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
This commit is contained in:
Benjamin Kramer
2011-09-15 20:43:18 +00:00
parent aba8015cc3
commit c26ed9b47f
4 changed files with 37 additions and 56 deletions

View File

@ -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) {