================
@@ -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:

We could take the approach you provided. Greg and I originally talked and 
mentioned how `GetAddressOf` will return the pointer within a buffer in certain 
cases. I'm not enough of an expert here to have strong opinions but I think 
we're in a confusing middleground, where GetAddressOf works for Load addresses, 
but fails for a host address even if we have a pointer internally to a data 
buffer. 

I think solving that is more fundamental to my (2nd?) PR in lldb, but if we can 
all agree on the returning invaild for host addresses. I'm okay with that, as 
long as we also add a comment/documentation to the call that HostAddress 
addresses are invalid and to instead use a data extractor. My only opinion on 
that as a new contributor is the API to work with ValueObject's data is clunky, 
because I can seemingly only construct a copy via `GetData`.

https://github.com/llvm/llvm-project/pull/89110
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to