gcc/libsanitizer/sanitizer_common/sanitizer_symbolizer_libbacktrace.h

50 lines
1.5 KiB
C
Raw Normal View History

//===-- sanitizer_symbolizer_libbacktrace.h ---------------------*- C++ -*-===//
//
// 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
//
//===----------------------------------------------------------------------===//
//
// This file is shared between AddressSanitizer and ThreadSanitizer
// run-time libraries.
// Header for libbacktrace symbolizer.
//===----------------------------------------------------------------------===//
#ifndef SANITIZER_SYMBOLIZER_LIBBACKTRACE_H
#define SANITIZER_SYMBOLIZER_LIBBACKTRACE_H
#include "sanitizer_platform.h"
#include "sanitizer_common.h"
#include "sanitizer_allocator_internal.h"
#include "sanitizer_symbolizer_internal.h"
#ifndef SANITIZER_LIBBACKTRACE
# define SANITIZER_LIBBACKTRACE 0
#endif
#ifndef SANITIZER_CP_DEMANGLE
# define SANITIZER_CP_DEMANGLE 0
#endif
namespace __sanitizer {
class LibbacktraceSymbolizer : public SymbolizerTool {
public:
static LibbacktraceSymbolizer *get(LowLevelAllocator *alloc);
bool SymbolizePC(uptr addr, SymbolizedStack *stack) override;
bool SymbolizeData(uptr addr, DataInfo *info) override;
// May return NULL if demangling failed.
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
private:
explicit LibbacktraceSymbolizer(void *state) : state_(state) {}
void *state_; // Leaked.
};
} // namespace __sanitizer
#endif // SANITIZER_SYMBOLIZER_LIBBACKTRACE_H