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