OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome_elf/crash/crash_helper.h" | 5 #include "chrome_elf/crash/crash_helper.h" |
6 | 6 |
7 #include <assert.h> | 7 #include <assert.h> |
8 #include <windows.h> | 8 #include <windows.h> |
9 | 9 |
10 #include <algorithm> | 10 #include <algorithm> |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 // information about why we intercept the SetUnhandledExceptionFilter API. | 96 // information about why we intercept the SetUnhandledExceptionFilter API. |
97 void DisableSetUnhandledExceptionFilter() { | 97 void DisableSetUnhandledExceptionFilter() { |
98 if (!g_crash_helper_enabled) | 98 if (!g_crash_helper_enabled) |
99 return; | 99 return; |
100 if (g_set_unhandled_exception_filter->Hook( | 100 if (g_set_unhandled_exception_filter->Hook( |
101 ::GetModuleHandle(nullptr), "kernel32.dll", | 101 ::GetModuleHandle(nullptr), "kernel32.dll", |
102 "SetUnhandledExceptionFilter", | 102 "SetUnhandledExceptionFilter", |
103 SetUnhandledExceptionFilterPatch) != NO_ERROR) { | 103 SetUnhandledExceptionFilterPatch) != NO_ERROR) { |
104 #ifdef _DEBUG | 104 #ifdef _DEBUG |
105 assert(false); | 105 assert(false); |
106 #endif //_DEBUG | 106 #endif // _DEBUG |
107 } | 107 } |
108 } | 108 } |
109 | 109 |
110 int GenerateCrashDump(EXCEPTION_POINTERS* exception_pointers) { | 110 int GenerateCrashDump(EXCEPTION_POINTERS* exception_pointers) { |
111 if (g_crash_helper_enabled) | 111 if (g_crash_helper_enabled) |
112 crashpad::CrashpadClient::DumpWithoutCrash( | 112 crashpad::CrashpadClient::DumpWithoutCrash( |
113 *(exception_pointers->ContextRecord)); | 113 *(exception_pointers->ContextRecord)); |
114 return EXCEPTION_CONTINUE_SEARCH; | 114 return EXCEPTION_CONTINUE_SEARCH; |
115 } | 115 } |
116 | 116 |
| 117 void DumpWithoutCrashing() { |
| 118 crash_reporter::DumpWithoutCrashing(); |
| 119 } |
| 120 |
117 } // namespace elf_crash | 121 } // namespace elf_crash |
118 | 122 |
119 //------------------------------------------------------------------------------ | 123 //------------------------------------------------------------------------------ |
120 // Exported crash APIs for the rest of the process. | 124 // Exported crash APIs for the rest of the process. |
121 //------------------------------------------------------------------------------ | 125 //------------------------------------------------------------------------------ |
122 | 126 |
123 // This helper is invoked by code in chrome.dll to retrieve the crash reports. | 127 // This helper is invoked by code in chrome.dll to retrieve the crash reports. |
124 // See CrashUploadListCrashpad. Note that we do not pass a std::vector here, | 128 // See CrashUploadListCrashpad. Note that we do not pass a std::vector here, |
125 // because we do not want to allocate/free in different modules. The returned | 129 // because we do not want to allocate/free in different modules. The returned |
126 // pointer is read-only. | 130 // pointer is read-only. |
(...skipping 13 matching lines...) Expand all Loading... |
140 | 144 |
141 // This helper is invoked by debugging code in chrome to register the client | 145 // This helper is invoked by debugging code in chrome to register the client |
142 // id. | 146 // id. |
143 extern "C" __declspec(dllexport) void SetMetricsClientId( | 147 extern "C" __declspec(dllexport) void SetMetricsClientId( |
144 const char* client_id) { | 148 const char* client_id) { |
145 if (!g_crash_helper_enabled) | 149 if (!g_crash_helper_enabled) |
146 return; | 150 return; |
147 if (client_id) | 151 if (client_id) |
148 crash_keys::SetMetricsClientIdFromGUID(client_id); | 152 crash_keys::SetMetricsClientIdFromGUID(client_id); |
149 } | 153 } |
OLD | NEW |