[Lldb-commits] [lldb] r362862 - Revert "DWARF: Simplify SymbolFileDWARF::GetDWARFCompileUnit"

Alex Langford via lldb-commits lldb-commits at lists.llvm.org
Fri Jun 7 17:55:03 PDT 2019


Author: xiaobai
Date: Fri Jun  7 17:55:03 2019
New Revision: 362862

URL: http://llvm.org/viewvc/llvm-project?rev=362862&view=rev
Log:
Revert "DWARF: Simplify SymbolFileDWARF::GetDWARFCompileUnit"

This reverts commit 58afc1bdebf9fa8b178d6c9d89af94c5cc091760.
This commit caused the test suite on macOS to fail many tests. It
appears that setting breakpoints is the issue. One example that fails
is the lit test Breakpoint/case-sensitive.test.

Modified:
    lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp?rev=362862&r1=362861&r2=362862&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Fri Jun  7 17:55:03 2019
@@ -608,7 +608,15 @@ SymbolFileDWARF::GetDWARFCompileUnit(lld
   if (!comp_unit)
     return nullptr;
 
-  return static_cast<DWARFUnit *>(comp_unit->GetUserData());
+  DWARFDebugInfo *info = DebugInfo();
+  if (info) {
+    // The compile unit ID is the index of the DWARF unit.
+    DWARFUnit *dwarf_cu = info->GetUnitAtIndex(comp_unit->GetID());
+    if (dwarf_cu && dwarf_cu->GetUserData() == nullptr)
+      dwarf_cu->SetUserData(comp_unit);
+    return dwarf_cu;
+  }
+  return nullptr;
 }
 
 DWARFDebugRangesBase *SymbolFileDWARF::GetDebugRanges() {




More information about the lldb-commits mailing list