OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "components/crash/app/breakpad_win.h" | 5 #include "components/crash/app/breakpad_win.h" |
6 | 6 |
7 #include <windows.h> | 7 #include <windows.h> |
8 #include <shellapi.h> | 8 #include <shellapi.h> |
9 #include <tchar.h> | 9 #include <tchar.h> |
10 #include <userenv.h> | 10 #include <userenv.h> |
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
274 } | 274 } |
275 | 275 |
276 // Exception filter for the service process used when breakpad is not enabled. | 276 // Exception filter for the service process used when breakpad is not enabled. |
277 // We just display the "Do you want to restart" message and then die | 277 // We just display the "Do you want to restart" message and then die |
278 // (without calling the previous filter). | 278 // (without calling the previous filter). |
279 long WINAPI ServiceExceptionFilter(EXCEPTION_POINTERS* info) { | 279 long WINAPI ServiceExceptionFilter(EXCEPTION_POINTERS* info) { |
280 DumpDoneCallback(NULL, NULL, NULL, info, NULL, false); | 280 DumpDoneCallback(NULL, NULL, NULL, info, NULL, false); |
281 return EXCEPTION_EXECUTE_HANDLER; | 281 return EXCEPTION_EXECUTE_HANDLER; |
282 } | 282 } |
283 | 283 |
| 284 // Installed via base::debug::SetCrashKeyReportingFunctions. |
| 285 void SetCrashKeyValueForBaseDebug(const base::StringPiece& key, |
| 286 const base::StringPiece& value) { |
| 287 DCHECK(CrashKeysWin::keeper()); |
| 288 CrashKeysWin::keeper()->SetCrashKeyValue(base::UTF8ToUTF16(key), |
| 289 base::UTF8ToUTF16(value)); |
| 290 } |
| 291 |
| 292 // Installed via base::debug::SetCrashKeyReportingFunctions. |
| 293 void ClearCrashKeyForBaseDebug(const base::StringPiece& key) { |
| 294 DCHECK(CrashKeysWin::keeper()); |
| 295 CrashKeysWin::keeper()->ClearCrashKeyValue(base::UTF8ToUTF16(key)); |
| 296 } |
| 297 |
284 } // namespace | 298 } // namespace |
285 | 299 |
286 // NOTE: This function is used by SyzyASAN to annotate crash reports. If you | 300 // NOTE: This function is used by SyzyASAN to annotate crash reports. If you |
287 // change the name or signature of this function you will break SyzyASAN | 301 // change the name or signature of this function you will break SyzyASAN |
288 // instrumented releases of Chrome. Please contact syzygy-team@chromium.org | 302 // instrumented releases of Chrome. Please contact syzygy-team@chromium.org |
289 // before doing so! | 303 // before doing so! |
290 extern "C" void __declspec(dllexport) __cdecl SetCrashKeyValueImpl( | 304 extern "C" void __declspec(dllexport) __cdecl SetCrashKeyValueImpl( |
291 const wchar_t* key, const wchar_t* value) { | 305 const wchar_t* key, const wchar_t* value) { |
292 CrashKeysWin* keeper = CrashKeysWin::keeper(); | 306 CrashKeysWin* keeper = CrashKeysWin::keeper(); |
293 if (!keeper) | 307 if (!keeper) |
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
520 GetCrashReporterClient()->GetIsPerUserInstall(base::FilePath(exe_path)); | 534 GetCrashReporterClient()->GetIsPerUserInstall(base::FilePath(exe_path)); |
521 | 535 |
522 // This is intentionally leaked. | 536 // This is intentionally leaked. |
523 CrashKeysWin* keeper = new CrashKeysWin(); | 537 CrashKeysWin* keeper = new CrashKeysWin(); |
524 | 538 |
525 google_breakpad::CustomClientInfo* custom_info = | 539 google_breakpad::CustomClientInfo* custom_info = |
526 keeper->GetCustomInfo(exe_path, process_type, GetProfileType(), | 540 keeper->GetCustomInfo(exe_path, process_type, GetProfileType(), |
527 base::CommandLine::ForCurrentProcess(), | 541 base::CommandLine::ForCurrentProcess(), |
528 GetCrashReporterClient()); | 542 GetCrashReporterClient()); |
529 | 543 |
| 544 base::debug::SetCrashKeyReportingFunctions(&SetCrashKeyValueForBaseDebug, |
| 545 &ClearCrashKeyForBaseDebug); |
| 546 |
530 google_breakpad::ExceptionHandler::MinidumpCallback callback = NULL; | 547 google_breakpad::ExceptionHandler::MinidumpCallback callback = NULL; |
531 LPTOP_LEVEL_EXCEPTION_FILTER default_filter = NULL; | 548 LPTOP_LEVEL_EXCEPTION_FILTER default_filter = NULL; |
532 // We install the post-dump callback only for the browser and service | 549 // We install the post-dump callback only for the browser and service |
533 // processes. It spawns a new browser/service process. | 550 // processes. It spawns a new browser/service process. |
534 if (process_type == L"browser") { | 551 if (process_type == L"browser") { |
535 callback = &DumpDoneCallback; | 552 callback = &DumpDoneCallback; |
536 default_filter = &ChromeExceptionFilter; | 553 default_filter = &ChromeExceptionFilter; |
537 } else if (process_type == L"service") { | 554 } else if (process_type == L"service") { |
538 callback = &DumpDoneCallback; | 555 callback = &DumpDoneCallback; |
539 default_filter = &ServiceExceptionFilter; | 556 default_filter = &ServiceExceptionFilter; |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
699 extern "C" void __declspec(dllexport) __cdecl | 716 extern "C" void __declspec(dllexport) __cdecl |
700 UnregisterNonABICompliantCodeRange(void* start) { | 717 UnregisterNonABICompliantCodeRange(void* start) { |
701 ExceptionHandlerRecord* record = | 718 ExceptionHandlerRecord* record = |
702 reinterpret_cast<ExceptionHandlerRecord*>(start); | 719 reinterpret_cast<ExceptionHandlerRecord*>(start); |
703 | 720 |
704 CHECK(RtlDeleteFunctionTable(&record->runtime_function)); | 721 CHECK(RtlDeleteFunctionTable(&record->runtime_function)); |
705 } | 722 } |
706 #endif | 723 #endif |
707 | 724 |
708 } // namespace breakpad | 725 } // namespace breakpad |
OLD | NEW |