DWARF: Reset the state after parsing a line table prologue and remove an unnecessary...
authorBenjamin Kramer <benny.kra@googlemail.com>
Thu, 15 Sep 2011 21:59:13 +0000 (21:59 +0000)
committerBenjamin Kramer <benny.kra@googlemail.com>
Thu, 15 Sep 2011 21:59:13 +0000 (21:59 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@139859 91177308-0d34-0410-b5e6-96231b3b80d8

lib/DebugInfo/DWARFContext.cpp
lib/DebugInfo/DWARFDebugAranges.cpp
lib/DebugInfo/DWARFDebugLine.cpp

index 4fc0b301bef9c103b0c4227ab5fbc196cde906eb..e1ac398b10116cf5eb11ded835a87f403bf4a417 100644 (file)
@@ -141,10 +141,8 @@ DWARFCompileUnit *DWARFContext::getCompileUnitForOffset(uint32_t offset) {
 }
 
 DILineInfo DWARFContext::getLineInfoForAddress(uint64_t address) {
-  // First, get the index for the arange.
-  uint32_t arangeIndex = getDebugAranges()->findAddress(address);
-  // From there, get the offset of the compile unit.
-  uint32_t cuOffset = getDebugAranges()->offsetAtIndex(arangeIndex);
+  // First, get the offset of the compile unit.
+  uint32_t cuOffset = getDebugAranges()->findAddress(address);
   // Retrieve the compile unit.
   DWARFCompileUnit *cu = getCompileUnitForOffset(cuOffset);
   if (!cu)
index 5053e19b71c98f32faa4859ba4ec949b40431cd1..576d37d7813a9d1ef6d52a8bcfa7a480d445b66b 100644 (file)
@@ -100,7 +100,7 @@ void DWARFDebugAranges::dump(raw_ostream &OS) const {
   const uint32_t num_ranges = getNumRanges();
   for (uint32_t i = 0; i < num_ranges; ++i) {
     const Range &range = Aranges[i];
-    OS << format("0x%8.8x: [0x%8.8llx - 0x%8.8llx)", range.Offset,
+    OS << format("0x%8.8x: [0x%8.8llx - 0x%8.8llx)\n", range.Offset,
                  (uint64_t)range.LoPC, (uint64_t)range.HiPC());
   }
 }
index 94fff6533e459533b5ec832361d40101fed4cf49..d8200a0fd6be1ba4804f8cec955a6f773faaca1f 100644 (file)
@@ -200,6 +200,8 @@ DWARFDebugLine::parseStatementTable(DataExtractor debug_line_data,
   const uint32_t end_offset = debug_line_offset + prologue->TotalLength +
                               sizeof(prologue->TotalLength);
 
+  state.reset();
+
   while (*offset_ptr < end_offset) {
     uint8_t opcode = debug_line_data.getU8(offset_ptr);