[Lldb-commits] [lldb] [lldb] Add summary for NSIndirectTaggedPointerString (PR #136025)

Adrian Prantl via lldb-commits lldb-commits at lists.llvm.org
Wed Apr 16 15:31:33 PDT 2025


================
@@ -368,3 +373,37 @@ bool lldb_private::formatters::NSTaggedString_SummaryProvider(
   stream << suffix;
   return true;
 }
+
+bool lldb_private::formatters::NSIndirectTaggedString_SummaryProvider(
+    ValueObject &valobj, ObjCLanguageRuntime::ClassDescriptorSP descriptor,
+    Stream &stream, const TypeSummaryOptions &summary_options) {
+  if (!descriptor)
+    return false;
+
+  uint64_t payload = 0;
+  if (!descriptor->GetTaggedPointerInfo(nullptr, nullptr, &payload))
+    return false;
+
+  // First 47 bits are the address of the contents.
+  addr_t ptr = payload & 0x7fffffffffffULL;
+  // Next 13 bits are the string's length.
+  size_t size = (payload >> 47) & 0x1fff;
+
+  Status status;
+  char buf[8192];
----------------
adrian-prantl wrote:

Given how deeply nested lldb stacks often are, I would probably use a std::vector<char> here and allocate this on the heap.

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


More information about the lldb-commits mailing list