зеркало из https://github.com/mozilla/gecko-dev.git
Bug 577486. Load the RtlCaptureContext entry point manually so that we can still run on Windows 2000. (patch modified to review comments by tnikkel) r=ted a=blocking
This commit is contained in:
Родитель
b6f426f863
Коммит
a984393e38
|
@ -39,6 +39,8 @@
|
|||
#include "client/windows/handler/exception_handler.h"
|
||||
#include "common/windows/guid_string.h"
|
||||
|
||||
typedef VOID (WINAPI *RtlCaptureContextPtr) (PCONTEXT pContextRecord);
|
||||
|
||||
namespace {
|
||||
|
||||
// Helper for GetProcId()
|
||||
|
@ -571,18 +573,28 @@ void ExceptionHandler::HandleInvalidParameter(const wchar_t* expression,
|
|||
EXCEPTION_RECORD exception_record = {};
|
||||
CONTEXT exception_context = {};
|
||||
EXCEPTION_POINTERS exception_ptrs = { &exception_record, &exception_context };
|
||||
RtlCaptureContext(&exception_context);
|
||||
exception_record.ExceptionCode = STATUS_NONCONTINUABLE_EXCEPTION;
|
||||
|
||||
// We store pointers to the the expression and function strings,
|
||||
// and the line as exception parameters to make them easy to
|
||||
// access by the developer on the far side.
|
||||
exception_record.NumberParameters = 3;
|
||||
exception_record.ExceptionInformation[0] =
|
||||
reinterpret_cast<ULONG_PTR>(&assertion.expression);
|
||||
exception_record.ExceptionInformation[1] =
|
||||
reinterpret_cast<ULONG_PTR>(&assertion.file);
|
||||
exception_record.ExceptionInformation[2] = assertion.line;
|
||||
EXCEPTION_POINTERS* exinfo = NULL;
|
||||
|
||||
RtlCaptureContextPtr fnRtlCaptureContext = (RtlCaptureContextPtr)
|
||||
GetProcAddress(GetModuleHandleW(L"kernel32"), "RtlCaptureContext");
|
||||
if (fnRtlCaptureContext) {
|
||||
fnRtlCaptureContext(&exception_context);
|
||||
|
||||
exception_record.ExceptionCode = STATUS_NONCONTINUABLE_EXCEPTION;
|
||||
|
||||
// We store pointers to the the expression and function strings,
|
||||
// and the line as exception parameters to make them easy to
|
||||
// access by the developer on the far side.
|
||||
exception_record.NumberParameters = 3;
|
||||
exception_record.ExceptionInformation[0] =
|
||||
reinterpret_cast<ULONG_PTR>(&assertion.expression);
|
||||
exception_record.ExceptionInformation[1] =
|
||||
reinterpret_cast<ULONG_PTR>(&assertion.file);
|
||||
exception_record.ExceptionInformation[2] = assertion.line;
|
||||
|
||||
exinfo = &exception_ptrs;
|
||||
}
|
||||
|
||||
bool success = false;
|
||||
// In case of out-of-process dump generation, directly call
|
||||
|
@ -590,10 +602,10 @@ void ExceptionHandler::HandleInvalidParameter(const wchar_t* expression,
|
|||
if (current_handler->IsOutOfProcess()) {
|
||||
success = current_handler->WriteMinidumpWithException(
|
||||
GetCurrentThreadId(),
|
||||
&exception_ptrs,
|
||||
exinfo,
|
||||
&assertion);
|
||||
} else {
|
||||
success = current_handler->WriteMinidumpOnHandlerThread(&exception_ptrs,
|
||||
success = current_handler->WriteMinidumpOnHandlerThread(exinfo,
|
||||
&assertion);
|
||||
}
|
||||
|
||||
|
@ -649,18 +661,28 @@ void ExceptionHandler::HandlePureVirtualCall() {
|
|||
EXCEPTION_RECORD exception_record = {};
|
||||
CONTEXT exception_context = {};
|
||||
EXCEPTION_POINTERS exception_ptrs = { &exception_record, &exception_context };
|
||||
RtlCaptureContext(&exception_context);
|
||||
exception_record.ExceptionCode = STATUS_NONCONTINUABLE_EXCEPTION;
|
||||
|
||||
// We store pointers to the the expression and function strings,
|
||||
// and the line as exception parameters to make them easy to
|
||||
// access by the developer on the far side.
|
||||
exception_record.NumberParameters = 3;
|
||||
exception_record.ExceptionInformation[0] =
|
||||
reinterpret_cast<ULONG_PTR>(&assertion.expression);
|
||||
exception_record.ExceptionInformation[1] =
|
||||
reinterpret_cast<ULONG_PTR>(&assertion.file);
|
||||
exception_record.ExceptionInformation[2] = assertion.line;
|
||||
EXCEPTION_POINTERS* exinfo = NULL;
|
||||
|
||||
RtlCaptureContextPtr fnRtlCaptureContext = (RtlCaptureContextPtr)
|
||||
GetProcAddress(GetModuleHandleW(L"kernel32"), "RtlCaptureContext");
|
||||
if (fnRtlCaptureContext) {
|
||||
fnRtlCaptureContext(&exception_context);
|
||||
|
||||
exception_record.ExceptionCode = STATUS_NONCONTINUABLE_EXCEPTION;
|
||||
|
||||
// We store pointers to the the expression and function strings,
|
||||
// and the line as exception parameters to make them easy to
|
||||
// access by the developer on the far side.
|
||||
exception_record.NumberParameters = 3;
|
||||
exception_record.ExceptionInformation[0] =
|
||||
reinterpret_cast<ULONG_PTR>(&assertion.expression);
|
||||
exception_record.ExceptionInformation[1] =
|
||||
reinterpret_cast<ULONG_PTR>(&assertion.file);
|
||||
exception_record.ExceptionInformation[2] = assertion.line;
|
||||
|
||||
exinfo = &exception_ptrs;
|
||||
}
|
||||
|
||||
bool success = false;
|
||||
// In case of out-of-process dump generation, directly call
|
||||
|
@ -669,10 +691,10 @@ void ExceptionHandler::HandlePureVirtualCall() {
|
|||
if (current_handler->IsOutOfProcess()) {
|
||||
success = current_handler->WriteMinidumpWithException(
|
||||
GetCurrentThreadId(),
|
||||
&exception_ptrs,
|
||||
exinfo,
|
||||
&assertion);
|
||||
} else {
|
||||
success = current_handler->WriteMinidumpOnHandlerThread(&exception_ptrs,
|
||||
success = current_handler->WriteMinidumpOnHandlerThread(exinfo,
|
||||
&assertion);
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче