================ @@ -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; + std::vector<char> buf(size); + if (auto process_sp = valobj.GetProcessSP()) + if (process_sp->ReadMemory(ptr, buf.data(), size, status)) { + llvm::StringRef prefix, suffix; + if (auto *language = Language::FindPlugin(summary_options.GetLanguage())) + std::tie(prefix, suffix) = + language->GetFormatterPrefixSuffix("NSString"); + stream << prefix << '"'; + stream.PutCString({buf.data(), size}); ---------------- adrian-prantl wrote:
Does PutCString scan through the buffer until it finds a `NUL` byte or does it copy `size` bytes (which would be faster). I doubt this affects the performance measurably. Just being curious. https://github.com/llvm/llvm-project/pull/136025 _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits