summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorDavide Italiano <davide@freebsd.org>2017-07-13 00:49:03 +0000
committerDavide Italiano <davide@freebsd.org>2017-07-13 00:49:03 +0000
commitb0e9b49e0d5b044734b745f96593955c06408437 (patch)
tree847cdee7c2922f615a5bbc92b6e18a115ee4d74d /tools
parentdd70def46c1772d440b75fca30e87e80fee0266e (diff)
[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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307871 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools')
-rw-r--r--tools/sanstats/sanstats.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/tools/sanstats/sanstats.cpp b/tools/sanstats/sanstats.cpp
index b2216eab119e..4463c0f0e48c 100644
--- a/tools/sanstats/sanstats.cpp
+++ b/tools/sanstats/sanstats.cpp
@@ -76,8 +76,11 @@ const char *ReadModule(char SizeofPtr, const char *Begin, const char *End) {
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 {