[llvm] r307871 - [sanstats] Print the correct line information.
Davide Italiano via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 12 17:49:03 PDT 2017
Author: davide
Date: Wed Jul 12 17:49:03 2017
New Revision: 307871
URL: http://llvm.org/viewvc/llvm-project?rev=307871&view=rev
Log:
[sanstats] Print the correct line information.
The instrumentation tracks the return address and not that of the
call so we remove one to compensate. Thanks for Peter Collingbourne
for confirming the analysis of the problem.
Added:
llvm/trunk/test/tools/sanstats/Inputs/
llvm/trunk/test/tools/sanstats/Inputs/debuginfo.stats
llvm/trunk/test/tools/sanstats/debuginfo.test
Modified:
llvm/trunk/tools/sanstats/sanstats.cpp
Added: llvm/trunk/test/tools/sanstats/Inputs/debuginfo.stats
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/sanstats/Inputs/debuginfo.stats?rev=307871&view=auto
==============================================================================
Binary files llvm/trunk/test/tools/sanstats/Inputs/debuginfo.stats (added) and llvm/trunk/test/tools/sanstats/Inputs/debuginfo.stats Wed Jul 12 17:49:03 2017 differ
Added: llvm/trunk/test/tools/sanstats/debuginfo.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/sanstats/debuginfo.test?rev=307871&view=auto
==============================================================================
--- llvm/trunk/test/tools/sanstats/debuginfo.test (added)
+++ llvm/trunk/test/tools/sanstats/debuginfo.test Wed Jul 12 17:49:03 2017
@@ -0,0 +1,4 @@
+# RUN: sanstats %p/Inputs/debuginfo.stats | FileCheck %s
+
+# CHECK: stats.cpp:23 vcall.cfi cfi-vcall 37
+# CHECK: stats.cpp:28 nvcall.cfi cfi-nvcall 51
Modified: llvm/trunk/tools/sanstats/sanstats.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/sanstats/sanstats.cpp?rev=307871&r1=307870&r2=307871&view=diff
==============================================================================
--- llvm/trunk/tools/sanstats/sanstats.cpp (original)
+++ llvm/trunk/tools/sanstats/sanstats.cpp Wed Jul 12 17:49:03 2017
@@ -76,8 +76,11 @@ const char *ReadModule(char SizeofPtr, c
if (Begin == End)
return nullptr;
+ // As the instrumentation tracks the return address and not
+ // the address of the call to `__sanitizer_stats_report` we
+ // remove one from the address to get the correct DI.
if (Expected<DILineInfo> LineInfo =
- Symbolizer.symbolizeCode(Filename, Addr)) {
+ Symbolizer.symbolizeCode(Filename, Addr - 1)) {
llvm::outs() << LineInfo->FileName << ':' << LineInfo->Line << ' '
<< LineInfo->FunctionName << ' ';
} else {
More information about the llvm-commits
mailing list