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@fb.com>

llvm-svn: 257132
This commit is contained in:
Stephane Sezer 2016-01-08 01:39:14 +00:00
parent 4ef99433aa
commit 506ecac085
1 changed files with 7 additions and 0 deletions

View File

@ -143,6 +143,13 @@ LineTable::InsertSequence (LineSequence* sequence)
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.