Implement std::experimental::source_location (N4519)
[official-gcc.git] / libsanitizer / sanitizer_common / sanitizer_symbolizer_libbacktrace.h
blobab1d6f9916346cf30dfbd13db2b933e92393ce24
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
15 #include "sanitizer_platform.h"
16 #include "sanitizer_common.h"
17 #include "sanitizer_allocator_internal.h"
18 #include "sanitizer_symbolizer_internal.h"
20 #ifndef SANITIZER_LIBBACKTRACE
21 # define SANITIZER_LIBBACKTRACE 0
22 #endif
24 #ifndef SANITIZER_CP_DEMANGLE
25 # define SANITIZER_CP_DEMANGLE 0
26 #endif
28 namespace __sanitizer {
30 class LibbacktraceSymbolizer : public SymbolizerTool {
31 public:
32 static LibbacktraceSymbolizer *get(LowLevelAllocator *alloc);
34 bool SymbolizePC(uptr addr, SymbolizedStack *stack) override;
36 bool SymbolizeData(uptr addr, DataInfo *info) override;
38 // May return NULL if demangling failed.
39 const char *Demangle(const char *name) override;
41 private:
42 explicit LibbacktraceSymbolizer(void *state) : state_(state) {}
44 void *state_; // Leaked.
47 } // namespace __sanitizer
48 #endif // SANITIZER_SYMBOLIZER_LIBBACKTRACE_H