[Lldb-commits] [lldb] Summarize std::string's when created from data. (PR #89110)
Greg Clayton via lldb-commits
lldb-commits at lists.llvm.org
Tue May 28 11:10:05 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) {
----------------
clayborg wrote:
> > Make sense to fix GetAddressOf to take advantage of the API it is implementing. If the address kind can be host and we can return a valid host address value, I would say we use it. We will need to look over all uses of this API internally if we do change it.
>
> If we decide to go forward with this refactor, I think we should probably split this out into it's own independent PR and put this one on pause. As Jim mentioned above there are currently places that make assumptions based on the value object being host and getting back an invalid address, and we would need to correct for that.
I would be interesting to see how many places do this kind of pattern. If it is only a few locations, then yes a quick PR to enable this correctly would be nice, but if it is many, we can just copy the code that Jim mentions to work around the issue.
https://github.com/llvm/llvm-project/pull/89110
More information about the lldb-commits
mailing list