Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(439)

Side by Side Diff: base/debug_util_posix.cc

Issue 99365: Lands http://codereview.chromium.org/99349 for Ryan.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | base/string_util_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 101
102 // Our pid is 0 without a debugger, assume this for any pid starting with 0. 102 // Our pid is 0 without a debugger, assume this for any pid starting with 0.
103 pid_index += tracer.size(); 103 pid_index += tracer.size();
104 return pid_index < status.size() && status[pid_index] != '0'; 104 return pid_index < status.size() && status[pid_index] != '0';
105 } 105 }
106 106
107 #endif // OS_LINUX 107 #endif // OS_LINUX
108 108
109 // static 109 // static
110 void DebugUtil::BreakDebugger() { 110 void DebugUtil::BreakDebugger() {
111 #if !defined(ARCH_CPU_ARM_FAMILY)
111 asm ("int3"); 112 asm ("int3");
113 #endif
112 } 114 }
113 115
114 StackTrace::StackTrace() { 116 StackTrace::StackTrace() {
115 const int kMaxCallers = 256; 117 const int kMaxCallers = 256;
116 118
117 void* callers[kMaxCallers]; 119 void* callers[kMaxCallers];
118 int count = backtrace(callers, kMaxCallers); 120 int count = backtrace(callers, kMaxCallers);
119 121
120 // Though the backtrace API man page does not list any possible negative 122 // Though the backtrace API man page does not list any possible negative
121 // return values, we still still exclude them because they would break the 123 // return values, we still still exclude them because they would break the
(...skipping 23 matching lines...) Expand all
145 for (size_t i = 0; i < trace_.size(); ++i) { 147 for (size_t i = 0; i < trace_.size(); ++i) {
146 (*os) << "\t" << trace_[i] << "\n"; 148 (*os) << "\t" << trace_[i] << "\n";
147 } 149 }
148 } else { 150 } else {
149 (*os) << "Backtrace:\n"; 151 (*os) << "Backtrace:\n";
150 for (size_t i = 0; i < trace_.size(); ++i) { 152 for (size_t i = 0; i < trace_.size(); ++i) {
151 (*os) << "\t" << trace_symbols.get()[i] << "\n"; 153 (*os) << "\t" << trace_symbols.get()[i] << "\n";
152 } 154 }
153 } 155 }
154 } 156 }
OLDNEW
« no previous file with comments | « no previous file | base/string_util_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698