From 5e70f4bdc15960730d0ff2aa167399e36bc64278 Mon Sep 17 00:00:00 2001 From: Pavel Labath Date: Tue, 21 Jan 2020 15:03:36 +0100 Subject: [PATCH] [lldb/breakpad] Use new line table constructor The old construction method can be quadratic for some inputs. This approach guarantees a reasonable performance. --- .../Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp b/lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp index b2c4d08..0d251c9 100644 --- a/lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp +++ b/lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp @@ -694,18 +694,18 @@ void SymbolFileBreakpad::ParseLineTableAndSupportFiles(CompileUnit &cu, "How did we create compile units without a base address?"); SupportFileMap map; - data.line_table_up = std::make_unique(&cu); - std::unique_ptr line_seq_up( - data.line_table_up->CreateLineSequenceContainer()); + std::vector> sequences; + std::unique_ptr line_seq_up = + LineTable::CreateLineSequenceContainer(); llvm::Optional next_addr; auto finish_sequence = [&]() { - data.line_table_up->AppendLineEntryToSequence( + LineTable::AppendLineEntryToSequence( line_seq_up.get(), *next_addr, /*line*/ 0, /*column*/ 0, /*file_idx*/ 0, /*is_start_of_statement*/ false, /*is_start_of_basic_block*/ false, /*is_prologue_end*/ false, /*is_epilogue_begin*/ false, /*is_terminal_entry*/ true); - data.line_table_up->InsertSequence(line_seq_up.get()); - line_seq_up->Clear(); + sequences.push_back(std::move(line_seq_up)); + line_seq_up = LineTable::CreateLineSequenceContainer(); }; LineIterator It(*m_objfile_sp, Record::Func, data.bookmark), @@ -722,7 +722,7 @@ void SymbolFileBreakpad::ParseLineTableAndSupportFiles(CompileUnit &cu, // Discontiguous entries. Finish off the previous sequence and reset. finish_sequence(); } - data.line_table_up->AppendLineEntryToSequence( + LineTable::AppendLineEntryToSequence( line_seq_up.get(), record->Address, record->LineNum, /*column*/ 0, map[record->FileNum], /*is_start_of_statement*/ true, /*is_start_of_basic_block*/ false, /*is_prologue_end*/ false, @@ -731,6 +731,7 @@ void SymbolFileBreakpad::ParseLineTableAndSupportFiles(CompileUnit &cu, } if (next_addr) finish_sequence(); + data.line_table_up = std::make_unique(&cu, std::move(sequences)); data.support_files = map.translate(cu.GetPrimaryFile(), *m_files); } -- 2.7.4