summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenjamin Kramer <benny.kra@googlemail.com>2011-09-15 18:02:20 +0000
committerBenjamin Kramer <benny.kra@googlemail.com>2011-09-15 18:02:20 +0000
commit6dda032003306ab5fd383676979a59a3a98d6d12 (patch)
treeea12bb8290a8c301eb2a60b22351af5cf6ca0299
parentebdf32f9076074fe373a4bf47c332b9bf08f6405 (diff)
downloadbcm5719-llvm-6dda032003306ab5fd383676979a59a3a98d6d12.tar.gz
bcm5719-llvm-6dda032003306ab5fd383676979a59a3a98d6d12.zip
DWARF: Print line tables per compile unit, so they get the right address size.
llvm-svn: 139808
-rw-r--r--llvm/lib/DebugInfo/DWARFCompileUnit.cpp3
-rw-r--r--llvm/lib/DebugInfo/DWARFCompileUnit.h8
-rw-r--r--llvm/lib/DebugInfo/DWARFContext.cpp17
3 files changed, 23 insertions, 5 deletions
diff --git a/llvm/lib/DebugInfo/DWARFCompileUnit.cpp b/llvm/lib/DebugInfo/DWARFCompileUnit.cpp
index d535df05d3b..24bf97ff608 100644
--- a/llvm/lib/DebugInfo/DWARFCompileUnit.cpp
+++ b/llvm/lib/DebugInfo/DWARFCompileUnit.cpp
@@ -94,8 +94,7 @@ void DWARFCompileUnit::dump(raw_ostream &OS) {
<< " (next CU at " << format("0x%08x", getNextCompileUnitOffset())
<< ")\n";
- extractDIEsIfNeeded(false);
- DieArray[0].dump(OS, this, -1U);
+ getCompileUnitDIE(false)->dump(OS, this, -1U);
}
void DWARFCompileUnit::setDIERelations() {
diff --git a/llvm/lib/DebugInfo/DWARFCompileUnit.h b/llvm/lib/DebugInfo/DWARFCompileUnit.h
index 378b6ced8cf..d9167292a9d 100644
--- a/llvm/lib/DebugInfo/DWARFCompileUnit.h
+++ b/llvm/lib/DebugInfo/DWARFCompileUnit.h
@@ -70,6 +70,14 @@ public:
BaseAddr = base_addr;
}
+ const DWARFDebugInfoEntryMinimal *
+ getCompileUnitDIE(bool extract_cu_die_only = true) {
+ extractDIEsIfNeeded(extract_cu_die_only);
+ if (DieArray.empty())
+ return NULL;
+ return &DieArray[0];
+ }
+
/// setDIERelations - We read in all of the DIE entries into our flat list
/// of DIE entries and now we need to go back through all of them and set the
/// parent, sibling and child pointers for quick DIE navigation.
diff --git a/llvm/lib/DebugInfo/DWARFContext.cpp b/llvm/lib/DebugInfo/DWARFContext.cpp
index 215effac41f..184a8b595c5 100644
--- a/llvm/lib/DebugInfo/DWARFContext.cpp
+++ b/llvm/lib/DebugInfo/DWARFContext.cpp
@@ -8,9 +8,11 @@
//===----------------------------------------------------------------------===//
#include "DWARFContext.h"
+#include "llvm/Support/Dwarf.h"
#include "llvm/Support/Format.h"
#include "llvm/Support/raw_ostream.h"
using namespace llvm;
+using namespace dwarf;
void DWARFContext::dump(raw_ostream &OS) {
OS << ".debug_abbrev contents:\n";
@@ -28,9 +30,18 @@ void DWARFContext::dump(raw_ostream &OS) {
set.dump(OS);
OS << "\n.debug_lines contents:\n";
- // FIXME: must be done per CU.
- DataExtractor lineData(getLineSection(), isLittleEndian(), /*FIXME*/8);
- DWARFDebugLine::dump(lineData, OS);
+ for (unsigned i = 0, e = getNumCompileUnits(); i != e; ++i) {
+ DWARFCompileUnit *cu = getCompileUnitAtIndex(i);
+ unsigned stmtOffset =
+ cu->getCompileUnitDIE()->getAttributeValueAsUnsigned(cu, DW_AT_stmt_list,
+ -1U);
+ if (stmtOffset != -1U) {
+ DataExtractor lineData(getLineSection(), isLittleEndian(),
+ cu->getAddressByteSize());
+ DWARFDebugLine::DumpingState state(OS);
+ DWARFDebugLine::parseStatementTable(lineData, &stmtOffset, state);
+ }
+ }
OS << "\n.debug_str contents:\n";
DataExtractor strData(getStringSection(), isLittleEndian(), 0);
OpenPOWER on IntegriCloud