[PATCH] D53857: [cfi] Support sanstats if binary is not available in the original location
Vitaly Buka via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Oct 29 18:46:39 PDT 2018
vitalybuka created this revision.
vitalybuka added a reviewer: pcc.
By default sanstats search binaries at the same location where the were when
stats was collected. Sometime you can print report immediately or need to move
post-processing to another workstation. To support this use-case if original binary is missing sanstats will fall-back to directory with sanstats file.
Repository:
rL LLVM
https://reviews.llvm.org/D53857
Files:
llvm/tools/sanstats/sanstats.cpp
Index: llvm/tools/sanstats/sanstats.cpp
===================================================================
--- llvm/tools/sanstats/sanstats.cpp
+++ llvm/tools/sanstats/sanstats.cpp
@@ -15,7 +15,9 @@
#include "llvm/DebugInfo/Symbolize/Symbolize.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/ErrorOr.h"
+#include "llvm/Support/FileSystem.h"
#include "llvm/Support/MemoryBuffer.h"
+#include "llvm/Support/Path.h"
#include "llvm/Transforms/Utils/SanitizerStats.h"
#include <stdint.h>
@@ -52,7 +54,11 @@
++Begin;
if (Begin == End)
return nullptr;
- StringRef Filename(FilenameBegin, Begin - FilenameBegin);
+ std::string Filename(FilenameBegin, Begin - FilenameBegin);
+
+ if (!llvm::sys::fs::exists(Filename))
+ Filename = std::string(llvm::sys::path::parent_path(ClInputFile)) +
+ std::string(llvm::sys::path::filename(Filename));
++Begin;
if (Begin == End)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D53857.171625.patch
Type: text/x-patch
Size: 923 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181030/654bf361/attachment.bin>
More information about the llvm-commits
mailing list