2014-05-22 09:09:21 +02:00
|
|
|
//===-- sanitizer_symbolizer_libbacktrace.h ---------------------*- C++ -*-===//
|
2013-12-05 10:18:38 +01:00
|
|
|
//
|
2019-08-14 10:47:11 +02:00
|
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
2013-12-05 10:18:38 +01:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// This file is shared between AddressSanitizer and ThreadSanitizer
|
|
|
|
// run-time libraries.
|
|
|
|
// Header for libbacktrace symbolizer.
|
|
|
|
//===----------------------------------------------------------------------===//
|
2014-05-22 09:09:21 +02:00
|
|
|
#ifndef SANITIZER_SYMBOLIZER_LIBBACKTRACE_H
|
|
|
|
#define SANITIZER_SYMBOLIZER_LIBBACKTRACE_H
|
2013-12-05 10:18:38 +01:00
|
|
|
|
|
|
|
#include "sanitizer_platform.h"
|
|
|
|
#include "sanitizer_common.h"
|
2015-10-21 09:32:45 +02:00
|
|
|
#include "sanitizer_allocator_internal.h"
|
|
|
|
#include "sanitizer_symbolizer_internal.h"
|
2013-12-05 10:18:38 +01:00
|
|
|
|
|
|
|
#ifndef SANITIZER_LIBBACKTRACE
|
|
|
|
# define SANITIZER_LIBBACKTRACE 0
|
|
|
|
#endif
|
|
|
|
|
2014-05-22 09:09:21 +02:00
|
|
|
#ifndef SANITIZER_CP_DEMANGLE
|
|
|
|
# define SANITIZER_CP_DEMANGLE 0
|
|
|
|
#endif
|
|
|
|
|
2013-12-05 10:18:38 +01:00
|
|
|
namespace __sanitizer {
|
|
|
|
|
2015-10-21 09:32:45 +02:00
|
|
|
class LibbacktraceSymbolizer : public SymbolizerTool {
|
2013-12-05 10:18:38 +01:00
|
|
|
public:
|
|
|
|
static LibbacktraceSymbolizer *get(LowLevelAllocator *alloc);
|
|
|
|
|
2015-10-21 09:32:45 +02:00
|
|
|
bool SymbolizePC(uptr addr, SymbolizedStack *stack) override;
|
2013-12-05 10:18:38 +01:00
|
|
|
|
2015-10-21 09:32:45 +02:00
|
|
|
bool SymbolizeData(uptr addr, DataInfo *info) override;
|
2013-12-05 10:18:38 +01:00
|
|
|
|
2014-05-22 09:09:21 +02:00
|
|
|
// May return NULL if demangling failed.
|
2015-10-21 09:32:45 +02:00
|
|
|
const char *Demangle(const char *name) override;
|
* sanitizer_common/sanitizer_symbolizer_libbacktrace.h
(LibbacktraceSymbolizer::Demangle): New declaration.
* sanitizer_common/sanitizer_symbolizer_posix_libcdep.cc
(POSIXSymbolizer::Demangle): Use libbacktrace_symbolizer_'s Demangle
method if possible.
* sanitizer_common/sanitizer_symbolizer_libbacktrace.cc: Include
"demangle.h" if SANITIZE_CP_DEMANGLE is defined.
(struct CplusV3DemangleData): New type.
(CplusV3DemangleCallback, CplusV3Demangle): New functions.
(SymbolizeCodePCInfoCallback, SymbolizeCodeCallback,
SymbolizeDataCallback): Use CplusV3Demangle.
* sanitizer_common/Makefile.am (AM_CXXFLAGS): Add
-DSANITIZE_CP_DEMANGLE and -I $(top_srcdir)/../include.
* libbacktrace/backtrace-rename.h (cplus_demangle_builtin_types,
cplus_demangle_fill_ctor, cplus_demangle_fill_dtor,
cplus_demangle_fill_extended_operator, cplus_demangle_fill_name,
cplus_demangle_init_info, cplus_demangle_mangled_name,
cplus_demangle_operators, cplus_demangle_print,
cplus_demangle_print_callback, cplus_demangle_type, cplus_demangle_v3,
cplus_demangle_v3_callback, is_gnu_v3_mangled_ctor,
is_gnu_v3_mangled_dtor, java_demangle_v3, java_demangle_v3_callback):
Define.
(__asan_internal_memcmp, __asan_internal_strncmp): New prototypes.
(memcmp, strncmp): Redefine.
* libbacktrace/Makefile.am (libsanitizer_libbacktrace_la_SOURCES): Add
../../libiberty/cp-demangle.c.
* libbacktrace/bridge.cc (__asan_internal_memcmp,
__asan_internal_strncmp): New functions.
* sanitizer_common/Makefile.in: Regenerated.
* libbacktrace/Makefile.in: Regenerated.
* configure: Regenerated.
* configure.ac: Regenerated.
* config.h.in: Regenerated.
From-SVN: r206477
2014-01-09 19:16:40 +01:00
|
|
|
|
2013-12-05 10:18:38 +01:00
|
|
|
private:
|
|
|
|
explicit LibbacktraceSymbolizer(void *state) : state_(state) {}
|
|
|
|
|
|
|
|
void *state_; // Leaked.
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace __sanitizer
|
2014-05-22 09:09:21 +02:00
|
|
|
#endif // SANITIZER_SYMBOLIZER_LIBBACKTRACE_H
|