diff options
author | agl@chromium.org <agl@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-01-16 21:17:30 +0000 |
---|---|---|
committer | agl@chromium.org <agl@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-01-16 21:17:30 +0000 |
commit | 5485cdcb5bc72c71dd67d982dadf76dd9c78328c (patch) | |
tree | 7f3bc0080230211be3adf17777cdf697c91bebb5 /base/debug_util_win.cc | |
parent | 32a66aed0e57642c8f0da0a4a34383bbc9250a32 (diff) | |
download | chromium_src-5485cdcb5bc72c71dd67d982dadf76dd9c78328c.zip chromium_src-5485cdcb5bc72c71dd67d982dadf76dd9c78328c.tar.gz chromium_src-5485cdcb5bc72c71dd67d982dadf76dd9c78328c.tar.bz2 |
Add StackTrace debugging utility class.
For the moment, it only works on Linux, although it should be pretty easy to
get it working on Mac with __builtin_return_address and __builtin_frame_address.
It will mostly fail to resolve functions. Use this wrapper script:
import os
import sys
import subprocess
import re
address = re.compile('.*\[(0x[0-9a-fA-F]{4,8})\].*')
if __name__ == '__main__':
p = subprocess.Popen(sys.argv[1:], stderr = subprocess.STDOUT, stdout = subprocess.PIPE)
addr2line = subprocess.Popen(['addr2line', '-e', sys.argv[1], '-f', '-C', '-s'],
stdout = subprocess.PIPE, stdin = subprocess.PIPE)
for line in p.stdout.readlines():
m = address.match(line);
if m is not None:
addr2line.stdin.write(m.groups()[0] + '\n')
function = addr2line.stdout.readline()[:-1]
location = addr2line.stdout.readline()[:-1]
sys.stdout.write('%s (%s)\n' % (function, location))
else:
sys.stdout.write(line)
Review URL: http://codereview.chromium.org/18303
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@8218 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/debug_util_win.cc')
-rw-r--r-- | base/debug_util_win.cc | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/base/debug_util_win.cc b/base/debug_util_win.cc index 906b71e..348bf44 100644 --- a/base/debug_util_win.cc +++ b/base/debug_util_win.cc @@ -101,3 +101,15 @@ void DebugUtil::BreakDebugger() { __debugbreak(); } +// TODO(port): not implemented on Windows +StackTrace::StackTrace() { +} + +const void *const *StackTrace::Addresses(size_t* count) { + *count = 0; + return NULL; +} + +void PrintBacktrace() { + NOTIMPLEMENTED(); +} |