[Lldb-commits] [PATCH] D15979: Fix dwarf sequence insertions
Francis Ricci via lldb-commits
lldb-commits at lists.llvm.org
Thu Jan 7 15:51:18 PST 2016
fjricci created this revision.
fjricci added reviewers: clayborg, andrew.w.kaylor.
fjricci added subscribers: lldb-commits, sas.
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.
http://reviews.llvm.org/D15979
Files:
source/Symbol/LineTable.cpp
Index: source/Symbol/LineTable.cpp
===================================================================
--- source/Symbol/LineTable.cpp
+++ source/Symbol/LineTable.cpp
@@ -143,6 +143,13 @@
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.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D15979.44281.patch
Type: text/x-patch
Size: 746 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20160107/5544e74d/attachment.bin>
More information about the lldb-commits
mailing list