[llvm-commits] [compiler-rt] r148798 - in /compiler-rt/trunk/lib/asan: scripts/asan_symbolize.py tests/test_output.sh

Alexander Potapenko glider at google.com
Tue Jan 24 02:44:44 PST 2012


Author: glider
Date: Tue Jan 24 04:44:44 2012
New Revision: 148798

URL: http://llvm.org/viewvc/llvm-project?rev=148798&view=rev
Log:
Tune asan_symbolize.py to symbolize 64-bit binaries correctly.
Add the DEBUG flag to test_output.sh

Modified:
    compiler-rt/trunk/lib/asan/scripts/asan_symbolize.py
    compiler-rt/trunk/lib/asan/tests/test_output.sh

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=148798&r1=148797&r2=148798&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/scripts/asan_symbolize.py (original)
+++ compiler-rt/trunk/lib/asan/scripts/asan_symbolize.py Tue Jan 24 04:44:44 2012
@@ -72,15 +72,20 @@
     addr = patch_address(frameno, addr)
     load_addr = int(addr, 16) - int(offset, 16)
     if not pipes.has_key(binary):
-      #print "atos -o %s -l %s" % (binary, hex(load_addr))
-      pipes[binary] = subprocess.Popen(["atos", "-o", binary],
+      # Guess which arch we're running. 10 = len("0x") + 8 hex digits.
+      if len(addr) > 10:
+        arch = "x86_64"
+      else:
+        arch = "i386"
+      #print "atos -o %s -arch %s " % (binary, arch)
+      pipes[binary] = subprocess.Popen(["atos", "-o", binary, "-arch", arch],
                          stdin=subprocess.PIPE, stdout=subprocess.PIPE,)
     p = pipes[binary]
     # TODO(glider): how to tell if the address is absolute?
     if ".app/" in binary and not ".framework" in binary:
       print >>p.stdin, "%s" % addr
     else:
-      print >>p.stdin, "%s" % offset
+      print >>p.stdin, "%s" % addr
     # TODO(glider): it's more efficient to make a batch atos run for each binary.
     p.stdin.close()
     atos_line = p.stdout.readline().rstrip()

Modified: compiler-rt/trunk/lib/asan/tests/test_output.sh
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/tests/test_output.sh?rev=148798&r1=148797&r2=148798&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/tests/test_output.sh (original)
+++ compiler-rt/trunk/lib/asan/tests/test_output.sh Tue Jan 24 04:44:44 2012
@@ -27,7 +27,9 @@
       exe=$c.$b.O$O
       so=$c.$b.O$O-so.so
       echo testing $exe
-      $CXX $CXXFLAGS -g -m$b -faddress-sanitizer -O$O $c.cc -o $exe
+      build_command="$CXX $CXXFLAGS -g -m$b -faddress-sanitizer -O$O $c.cc -o $exe"
+      [ "$DEBUG" == "1" ] && echo $build_command
+      $build_command
       [ -e "$c_so.cc" ] && $CXX $CXXFLAGS -g -m$b -faddress-sanitizer -O$O $c_so.cc -fPIC -shared -o $so
       # If there's an OS-specific template, use it.
       # Please minimize the use of OS-specific templates.





More information about the llvm-commits mailing list