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 <fjri...@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. _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits