[Lldb-commits] [llvm] [lldb] Fix size in bytes of type DIEs when size in bits is not a multiple of 8 (PR #69741)

Michael Buch via lldb-commits lldb-commits at lists.llvm.org
Thu Nov 9 22:33:29 PST 2023


================
@@ -2210,9 +2216,16 @@ bool DWARFASTParserClang::CompleteRecordType(const DWARFDIE &die,
       !layout_info.vbase_offsets.empty()) {
     if (type)
       layout_info.bit_size = type->GetByteSize(nullptr).value_or(0) * 8;
-    if (layout_info.bit_size == 0)
-      layout_info.bit_size =
-          die.GetAttributeValueAsUnsigned(DW_AT_byte_size, 0) * 8;
+    if (layout_info.bit_size == 0) {
+      auto byte_size =
+          die.GetAttributeValueAsUnsigned(DW_AT_byte_size, UINT64_MAX);
+
+      if (byte_size != UINT64_MAX)
+        layout_info.bit_size = byte_size;
----------------
Michael137 wrote:

How come we don't need to do the `* 8` here to go from bytes to bits?

https://github.com/llvm/llvm-project/pull/69741


More information about the lldb-commits mailing list