[Lldb-commits] [PATCH] D40211: Add comments to DWARFCompileUnit length fields/methods

Jan Kratochvil via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Sun Nov 19 06:35:43 PST 2017


This revision was automatically updated to reflect the committed changes.
Closed by commit rL318626: Add comments to DWARFCompileUnit length fields/methods (authored by jankratochvil).

Changed prior to commit:
  https://reviews.llvm.org/D40211?vs=123472&id=123498#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D40211

Files:
  lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.h


Index: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.h
===================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.h
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.h
@@ -41,26 +41,24 @@
   void Clear();
   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;
-  uint32_t Size() const {
-    return m_is_dwarf64 ? 23
-                        : 11; /* Size in bytes of the compile unit header */
-  }
+  // Size in bytes of the initial length + compile unit header.
+  uint32_t Size() const { return m_is_dwarf64 ? 23 : 11; }
   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 {
-    return m_offset + m_length + (m_is_dwarf64 ? 12 : 4);
+    return m_offset + (m_is_dwarf64 ? 12 : 4) + m_length;
   }
+  // Size of the CU data (without initial length and without header).
   size_t GetDebugInfoSize() const {
-    return m_length + (m_is_dwarf64 ? 12 : 4) - Size(); /* Size in bytes of the
-                                                           .debug_info data
-                                                           associated with this
-                                                           compile unit. */
+    return (m_is_dwarf64 ? 12 : 4) + m_length - Size();
   }
+  // Size of the CU data incl. header but without initial length.
   uint32_t GetLength() const { return m_length; }
   uint16_t GetVersion() const { return m_version; }
   const DWARFAbbreviationDeclarationSet *GetAbbreviations() const {
@@ -175,6 +173,7 @@
                                                         // DW_TAG_subprogram
                                                         // DIEs
   dw_addr_t m_base_addr;
+  // Offset of the initial length field.
   dw_offset_t m_offset;
   dw_offset_t m_length;
   uint16_t m_version;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D40211.123498.patch
Type: text/x-patch
Size: 2232 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20171119/011082cf/attachment.bin>


More information about the lldb-commits mailing list