[Lldb-commits] [PATCH] D51578: Contiguous .debug_info+.debug_types for D32167

2019-02-02 Thread Jan Kratochvil via Phabricator via lldb-commits
jankratochvil updated this revision to Diff 184919.
jankratochvil added a comment.

This update fixes a regression after D52403 , 
the code is simplified - `eSectionTypeDWARFDebugInfo` is no longer hardcoded in 
this patch.

OK for check-in with this new code?


Repository:
  rLLDB LLDB

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D51578/new/

https://reviews.llvm.org/D51578

Files:
  lldb/include/lldb/lldb-enumerations.h
  lldb/source/Core/Section.cpp
  lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
  lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
  lldb/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp
  lldb/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.h
  lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp
  lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
  lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.h
  lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
  lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
  lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.cpp
  lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.h
  lldb/source/Symbol/ObjectFile.cpp

Index: lldb/source/Symbol/ObjectFile.cpp
===
--- lldb/source/Symbol/ObjectFile.cpp
+++ lldb/source/Symbol/ObjectFile.cpp
@@ -367,6 +367,7 @@
   case eSectionTypeDWARFDebugStrOffsets:
   case eSectionTypeDWARFDebugStrOffsetsDwo:
   case eSectionTypeDWARFDebugTypes:
+  case eSectionTypeDWARFDebugTypesDwo:
   case eSectionTypeDWARFAppleNames:
   case eSectionTypeDWARFAppleTypes:
   case eSectionTypeDWARFAppleNamespaces:
Index: lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.h
===
--- lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.h
+++ lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.h
@@ -47,9 +47,10 @@
 
   const lldb_private::DWARFDataExtractor &get_debug_abbrev_data() override;
   const lldb_private::DWARFDataExtractor &get_debug_addr_data() override;
-  const lldb_private::DWARFDataExtractor &get_debug_info_data() override;
+  const lldb_private::DWARFDataExtractor &get_raw_debug_info_data() override;
   const lldb_private::DWARFDataExtractor &get_debug_str_data() override;
   const lldb_private::DWARFDataExtractor &get_debug_str_offsets_data() override;
+  const lldb_private::DWARFDataExtractor &get_raw_debug_types_data() override;
 
 protected:
   void LoadSectionData(lldb::SectionType sect_type,
Index: lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.cpp
===
--- lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.cpp
+++ lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.cpp
@@ -135,8 +135,9 @@
   return m_data_debug_addr.m_data;
 }
 
-const DWARFDataExtractor &SymbolFileDWARFDwo::get_debug_info_data() {
-  return GetCachedSectionData(eSectionTypeDWARFDebugInfoDwo, m_data_debug_info);
+const DWARFDataExtractor &SymbolFileDWARFDwo::get_raw_debug_info_data() {
+  return GetCachedSectionData(eSectionTypeDWARFDebugInfoDwo,
+  m_data_raw_debug_info);
 }
 
 const DWARFDataExtractor &SymbolFileDWARFDwo::get_debug_str_data() {
@@ -148,6 +149,11 @@
   m_data_debug_str_offsets);
 }
 
+const DWARFDataExtractor &SymbolFileDWARFDwo::get_raw_debug_types_data() {
+  return GetCachedSectionData(eSectionTypeDWARFDebugTypesDwo,
+  m_data_raw_debug_types);
+}
+
 SymbolFileDWARF *SymbolFileDWARFDwo::GetBaseSymbolFile() {
   return m_base_dwarf_cu->GetSymbolFileDWARF();
 }
Index: lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
===
--- lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
+++ lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
@@ -231,7 +231,8 @@
   virtual const lldb_private::DWARFDataExtractor &get_debug_addr_data();
   const lldb_private::DWARFDataExtractor &get_debug_aranges_data();
   const lldb_private::DWARFDataExtractor &get_debug_frame_data();
-  virtual const lldb_private::DWARFDataExtractor &get_debug_info_data();
+  const lldb_private::DWARFDataExtractor &get_debug_info_data();
+  virtual const lldb_private::DWARFDataExtractor &get_raw_debug_info_data();
   const lldb_private::DWARFDataExtractor &get_debug_line_data();
   const lldb_private::DWARFDataExtractor &get_debug_line_str_data();
   const lldb_private::DWARFDataExtractor &get_debug_macro_data();
@@ -241,7 +242,7 @@
   const lldb_private::DWARFDataExtractor &get_debug_rnglists_data();
   virtual const lldb_private::DWARFDataExtractor &get_debug_str_data();
   virtual const lldb_private::DWARFDataExtractor &get_debug_str_offsets_data();
-  const lldb_private::DWARFDataExtractor &get_debug_types_data();
+  virtual const lldb_private::DWARFDataExtractor &g

[Lldb-commits] [PATCH] D54670: .debug_types: Update of D32167 on top of D51578 (.debug_types section concatenation)

2019-02-02 Thread Jan Kratochvil via Phabricator via lldb-commits
jankratochvil updated this revision to Diff 184920.
Herald added a reviewer: serge-sans-paille.

Repository:
  rLLDB LLDB

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D54670/new/

https://reviews.llvm.org/D54670

Files:
  lldb/packages/Python/lldbsuite/test/lldbtest.py
  lldb/packages/Python/lldbsuite/test/make/Makefile.rules
  lldb/packages/Python/lldbsuite/test/plugins/builder_base.py
  lldb/packages/Python/lldbsuite/test/test_categories.py
  lldb/source/Plugins/SymbolFile/DWARF/CMakeLists.txt
  lldb/source/Plugins/SymbolFile/DWARF/DIERef.cpp
  lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
  lldb/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp
  lldb/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.h
  lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp
  lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.h
  lldb/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp
  lldb/source/Plugins/SymbolFile/DWARF/DWARFFormValue.h
  lldb/source/Plugins/SymbolFile/DWARF/DWARFTypeUnit.cpp
  lldb/source/Plugins/SymbolFile/DWARF/DWARFTypeUnit.h
  lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
  lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.h
  lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp

Index: lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
===
--- lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
+++ lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
@@ -448,20 +448,6 @@
 if (section_list == NULL)
   return 0;
 
-// On non Apple platforms we might have .debug_types debug info that is
-// created by using "-fdebug-types-section". LLDB currently will try to
-// load this debug info, but it causes crashes during debugging when types
-// are missing since it doesn't know how to parse the info in the
-// .debug_types type units. This causes all complex debug info types to be
-// unresolved. Because this causes LLDB to crash and since it really
-// doesn't provide a solid debuggiung experience, we should disable trying
-// to debug this kind of DWARF until support gets added or deprecated.
-if (section_list->FindSectionByName(ConstString(".debug_types"))) {
-  m_obj_file->GetModule()->ReportWarning(
-"lldb doesn’t support .debug_types debug info");
-  return 0;
-}
-
 uint64_t debug_abbrev_file_size = 0;
 uint64_t debug_info_file_size = 0;
 uint64_t debug_line_file_size = 0;
@@ -825,7 +811,7 @@
 cu_sp.reset(new CompileUnit(
 module_sp, dwarf_cu, cu_file_spec, dwarf_cu->GetID(),
 cu_language, is_optimized ? eLazyBoolYes : eLazyBoolNo));
-if (cu_sp) {
+if (dwarf_cu->GetAsCompileUnit() && cu_sp) {
   // If we just created a compile unit with an invalid file spec,
   // try and get the first entry in the supports files from the
   // line table as that should be the compile unit.
@@ -838,16 +824,16 @@
   cu_sp->GetSupportFiles().Replace(0, cu_file_spec);
 }
   }
+}
 
-  dwarf_cu->SetUserData(cu_sp.get());
+dwarf_cu->SetUserData(cu_sp.get());
 
-  // Figure out the compile unit index if we weren't given one
-  if (cu_idx == UINT32_MAX)
-DebugInfo()->GetCompileUnit(dwarf_cu->GetOffset(), &cu_idx);
+// Figure out the compile unit index if we weren't given one
+if (cu_idx == UINT32_MAX)
+  DebugInfo()->GetCompileUnit(dwarf_cu->GetOffset(), &cu_idx);
 
-  m_obj_file->GetModule()->GetSymbolVendor()->SetCompileUnitAtIndex(
-  cu_idx, cu_sp);
-}
+m_obj_file->GetModule()->GetSymbolVendor()->SetCompileUnitAtIndex(
+cu_idx, cu_sp);
   }
 }
   }
Index: lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.h
===
--- lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.h
+++ lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.h
@@ -16,12 +16,15 @@
 #include 
 
 class DWARFUnit;
+class DWARFTypeUnit;
 class DWARFCompileUnit;
 class NameToDIE;
 class SymbolFileDWARF;
 class SymbolFileDWARFDwo;
 
 typedef std::shared_ptr DWARFUnitSP;
+typedef std::shared_ptr DWARFTypeUnitSP;
+typedef std::shared_ptr DWARFCompileUnitSP;
 
 enum DWARFProducer {
   eProducerInvalid = 0,
@@ -38,6 +41,12 @@
 public:
   virtual ~DWARFUnit();
 
+  bool ExtractHeader(SymbolFileDWARF *dwarf,
+ const lldb_private::DWARFDataExtractor &data,
+ lldb::offset_t *offset_ptr);
+
+  DWARFTypeUnit *GetAsTypeUnit();
+  DWARFCompileUnit *GetAsCompileUnit();
   void ExtractUnitDIEIfNeeded();
   void ExtractDIEsIfNeeded();
 
@@ -180,6 +189,10 @@
 return die_iterator_range(m_die_array.begin(), m_die_array.end());
   }
 
+  DWARFDIE FindTypeSignat