#if SANITIZER_SUPPORTS_WEAK_HOOKS
extern "C" {
-SANITIZER_INTERFACE_ATTRIBUTE SANITIZER_WEAK_ATTRIBUTE
-bool __sanitizer_symbolize_code(const char *ModuleName, u64 ModuleOffset,
- char *Buffer, int MaxLength);
+SANITIZER_INTERFACE_ATTRIBUTE SANITIZER_WEAK_ATTRIBUTE bool
+__sanitizer_symbolize_code(const char *ModuleName, u64 ModuleOffset,
+ char *Buffer, int MaxLength,
+ bool SymbolizeInlineFrames);
SANITIZER_INTERFACE_ATTRIBUTE SANITIZER_WEAK_ATTRIBUTE
bool __sanitizer_symbolize_data(const char *ModuleName, u64 ModuleOffset,
char *Buffer, int MaxLength);
bool SymbolizePC(uptr addr, SymbolizedStack *stack) override {
bool result = __sanitizer_symbolize_code(
- stack->info.module, stack->info.module_offset, buffer_, kBufferSize);
+ stack->info.module, stack->info.module_offset, buffer_, kBufferSize,
+ common_flags()->symbolize_inline_frames);
if (result) ParseSymbolizePCOutput(buffer_, stack);
return result;
}
//===----------------------------------------------------------------------===//
#include <stdio.h>
+
#include <string>
#include "llvm/DebugInfo/Symbolize/DIPrinter.h"
typedef uint64_t u64;
bool __sanitizer_symbolize_code(const char *ModuleName, uint64_t ModuleOffset,
- char *Buffer, int MaxLength) {
+ char *Buffer, int MaxLength,
+ bool SymbolizeInlineFrames) {
std::string Result;
{
llvm::raw_string_ostream OS(Result);
llvm::symbolize::DIPrinter Printer(OS);
// TODO: it is neccessary to set proper SectionIndex here.
// object::SectionedAddress::UndefSection works for only absolute addresses.
- auto ResOrErr = getDefaultSymbolizer()->symbolizeInlinedCode(
- ModuleName,
- {ModuleOffset, llvm::object::SectionedAddress::UndefSection});
- Printer << (ResOrErr ? ResOrErr.get() : llvm::DIInliningInfo());
+ if (SymbolizeInlineFrames) {
+ auto ResOrErr = getDefaultSymbolizer()->symbolizeInlinedCode(
+ ModuleName,
+ {ModuleOffset, llvm::object::SectionedAddress::UndefSection});
+ Printer << (ResOrErr ? ResOrErr.get() : llvm::DIInliningInfo());
+ } else {
+ auto ResOrErr = getDefaultSymbolizer()->symbolizeCode(
+ ModuleName,
+ {ModuleOffset, llvm::object::SectionedAddress::UndefSection});
+ Printer << (ResOrErr ? ResOrErr.get() : llvm::DILineInfo());
+ }
}
return __sanitizer::internal_snprintf(Buffer, MaxLength, "%s",
Result.c_str()) < MaxLength;