1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/security/sandbox/chromium/base/debug/debugger.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,48 @@ 1.4 +// Copyright (c) 2011 The Chromium Authors. All rights reserved. 1.5 +// Use of this source code is governed by a BSD-style license that can be 1.6 +// found in the LICENSE file. 1.7 + 1.8 +// This is a cross platform interface for helper functions related to 1.9 +// debuggers. You should use this to test if you're running under a debugger, 1.10 +// and if you would like to yield (breakpoint) into the debugger. 1.11 + 1.12 +#ifndef BASE_DEBUG_DEBUGGER_H 1.13 +#define BASE_DEBUG_DEBUGGER_H 1.14 + 1.15 +#include "base/base_export.h" 1.16 + 1.17 +namespace base { 1.18 +namespace debug { 1.19 + 1.20 +// Starts the registered system-wide JIT debugger to attach it to specified 1.21 +// process. 1.22 +BASE_EXPORT bool SpawnDebuggerOnProcess(unsigned process_id); 1.23 + 1.24 +// Waits wait_seconds seconds for a debugger to attach to the current process. 1.25 +// When silent is false, an exception is thrown when a debugger is detected. 1.26 +BASE_EXPORT bool WaitForDebugger(int wait_seconds, bool silent); 1.27 + 1.28 +// Returns true if the given process is being run under a debugger. 1.29 +// 1.30 +// On OS X, the underlying mechanism doesn't work when the sandbox is enabled. 1.31 +// To get around this, this function caches its value. 1.32 +// 1.33 +// WARNING: Because of this, on OS X, a call MUST be made to this function 1.34 +// BEFORE the sandbox is enabled. 1.35 +BASE_EXPORT bool BeingDebugged(); 1.36 + 1.37 +// Break into the debugger, assumes a debugger is present. 1.38 +BASE_EXPORT void BreakDebugger(); 1.39 + 1.40 +// Used in test code, this controls whether showing dialogs and breaking into 1.41 +// the debugger is suppressed for debug errors, even in debug mode (normally 1.42 +// release mode doesn't do this stuff -- this is controlled separately). 1.43 +// Normally UI is not suppressed. This is normally used when running automated 1.44 +// tests where we want a crash rather than a dialog or a debugger. 1.45 +BASE_EXPORT void SetSuppressDebugUI(bool suppress); 1.46 +BASE_EXPORT bool IsDebugUISuppressed(); 1.47 + 1.48 +} // namespace debug 1.49 +} // namespace base 1.50 + 1.51 +#endif // BASE_DEBUG_DEBUGGER_H