[Lldb-commits] [lldb] Summarize std::string's when created from data. (PR #89110)

Jacob Lalonde via lldb-commits lldb-commits at lists.llvm.org
Mon Apr 29 16:37:44 PDT 2024


================
@@ -254,13 +254,17 @@ bool lldb_private::formatters::LibStdcppStringSummaryProvider(
   } else
     addr_of_string =
         valobj.GetAddressOf(scalar_is_load_addr, &addr_type);
-  if (addr_of_string != LLDB_INVALID_ADDRESS) {
+
+  // We have to check for host address here
+  // because GetAddressOf returns INVALID for all non load addresses.
+  // But we can still format strings in host memory.
+  if (addr_of_string != LLDB_INVALID_ADDRESS ||
+        addr_type == eAddressTypeHost) {
----------------
Jlalond wrote:

That I don't know. ValueObject does [explicitly return](https://github.com/llvm/llvm-project/blob/main/lldb/source/Core/ValueObject.cpp#L1408C12-L1408C32) `LLDB_INVALID_ADDRESS` when `addressType == eAddressTypeHost`. I thought this was weird and potentially returning the address of the in memory buffer made more sense, but that seemed like a major refactor for a minor string issue

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


More information about the lldb-commits mailing list