ramosian-glider / sanitizers

0 stars 0 forks source link

asan_symbolize.py should try to demangle C++ names #146

Closed ramosian-glider closed 9 years ago

ramosian-glider commented 9 years ago

Originally reported on Google Code with ID 145

Currently, the asan_symbolize.py script doesn't demangle C++ filenames by itself. I
quickly rewrote the print_symbolized_lines function to do this in case the c++filt
command is available:

  def print_symbolized_lines(self, symbolized_lines):
    if not symbolized_lines:
      print self.current_line
    else:
      cppfilt = None
      try:
        cppfilt = subprocess.Popen(["c++filt"], stdin=subprocess.PIPE, stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
      except OSError:
        # c++filt not available, ignore error
        pass

      for symbolized_frame in symbolized_lines:
        frame = symbolized_frame.rstrip()
        if cppfilt != None:
          stdout, stderr = cppfilt.communicate(frame)
          frame = stdout
        print '    #' + str(self.frame_no) + ' ' + frame
        self.frame_no += 1

Not sure if you want to add something similar, but it works well for me and makes automation
a little easier :)

Reported by decoder.oh on 2013-01-25 14:01:18

ramosian-glider commented 9 years ago
we usually simply run 
  ./a.out 2>&1 | asan_symbolize.py| c++filt 
Isn't that enough? 

The new symbolizer is coming, so asan_symbolize.py will eventually get deprecated.

https://code.google.com/p/address-sanitizer/wiki/CallStack

Reported by konstantin.s.serebryany on 2013-01-25 14:04:00

ramosian-glider commented 9 years ago
People often don't know that they should run it like that and I got this question more
than once already. I think in most, if not all cases, there is no benefit in showing
the mangled trace, because it is at most useful for debugging problems in the symbolizer,
but not for reading the actual trace. If that is the case, then the symbolizer should
demangle on its own by default.

But if the new symbolizer is coming soon anyway, then I hope it'll be able to do this
and we don't need to change the python script right now :)

Reported by decoder.oh on 2013-01-25 14:06:39

ramosian-glider commented 9 years ago
Note filtering the whole ASan logs through c++filt sometimes produces silly results.
We must demangle only function names with c++filt in asan_symbolize.py or llvm-symbolizer.

Reported by glider@chromium.org on 2013-01-25 14:23:24

ramosian-glider commented 9 years ago
FTR: Using a pipe for c++filt is unnecessary on Linux - you can additionally pass "-C"
to addr2line process or "--demangle" to llvm-symbolizer.

Reported by samsonov@google.com on 2013-01-25 15:28:50

ramosian-glider commented 9 years ago
http://llvm.org/viewvc/llvm-project?rev=175429&view=rev adds flag -d to do what
samsonov@ suggested in comment #4

This does not seem applicable to atos on MacOS

Reported by konstantin.s.serebryany on 2013-02-18 08:04:45

ramosian-glider commented 9 years ago
Adding Project:AddressSanitizer as part of GitHub migration.

Reported by ramosian.glider on 2015-07-30 09:13:40