[Lldb-commits] [lldb] c4267b7 - Revert "[lldb/PDB] Use the new line table constructor"

Pavel Labath via lldb-commits lldb-commits at lists.llvm.org
Tue Jan 28 08:17:07 PST 2020


Author: Pavel Labath
Date: 2020-01-28T17:15:44+01:00
New Revision: c4267b7b1371cc3ffaf6d4e701ab90c082ef18dd

URL: https://github.com/llvm/llvm-project/commit/c4267b7b1371cc3ffaf6d4e701ab90c082ef18dd
DIFF: https://github.com/llvm/llvm-project/commit/c4267b7b1371cc3ffaf6d4e701ab90c082ef18dd.diff

LOG: Revert "[lldb/PDB] Use the new line table constructor"

This reverts commit bb73210ba9f16c1516f564235c86cbddccd1bd6d due to
failures on the windows bot.

Added: 
    

Modified: 
    lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
    lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp

Removed: 
    


################################################################################
diff  --git a/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp b/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
index 5757efe5fa6a..9ecaa042863f 100644
--- a/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
+++ b/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
@@ -1021,7 +1021,7 @@ uint32_t SymbolFileNativePDB::ResolveSymbolContext(
   return 0;
 }
 
-static void AppendLineEntryToSequence(LineSequence &sequence,
+static void AppendLineEntryToSequence(LineTable &table, LineSequence &sequence,
                                       const CompilandIndexItem &cci,
                                       lldb::addr_t base_addr,
                                       uint32_t file_number,
@@ -1040,18 +1040,21 @@ static void AppendLineEntryToSequence(LineSequence &sequence,
 
   uint32_t lno = cur_info.getStartLine();
 
-  LineTable::AppendLineEntryToSequence(&sequence, addr, lno, 0, file_number,
-                                       is_statement, false, is_prologue,
-                                       is_epilogue, false);
+  table.AppendLineEntryToSequence(&sequence, addr, lno, 0, file_number,
+                                  is_statement, false, is_prologue, is_epilogue,
+                                  false);
 }
 
-static void TerminateLineSequence(const LineFragmentHeader &block,
+static void TerminateLineSequence(LineTable &table,
+                                  const LineFragmentHeader &block,
                                   lldb::addr_t base_addr, uint32_t file_number,
-                                  uint32_t last_line, LineSequence &seq) {
+                                  uint32_t last_line,
+                                  std::unique_ptr<LineSequence> seq) {
   // The end is always a terminal entry, so insert it regardless.
-  LineTable::AppendLineEntryToSequence(&seq, base_addr + block.CodeSize,
-                                       last_line, 0, file_number, false, false,
-                                       false, false, true);
+  table.AppendLineEntryToSequence(seq.get(), base_addr + block.CodeSize,
+                                  last_line, 0, file_number, false, false,
+                                  false, false, true);
+  table.InsertSequence(seq.release());
 }
 
 bool SymbolFileNativePDB::ParseLineTable(CompileUnit &comp_unit) {
@@ -1065,11 +1068,11 @@ bool SymbolFileNativePDB::ParseLineTable(CompileUnit &comp_unit) {
   CompilandIndexItem *cci =
       m_index->compilands().GetCompiland(cu_id.asCompiland().modi);
   lldbassert(cci);
+  auto line_table = std::make_unique<LineTable>(&comp_unit);
 
   // This is basically a copy of the .debug$S subsections from all original COFF
   // object files merged together with address relocations applied.  We are
   // looking for all DEBUG_S_LINES subsections.
-  std::vector<std::unique_ptr<LineSequence>> sequences;
   for (const DebugSubsectionRecord &dssr :
        cci->m_debug_stream.getSubsectionsArray()) {
     if (dssr.kind() != DebugSubsectionKind::Lines)
@@ -1108,23 +1111,20 @@ bool SymbolFileNativePDB::ParseLineTable(CompileUnit &comp_unit) {
       lldbassert(fn_iter != cci->m_file_list.end());
       uint32_t file_index = std::distance(cci->m_file_list.begin(), fn_iter);
 
-      std::unique_ptr<LineSequence> sequence =
-          LineTable::CreateLineSequenceContainer();
+      std::unique_ptr<LineSequence> sequence(
+          line_table->CreateLineSequenceContainer());
       lldbassert(!group.LineNumbers.empty());
 
       for (const LineNumberEntry &entry : group.LineNumbers) {
-        AppendLineEntryToSequence(*sequence, *cci, virtual_addr, file_index,
-                                  *lfh, entry);
+        AppendLineEntryToSequence(*line_table, *sequence, *cci, virtual_addr,
+                                  file_index, *lfh, entry);
       }
       LineInfo last_line(group.LineNumbers.back().Flags);
-      TerminateLineSequence(*lfh, virtual_addr, file_index,
-                            last_line.getEndLine(), *sequence);
-      sequences.push_back(std::move(sequence));
+      TerminateLineSequence(*line_table, *lfh, virtual_addr, file_index,
+                            last_line.getEndLine(), std::move(sequence));
     }
   }
 
-  auto line_table =
-      std::make_unique<LineTable>(&comp_unit, std::move(sequences));
   if (line_table->GetSize() == 0)
     return false;
 

diff  --git a/lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp b/lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp
index f9ce8d90d364..7696ec2466d4 100644
--- a/lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp
+++ b/lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp
@@ -1772,6 +1772,7 @@ bool SymbolFilePDB::ParseCompileUnitLineTable(CompileUnit &comp_unit,
   // to do a mapping so that we can hand out indices.
   llvm::DenseMap<uint32_t, uint32_t> index_map;
   BuildSupportFileIdToSupportFileIndexMap(*compiland_up, index_map);
+  auto line_table = std::make_unique<LineTable>(&comp_unit);
 
   // Find contributions to `compiland` from all source and header files.
   auto files = m_session_up->getSourceFilesForCompiland(*compiland_up);
@@ -1780,10 +1781,9 @@ bool SymbolFilePDB::ParseCompileUnitLineTable(CompileUnit &comp_unit,
 
   // For each source and header file, create a LineSequence for contributions
   // to the compiland from that file, and add the sequence.
-  std::vector<std::unique_ptr<LineSequence>> sequences;
   while (auto file = files->getNext()) {
-    std::unique_ptr<LineSequence> sequence =
-        LineTable::CreateLineSequenceContainer();
+    std::unique_ptr<LineSequence> sequence(
+        line_table->CreateLineSequenceContainer());
     auto lines = m_session_up->findLineNumbers(*compiland_up, *file);
     if (!lines)
       continue;
@@ -1812,12 +1812,12 @@ bool SymbolFilePDB::ParseCompileUnitLineTable(CompileUnit &comp_unit,
       // of the previous entry's address range if the current entry resulted in
       // a gap from the previous entry.
       if (is_gap && ShouldAddLine(match_line, prev_line, prev_length)) {
-        LineTable::AppendLineEntryToSequence(
+        line_table->AppendLineEntryToSequence(
             sequence.get(), prev_addr + prev_length, prev_line, 0,
             prev_source_idx, false, false, false, false, true);
 
-        sequences.push_back(std::move(sequence));
-        sequence = LineTable::CreateLineSequenceContainer();
+        line_table->InsertSequence(sequence.release());
+        sequence = line_table->CreateLineSequenceContainer();
       }
 
       if (ShouldAddLine(match_line, lno, length)) {
@@ -1836,9 +1836,9 @@ bool SymbolFilePDB::ParseCompileUnitLineTable(CompileUnit &comp_unit,
             is_epilogue = (addr == epilogue->getVirtualAddress());
         }
 
-        LineTable::AppendLineEntryToSequence(sequence.get(), addr, lno, col,
-                                             source_idx, is_statement, false,
-                                             is_prologue, is_epilogue, false);
+        line_table->AppendLineEntryToSequence(sequence.get(), addr, lno, col,
+                                              source_idx, is_statement, false,
+                                              is_prologue, is_epilogue, false);
       }
 
       prev_addr = addr;
@@ -1849,16 +1849,14 @@ bool SymbolFilePDB::ParseCompileUnitLineTable(CompileUnit &comp_unit,
 
     if (entry_count > 0 && ShouldAddLine(match_line, prev_line, prev_length)) {
       // The end is always a terminal entry, so insert it regardless.
-      LineTable::AppendLineEntryToSequence(
+      line_table->AppendLineEntryToSequence(
           sequence.get(), prev_addr + prev_length, prev_line, 0,
           prev_source_idx, false, false, false, false, true);
     }
 
-    sequences.push_back(std::move(sequence));
+    line_table->InsertSequence(sequence.get());
   }
 
-  auto line_table =
-      std::make_unique<LineTable>(&comp_unit, std::move(sequences));
   if (line_table->GetSize()) {
     comp_unit.SetLineTable(line_table.release());
     return true;


        


More information about the lldb-commits mailing list