diff options
author | Benjamin Kramer <benny.kra@googlemail.com> | 2011-09-15 18:02:20 +0000 |
---|---|---|
committer | Benjamin Kramer <benny.kra@googlemail.com> | 2011-09-15 18:02:20 +0000 |
commit | fe80f1da404d25f93e4a2492b127554a882bd5bb (patch) | |
tree | a4c54f057d1619c6cf825248f6b9c9d6ae70aa3e /lib/DebugInfo/DWARFContext.cpp | |
parent | 10ec65004d8da411ab59a1fee85c0ff54539776a (diff) | |
download | external_llvm-fe80f1da404d25f93e4a2492b127554a882bd5bb.zip external_llvm-fe80f1da404d25f93e4a2492b127554a882bd5bb.tar.gz external_llvm-fe80f1da404d25f93e4a2492b127554a882bd5bb.tar.bz2 |
DWARF: Print line tables per compile unit, so they get the right address size.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@139808 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/DebugInfo/DWARFContext.cpp')
-rw-r--r-- | lib/DebugInfo/DWARFContext.cpp | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/lib/DebugInfo/DWARFContext.cpp b/lib/DebugInfo/DWARFContext.cpp index 215effa..184a8b5 100644 --- a/lib/DebugInfo/DWARFContext.cpp +++ b/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); |