[llvm-dwarfdump] - Print section name and index when dumping .debug_info ranges
Teaches llvm-dwarfdump to print section index and name of range
when it dumps .debug_info.
Differential revision: https://reviews.llvm.org/D36313
llvm-svn: 310915
diff --git a/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp b/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp
index fdfc95f..703fc89 100644
--- a/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp
+++ b/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp
@@ -933,6 +933,7 @@
bool IsLittleEndian;
uint8_t AddressSize;
StringRef FileName;
+ const object::ObjectFile *Obj = nullptr;
using TypeSectionMap = MapVector<object::SectionRef, DWARFSectionMap,
std::map<object::SectionRef, unsigned>>;
@@ -1051,7 +1052,8 @@
DWARFObjInMemory(const object::ObjectFile &Obj, const LoadedObjectInfo *L,
function_ref<ErrorPolicy(Error)> HandleError)
: IsLittleEndian(Obj.isLittleEndian()),
- AddressSize(Obj.getBytesInAddress()), FileName(Obj.getFileName()) {
+ AddressSize(Obj.getBytesInAddress()), FileName(Obj.getFileName()),
+ Obj(&Obj) {
for (const SectionRef &Section : Obj.sections()) {
StringRef Name;
@@ -1188,6 +1190,8 @@
return AI->second;
}
+ const object::ObjectFile *getFile() const override { return Obj; }
+
bool isLittleEndian() const override { return IsLittleEndian; }
StringRef getAbbrevDWOSection() const override { return AbbrevDWOSection; }
const DWARFSection &getLineDWOSection() const override {