diff options
author | ivan.penkov@gmail.com <ivan.penkov@gmail.com@4c0a9323-5329-0410-9bdc-e9ce6186880e> | 2012-11-01 21:49:06 +0000 |
---|---|---|
committer | ivan.penkov@gmail.com <ivan.penkov@gmail.com@4c0a9323-5329-0410-9bdc-e9ce6186880e> | 2012-11-01 21:49:06 +0000 |
commit | 6b91f41a7c22410db9ebc81a369f5fd84cd31f8e (patch) | |
tree | a8818436ea4181221c2eec30e1a7c1829d4e25d6 /src | |
parent | Fix a compile warning in stack_frame_symbolizer.cc (diff) | |
download | breakpad-6b91f41a7c22410db9ebc81a369f5fd84cd31f8e.tar.xz |
SuspendThread returns a DWORD value, so checking the return value with ">= 0"
doesn't work. On failure, the return value is (DWORD) -1 (which is
0xFFFFFFFF).
http://breakpad.appspot.com/491002/
git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1075 4c0a9323-5329-0410-9bdc-e9ce6186880e
Diffstat (limited to 'src')
-rw-r--r-- | src/client/windows/handler/exception_handler.cc | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/client/windows/handler/exception_handler.cc b/src/client/windows/handler/exception_handler.cc index e30ec40d..59a63144 100644 --- a/src/client/windows/handler/exception_handler.cc +++ b/src/client/windows/handler/exception_handler.cc @@ -44,6 +44,9 @@ namespace google_breakpad { static const int kWaitForHandlerThreadMs = 60000; static const int kExceptionHandlerThreadInitialStackSize = 64 * 1024; +// As documented on MSDN, on failure SuspendThread returns (DWORD) -1 +static const DWORD kFailedToSuspendThread = static_cast<DWORD>(-1); + // This is passed as the context to the MinidumpWriteDump callback. typedef struct { AppMemoryList::const_iterator iter; @@ -747,7 +750,7 @@ bool ExceptionHandler::WriteMinidumpForChild(HANDLE child, EXCEPTION_RECORD ex; CONTEXT ctx; EXCEPTION_POINTERS exinfo = { NULL, NULL }; - DWORD last_suspend_count = -1; + DWORD last_suspend_count = kFailedToSuspendThread; HANDLE child_thread_handle = OpenThread(THREAD_GET_CONTEXT | THREAD_QUERY_INFORMATION | THREAD_SUSPEND_RESUME, @@ -757,7 +760,7 @@ bool ExceptionHandler::WriteMinidumpForChild(HANDLE child, // non-fatal error. if (child_thread_handle != NULL) { last_suspend_count = SuspendThread(child_thread_handle); - if (last_suspend_count >= 0) { + if (last_suspend_count != kFailedToSuspendThread) { ctx.ContextFlags = CONTEXT_ALL; if (GetThreadContext(child_thread_handle, &ctx)) { memset(&ex, 0, sizeof(ex)); @@ -780,7 +783,7 @@ bool ExceptionHandler::WriteMinidumpForChild(HANDLE child, exinfo.ExceptionRecord ? &exinfo : NULL, NULL, child, false); - if (last_suspend_count >= 0) { + if (last_suspend_count != kFailedToSuspendThread) { ResumeThread(child_thread_handle); } |