From 1ffe08c10b4ade6acf92d4a1c2f604200facd410 Mon Sep 17 00:00:00 2001 From: "deanm@google.com" Date: Wed, 13 Aug 2008 11:15:11 +0000 Subject: Make debug_util cross platform, adding BeingDebugged and BreakDebugger. Linux supported added, and Mac OSX left as a todo for the mac team. git-svn-id: svn://svn.chromium.org/chrome/trunk/src@785 0039d316-1c4b-4281-b951-d872f2087c98 --- base/debug_util.h | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'base/debug_util.h') 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_ -- cgit v1.1