| OLD | NEW |
| 1 |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 2 // Copyright (c) 2009 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 3 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 4 // found in the LICENSE file. |
| 4 | 5 |
| 5 // crash_report.cc : Implementation crash reporting. | 6 // crash_report.cc : Implementation crash reporting. |
| 6 #include "chrome_frame/crash_reporting/crash_report.h" | 7 #include "chrome_frame/crash_reporting/crash_report.h" |
| 7 | 8 |
| 8 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 9 #include "base/logging.h" | 10 #include "base/logging.h" |
| 10 #include "breakpad/src/client/windows/handler/exception_handler.h" | 11 #include "breakpad/src/client/windows/handler/exception_handler.h" |
| 11 #include "chrome_frame/crash_reporting/vectored_handler.h" | 12 #include "chrome_frame/crash_reporting/vectored_handler.h" |
| 12 #include "chrome_frame/crash_reporting/vectored_handler-impl.h" | 13 #include "chrome_frame/crash_reporting/vectored_handler-impl.h" |
| 14 #include "chrome_frame/utils.h" |
| 13 | 15 |
| 14 namespace { | 16 namespace { |
| 15 // TODO(joshia): factor out common code with chrome used for crash reporting | 17 // TODO(joshia): factor out common code with chrome used for crash reporting |
| 16 const wchar_t kGoogleUpdatePipeName[] = L"\\\\.\\pipe\\GoogleCrashServices\\"; | 18 const wchar_t kGoogleUpdatePipeName[] = L"\\\\.\\pipe\\GoogleCrashServices\\"; |
| 19 const wchar_t kChromePipeName[] = L"\\\\.\\pipe\\ChromeCrashServices"; |
| 20 |
| 17 google_breakpad::ExceptionHandler* g_breakpad = NULL; | 21 google_breakpad::ExceptionHandler* g_breakpad = NULL; |
| 18 | 22 |
| 19 __declspec(naked) | 23 __declspec(naked) |
| 20 static EXCEPTION_REGISTRATION_RECORD* InternalRtlpGetExceptionList() { | 24 static EXCEPTION_REGISTRATION_RECORD* InternalRtlpGetExceptionList() { |
| 21 __asm { | 25 __asm { |
| 22 mov eax, fs:0 | 26 mov eax, fs:0 |
| 23 ret | 27 ret |
| 24 } | 28 } |
| 25 } | 29 } |
| 26 } // end of namespace | 30 } // end of namespace |
| (...skipping 22 matching lines...) Expand all Loading... |
| 49 | 53 |
| 50 static inline WORD RtlCaptureStackBackTrace(DWORD FramesToSkip, | 54 static inline WORD RtlCaptureStackBackTrace(DWORD FramesToSkip, |
| 51 DWORD FramesToCapture, void** BackTrace, DWORD* BackTraceHash) { | 55 DWORD FramesToCapture, void** BackTrace, DWORD* BackTraceHash) { |
| 52 return ::RtlCaptureStackBackTrace(FramesToSkip, FramesToCapture, | 56 return ::RtlCaptureStackBackTrace(FramesToSkip, FramesToCapture, |
| 53 BackTrace, BackTraceHash); | 57 BackTrace, BackTraceHash); |
| 54 } | 58 } |
| 55 }; | 59 }; |
| 56 | 60 |
| 57 extern "C" IMAGE_DOS_HEADER __ImageBase; | 61 extern "C" IMAGE_DOS_HEADER __ImageBase; |
| 58 | 62 |
| 63 std::wstring GetCrashServerPipeName(const std::wstring& user_sid) { |
| 64 if (IsHeadlessMode()) |
| 65 return kChromePipeName; |
| 66 |
| 67 std::wstring pipe_name = kGoogleUpdatePipeName; |
| 68 pipe_name += user_sid; |
| 69 return pipe_name; |
| 70 } |
| 71 |
| 59 bool InitializeVectoredCrashReporting( | 72 bool InitializeVectoredCrashReporting( |
| 60 bool full_dump, | 73 bool full_dump, |
| 61 const wchar_t* user_sid, | 74 const wchar_t* user_sid, |
| 62 const std::wstring& dump_path, | 75 const std::wstring& dump_path, |
| 63 google_breakpad::CustomClientInfo* client_info) { | 76 google_breakpad::CustomClientInfo* client_info) { |
| 64 DCHECK(user_sid); | 77 DCHECK(user_sid); |
| 65 DCHECK(client_info); | 78 DCHECK(client_info); |
| 66 if (g_breakpad) | 79 if (g_breakpad) |
| 67 return true; | 80 return true; |
| 68 | 81 |
| 69 std::wstring pipe_name(kGoogleUpdatePipeName); | 82 std::wstring pipe_name = GetCrashServerPipeName(user_sid); |
| 70 pipe_name += user_sid; | |
| 71 | 83 |
| 72 if (dump_path.empty()) { | 84 if (dump_path.empty()) { |
| 73 return false; | 85 return false; |
| 74 } | 86 } |
| 75 | 87 |
| 76 MINIDUMP_TYPE dump_type = full_dump ? MiniDumpWithFullMemory : MiniDumpNormal; | 88 MINIDUMP_TYPE dump_type = full_dump ? MiniDumpWithFullMemory : MiniDumpNormal; |
| 77 g_breakpad = new google_breakpad::ExceptionHandler( | 89 g_breakpad = new google_breakpad::ExceptionHandler( |
| 78 dump_path, NULL, NULL, NULL, | 90 dump_path, NULL, NULL, NULL, |
| 79 google_breakpad::ExceptionHandler::HANDLER_INVALID_PARAMETER | | 91 google_breakpad::ExceptionHandler::HANDLER_INVALID_PARAMETER | |
| 80 google_breakpad::ExceptionHandler::HANDLER_PURECALL, dump_type, | 92 google_breakpad::ExceptionHandler::HANDLER_PURECALL, dump_type, |
| (...skipping 11 matching lines...) Expand all Loading... |
| 92 | 104 |
| 93 return g_breakpad != NULL; | 105 return g_breakpad != NULL; |
| 94 } | 106 } |
| 95 | 107 |
| 96 bool ShutdownVectoredCrashReporting() { | 108 bool ShutdownVectoredCrashReporting() { |
| 97 VectoredHandler::Unregister(); | 109 VectoredHandler::Unregister(); |
| 98 delete g_breakpad; | 110 delete g_breakpad; |
| 99 g_breakpad = NULL; | 111 g_breakpad = NULL; |
| 100 return true; | 112 return true; |
| 101 } | 113 } |
| OLD | NEW |