OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 // This is a cross platform interface for helper functions related to | 5 // This is a cross platform interface for helper functions related to |
6 // debuggers. You should use this to test if you're running under a debugger, | 6 // debuggers. You should use this to test if you're running under a debugger, |
7 // and if you would like to yield (breakpoint) into the debugger. | 7 // and if you would like to yield (breakpoint) into the debugger. |
8 | 8 |
9 #ifndef BASE_DEBUG_DEBUGGER_H | 9 #ifndef BASE_DEBUG_DEBUGGER_H |
10 #define BASE_DEBUG_DEBUGGER_H | 10 #define BASE_DEBUG_DEBUGGER_H |
11 #pragma once | 11 #pragma once |
12 | 12 |
13 #include "base/base_api.h" | 13 #include "base/base_export.h" |
14 | 14 |
15 namespace base { | 15 namespace base { |
16 namespace debug { | 16 namespace debug { |
17 | 17 |
18 // Starts the registered system-wide JIT debugger to attach it to specified | 18 // Starts the registered system-wide JIT debugger to attach it to specified |
19 // process. | 19 // process. |
20 BASE_API bool SpawnDebuggerOnProcess(unsigned process_id); | 20 BASE_EXPORT bool SpawnDebuggerOnProcess(unsigned process_id); |
21 | 21 |
22 // Waits wait_seconds seconds for a debugger to attach to the current process. | 22 // Waits wait_seconds seconds for a debugger to attach to the current process. |
23 // When silent is false, an exception is thrown when a debugger is detected. | 23 // When silent is false, an exception is thrown when a debugger is detected. |
24 BASE_API bool WaitForDebugger(int wait_seconds, bool silent); | 24 BASE_EXPORT bool WaitForDebugger(int wait_seconds, bool silent); |
25 | 25 |
26 // Returns true if the given process is being run under a debugger. | 26 // Returns true if the given process is being run under a debugger. |
27 // | 27 // |
28 // On OS X, the underlying mechanism doesn't work when the sandbox is enabled. | 28 // On OS X, the underlying mechanism doesn't work when the sandbox is enabled. |
29 // To get around this, this function caches its value. | 29 // To get around this, this function caches its value. |
30 // | 30 // |
31 // WARNING: Because of this, on OS X, a call MUST be made to this function | 31 // WARNING: Because of this, on OS X, a call MUST be made to this function |
32 // BEFORE the sandbox is enabled. | 32 // BEFORE the sandbox is enabled. |
33 BASE_API bool BeingDebugged(); | 33 BASE_EXPORT bool BeingDebugged(); |
34 | 34 |
35 // Break into the debugger, assumes a debugger is present. | 35 // Break into the debugger, assumes a debugger is present. |
36 BASE_API void BreakDebugger(); | 36 BASE_EXPORT void BreakDebugger(); |
37 | 37 |
38 // Used in test code, this controls whether showing dialogs and breaking into | 38 // Used in test code, this controls whether showing dialogs and breaking into |
39 // the debugger is suppressed for debug errors, even in debug mode (normally | 39 // the debugger is suppressed for debug errors, even in debug mode (normally |
40 // release mode doesn't do this stuff -- this is controlled separately). | 40 // release mode doesn't do this stuff -- this is controlled separately). |
41 // Normally UI is not suppressed. This is normally used when running automated | 41 // Normally UI is not suppressed. This is normally used when running automated |
42 // tests where we want a crash rather than a dialog or a debugger. | 42 // tests where we want a crash rather than a dialog or a debugger. |
43 BASE_API void SetSuppressDebugUI(bool suppress); | 43 BASE_EXPORT void SetSuppressDebugUI(bool suppress); |
44 BASE_API bool IsDebugUISuppressed(); | 44 BASE_EXPORT bool IsDebugUISuppressed(); |
45 | 45 |
46 } // namespace debug | 46 } // namespace debug |
47 } // namespace base | 47 } // namespace base |
48 | 48 |
49 #endif // BASE_DEBUG_DEBUGGER_H | 49 #endif // BASE_DEBUG_DEBUGGER_H |
OLD | NEW |