diff options
author | Kostya Serebryany <kcc@google.com> | 2018-10-11 00:34:20 +0000 |
---|---|---|
committer | Kostya Serebryany <kcc@google.com> | 2018-10-11 00:34:20 +0000 |
commit | f6fb4b25add296a3fedf0bcea3bab125ffe0708e (patch) | |
tree | a43fa69dbf56a63feea5e701f2966f003513300f | |
parent | e06e91881006575165fb232b9755f6b7eaa41a39 (diff) |
[hwasan] more compact printing for 'Previosly allocated frames'
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@344210 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/hwasan/hwasan_report.cc | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/lib/hwasan/hwasan_report.cc b/lib/hwasan/hwasan_report.cc index 46373b9f1..e70a9807a 100644 --- a/lib/hwasan/hwasan_report.cc +++ b/lib/hwasan/hwasan_report.cc @@ -23,6 +23,7 @@ #include "sanitizer_common/sanitizer_mutex.h" #include "sanitizer_common/sanitizer_report_decorator.h" #include "sanitizer_common/sanitizer_stackdepot.h" +#include "sanitizer_common/sanitizer_stacktrace_printer.h" #include "sanitizer_common/sanitizer_symbolizer.h" using namespace __sanitizer; @@ -194,6 +195,7 @@ void PrintAddressDescription( ? current_stack_allocations : t->stack_allocations(); uptr frames = Min((uptr)flags()->stack_history_size, sa->size()); + InternalScopedString frame_desc(GetPageSizeCached() * 2); for (uptr i = 0; i < frames; i++) { uptr record = (*sa)[i]; if (!record) @@ -201,10 +203,15 @@ void PrintAddressDescription( uptr sp = (record >> 48) << 4; uptr pc_mask = (1ULL << 48) - 1; uptr pc = record & pc_mask; - uptr fixed_pc = StackTrace::GetNextInstructionPc(pc); - StackTrace stack(&fixed_pc, 1); - Printf("record: %p pc: %p sp: %p", record, pc, sp); - stack.Print(); + if (SymbolizedStack *frame = Symbolizer::GetOrInit()->SymbolizePC(pc)) { + frame_desc.append(" sp: 0x%zx pc: %p ", sp, pc); + RenderFrame(&frame_desc, "in %f %s:%l\n", 0, frame->info, + common_flags()->symbolize_vs_style, + common_flags()->strip_path_prefix); + frame->ClearAll(); + } + Printf("%s", frame_desc.data()); + frame_desc.clear(); } num_descriptions_printed++; |