xref: /aosp_15_r20/external/libchrome/base/debug/dump_without_crashing.h (revision 635a864187cb8b6c713ff48b7e790a6b21769273)
1*635a8641SAndroid Build Coastguard Worker // Copyright 2013 The Chromium Authors. All rights reserved.
2*635a8641SAndroid Build Coastguard Worker // Use of this source code is governed by a BSD-style license that can be
3*635a8641SAndroid Build Coastguard Worker // found in the LICENSE file.
4*635a8641SAndroid Build Coastguard Worker 
5*635a8641SAndroid Build Coastguard Worker #ifndef BASE_DEBUG_DUMP_WITHOUT_CRASHING_H_
6*635a8641SAndroid Build Coastguard Worker #define BASE_DEBUG_DUMP_WITHOUT_CRASHING_H_
7*635a8641SAndroid Build Coastguard Worker 
8*635a8641SAndroid Build Coastguard Worker #include "base/base_export.h"
9*635a8641SAndroid Build Coastguard Worker #include "base/compiler_specific.h"
10*635a8641SAndroid Build Coastguard Worker #include "build/build_config.h"
11*635a8641SAndroid Build Coastguard Worker 
12*635a8641SAndroid Build Coastguard Worker namespace base {
13*635a8641SAndroid Build Coastguard Worker 
14*635a8641SAndroid Build Coastguard Worker namespace debug {
15*635a8641SAndroid Build Coastguard Worker 
16*635a8641SAndroid Build Coastguard Worker // Handler to silently dump the current process without crashing.
17*635a8641SAndroid Build Coastguard Worker // Before calling this function, call SetDumpWithoutCrashingFunction to pass a
18*635a8641SAndroid Build Coastguard Worker // function pointer.
19*635a8641SAndroid Build Coastguard Worker // Windows:
20*635a8641SAndroid Build Coastguard Worker // This must be done for each instance of base (i.e. module) and is normally
21*635a8641SAndroid Build Coastguard Worker // chrome_elf!DumpProcessWithoutCrash. See example code in chrome_main.cc that
22*635a8641SAndroid Build Coastguard Worker // does this for chrome.dll and chrome_child.dll. Note: Crashpad sets this up
23*635a8641SAndroid Build Coastguard Worker // for main chrome.exe as part of calling crash_reporter::InitializeCrashpad.
24*635a8641SAndroid Build Coastguard Worker // Mac/Linux:
25*635a8641SAndroid Build Coastguard Worker // Crashpad does this as part of crash_reporter::InitializeCrashpad.
26*635a8641SAndroid Build Coastguard Worker // Returns false if called before SetDumpWithoutCrashingFunction.
27*635a8641SAndroid Build Coastguard Worker BASE_EXPORT bool DumpWithoutCrashing();
28*635a8641SAndroid Build Coastguard Worker 
29*635a8641SAndroid Build Coastguard Worker // Sets a function that'll be invoked to dump the current process when
30*635a8641SAndroid Build Coastguard Worker // DumpWithoutCrashing() is called.
31*635a8641SAndroid Build Coastguard Worker BASE_EXPORT void SetDumpWithoutCrashingFunction(void (CDECL *function)());
32*635a8641SAndroid Build Coastguard Worker 
33*635a8641SAndroid Build Coastguard Worker }  // namespace debug
34*635a8641SAndroid Build Coastguard Worker 
35*635a8641SAndroid Build Coastguard Worker }  // namespace base
36*635a8641SAndroid Build Coastguard Worker 
37*635a8641SAndroid Build Coastguard Worker #endif  // BASE_DEBUG_DUMP_WITHOUT_CRASHING_H_
38