summaryrefslogtreecommitdiff
path: root/lib/DebugInfo/DWARFDebugLine.cpp
diff options
context:
space:
mode:
authorBenjamin Kramer <benny.kra@googlemail.com>2011-09-15 20:43:18 +0000
committerBenjamin Kramer <benny.kra@googlemail.com>2011-09-15 20:43:18 +0000
commitc26ed9b47ff77ca6244feda9e3837b49624605db (patch)
tree85ca519ec4b793cfdfe44275827433ce178d4f36 /lib/DebugInfo/DWARFDebugLine.cpp
parentaba8015cc375ac7de757d92e55d1aad986de6202 (diff)
downloadllvm-c26ed9b47ff77ca6244feda9e3837b49624605db.tar.gz
llvm-c26ed9b47ff77ca6244feda9e3837b49624605db.tar.bz2
llvm-c26ed9b47ff77ca6244feda9e3837b49624605db.tar.xz
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@139835 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/DebugInfo/DWARFDebugLine.cpp')
-rw-r--r--lib/DebugInfo/DWARFDebugLine.cpp52
1 files changed, 14 insertions, 38 deletions
diff --git a/lib/DebugInfo/DWARFDebugLine.cpp b/lib/DebugInfo/DWARFDebugLine.cpp
index c2fb111ebc..941d8813d5 100644
--- a/lib/DebugInfo/DWARFDebugLine.cpp
+++ b/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) {