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

Greg Clayton via lldb-commits lldb-commits at lists.llvm.org
Mon Nov 20 07:50:01 PST 2017


> On Nov 19, 2017, at 4:56 PM, Zachary Turner <zturner at google.com> wrote:
> 
> 
> 
> On Sun, Nov 19, 2017 at 6:35 AM Jan Kratochvil via Phabricator via lldb-commits <lldb-commits at lists.llvm.org <mailto:lldb-commits at lists.llvm.org>> wrote:
> 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 <https://reviews.llvm.org/D40211?vs=123472&id=123498#toc>
> 
> Repository:
>   rL LLVM
> 
> https://reviews.llvm.org/D40211 <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; }
> 
> This is pretty gross.  Don't we have a structure somewhere that represents a compile unit header?  That we can just call sizeof on?  Same goes for the rest of the patch

It varies depending on data on how the length unit is represented in the data stream. If the length starts with UINT32_MAX, it is followed by a 64 bit length. If the length isn't UINT32_MAX it is just a 32 bit length. 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20171120/d0dad58d/attachment.html>


More information about the lldb-commits mailing list