| 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 | |
| 7 | #include <stdlib.h> |
| 8 | #include <windows.h> |
| 9 | |
| 10 | #include "base/clang_profiling_buildflags.h" |
| 11 | |
| 12 | #if BUILDFLAG(CLANG_PROFILING) |
| 13 | #include "base/test/clang_profiling.h" |
| 14 | #endif |
| 15 | |
| 16 | namespace base { |
| 17 | namespace debug { |
| 18 | |
| 19 | bool BeingDebugged() { |
| 20 | return ::IsDebuggerPresent() != 0; |
| 21 | } |
| 22 | |
| 23 | void BreakDebugger() { |
| 24 | #if BUILDFLAG(CLANG_PROFILING) |
| 25 | WriteClangProfilingProfile(); |
| 26 | #endif |
| 27 | |
| 28 | if (IsDebugUISuppressed()) |
| 29 | _exit(1); |
| 30 | |
| 31 | __debugbreak(); |
| 32 | } |
| 33 | |
| 34 | void VerifyDebugger() {} |
| 35 | |
| 36 | } // namespace debug |
| 37 | } // namespace base |
| 38 | |