[Lldb-commits] [lldb] [LLDB][NFC] Added the interface DWARFExpression::Delegate to break dependencies and reduce lldb-server size (PR #131645)

Dmitry Vasilyev via lldb-commits lldb-commits at lists.llvm.org
Fri Mar 21 07:25:34 PDT 2025


================
@@ -696,6 +696,87 @@ llvm::StringRef DWARFUnit::PeekDIEName(dw_offset_t die_offset) {
   return llvm::StringRef();
 }
 
+llvm::Error DWARFUnit::GetDIEBitSizeAndSign(uint64_t die_offset,
+                                            uint64_t &bit_size, bool &sign) {
+  // Retrieve the type DIE that the value is being converted to. This
+  // offset is compile unit relative so we need to fix it up.
+  const uint64_t abs_die_offset = die_offset + GetOffset();
+  // FIXME: the constness has annoying ripple effects.
+  DWARFDIE die = GetDIE(abs_die_offset);
+  if (!die)
+    return llvm::createStringError("cannot resolve DW_OP_convert type DIE");
+  uint64_t encoding =
+      die.GetAttributeValueAsUnsigned(DW_AT_encoding, DW_ATE_hi_user);
+  bit_size = die.GetAttributeValueAsUnsigned(DW_AT_byte_size, 0) * 8;
+  if (!bit_size)
+    bit_size = die.GetAttributeValueAsUnsigned(DW_AT_bit_size, 0);
+  if (!bit_size)
+    return llvm::createStringError("unsupported type size in DW_OP_convert");
----------------
slydiman wrote:

Done.

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


More information about the lldb-commits mailing list