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" 19 #include "sanitizer_allocator_internal.h" 20 #include "sanitizer_symbolizer_internal.h" 21 22 #ifndef SANITIZER_LIBBACKTRACE 23 # define SANITIZER_LIBBACKTRACE 0 24 #endif 25 26 #ifndef SANITIZER_CP_DEMANGLE 27 # define SANITIZER_CP_DEMANGLE 0 28 #endif 29 30 namespace __sanitizer { 31 32 class LibbacktraceSymbolizer : public SymbolizerTool { 33 public: 34 static LibbacktraceSymbolizer *get(LowLevelAllocator *alloc); 35 36 bool SymbolizePC(uptr addr, SymbolizedStack *stack) override; 37 38 bool SymbolizeData(uptr addr, DataInfo *info) override; 39 40 // May return NULL if demangling failed. 41 const char *Demangle(const char *name) override; 42 43 private: 44 explicit LibbacktraceSymbolizer(void *state) : state_(state) {} 45 46 void *state_; // Leaked. 47 }; 48 49 } // namespace __sanitizer 50 #endif // SANITIZER_SYMBOLIZER_LIBBACKTRACE_H 51