summaryrefslogtreecommitdiffstats
path: root/llvm/tools/llvm-cfi-verify/lib/FileAnalysis.h
diff options
context:
space:
mode:
authorMitch Phillips <mitchphillips@outlook.com>2017-10-31 23:20:05 +0000
committerMitch Phillips <mitchphillips@outlook.com>2017-10-31 23:20:05 +0000
commit7db6f7a344653a7425ab1d6263f3c9a8356556a4 (patch)
treec24cfd12feff449f82f64196375904a0eb4a1c4c /llvm/tools/llvm-cfi-verify/lib/FileAnalysis.h
parent7438b2631720c9e7cbd23d9ce789cafd02400cd5 (diff)
downloadbcm5719-llvm-7db6f7a344653a7425ab1d6263f3c9a8356556a4.tar.gz
bcm5719-llvm-7db6f7a344653a7425ab1d6263f3c9a8356556a4.zip
Parse DWARF information to reduce false positives.
Summary: Help differentiate code and data by parsing DWARF information. This will reduce false positive rates where data is placed in executable sections and is mistakenly parsed as code, resulting in an inflation in the number of indirect CF instructions (and hence an inflation of the number of unprotected). Also prints the DWARF line data around the region of each indirect CF instruction. Reviewers: pcc Subscribers: probinson, llvm-commits, vlad.tsyrklevich, mgorny, aprantl, kcc Differential Revision: https://reviews.llvm.org/D38654 llvm-svn: 317050
Diffstat (limited to 'llvm/tools/llvm-cfi-verify/lib/FileAnalysis.h')
-rw-r--r--llvm/tools/llvm-cfi-verify/lib/FileAnalysis.h19
1 files changed, 18 insertions, 1 deletions
diff --git a/llvm/tools/llvm-cfi-verify/lib/FileAnalysis.h b/llvm/tools/llvm-cfi-verify/lib/FileAnalysis.h
index 1ed575bb9e4..9945a2110a2 100644
--- a/llvm/tools/llvm-cfi-verify/lib/FileAnalysis.h
+++ b/llvm/tools/llvm-cfi-verify/lib/FileAnalysis.h
@@ -12,6 +12,7 @@
#include "llvm/ADT/DenseMap.h"
#include "llvm/BinaryFormat/ELF.h"
+#include "llvm/DebugInfo/DWARF/DWARFContext.h"
#include "llvm/MC/MCAsmInfo.h"
#include "llvm/MC/MCContext.h"
#include "llvm/MC/MCDisassembler/MCDisassembler.h"
@@ -120,6 +121,18 @@ public:
const MCInstrInfo *getMCInstrInfo() const;
const MCInstrAnalysis *getMCInstrAnalysis() const;
+ // Returns true if this class is using DWARF line tables for elimination.
+ bool hasLineTableInfo() const;
+
+ // Returns the line table information for the range {Address +-
+ // DWARFSearchRange}. Returns an empty table if the address has no valid line
+ // table information, or this analysis object has DWARF handling disabled.
+ DILineInfoTable getLineInfoForAddressRange(uint64_t Address);
+
+ // Returns whether the provided address has valid line information for
+ // instructions in the range of Address +- DWARFSearchRange.
+ bool hasValidLineInfoForAddressRange(uint64_t Address);
+
protected:
// Construct a blank object with the provided triple and features. Used in
// testing, where a sub class will dependency inject protected methods to
@@ -162,8 +175,12 @@ private:
std::unique_ptr<const MCInstrAnalysis> MIA;
std::unique_ptr<MCInstPrinter> Printer;
+ // DWARF debug information.
+ std::unique_ptr<DWARFContext> DWARF;
+
// A mapping between the virtual memory address to the instruction metadata
- // struct.
+ // struct. TODO(hctim): Reimplement this as a sorted vector to avoid per-
+ // insertion allocation.
std::map<uint64_t, Instr> Instructions;
// Contains a mapping between a specific address, and a list of instructions
OpenPOWER on IntegriCloud