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

Issue 18303: Add StackTrace debugging utility class. (Closed)

Created:
11 years, 11 months ago by agl
Modified:
9 years, 7 months ago
Reviewers:
Evan Martin
CC:
chromium-reviews_googlegroups.com
Visibility:
Public.

Description

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)

Patch Set 1 #

Total comments: 8

Patch Set 2 : Addressing comments #

Total comments: 2
Unified diffs Side-by-side diffs Delta from patch set Stats (+78 lines, -1 line) Patch
M base/debug_util.h View 1 2 chunks +23 lines, -1 line 0 comments Download
M base/debug_util_posix.cc View 1 2 chunks +42 lines, -0 lines 1 comment Download
M base/debug_util_win.cc View 1 1 chunk +13 lines, -0 lines 1 comment Download

Messages

Total messages: 4 (0 generated)
agl
11 years, 11 months ago (2009-01-16 01:41:07 UTC) #1
Evan Martin
stars on the left, unsigned => size_t http://codereview.chromium.org/18303/diff/1/3 File base/debug_util_posix.cc (right): http://codereview.chromium.org/18303/diff/1/3#newcode7 Line 7: #if ...
11 years, 11 months ago (2009-01-16 02:09:04 UTC) #2
agl
http://codereview.chromium.org/18303/diff/1/3 File base/debug_util_posix.cc (right): http://codereview.chromium.org/18303/diff/1/3#newcode7 Line 7: #if defined(OS_LINUX) On 2009/01/16 02:09:04, Evan Martin wrote: ...
11 years, 11 months ago (2009-01-16 18:22:55 UTC) #3
Evan Martin
11 years, 11 months ago (2009-01-16 18:30:08 UTC) #4
lgtm

http://codereview.chromium.org/18303/diff/205/8
File base/debug_util_posix.cc (right):

http://codereview.chromium.org/18303/diff/205/8#newcode124
Line 124: fprintf(stderr, "<printing stacktraces not implemented>\n");
you won't need this anymore with the above

http://codereview.chromium.org/18303/diff/205/9
File base/debug_util_win.cc (right):

http://codereview.chromium.org/18303/diff/205/9#newcode114
Line 114: fprintf(stderr, "<printing stacktraces not implemented>\n");
you don't need this anymore with the below

Powered by Google App Engine
This is Rietveld 408576698