[PATCH] New options for asan-symbolizer script: set cross-compile prefix, set path to sysroot, print help message

Alexander Potapenko glider at google.com
Tue Jul 29 06:09:58 PDT 2014


================
Comment at: lib/asan/scripts/asan_symbolize.py:22
@@ +21,3 @@
+demangle = False
+cc_prefix = None
+sysroot_path = None
----------------
"binutils_prefix", maybe?
I imagine someone who doesn't do cross-compilation may want to use a custom addr2line.

================
Comment at: lib/asan/scripts/asan_symbolize.py:24
@@ -23,1 +23,3 @@
+sysroot_path = None
+binary_name_filter=None
 
----------------
Please add spaces around "="

================
Comment at: lib/asan/scripts/asan_symbolize.py:28
@@ -25,3 +27,3 @@
 def fix_filename(file_name):
   for path_to_cut in sys.argv[1:]:
     file_name = re.sub('.*' + path_to_cut, '', file_name)
----------------
Please fix this loop to skip command line options and their arguments. Otherwise we'll occasionally cut the sysroot path from the file names.

================
Comment at: lib/asan/scripts/asan_symbolize.py:34
@@ -31,1 +33,3 @@
 
+def Sysroot_path_filter(binary_name):
+  return sysroot_path + binary_name
----------------
s/Sysroot/sysroot

================
Comment at: lib/asan/scripts/asan_symbolize.py:37
@@ -32,2 +36,3 @@
+
 def GuessArch(addr):
   # Guess which arch we're running. 10 = len('0x') + 8 hex digits.
----------------
While at it, can you please replace "GuessArch" with "guess_arch"?

================
Comment at: lib/asan/scripts/asan_symbolize.py:415
@@ +414,3 @@
+Example:
+  asan_symbolize.py -c "$HOME/opt/cross/bin/arm-linux-gnueabi-"  -s "$HOME/SymbolFiles" < asan.log
+"""
----------------
Please mention that other command line arguments are treated as patterns to be cut from the file paths (see fix_filename() above). We may want to reconsider this someday, e.g. make a repeating option (that's why you may want to use argparse instead of getopt, but I'm not insisting on this now).

================
Comment at: lib/asan/scripts/asan_symbolize.py:437
@@ +436,3 @@
+    else:
+      assert False, "unhandled option"
+
----------------
Not sure it's a good idea to assert on an unhandled option. This may cause unnecessary problems during deployment.

http://reviews.llvm.org/D4703






More information about the llvm-commits mailing list