[Lldb-commits] [lldb] r211212 - Don't allow multiple line entries with the same address to exist sequentially.

Greg Clayton gclayton at apple.com
Wed Jun 18 12:55:35 PDT 2014


Author: gclayton
Date: Wed Jun 18 14:55:34 2014
New Revision: 211212

URL: http://llvm.org/viewvc/llvm-project?rev=211212&view=rev
Log:
Don't allow multiple line entries with the same address to exist sequentially.

The compiler, when JIT'ing code, can emit illegal DWARF line tables (address is line table sequences must increase). This changes fixes that issue by replacing previous line entries whose start address is the same with the new line entry to avoid having multiple line entries with the same address. Since the address range of lines entries is determined by the delta between the current and next line entry, this shouldn't cause any issues.


Modified:
    lldb/trunk/source/Symbol/LineTable.cpp

Modified: lldb/trunk/source/Symbol/LineTable.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/LineTable.cpp?rev=211212&r1=211211&r2=211212&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/LineTable.cpp (original)
+++ lldb/trunk/source/Symbol/LineTable.cpp Wed Jun 18 14:55:34 2014
@@ -96,7 +96,17 @@ LineTable::AppendLineEntryToSequence
     assert(sequence != nullptr);
     LineSequenceImpl* seq = reinterpret_cast<LineSequenceImpl*>(sequence);
     Entry entry(file_addr, line, column, file_idx, is_start_of_statement, is_start_of_basic_block, is_prologue_end, is_epilogue_begin, is_terminal_entry);
-    seq->m_entries.push_back (entry);
+    entry_collection &entries = seq->m_entries;
+    // Replace the last entry if the address is the same, otherwise append it. If we have multiple
+    // line entries at the same address, this indicates illegal DWARF so this "fixes" the line table
+    // to be correct. If not fixed this can cause a line entry's address that when resolved back to
+    // a symbol context, could resolve to a different line entry. We really want a 1 to 1 mapping
+    // here to avoid these kinds of inconsistencies. We will need tor revisit this if the DWARF line
+    // tables are updated to allow multiple entries at the same address legally.
+    if (!entries.empty() && entries.back().file_addr == file_addr)
+        entries.back() = entry;
+    else
+        entries.push_back (entry);
 }
 
 void





More information about the lldb-commits mailing list