[PATCH] [compiler-rt] Spring cleaning of compiler-rt symbolizers

Kuba Brecka kuba.brecka at gmail.com
Mon Feb 23 04:51:05 PST 2015


Hi everyone,

this is a refactoring, NFC patch that tries to clean up the current symbolizer code in `sanitizer_common/sanitizer_symbolizer*.[cc|h]`.  One of the reasons for that is that I'd like to implement some OS X specific symbolizers that could be available in case llvm-symbolizer isn't (AtosSymbolizer and/or DlAddr symbolizer, see http://reviews.llvm.org/D6588).  However, there are other weirdnesses in the current implementation:  We have several symbolizers available (libbacktrace, llvm-symbolizer, internal symbolizer, addr2line), but they don't share a common interface.  The `POSIXSymbolizer` which operates on top of the individual symbolizers has a hardcoded format of output that it expects.  The symbolizers also form a very weird chain, e.g. if libbacktrace symbolizer is available but cannot symbolize something, we still try to symbolize using an internal or external symbolizer.  But when an internal symbolizer returns "false", we don't try an external one.  `SymbolizerProcess` which is supposed to only transfer communication from/to an external process actually contains logic to format commands.

This patch extracts an interface, `SymbolizerInterface` that all the symbolizers now implement.  `SymbolizerProcess` now only takes a string command and returns a string response.  Things in `POSIXSymbolizer` that were specific to llvm-symbolizer and now extracted into `LLVMSymbolizer` class.  Parsing of llvm-symbolizer output is extracted into `ParseSymbolizePCOutput` and `ParseSymbolizeDataOutput` methods, and it's used to parse lines from both llvm-symbolizer and addr2line.  The symbolizers now form an explicit chain via the `next_symbolizer_` field, and `POSIXSymbolizer` walks this linked list when symbolizing an address.

Thanks for reviewing!
Kuba

http://reviews.llvm.org/D7827

Files:
  lib/sanitizer_common/sanitizer_symbolizer.h
  lib/sanitizer_common/sanitizer_symbolizer_libbacktrace.cc
  lib/sanitizer_common/sanitizer_symbolizer_libbacktrace.h
  lib/sanitizer_common/sanitizer_symbolizer_posix_libcdep.cc

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D7827.20505.patch
Type: text/x-patch
Size: 45183 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150223/95dbc3c6/attachment.bin>


More information about the llvm-commits mailing list