mirror of
https://github.com/chromium/crashpad.git
synced 2025-03-19 18:03:47 +00:00
win: Make DumpAndCrash() always terminate, and tidy up special codes
Upstreaming with tidying up of https://codereview.chromium.org/2377693002/. R=mark@chromium.org BUG=chromium:634418 Change-Id: Ie8b3b673c8d2a06c5cc918a034688aa9396cfbf4 Reviewed-on: https://chromium-review.googlesource.com/390436 Reviewed-by: Mark Mentovai <mark@chromium.org>
This commit is contained in:
parent
5a6c961658
commit
a16a7fd4ef
@ -39,6 +39,7 @@
|
|||||||
#include "util/win/registration_protocol_win.h"
|
#include "util/win/registration_protocol_win.h"
|
||||||
#include "util/win/scoped_handle.h"
|
#include "util/win/scoped_handle.h"
|
||||||
#include "util/win/scoped_process_suspend.h"
|
#include "util/win/scoped_process_suspend.h"
|
||||||
|
#include "util/win/termination_codes.h"
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
@ -109,8 +110,7 @@ LONG WINAPI UnhandledExceptionHandler(EXCEPTION_POINTERS* exception_pointers) {
|
|||||||
|
|
||||||
LOG(ERROR) << "crash server did not respond, self-terminating";
|
LOG(ERROR) << "crash server did not respond, self-terminating";
|
||||||
|
|
||||||
const UINT kCrashExitCodeNoDump = 0xffff7001;
|
TerminateProcess(GetCurrentProcess(), crashpad::kTerminationCodeCrashNoDump);
|
||||||
TerminateProcess(GetCurrentProcess(), kCrashExitCodeNoDump);
|
|
||||||
|
|
||||||
return EXCEPTION_CONTINUE_SEARCH;
|
return EXCEPTION_CONTINUE_SEARCH;
|
||||||
}
|
}
|
||||||
@ -487,7 +487,8 @@ void CrashpadClient::DumpWithoutCrash(const CONTEXT& context) {
|
|||||||
// static
|
// static
|
||||||
void CrashpadClient::DumpAndCrash(EXCEPTION_POINTERS* exception_pointers) {
|
void CrashpadClient::DumpAndCrash(EXCEPTION_POINTERS* exception_pointers) {
|
||||||
if (g_signal_exception == INVALID_HANDLE_VALUE) {
|
if (g_signal_exception == INVALID_HANDLE_VALUE) {
|
||||||
LOG(ERROR) << "haven't called UseHandler()";
|
LOG(ERROR) << "haven't called UseHandler(), no dump captured";
|
||||||
|
TerminateProcess(GetCurrentProcess(), kTerminationCodeUseHandlerNotCalled);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,6 +25,7 @@
|
|||||||
#include "util/misc/metrics.h"
|
#include "util/misc/metrics.h"
|
||||||
#include "util/win/registration_protocol_win.h"
|
#include "util/win/registration_protocol_win.h"
|
||||||
#include "util/win/scoped_process_suspend.h"
|
#include "util/win/scoped_process_suspend.h"
|
||||||
|
#include "util/win/termination_codes.h"
|
||||||
|
|
||||||
namespace crashpad {
|
namespace crashpad {
|
||||||
|
|
||||||
@ -47,8 +48,6 @@ unsigned int CrashReportExceptionHandler::ExceptionHandlerServerException(
|
|||||||
HANDLE process,
|
HANDLE process,
|
||||||
WinVMAddress exception_information_address,
|
WinVMAddress exception_information_address,
|
||||||
WinVMAddress debug_critical_section_address) {
|
WinVMAddress debug_critical_section_address) {
|
||||||
const unsigned int kFailedTerminationCode = 0xffff7002;
|
|
||||||
|
|
||||||
Metrics::ExceptionEncountered();
|
Metrics::ExceptionEncountered();
|
||||||
|
|
||||||
ScopedProcessSuspend suspend(process);
|
ScopedProcessSuspend suspend(process);
|
||||||
@ -60,7 +59,7 @@ unsigned int CrashReportExceptionHandler::ExceptionHandlerServerException(
|
|||||||
debug_critical_section_address)) {
|
debug_critical_section_address)) {
|
||||||
LOG(WARNING) << "ProcessSnapshotWin::Initialize failed";
|
LOG(WARNING) << "ProcessSnapshotWin::Initialize failed";
|
||||||
Metrics::ExceptionCaptureResult(Metrics::CaptureResult::kSnapshotFailed);
|
Metrics::ExceptionCaptureResult(Metrics::CaptureResult::kSnapshotFailed);
|
||||||
return kFailedTerminationCode;
|
return kTerminationCodeSnapshotFailed;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Now that we have the exception information, even if something else fails we
|
// Now that we have the exception information, even if something else fails we
|
||||||
|
@ -189,6 +189,7 @@
|
|||||||
'win/scoped_local_alloc.h',
|
'win/scoped_local_alloc.h',
|
||||||
'win/scoped_process_suspend.cc',
|
'win/scoped_process_suspend.cc',
|
||||||
'win/scoped_process_suspend.h',
|
'win/scoped_process_suspend.h',
|
||||||
|
'win/termination_codes.h',
|
||||||
'win/time.cc',
|
'win/time.cc',
|
||||||
'win/time.h',
|
'win/time.h',
|
||||||
'win/xp_compat.h',
|
'win/xp_compat.h',
|
||||||
|
37
util/win/termination_codes.h
Normal file
37
util/win/termination_codes.h
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
// Copyright 2016 The Crashpad Authors. All rights reserved.
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
|
||||||
|
#ifndef CRASHPAD_UTIL_WIN_TERMINATION_CODES_H_
|
||||||
|
#define CRASHPAD_UTIL_WIN_TERMINATION_CODES_H_
|
||||||
|
|
||||||
|
namespace crashpad {
|
||||||
|
|
||||||
|
//! \brief Crashpad-specific codes that are used as arguments to
|
||||||
|
//! `TerminateProcess()` in unusual circumstances.
|
||||||
|
enum TerminationCodes : unsigned int {
|
||||||
|
//! \brief The crash handler did not respond, and the client self-terminated.
|
||||||
|
kTerminationCodeCrashNoDump = 0xffff7001,
|
||||||
|
|
||||||
|
//! \brief The initial process snapshot failed, so the correct client
|
||||||
|
//! termination code could not be retrieved.
|
||||||
|
kTerminationCodeSnapshotFailed = 0xffff7002,
|
||||||
|
|
||||||
|
//! \brief A dump was requested for a client that was never registered with
|
||||||
|
//! the crash handler.
|
||||||
|
kTerminationCodeUseHandlerNotCalled = 0xffff7003,
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace crashpad
|
||||||
|
|
||||||
|
#endif // CRASHPAD_UTIL_WIN_TERMINATION_CODES_H_
|
Loading…
x
Reference in New Issue
Block a user