[Lldb-commits] [lldb] r257132 - Fix dwarf sequence insertions

Stephane Sezer via lldb-commits lldb-commits at lists.llvm.org
Thu Jan 7 17:39:14 PST 2016


Author: sas
Date: Thu Jan  7 19:39:14 2016
New Revision: 257132

URL: http://llvm.org/viewvc/llvm-project?rev=257132&view=rev
Log:
Fix dwarf sequence insertions

Summary:
If two dwarf sequences begin with entries that have identical addresses,
it is possible for the comparator to order the first entry of the new
sequence between the first and second entries of the existing sequence.

This will result in an attempted insertion of the second sequence inside
of the first sequence, which is invalid.

Ensure that insertions only occur in between existing sequences.

Reviewers: andrew.w.kaylor, clayborg

Subscribers: sas, lldb-commits

Differential Revision: http://reviews.llvm.org/D15979

Change by Francis Ricci <fjricci at fb.com>

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=257132&r1=257131&r2=257132&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/LineTable.cpp (original)
+++ lldb/trunk/source/Symbol/LineTable.cpp Thu Jan  7 19:39:14 2016
@@ -143,6 +143,13 @@ LineTable::InsertSequence (LineSequence*
     entry_collection::iterator end_pos = m_entries.end();
     LineTable::Entry::LessThanBinaryPredicate less_than_bp(this);
     entry_collection::iterator pos = upper_bound(begin_pos, end_pos, entry, less_than_bp);
+
+    // We should never insert a sequence in the middle of another sequence
+    if (pos != begin_pos) {
+        while (pos < end_pos && !((pos - 1)->is_terminal_entry))
+            pos++;
+    }
+
 #ifdef LLDB_CONFIGURATION_DEBUG
     // If we aren't inserting at the beginning, the previous entry should
     // terminate a sequence.




More information about the lldb-commits mailing list