Stephen Hines | 2d1fdb2 | 2014-05-28 23:58:16 -0700 | [diff] [blame] | 1 | //===-- sanitizer_symbolizer_libbacktrace.h ---------------------*- C++ -*-===// |
| 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
| 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // License. See LICENSE.TXT for details. |
| 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | // |
| 10 | // This file is shared between AddressSanitizer and ThreadSanitizer |
| 11 | // run-time libraries. |
| 12 | // Header for libbacktrace symbolizer. |
| 13 | //===----------------------------------------------------------------------===// |
| 14 | #ifndef SANITIZER_SYMBOLIZER_LIBBACKTRACE_H |
| 15 | #define SANITIZER_SYMBOLIZER_LIBBACKTRACE_H |
| 16 | |
| 17 | #include "sanitizer_platform.h" |
| 18 | #include "sanitizer_common.h" |
Pirama Arumuga Nainar | 7c91505 | 2015-04-08 08:58:29 -0700 | [diff] [blame] | 19 | #include "sanitizer_symbolizer_internal.h" |
Stephen Hines | 2d1fdb2 | 2014-05-28 23:58:16 -0700 | [diff] [blame] | 20 | |
| 21 | #ifndef SANITIZER_LIBBACKTRACE |
| 22 | # define SANITIZER_LIBBACKTRACE 0 |
| 23 | #endif |
| 24 | |
| 25 | #ifndef SANITIZER_CP_DEMANGLE |
| 26 | # define SANITIZER_CP_DEMANGLE 0 |
| 27 | #endif |
| 28 | |
| 29 | namespace __sanitizer { |
| 30 | |
Pirama Arumuga Nainar | 7c91505 | 2015-04-08 08:58:29 -0700 | [diff] [blame] | 31 | class LibbacktraceSymbolizer : public SymbolizerTool { |
Stephen Hines | 2d1fdb2 | 2014-05-28 23:58:16 -0700 | [diff] [blame] | 32 | public: |
| 33 | static LibbacktraceSymbolizer *get(LowLevelAllocator *alloc); |
| 34 | |
Pirama Arumuga Nainar | 7c91505 | 2015-04-08 08:58:29 -0700 | [diff] [blame] | 35 | bool SymbolizePC(uptr addr, SymbolizedStack *stack) override; |
Stephen Hines | 2d1fdb2 | 2014-05-28 23:58:16 -0700 | [diff] [blame] | 36 | |
Pirama Arumuga Nainar | 7c91505 | 2015-04-08 08:58:29 -0700 | [diff] [blame] | 37 | bool SymbolizeData(uptr addr, DataInfo *info) override; |
Stephen Hines | 2d1fdb2 | 2014-05-28 23:58:16 -0700 | [diff] [blame] | 38 | |
| 39 | // May return NULL if demangling failed. |
Pirama Arumuga Nainar | 7c91505 | 2015-04-08 08:58:29 -0700 | [diff] [blame] | 40 | const char *Demangle(const char *name) override; |
Stephen Hines | 2d1fdb2 | 2014-05-28 23:58:16 -0700 | [diff] [blame] | 41 | |
| 42 | private: |
| 43 | explicit LibbacktraceSymbolizer(void *state) : state_(state) {} |
| 44 | |
| 45 | void *state_; // Leaked. |
| 46 | }; |
| 47 | |
| 48 | } // namespace __sanitizer |
| 49 | #endif // SANITIZER_SYMBOLIZER_LIBBACKTRACE_H |