summaryrefslogtreecommitdiff
path: root/lib/DebugInfo/DWARFFormValue.cpp
diff options
context:
space:
mode:
authorEric Christopher <echristo@gmail.com>2013-01-15 23:56:56 +0000
committerEric Christopher <echristo@gmail.com>2013-01-15 23:56:56 +0000
commit72f7bfbf0e02bb11d3e7cca1f9598c5f9d9fa2ca (patch)
treeac0756254ac88cc3469f7274306ce15cab7f8a19 /lib/DebugInfo/DWARFFormValue.cpp
parentaf50dda4102114b23ac7d8c2db4703f22e02f02c (diff)
downloadllvm-72f7bfbf0e02bb11d3e7cca1f9598c5f9d9fa2ca.tar.gz
llvm-72f7bfbf0e02bb11d3e7cca1f9598c5f9d9fa2ca.tar.bz2
llvm-72f7bfbf0e02bb11d3e7cca1f9598c5f9d9fa2ca.tar.xz
Split address information for DWARF5 split dwarf proposal. This involves
using the DW_FORM_GNU_addr_index and a separate .debug_addr section which stays in the executable and is fully linked. Sneak in two other small changes: a) Print out the debug_str_offsets.dwo section. b) Change form we're expecting the entries in the debug_str_offsets.dwo section to take from ULEB128 to U32. Add tests for all of this in the fission-cu.ll test. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@172578 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/DebugInfo/DWARFFormValue.cpp')
-rw-r--r--lib/DebugInfo/DWARFFormValue.cpp21
1 files changed, 20 insertions, 1 deletions
diff --git a/lib/DebugInfo/DWARFFormValue.cpp b/lib/DebugInfo/DWARFFormValue.cpp
index 14c68049b3..d1bcf96f7f 100644
--- a/lib/DebugInfo/DWARFFormValue.cpp
+++ b/lib/DebugInfo/DWARFFormValue.cpp
@@ -325,6 +325,16 @@ DWARFFormValue::dump(raw_ostream &OS, const DWARFCompileUnit *cu) const {
switch (Form) {
case DW_FORM_addr: OS << format("0x%016" PRIx64, uvalue); break;
+ case DW_FORM_GNU_addr_index: {
+ StringRef AddrOffsetSec = cu->getAddrOffsetSection();
+ OS << format(" indexed (%8.8x) address = ", (uint32_t)uvalue);
+ if (AddrOffsetSec.size() != 0) {
+ DataExtractor DA(AddrOffsetSec, true, cu->getAddressByteSize());
+ OS << format("0x%016" PRIx64, getIndirectAddress(&DA, cu));
+ } else
+ OS << "<no .debug_addr section>";
+ break;
+ }
case DW_FORM_flag_present: OS << "true"; break;
case DW_FORM_flag:
case DW_FORM_data1: OS << format("0x%02x", (uint8_t)uvalue); break;
@@ -452,10 +462,19 @@ DWARFFormValue::getIndirectCString(const DataExtractor *DS,
if (!DS || !DSO) return NULL;
uint32_t offset = Value.uval * 4;
- uint32_t soffset = DSO->getULEB128(&offset);
+ uint32_t soffset = DSO->getU32(&offset);
return DS->getCStr(&soffset);
}
+uint64_t
+DWARFFormValue::getIndirectAddress(const DataExtractor *DA,
+ const DWARFCompileUnit *cu) const {
+ if (!DA) return 0;
+
+ uint32_t offset = Value.uval * cu->getAddressByteSize();
+ return DA->getAddress(&offset);
+}
+
uint64_t DWARFFormValue::getReference(const DWARFCompileUnit *cu) const {
uint64_t die_offset = Value.uval;
switch (Form) {