win: Add DumpAndCrash to client

Something like this is required to implement something like
https://code.google.com/p/chromium/codesearch#chromium/src/components/crash/content/app/breakpad_win.cc&l=397
in Chrome (used by Syzygy and V8 in x64 it looks like).

I didn't want to expose UnhandledExceptionFilter() directly as it's
__stdcall so adding a forwarder to CrashpadClient seemed tidier, but the
functionality matches what is needed.

R=mark@chromium.org
BUG=chromium:546288

Review URL: https://codereview.chromium.org/1416603010 .
This commit is contained in:
Scott Graham 2015-11-06 14:08:13 -08:00
parent d3825afb25
commit 9e4cd8f07b
2 changed files with 15 additions and 0 deletions

View File

@ -142,6 +142,16 @@ class CrashpadClient {
//! \param[in] context A `CONTEXT`, generally captured by CaptureContext() or
//! similar.
static void DumpWithoutCrash(const CONTEXT& context);
//! \brief Requests that the handler capture a dump using the given \a
//! exception_pointers to get the `EXCEPTION_RECORD` and `CONTEXT`.
//!
//! This function is not necessary in general usage as an unhandled exception
//! filter is installed by UseHandler().
//!
//! \param[in] exception_pointers An `EXCEPTION_POINTERS`, as would generally
//! passed to an unhandled exception filter.
static void DumpAndCrash(EXCEPTION_POINTERS* exception_pointers);
#endif
//! \brief Configures the process to direct its crashes to a Crashpad handler.

View File

@ -435,4 +435,9 @@ void CrashpadClient::DumpWithoutCrash(const CONTEXT& context) {
PLOG_IF(ERROR, wfso_result != WAIT_OBJECT_0) << "WaitForSingleObject";
}
// static
void CrashpadClient::DumpAndCrash(EXCEPTION_POINTERS* exception_pointers) {
UnhandledExceptionHandler(exception_pointers);
}
} // namespace crashpad