sanitizer_symbolizer_libbacktrace.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. //===-- sanitizer_symbolizer_libbacktrace.h ---------------------*- C++ -*-===//
  2. //
  3. // This file is distributed under the University of Illinois Open Source
  4. // License. See LICENSE.TXT for details.
  5. //
  6. //===----------------------------------------------------------------------===//
  7. //
  8. // This file is shared between AddressSanitizer and ThreadSanitizer
  9. // run-time libraries.
  10. // Header for libbacktrace symbolizer.
  11. //===----------------------------------------------------------------------===//
  12. #ifndef SANITIZER_SYMBOLIZER_LIBBACKTRACE_H
  13. #define SANITIZER_SYMBOLIZER_LIBBACKTRACE_H
  14. #include "sanitizer_platform.h"
  15. #include "sanitizer_common.h"
  16. #include "sanitizer_symbolizer.h"
  17. #ifndef SANITIZER_LIBBACKTRACE
  18. # define SANITIZER_LIBBACKTRACE 0
  19. #endif
  20. #ifndef SANITIZER_CP_DEMANGLE
  21. # define SANITIZER_CP_DEMANGLE 0
  22. #endif
  23. namespace __sanitizer {
  24. class LibbacktraceSymbolizer {
  25. public:
  26. static LibbacktraceSymbolizer *get(LowLevelAllocator *alloc);
  27. uptr SymbolizeCode(uptr addr, AddressInfo *frames, uptr max_frames,
  28. const char *module_name, uptr module_offset);
  29. bool SymbolizeData(uptr addr, DataInfo *info);
  30. // May return NULL if demangling failed.
  31. static char *Demangle(const char *name, bool always_alloc = false);
  32. private:
  33. explicit LibbacktraceSymbolizer(void *state) : state_(state) {}
  34. void *state_; // Leaked.
  35. };
  36. } // namespace __sanitizer
  37. #endif // SANITIZER_SYMBOLIZER_LIBBACKTRACE_H