<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">sizeof(struct) tends to include system level padding for the current host. But to answer your question, no there isn't a structure defined like this and we wouldn't use them anyway as we want to fill out one compile unit struct that works for both. <div class=""><br class=""><div class=""><div><blockquote type="cite" class=""><div class="">On Nov 20, 2017, at 8:01 AM, Zachary Turner <<a href="mailto:zturner@google.com" class="">zturner@google.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class="">Right but isn’t there a DWARF64_HEADER and DEARF32_HEADER struct somewhere?  This way you could just say <br class=""><br class="">  return m_isdwarf64 ? sizeof(DWARF64_HEADER) : sizeof(DWARF32_HEADER);<br class=""><div class="gmail_quote"><div dir="ltr" class="">On Mon, Nov 20, 2017 at 7:50 AM Greg Clayton <<a href="mailto:clayborg@gmail.com" class="">clayborg@gmail.com</a>> wrote:<br class=""></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word" class=""><br class=""><div class=""><blockquote type="cite" class=""><div class="">On Nov 19, 2017, at 4:56 PM, Zachary Turner <<a href="mailto:zturner@google.com" target="_blank" class="">zturner@google.com</a>> wrote:</div><br class="m_-6047306128612448630Apple-interchange-newline"><div class=""><div dir="ltr" class=""><br class=""><br class=""><div class="gmail_quote"><div dir="ltr" class="">On Sun, Nov 19, 2017 at 6:35 AM Jan Kratochvil via Phabricator via lldb-commits <<a href="mailto:lldb-commits@lists.llvm.org" target="_blank" class="">lldb-commits@lists.llvm.org</a>> wrote:<br class=""></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">This revision was automatically updated to reflect the committed changes.<br class="">
Closed by commit rL318626: Add comments to DWARFCompileUnit length fields/methods (authored by jankratochvil).<br class="">
<br class="">
Changed prior to commit:<br class="">
  <a href="https://reviews.llvm.org/D40211?vs=123472&id=123498#toc" rel="noreferrer" target="_blank" class="">https://reviews.llvm.org/D40211?vs=123472&id=123498#toc</a><br class="">
<br class="">
Repository:<br class="">
  rL LLVM<br class="">
<br class="">
<a href="https://reviews.llvm.org/D40211" rel="noreferrer" target="_blank" class="">https://reviews.llvm.org/D40211</a><br class="">
<br class="">
Files:<br class="">
  lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.h<br class="">
<br class="">
<br class="">
Index: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.h<br class="">
===================================================================<br class="">
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.h<br class="">
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.h<br class="">
@@ -41,26 +41,24 @@<br class="">
   void Clear();<br class="">
   bool Verify(lldb_private::Stream *s) const;<br class="">
   void Dump(lldb_private::Stream *s) const;<br class="">
+  // Offset of the initial length field.<br class="">
   dw_offset_t GetOffset() const { return m_offset; }<br class="">
   lldb::user_id_t GetID() const;<br class="">
-  uint32_t Size() const {<br class="">
-    return m_is_dwarf64 ? 23<br class="">
-                        : 11; /* Size in bytes of the compile unit header */<br class="">
-  }<br class="">
+  // Size in bytes of the initial length + compile unit header.<br class="">
+  uint32_t Size() const { return m_is_dwarf64 ? 23 : 11; }<br class=""></blockquote><div class=""><br class=""></div><div class="">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</div></div></div>
</div></blockquote></div><br class=""></div><div style="word-wrap:break-word" class=""><div class="">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. </div></div></blockquote></div>
</div></blockquote></div><br class=""></div></div></body></html>