diff options
Diffstat (limited to 'base/debug_util.h')
-rw-r--r-- | base/debug_util.h | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/base/debug_util.h b/base/debug_util.h index 54381e5..288ea4b 100644 --- a/base/debug_util.h +++ b/base/debug_util.h @@ -27,8 +27,12 @@ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -#ifndef BASE_DEBUG_UTIL_H__ -#define BASE_DEBUG_UTIL_H__ +// This is a cross platform interface for helper functions related to debuggers. +// You should use this to test if you're running under a debugger, and if you +// would like to yield (breakpoint) into the debugger. + +#ifndef BASE_DEBUG_UTIL_H_ +#define BASE_DEBUG_UTIL_H_ class DebugUtil { public: @@ -39,6 +43,12 @@ class DebugUtil { // Waits wait_seconds seconds for a debugger to attach to the current process. // When silent is false, an exception is thrown when a debugger is detected. static bool WaitForDebugger(int wait_seconds, bool silent); + + // Are we running under a debugger? + static bool BeingDebugged(); + + // Break into the debugger, assumes a debugger is present. + static void BreakDebugger(); }; -#endif // BASE_DEBUG_UTIL_H__ +#endif // BASE_DEBUG_UTIL_H_ |