diff options
author | Benjamin Kramer <benny.kra@googlemail.com> | 2011-09-15 20:43:18 +0000 |
---|---|---|
committer | Benjamin Kramer <benny.kra@googlemail.com> | 2011-09-15 20:43:18 +0000 |
commit | 679e1752f81e21c40392ff90aaaabbe9596ef07f (patch) | |
tree | 269ddc28c10a7c0232f470849dbbea5642dccfc4 /llvm/lib/DebugInfo/DWARFDebugLine.cpp | |
parent | d923eb0d1e358b07b4f5c0709d7171ba56d15881 (diff) | |
download | bcm5719-llvm-679e1752f81e21c40392ff90aaaabbe9596ef07f.tar.gz bcm5719-llvm-679e1752f81e21c40392ff90aaaabbe9596ef07f.zip |
DWARF: Remove accessors that parse the whole line table section in one go, this can't possibly work.
The address size is specified by the compile unit associated with a line table, there is no global address size.
llvm-svn: 139835
Diffstat (limited to 'llvm/lib/DebugInfo/DWARFDebugLine.cpp')
-rw-r--r-- | llvm/lib/DebugInfo/DWARFDebugLine.cpp | 52 |
1 files changed, 14 insertions, 38 deletions
diff --git a/llvm/lib/DebugInfo/DWARFDebugLine.cpp b/llvm/lib/DebugInfo/DWARFDebugLine.cpp index c2fb111ebcf..941d8813d55 100644 --- a/llvm/lib/DebugInfo/DWARFDebugLine.cpp +++ b/llvm/lib/DebugInfo/DWARFDebugLine.cpp @@ -99,50 +99,12 @@ void DWARFDebugLine::State::appendRowToMatrix(uint32_t offset) { Row::postAppend(); } -void DWARFDebugLine::parse(const DataExtractor debug_line_data) { - LineTableMap.clear(); - uint32_t offset = 0; - State state; - while (debug_line_data.isValidOffset(offset)) { - const uint32_t debug_line_offset = offset; - - if (parseStatementTable(debug_line_data, &offset, state)) { - // Make sure we don't don't loop infinitely - if (offset <= debug_line_offset) - break; - - LineTableMap[debug_line_offset] = state; - state.reset(); - } - else - ++offset; // Try next byte in line table - } -} - DWARFDebugLine::DumpingState::~DumpingState() {} void DWARFDebugLine::DumpingState::finalize(uint32_t offset) { LineTable::dump(OS); } -void DWARFDebugLine::dump(const DataExtractor debug_line_data, raw_ostream &OS){ - uint32_t offset = 0; - DumpingState state(OS); - while (debug_line_data.isValidOffset(offset)) { - const uint32_t debug_line_offset = offset; - - if (parseStatementTable(debug_line_data, &offset, state)) { - // Make sure we don't don't loop infinitely - if (offset <= debug_line_offset) - break; - - state.reset(); - } - else - ++offset; // Try next byte in line table - } -} - const DWARFDebugLine::LineTable * DWARFDebugLine::getLineTable(uint32_t offset) const { LineTableConstIter pos = LineTableMap.find(offset); @@ -151,6 +113,20 @@ DWARFDebugLine::getLineTable(uint32_t offset) const { return 0; } +const DWARFDebugLine::LineTable * +DWARFDebugLine::getOrParseLineTable(DataExtractor debug_line_data, + uint32_t offset) { + LineTableIter pos = LineTableMap.find(offset); + if (pos == LineTableMap.end()) { + // Parse and cache the line table for at this offset. + State state; + if (!parseStatementTable(debug_line_data, &offset, state)) + return 0; + pos->second = state; + } + return &pos->second; +} + bool DWARFDebugLine::parsePrologue(DataExtractor debug_line_data, uint32_t *offset_ptr, Prologue *prologue) { |