OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "base/debug/debugger.h" | 5 #include "base/debug/debugger.h" |
6 #include "build/build_config.h" | 6 #include "build/build_config.h" |
7 | 7 |
8 #include <errno.h> | 8 #include <errno.h> |
9 #include <execinfo.h> | 9 #include <execinfo.h> |
10 #include <fcntl.h> | 10 #include <fcntl.h> |
11 #include <stdio.h> | 11 #include <stdio.h> |
12 #include <stdlib.h> | 12 #include <stdlib.h> |
13 #include <sys/param.h> | 13 #include <sys/param.h> |
14 #include <sys/stat.h> | 14 #include <sys/stat.h> |
15 #if !defined(OS_NACL) | |
16 #include <sys/sysctl.h> | |
17 #endif | |
18 #include <sys/types.h> | 15 #include <sys/types.h> |
19 #include <unistd.h> | 16 #include <unistd.h> |
20 | 17 |
21 #include <string> | 18 #include <string> |
22 #include <vector> | 19 #include <vector> |
23 | 20 |
24 #if defined(__GLIBCXX__) | 21 #if defined(__GLIBCXX__) |
25 #include <cxxabi.h> | 22 #include <cxxabi.h> |
26 #endif | 23 #endif |
27 | 24 |
28 #if defined(OS_MACOSX) | 25 #if defined(OS_MACOSX) |
29 #include <AvailabilityMacros.h> | 26 #include <AvailabilityMacros.h> |
30 #endif | 27 #endif |
31 | 28 |
| 29 #if defined(OS_MACOSX) || defined(OS_OPENBSD) || defined(OS_FREEBSD) |
| 30 #include <sys/sysctl.h> |
| 31 #endif |
| 32 |
32 #include <iostream> | 33 #include <iostream> |
33 | 34 |
34 #include "base/basictypes.h" | 35 #include "base/basictypes.h" |
35 #include "base/eintr_wrapper.h" | 36 #include "base/eintr_wrapper.h" |
36 #include "base/logging.h" | 37 #include "base/logging.h" |
37 #include "base/memory/scoped_ptr.h" | 38 #include "base/memory/scoped_ptr.h" |
38 #include "base/safe_strerror_posix.h" | 39 #include "base/safe_strerror_posix.h" |
39 #include "base/string_piece.h" | 40 #include "base/string_piece.h" |
40 #include "base/stringprintf.h" | 41 #include "base/stringprintf.h" |
41 | 42 |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 return pid_index < status.size() && status[pid_index] != '0'; | 130 return pid_index < status.size() && status[pid_index] != '0'; |
130 } | 131 } |
131 | 132 |
132 #elif defined(OS_NACL) | 133 #elif defined(OS_NACL) |
133 | 134 |
134 bool BeingDebugged() { | 135 bool BeingDebugged() { |
135 NOTIMPLEMENTED(); | 136 NOTIMPLEMENTED(); |
136 return false; | 137 return false; |
137 } | 138 } |
138 | 139 |
139 #elif defined(OS_FREEBSD) | 140 #else |
140 | 141 |
141 bool BeingDebugged() { | 142 bool BeingDebugged() { |
142 // TODO(benl): can we determine this under FreeBSD? | 143 // TODO(benl): can we determine this under FreeBSD? |
143 NOTIMPLEMENTED(); | 144 NOTIMPLEMENTED(); |
144 return false; | 145 return false; |
145 } | 146 } |
146 | 147 |
147 #endif // defined(OS_FREEBSD) | 148 #endif // defined(OS_FREEBSD) |
148 | 149 |
149 // We want to break into the debugger in Debug mode, and cause a crash dump in | 150 // We want to break into the debugger in Debug mode, and cause a crash dump in |
(...skipping 25 matching lines...) Expand all Loading... |
175 | 176 |
176 void BreakDebugger() { | 177 void BreakDebugger() { |
177 DEBUG_BREAK(); | 178 DEBUG_BREAK(); |
178 #if defined(NDEBUG) | 179 #if defined(NDEBUG) |
179 _exit(1); | 180 _exit(1); |
180 #endif | 181 #endif |
181 } | 182 } |
182 | 183 |
183 } // namespace debug | 184 } // namespace debug |
184 } // namespace base | 185 } // namespace base |
OLD | NEW |