summaryrefslogtreecommitdiffstats
path: root/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp
diff options
context:
space:
mode:
authorJames Henderson <jh7370@my.bristol.ac.uk>2018-02-02 12:35:52 +0000
committerJames Henderson <jh7370@my.bristol.ac.uk>2018-02-02 12:35:52 +0000
commit3fcc74500a3802efed7bc6fa2a998321d32f189c (patch)
tree59d6868475f3ec7fcc261010c72f8e6fdb58f143 /llvm/lib/DebugInfo/DWARF/DWARFContext.cpp
parentf5de271a9214ac4cb0595d8770d9ea31f894b06c (diff)
downloadbcm5719-llvm-3fcc74500a3802efed7bc6fa2a998321d32f189c.tar.gz
bcm5719-llvm-3fcc74500a3802efed7bc6fa2a998321d32f189c.zip
[DWARF v5] Add limited support for dumping .debug_rnglists
This change adds support to llvm-dwarfdump for dumping DWARF5 .debug_rnglists sections in regular ELF files. It is not complete, in that several DW_RLE_* encodings are currently not supported, but does dump the headert and the basic ranges for DW_RLE_start_length and DW_RLE_start_end encodings. Obvious next steps are to add verbose dumping that dumps the raw encodings, rather than the interpreted contents, to add -verify support of the section (e.g. to show that the correct number of offsets are specified), add dumping of .debug_rnglists.dwo, and to add support for other encodings. Reviewed by: dblaikie, JDevlieghere Differential Revision: https://reviews.llvm.org/D42481 llvm-svn: 324077
Diffstat (limited to 'llvm/lib/DebugInfo/DWARF/DWARFContext.cpp')
-rw-r--r--llvm/lib/DebugInfo/DWARF/DWARFContext.cpp27
1 files changed, 27 insertions, 0 deletions
diff --git a/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp b/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp
index e159303ab20..761f2b5d800 100644
--- a/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp
+++ b/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp
@@ -25,6 +25,7 @@
#include "llvm/DebugInfo/DWARF/DWARFDebugMacro.h"
#include "llvm/DebugInfo/DWARF/DWARFDebugPubTable.h"
#include "llvm/DebugInfo/DWARF/DWARFDebugRangeList.h"
+#include "llvm/DebugInfo/DWARF/DWARFDebugRnglists.h"
#include "llvm/DebugInfo/DWARF/DWARFDie.h"
#include "llvm/DebugInfo/DWARF/DWARFFormValue.h"
#include "llvm/DebugInfo/DWARF/DWARFGdbIndex.h"
@@ -490,6 +491,27 @@ void DWARFContext::dump(
rangeList.dump(OS);
}
+ if (shouldDump(Explicit, ".debug_rnglists", DIDT_ID_DebugRnglists,
+ DObj->getRnglistsSection().Data)) {
+ DWARFDataExtractor rnglistData(*DObj, DObj->getRnglistsSection(),
+ isLittleEndian(), 0);
+ uint32_t Offset = 0;
+ while (rnglistData.isValidOffset(Offset)) {
+ DWARFDebugRnglists Rnglists;
+ uint32_t TableOffset = Offset;
+ if (Error Err = Rnglists.extract(rnglistData, &Offset)) {
+ errs() << "error: " + toString(std::move(Err)) << '\n';
+ uint64_t Length = Rnglists.length();
+ // Keep going after an error, if we can, assuming that the length field
+ // could be read. If it couldn't, stop reading the section.
+ if (Length == 0)
+ break;
+ Offset = TableOffset + Length;
+ } else
+ Rnglists.dump(OS);
+ }
+ }
+
if (shouldDump(Explicit, ".debug_pubnames", DIDT_ID_DebugPubnames,
DObj->getPubNamesSection()))
DWARFDebugPubTable(DObj->getPubNamesSection(), isLittleEndian(), false)
@@ -1164,6 +1186,7 @@ class DWARFObjInMemory final : public DWARFObject {
DWARFSectionMap LocSection;
DWARFSectionMap LineSection;
DWARFSectionMap RangeSection;
+ DWARFSectionMap RnglistsSection;
DWARFSectionMap StringOffsetSection;
DWARFSectionMap InfoDWOSection;
DWARFSectionMap LineDWOSection;
@@ -1184,6 +1207,7 @@ class DWARFObjInMemory final : public DWARFObject {
.Case("debug_line", &LineSection)
.Case("debug_str_offsets", &StringOffsetSection)
.Case("debug_ranges", &RangeSection)
+ .Case("debug_rnglists", &RnglistsSection)
.Case("debug_info.dwo", &InfoDWOSection)
.Case("debug_loc.dwo", &LocDWOSection)
.Case("debug_line.dwo", &LineDWOSection)
@@ -1475,6 +1499,9 @@ public:
const DWARFSection &getLineSection() const override { return LineSection; }
StringRef getStringSection() const override { return StringSection; }
const DWARFSection &getRangeSection() const override { return RangeSection; }
+ const DWARFSection &getRnglistsSection() const override {
+ return RnglistsSection;
+ }
StringRef getMacinfoSection() const override { return MacinfoSection; }
StringRef getPubNamesSection() const override { return PubNamesSection; }
StringRef getPubTypesSection() const override { return PubTypesSection; }
OpenPOWER on IntegriCloud