| OLD | NEW |
| 1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2009 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 "build/build_config.h" | 5 #include "build/build_config.h" |
| 6 #include "base/debug_util.h" | 6 #include "base/debug_util.h" |
| 7 | 7 |
| 8 #include <errno.h> | 8 #include <errno.h> |
| 9 #include <fcntl.h> | 9 #include <fcntl.h> |
| 10 #include <stdio.h> | 10 #include <stdio.h> |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 | 165 |
| 166 base::StringPiece::size_type pid_index = status.find(tracer); | 166 base::StringPiece::size_type pid_index = status.find(tracer); |
| 167 if (pid_index == base::StringPiece::npos) | 167 if (pid_index == base::StringPiece::npos) |
| 168 return false; | 168 return false; |
| 169 | 169 |
| 170 // Our pid is 0 without a debugger, assume this for any pid starting with 0. | 170 // Our pid is 0 without a debugger, assume this for any pid starting with 0. |
| 171 pid_index += tracer.size(); | 171 pid_index += tracer.size(); |
| 172 return pid_index < status.size() && status[pid_index] != '0'; | 172 return pid_index < status.size() && status[pid_index] != '0'; |
| 173 } | 173 } |
| 174 | 174 |
| 175 #endif // OS_LINUX | 175 #elif defined(OS_FREEBSD) |
| 176 |
| 177 bool DebugUtil::BeingDebugged() { |
| 178 // TODO(benl): can we determine this under FreeBSD? |
| 179 NOTIMPLEMENTED(); |
| 180 return false; |
| 181 } |
| 182 |
| 183 #endif |
| 176 | 184 |
| 177 // static | 185 // static |
| 178 void DebugUtil::BreakDebugger() { | 186 void DebugUtil::BreakDebugger() { |
| 179 #if defined(ARCH_CPU_ARM_FAMILY) | 187 #if defined(ARCH_CPU_ARM_FAMILY) |
| 180 asm("bkpt 0"); | 188 asm("bkpt 0"); |
| 181 #else | 189 #else |
| 182 asm("int3"); | 190 asm("int3"); |
| 183 #endif | 191 #endif |
| 184 } | 192 } |
| 185 | 193 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 } | 229 } |
| 222 } else { | 230 } else { |
| 223 (*os) << "Backtrace:\n"; | 231 (*os) << "Backtrace:\n"; |
| 224 for (int i = 0; i < count_; ++i) { | 232 for (int i = 0; i < count_; ++i) { |
| 225 std::string trace_symbol(trace_symbols.get()[i]); | 233 std::string trace_symbol(trace_symbols.get()[i]); |
| 226 DemangleSymbols(&trace_symbol); | 234 DemangleSymbols(&trace_symbol); |
| 227 (*os) << "\t" << trace_symbol << "\n"; | 235 (*os) << "\t" << trace_symbol << "\n"; |
| 228 } | 236 } |
| 229 } | 237 } |
| 230 } | 238 } |
| OLD | NEW |