aboutsummaryrefslogtreecommitdiff
path: root/src/client/windows/handler
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/windows/handler')
-rw-r--r--src/client/windows/handler/exception_handler.cc10
-rw-r--r--src/client/windows/handler/exception_handler.h11
2 files changed, 18 insertions, 3 deletions
diff --git a/src/client/windows/handler/exception_handler.cc b/src/client/windows/handler/exception_handler.cc
index 4bb67b21..0e6c43c9 100644
--- a/src/client/windows/handler/exception_handler.cc
+++ b/src/client/windows/handler/exception_handler.cc
@@ -72,7 +72,8 @@ ExceptionHandler::ExceptionHandler(const wstring &dump_path,
requesting_thread_id_(0),
exception_info_(NULL),
assertion_(NULL),
- handler_return_value_(false) {
+ handler_return_value_(false),
+ handle_debug_exceptions_(false) {
#if _MSC_VER >= 1400 // MSVC 2005/8
previous_iph_ = NULL;
#endif // _MSC_VER >= 1400
@@ -274,10 +275,13 @@ LONG ExceptionHandler::HandleException(EXCEPTION_POINTERS *exinfo) {
// Ignore EXCEPTION_BREAKPOINT and EXCEPTION_SINGLE_STEP exceptions. This
// logic will short-circuit before calling WriteMinidumpOnHandlerThread,
// allowing something else to handle the breakpoint without incurring the
- // overhead transitioning to and from the handler thread.
+ // overhead transitioning to and from the handler thread. This behavior
+ // can be overridden by calling ExceptionHandler::set_handle_debug_exceptions.
DWORD code = exinfo->ExceptionRecord->ExceptionCode;
LONG action;
- if (code != EXCEPTION_BREAKPOINT && code != EXCEPTION_SINGLE_STEP &&
+ bool is_debug_exception = (code == EXCEPTION_BREAKPOINT) ||
+ (code == EXCEPTION_SINGLE_STEP);
+ if ((!is_debug_exception || current_handler->get_handle_debug_exceptions()) &&
current_handler->WriteMinidumpOnHandlerThread(exinfo, NULL)) {
// The handler fully handled the exception. Returning
// EXCEPTION_EXECUTE_HANDLER indicates this to the system, and usually
diff --git a/src/client/windows/handler/exception_handler.h b/src/client/windows/handler/exception_handler.h
index 433b6bf4..7d82564c 100644
--- a/src/client/windows/handler/exception_handler.h
+++ b/src/client/windows/handler/exception_handler.h
@@ -175,6 +175,12 @@ class ExceptionHandler {
// dumps.
DWORD get_requesting_thread_id() const { return requesting_thread_id_; }
+ // Controls behavior of EXCEPTION_BREAKPOINT and EXCEPTION_SINGLE_STEP.
+ bool get_handle_debug_exceptions() const { return handle_debug_exceptions_; }
+ void set_handle_debug_exceptions(bool handle_debug_exceptions) {
+ handle_debug_exceptions_ = handle_debug_exceptions;
+ }
+
private:
friend class AutoExceptionHandler;
@@ -322,6 +328,11 @@ class ExceptionHandler {
// the requesting thread.
bool handler_return_value_;
+ // If true, the handler will intercept EXCEPTION_BREAKPOINT and
+ // EXCEPTION_SINGLE_STEP exceptions. Leave this false (the default)
+ // to not interfere with debuggers.
+ bool handle_debug_exceptions_;
+
// A stack of ExceptionHandler objects that have installed unhandled
// exception filters. This vector is used by HandleException to determine
// which ExceptionHandler object to route an exception to. When an