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

Side by Side Diff: base/debug_util.h

Issue 62140: Print backtraces on FATAL log messages in debug mode. (Closed)
Patch Set: Add todo for stackwalk64 Created 11 years, 8 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
« no previous file with comments | « base/base.gyp ('k') | base/debug_util_posix.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-2008 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 // This is a cross platform interface for helper functions related to debuggers. 5 // This is a cross platform interface for helper functions related to debuggers.
6 // You should use this to test if you're running under a debugger, and if you 6 // You should use this to test if you're running under a debugger, and if you
7 // would like to yield (breakpoint) into the debugger. 7 // would like to yield (breakpoint) into the debugger.
8 8
9 #ifndef BASE_DEBUG_UTIL_H_ 9 #ifndef BASE_DEBUG_UTIL_H_
10 #define BASE_DEBUG_UTIL_H_ 10 #define BASE_DEBUG_UTIL_H_
11 11
12 #include <iostream>
13 #include <vector>
14
12 #include "base/basictypes.h" 15 #include "base/basictypes.h"
13 16
14 #include <vector>
15
16 // A stacktrace can be helpful in debugging. For example, you can include a 17 // A stacktrace can be helpful in debugging. For example, you can include a
17 // stacktrace member in a object (probably around #ifndef NDEBUG) so that you 18 // stacktrace member in a object (probably around #ifndef NDEBUG) so that you
18 // can later see where the given object was created from. 19 // can later see where the given object was created from.
19 class StackTrace { 20 class StackTrace {
20 public: 21 public:
21 // Create a stacktrace from the current location 22 // Create a stacktrace from the current location
22 StackTrace(); 23 StackTrace();
23 // Get an array of instruction pointer values. 24 // Get an array of instruction pointer values.
24 // count: (output) the number of elements in the returned array 25 // count: (output) the number of elements in the returned array
25 const void *const *Addresses(size_t* count); 26 const void *const *Addresses(size_t* count);
26 // Print a backtrace to stderr 27 // Print a backtrace to stderr
27 void PrintBacktrace(); 28 void PrintBacktrace();
28 29
30 // Resolve backtrace to symbols and write to stream.
31 void OutputToStream(std::ostream* os);
32
29 private: 33 private:
30 std::vector<void*> trace_; 34 std::vector<void*> trace_;
31 35
32 DISALLOW_EVIL_CONSTRUCTORS(StackTrace); 36 DISALLOW_EVIL_CONSTRUCTORS(StackTrace);
33 }; 37 };
34 38
35 class DebugUtil { 39 class DebugUtil {
36 public: 40 public:
37 // Starts the registered system-wide JIT debugger to attach it to specified 41 // Starts the registered system-wide JIT debugger to attach it to specified
38 // process. 42 // process.
(...skipping 18 matching lines...) Expand all
57 // process a Chrome crash. This translates into a long wait till the process 61 // process a Chrome crash. This translates into a long wait till the process
58 // actually dies. 62 // actually dies.
59 // This method disables OS Crash reporting entireley. 63 // This method disables OS Crash reporting entireley.
60 // TODO(playmobil): Remove this when we have Breakpad integration enabled - 64 // TODO(playmobil): Remove this when we have Breakpad integration enabled -
61 // see http://crbug.com/7652 65 // see http://crbug.com/7652
62 static void DisableOSCrashDumps(); 66 static void DisableOSCrashDumps();
63 #endif // defined(OS_MACOSX) 67 #endif // defined(OS_MACOSX)
64 }; 68 };
65 69
66 #endif // BASE_DEBUG_UTIL_H_ 70 #endif // BASE_DEBUG_UTIL_H_
OLDNEW
« no previous file with comments | « base/base.gyp ('k') | base/debug_util_posix.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698