[llvm-commits] [compiler-rt] r161947 - /compiler-rt/trunk/lib/asan/scripts/asan_symbolize.py
Alexander Potapenko
glider at google.com
Wed Aug 15 06:58:24 PDT 2012
Author: glider
Date: Wed Aug 15 08:58:24 2012
New Revision: 161947
URL: http://llvm.org/viewvc/llvm-project?rev=161947&view=rev
Log:
Pass offset of the frame address within the binary to addr2line instead of the absolute address.
Fixes the problem with -PIE binaries.
Modified:
compiler-rt/trunk/lib/asan/scripts/asan_symbolize.py
Modified: compiler-rt/trunk/lib/asan/scripts/asan_symbolize.py
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/scripts/asan_symbolize.py?rev=161947&r1=161946&r2=161947&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/scripts/asan_symbolize.py (original)
+++ compiler-rt/trunk/lib/asan/scripts/asan_symbolize.py Wed Aug 15 08:58:24 2012
@@ -38,11 +38,14 @@
self.binary = binary
self.pipe = self.open_addr2line()
def open_addr2line(self):
- return subprocess.Popen(["addr2line", "-f", "-e", self.binary],
+ cmd = ["addr2line", "-f", "-e", self.binary]
+ if DEBUG:
+ print ' '.join(cmd)
+ return subprocess.Popen(cmd,
stdin=subprocess.PIPE, stdout=subprocess.PIPE)
- def symbolize(self, prefix, addr, _):
+ def symbolize(self, prefix, addr, offset):
try:
- print >> self.pipe.stdin, addr
+ print >> self.pipe.stdin, offset
function_name = self.pipe.stdout.readline().rstrip()
file_name = self.pipe.stdout.readline().rstrip()
except Exception:
@@ -140,7 +143,7 @@
if suffix:
filename = binary + suffix
if os.access(filename, os.F_OK):
- return BreakpadSymbolizer(addr, filename)
+ return BreakpadSymbolizer(filename)
return None
@@ -175,10 +178,12 @@
self.files.append(' '.join(fragments[2:]))
elif fragments[0] == 'PUBLIC':
self.symbols[int(fragments[1], 16)] = ' '.join(fragments[3:])
- elif fragments[0] == 'CFI':
+ elif fragments[0] in ['CFI', 'STACK']:
pass
elif fragments[0] == 'FUNC':
cur_function_addr = int(fragments[1], 16)
+ if not cur_function_addr in self.symbols.keys():
+ self.symbols[cur_function_addr] = ' '.join(fragments[4:])
else:
# Line starting with an address.
addr = int(fragments[0], 16)
@@ -210,8 +215,10 @@
res = self.get_sym_file_line(int(offset, 16))
if res:
function_name, file_name, line_no = res
- return "%s%s in %s %s:%d" % (
+ result = "%s%s in %s %s:%d" % (
prefix, addr, function_name, file_name, line_no)
+ print result
+ return result
else:
return None
More information about the llvm-commits
mailing list