Commit 9845bc92 authored by glider@chromium.org's avatar glider@chromium.org

Merge Linux-specific bits from upstream asan_symbolize.py into Chrome

TBR=timurrrr
Review URL: https://chromiumcodereview.appspot.com/10836026

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@149164 0039d316-1c4b-4281-b951-d872f2087c98
parent 0aa12e03
...@@ -11,15 +11,25 @@ import string ...@@ -11,15 +11,25 @@ import string
import subprocess import subprocess
pipes = {} pipes = {}
filetypes = {}
vmaddrs = {} vmaddrs = {}
DEBUG=False
def fix_filename(file_name):
for path_to_cut in sys.argv[1:]:
file_name = re.sub(".*" + path_to_cut, "", file_name)
file_name = re.sub(".*asan_[a-z_]*.cc:[0-9]*", "_asan_rtl_", file_name)
file_name = re.sub(".*crtstuff.c:0", "???:0", file_name)
return file_name
# TODO(glider): need some refactoring here # TODO(glider): need some refactoring here
def symbolize_addr2line(line): def symbolize_addr2line(line):
#0 0x7f6e35cf2e45 (/blah/foo.so+0x11fe45) #0 0x7f6e35cf2e45 (/blah/foo.so+0x11fe45)
match = re.match('^( *#[0-9]+ *0x[0-9a-f]+) *\((.*)\+(0x[0-9a-f]+)\)', line) match = re.match('^( *#([0-9]+) *0x[0-9a-f]+) *\((.*)\+(0x[0-9a-f]+)\)', line)
if match: if match:
binary = match.group(2) frameno = match.group(2)
addr = match.group(3) binary = match.group(3)
addr = match.group(4)
if not pipes.has_key(binary): if not pipes.has_key(binary):
pipes[binary] = subprocess.Popen(["addr2line", "-f", "-e", binary], pipes[binary] = subprocess.Popen(["addr2line", "-f", "-e", binary],
stdin=subprocess.PIPE, stdout=subprocess.PIPE) stdin=subprocess.PIPE, stdout=subprocess.PIPE)
...@@ -31,10 +41,7 @@ def symbolize_addr2line(line): ...@@ -31,10 +41,7 @@ def symbolize_addr2line(line):
except: except:
function_name = "" function_name = ""
file_name = "" file_name = ""
for path_to_cut in sys.argv[1:]: file_name = fix_filename(file_name)
file_name = re.sub(".*" + path_to_cut, "", file_name)
file_name = re.sub(".*asan_rtl.cc:[0-9]*", "_asan_rtl_", file_name)
file_name = re.sub(".*crtstuff.c:0", "???:0", file_name)
print match.group(1), "in", function_name, file_name print match.group(1), "in", function_name, file_name
else: else:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment