diff options
author | Evgeniy Stepanov <eugeni.stepanov@gmail.com> | 2019-02-15 18:38:23 +0000 |
---|---|---|
committer | Yi Kong <yikong@google.com> | 2019-03-05 01:21:17 +0000 |
commit | 93fdca9502fba814dd6af7cbd3a61926e79c219d (patch) | |
tree | c0825b565dd440ecc387676ee090ff246d3198ad | |
parent | 58afd02e0674990b84214f6f22c7e7f17d7adfba (diff) | |
download | compiler-rt-93fdca9502fba814dd6af7cbd3a61926e79c219d.tar.gz |
Fix unsymbolized stack history printing.
Summary:
When symbols are unavailable, the current code prints
sp: ... pc: ... (null) (null)
instead of module name + offset.
Change the output to include module name and offset, and also to match
the regular sanitizer stack trace format so that it is recognized by
symbolize.py out of the box.
Reviewers: kcc, pcc
Subscribers: kubamracek, jdoerfert, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D58267
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@354157 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/hwasan/hwasan_report.cc | 4 | ||||
-rw-r--r-- | test/hwasan/TestCases/stack-uar.c | 5 |
2 files changed, 7 insertions, 2 deletions
diff --git a/lib/hwasan/hwasan_report.cc b/lib/hwasan/hwasan_report.cc index aad5e4095..762171362 100644 --- a/lib/hwasan/hwasan_report.cc +++ b/lib/hwasan/hwasan_report.cc @@ -252,8 +252,8 @@ void PrintAddressDescription( uptr pc_mask = (1ULL << 48) - 1; uptr pc = record & pc_mask; 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, + frame_desc.append(" sp: 0x%zx ", sp); + RenderFrame(&frame_desc, "#%n %p %F %L\n", 0, frame->info, common_flags()->symbolize_vs_style, common_flags()->strip_path_prefix); frame->ClearAll(); diff --git a/test/hwasan/TestCases/stack-uar.c b/test/hwasan/TestCases/stack-uar.c index 863a84017..8b308a511 100644 --- a/test/hwasan/TestCases/stack-uar.c +++ b/test/hwasan/TestCases/stack-uar.c @@ -1,5 +1,6 @@ // Tests use-after-return detection and reporting. // RUN: %clang_hwasan -O0 -fno-discard-value-names %s -o %t && not %run %t 2>&1 | FileCheck %s +// RUN: %clang_hwasan -O0 -fno-discard-value-names %s -o %t && not %env_hwasan_opts=symbolize=0 %run %t 2>&1 | FileCheck %s --check-prefix=NOSYM // REQUIRES: stable-runtime @@ -37,5 +38,9 @@ int main() { // CHECK: buggy // CHECK: 4096 zzz + // NOSYM: Previously allocated frames: + // NOSYM-NEXT: sp: 0x{{.*}} #0 0x{{.*}} ({{.*}}/stack-uar.c.tmp+0x{{.*}}){{$}} + // NOSYM-NEXT: 16 CCC; + // CHECK: SUMMARY: HWAddressSanitizer: tag-mismatch {{.*}} in main } |