Skip to content

Commit 5e70f4b

Browse files
committed
[lldb/breakpad] Use new line table constructor
The old construction method can be quadratic for some inputs. This approach guarantees a reasonable performance.
1 parent 18a96fd commit 5e70f4b

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -694,18 +694,18 @@ void SymbolFileBreakpad::ParseLineTableAndSupportFiles(CompileUnit &cu,
694694
"How did we create compile units without a base address?");
695695

696696
SupportFileMap map;
697-
data.line_table_up = std::make_unique<LineTable>(&cu);
698-
std::unique_ptr<LineSequence> line_seq_up(
699-
data.line_table_up->CreateLineSequenceContainer());
697+
std::vector<std::unique_ptr<LineSequence>> sequences;
698+
std::unique_ptr<LineSequence> line_seq_up =
699+
LineTable::CreateLineSequenceContainer();
700700
llvm::Optional<addr_t> next_addr;
701701
auto finish_sequence = [&]() {
702-
data.line_table_up->AppendLineEntryToSequence(
702+
LineTable::AppendLineEntryToSequence(
703703
line_seq_up.get(), *next_addr, /*line*/ 0, /*column*/ 0,
704704
/*file_idx*/ 0, /*is_start_of_statement*/ false,
705705
/*is_start_of_basic_block*/ false, /*is_prologue_end*/ false,
706706
/*is_epilogue_begin*/ false, /*is_terminal_entry*/ true);
707-
data.line_table_up->InsertSequence(line_seq_up.get());
708-
line_seq_up->Clear();
707+
sequences.push_back(std::move(line_seq_up));
708+
line_seq_up = LineTable::CreateLineSequenceContainer();
709709
};
710710

711711
LineIterator It(*m_objfile_sp, Record::Func, data.bookmark),
@@ -722,7 +722,7 @@ void SymbolFileBreakpad::ParseLineTableAndSupportFiles(CompileUnit &cu,
722722
// Discontiguous entries. Finish off the previous sequence and reset.
723723
finish_sequence();
724724
}
725-
data.line_table_up->AppendLineEntryToSequence(
725+
LineTable::AppendLineEntryToSequence(
726726
line_seq_up.get(), record->Address, record->LineNum, /*column*/ 0,
727727
map[record->FileNum], /*is_start_of_statement*/ true,
728728
/*is_start_of_basic_block*/ false, /*is_prologue_end*/ false,
@@ -731,6 +731,7 @@ void SymbolFileBreakpad::ParseLineTableAndSupportFiles(CompileUnit &cu,
731731
}
732732
if (next_addr)
733733
finish_sequence();
734+
data.line_table_up = std::make_unique<LineTable>(&cu, std::move(sequences));
734735
data.support_files = map.translate(cu.GetPrimaryFile(), *m_files);
735736
}
736737

0 commit comments

Comments
 (0)