[Sanitizer] Simplify StackTrace::PrintStack interface: prefer common flags to turn on/off the symbolization

llvm-svn: 193587
This commit is contained in:
Alexey Samsonov 2013-10-29 05:31:25 +00:00
parent 51bfb820cc
commit a687d2593f
6 changed files with 9 additions and 9 deletions

View File

@ -29,9 +29,8 @@ void PrintStack(const uptr *trace, uptr size) {
Printf("<empty stack>\n\n");
return;
}
StackTrace::PrintStack(trace, size, common_flags()->symbolize,
MaybeCallAsanSymbolize);
Printf("\n");
StackTrace::PrintStack(trace, size, MaybeCallAsanSymbolize);
Printf("\n");
}
void PrintStack(StackTrace *stack) {

View File

@ -295,7 +295,7 @@ static void PrintStackTraceById(u32 stack_trace_id) {
CHECK(stack_trace_id);
uptr size = 0;
const uptr *trace = StackDepotGet(stack_trace_id, &size);
StackTrace::PrintStack(trace, size, common_flags()->symbolize, 0);
StackTrace::PrintStack(trace, size);
}
// ForEachChunk callback. Aggregates unreachable chunks into a LeakReport.

View File

@ -142,6 +142,7 @@ static void ParseFlagsFromString(Flags *f, const char *str) {
static void InitializeFlags(Flags *f, const char *options) {
CommonFlags *cf = common_flags();
cf->external_symbolizer_path = GetEnv("MSAN_SYMBOLIZER_PATH");
cf->symbolize = true;
cf->strip_path_prefix = "";
cf->fast_unwind_on_fatal = false;
cf->fast_unwind_on_malloc = true;

View File

@ -36,7 +36,7 @@ class Decorator: private __sanitizer::AnsiColorDecorator {
static void PrintStack(const uptr *trace, uptr size) {
SymbolizerScope sym_scope;
StackTrace::PrintStack(trace, size, true, 0);
StackTrace::PrintStack(trace, size);
Printf("\n");
}

View File

@ -38,7 +38,7 @@ static void PrintStackFramePrefix(uptr frame_num, uptr pc) {
Printf(" #%zu 0x%zx", frame_num, pc);
}
void StackTrace::PrintStack(const uptr *addr, uptr size, bool symbolize,
void StackTrace::PrintStack(const uptr *addr, uptr size,
SymbolizeCallback symbolize_callback) {
MemoryMappingLayout proc_maps(/*cache_enabled*/true);
InternalScopedBuffer<char> buff(GetPageSizeCached() * 2);
@ -62,7 +62,7 @@ void StackTrace::PrintStack(const uptr *addr, uptr size, bool symbolize,
frame_num++;
}
}
if (symbolize && addr_frames_num == 0) {
if (common_flags()->symbolize && addr_frames_num == 0) {
// Use our own (online) symbolizer, if necessary.
if (Symbolizer *sym = Symbolizer::GetOrNull())
addr_frames_num =

View File

@ -34,8 +34,8 @@ struct StackTrace {
uptr size;
uptr trace[kStackTraceMax];
static void PrintStack(const uptr *addr, uptr size, bool symbolize,
SymbolizeCallback symbolize_callback);
static void PrintStack(const uptr *addr, uptr size,
SymbolizeCallback symbolize_callback = 0);
void CopyFrom(const uptr *src, uptr src_size) {
size = src_size;