[email protected] | 5858035 | 2010-10-26 04:07:50 | [diff] [blame] | 1 | // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
2 | // Use of this source code is governed by a BSD-style license that can be | ||||
3 | // found in the LICENSE file. | ||||
4 | |||||
5 | #include "base/debug/debugger.h" | ||||
6 | |||||
[email protected] | 8a65f28 | 2014-04-17 23:29:55 | [diff] [blame] | 7 | #include <stdlib.h> |
[email protected] | 5858035 | 2010-10-26 04:07:50 | [diff] [blame] | 8 | #include <windows.h> |
[email protected] | 5858035 | 2010-10-26 04:07:50 | [diff] [blame] | 9 | |
10 | namespace base { | ||||
11 | namespace debug { | ||||
12 | |||||
[email protected] | 5858035 | 2010-10-26 04:07:50 | [diff] [blame] | 13 | bool BeingDebugged() { |
14 | return ::IsDebuggerPresent() != 0; | ||||
15 | } | ||||
16 | |||||
17 | void BreakDebugger() { | ||||
[email protected] | d028296 | 2011-01-01 16:08:52 | [diff] [blame] | 18 | if (IsDebugUISuppressed()) |
[email protected] | 5858035 | 2010-10-26 04:07:50 | [diff] [blame] | 19 | _exit(1); |
20 | __debugbreak(); | ||||
[email protected] | f355c56 | 2011-01-21 05:02:17 | [diff] [blame] | 21 | #if defined(NDEBUG) |
22 | _exit(1); | ||||
23 | #endif | ||||
[email protected] | 5858035 | 2010-10-26 04:07:50 | [diff] [blame] | 24 | } |
25 | |||||
26 | } // namespace debug | ||||
27 | } // namespace base |