[Lldb-commits] [PATCH] D40466: DWZ 02/12: DWARFUnit split out of DWARFCompileUnit

2018-02-20 Thread Jan Kratochvil via Phabricator via lldb-commits
jankratochvil updated this revision to Diff 135047.

https://reviews.llvm.org/D40466

Files:
  source/Plugins/SymbolFile/DWARF/CMakeLists.txt
  source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp
  source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.h
  source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
  source/Plugins/SymbolFile/DWARF/DWARFUnit.h

Index: source/Plugins/SymbolFile/DWARF/DWARFUnit.h
===
--- /dev/null
+++ source/Plugins/SymbolFile/DWARF/DWARFUnit.h
@@ -0,0 +1,159 @@
+//===-- DWARFUnit.h -*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+
+#ifndef SymbolFileDWARF_DWARFUnit_h_
+#define SymbolFileDWARF_DWARFUnit_h_
+
+#include "DWARFDIE.h"
+#include "DWARFDebugInfoEntry.h"
+#include "lldb/lldb-enumerations.h"
+
+class DWARFUnit;
+class DWARFCompileUnit;
+class NameToDIE;
+class SymbolFileDWARF;
+class SymbolFileDWARFDwo;
+
+typedef std::shared_ptr DWARFUnitSP;
+
+enum DWARFProducer {
+  eProducerInvalid = 0,
+  eProducerClang,
+  eProducerGCC,
+  eProducerLLVMGCC,
+  eProcucerOther
+};
+
+class DWARFUnit {
+public:
+  virtual ~DWARFUnit();
+
+  size_t ExtractDIEsIfNeeded(bool cu_die_only);
+  DWARFDIE LookupAddress(const dw_addr_t address);
+  size_t AppendDIEsWithTag(const dw_tag_t tag,
+   DWARFDIECollection _dies,
+   uint32_t depth = UINT32_MAX) const;
+  bool Verify(lldb_private::Stream *s) const;
+  void Dump(lldb_private::Stream *s) const;
+  // Offset of the initial length field.
+  dw_offset_t GetOffset() const { return m_offset; }
+  lldb::user_id_t GetID() const;
+  // Size in bytes of the initial length + compile unit header.
+  uint32_t Size() const;
+  bool ContainsDIEOffset(dw_offset_t die_offset) const {
+return die_offset >= GetFirstDIEOffset() &&
+   die_offset < GetNextCompileUnitOffset();
+  }
+  dw_offset_t GetFirstDIEOffset() const { return m_offset + Size(); }
+  dw_offset_t GetNextCompileUnitOffset() const;
+  // Size of the CU data (without initial length and without header).
+  size_t GetDebugInfoSize() const;
+  // Size of the CU data incl. header but without initial length.
+  uint32_t GetLength() const;
+  uint16_t GetVersion() const;
+  const DWARFAbbreviationDeclarationSet *GetAbbreviations() const;
+  dw_offset_t GetAbbrevOffset() const;
+  uint8_t GetAddressByteSize() const;
+  dw_addr_t GetBaseAddress() const;
+  dw_addr_t GetAddrBase() const;
+  dw_addr_t GetRangesBase() const;
+  void SetAddrBase(dw_addr_t addr_base, dw_addr_t ranges_base, dw_offset_t base_obj_offset);
+  void ClearDIEs(bool keep_compile_unit_die);
+  void BuildAddressRangeTable(SymbolFileDWARF *dwarf2Data,
+  DWARFDebugAranges *debug_aranges);
+
+  lldb::ByteOrder GetByteOrder() const;
+
+  lldb_private::TypeSystem *GetTypeSystem();
+
+  DWARFFormValue::FixedFormSizes GetFixedFormSizes();
+
+  void SetBaseAddress(dw_addr_t base_addr);
+
+  DWARFDIE
+  GetCompileUnitDIEOnly();
+
+  DWARFDIE
+  DIE();
+
+  bool HasDIEsParsed() const;
+
+  DWARFDIE GetDIE(dw_offset_t die_offset);
+
+  static uint8_t GetAddressByteSize(const DWARFUnit *cu);
+
+  static bool IsDWARF64(const DWARFUnit *cu);
+
+  static uint8_t GetDefaultAddressSize();
+
+  static void SetDefaultAddressSize(uint8_t addr_size);
+
+  void *GetUserData() const;
+
+  void SetUserData(void *d);
+
+  bool Supports_DW_AT_APPLE_objc_complete_type();
+
+  bool DW_AT_decl_file_attributes_are_invalid();
+
+  bool Supports_unnamed_objc_bitfields();
+
+  void Index(NameToDIE _basenames, NameToDIE _fullnames,
+ NameToDIE _methods, NameToDIE _selectors,
+ NameToDIE _class_selectors, NameToDIE ,
+ NameToDIE , NameToDIE );
+
+  SymbolFileDWARF *GetSymbolFileDWARF() const;
+
+  DWARFProducer GetProducer();
+
+  uint32_t GetProducerVersionMajor();
+
+  uint32_t GetProducerVersionMinor();
+
+  uint32_t GetProducerVersionUpdate();
+
+  static lldb::LanguageType LanguageTypeFromDWARF(uint64_t val);
+
+  lldb::LanguageType GetLanguageType();
+
+  bool IsDWARF64() const;
+
+  bool GetIsOptimized();
+
+  SymbolFileDWARFDwo *GetDwoSymbolFile() const;
+
+  dw_offset_t GetBaseObjOffset() const;
+
+protected:
+  virtual DWARFCompileUnit () = 0;
+  virtual const DWARFCompileUnit () const = 0;
+
+  DWARFUnit();
+
+  static void
+  IndexPrivate(DWARFUnit *dwarf_cu, const lldb::LanguageType cu_language,
+   const DWARFFormValue::FixedFormSizes _form_sizes,
+   const dw_offset_t cu_offset, NameToDIE _basenames,
+   NameToDIE _fullnames, NameToDIE _methods,
+   NameToDIE _selectors, NameToDIE _class_selectors,
+   NameToDIE , NameToDIE , NameToDIE );
+
+  

[Lldb-commits] [PATCH] D40466: DWZ 02/12: DWARFUnit split out of DWARFCompileUnit

2018-02-04 Thread Jan Kratochvil via Phabricator via lldb-commits
jankratochvil added a comment.

This patch only tries to move code without changing it in any way (except for 
some Data() references required for DWARFCompileUnit members access from 
DWARFUnit).


https://reviews.llvm.org/D40466



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits