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 <execinfo.h> | 9 #include <execinfo.h> |
10 #include <fcntl.h> | 10 #include <fcntl.h> |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
100 | 100 |
101 // Our pid is 0 without a debugger, assume this for any pid starting with 0. | 101 // Our pid is 0 without a debugger, assume this for any pid starting with 0. |
102 pid_index += tracer.size(); | 102 pid_index += tracer.size(); |
103 return pid_index < status.size() && status[pid_index] != '0'; | 103 return pid_index < status.size() && status[pid_index] != '0'; |
104 } | 104 } |
105 | 105 |
106 #endif // OS_LINUX | 106 #endif // OS_LINUX |
107 | 107 |
108 // static | 108 // static |
109 void DebugUtil::BreakDebugger() { | 109 void DebugUtil::BreakDebugger() { |
110 #if !defined(ARCH_CPU_ARM_FAMILY) | |
Mark Mentovai
2009/05/06 16:18:16
This needs a TODO for someone to implement it on A
| |
110 asm ("int3"); | 111 asm ("int3"); |
112 #endif | |
111 } | 113 } |
112 | 114 |
113 StackTrace::StackTrace() { | 115 StackTrace::StackTrace() { |
114 const int kMaxCallers = 256; | 116 const int kMaxCallers = 256; |
115 | 117 |
116 void* callers[kMaxCallers]; | 118 void* callers[kMaxCallers]; |
117 int count = backtrace(callers, kMaxCallers); | 119 int count = backtrace(callers, kMaxCallers); |
118 | 120 |
119 // Though the backtrace API man page does not list any possible negative | 121 // Though the backtrace API man page does not list any possible negative |
120 // return values, we still still exclude them because they would break the | 122 // return values, we still still exclude them because they would break the |
(...skipping 23 matching lines...) Expand all Loading... | |
144 for (size_t i = 0; i < trace_.size(); ++i) { | 146 for (size_t i = 0; i < trace_.size(); ++i) { |
145 (*os) << "\t" << trace_[i] << "\n"; | 147 (*os) << "\t" << trace_[i] << "\n"; |
146 } | 148 } |
147 } else { | 149 } else { |
148 (*os) << "Backtrace:\n"; | 150 (*os) << "Backtrace:\n"; |
149 for (size_t i = 0; i < trace_.size(); ++i) { | 151 for (size_t i = 0; i < trace_.size(); ++i) { |
150 (*os) << "\t" << trace_symbols.get()[i] << "\n"; | 152 (*os) << "\t" << trace_symbols.get()[i] << "\n"; |
151 } | 153 } |
152 } | 154 } |
153 } | 155 } |
OLD | NEW |