[Lldb-commits] [lldb] Summarize std::string's when created from data. (PR #89110)
via lldb-commits
lldb-commits at lists.llvm.org
Thu May 23 12:35:35 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) {
----------------
jimingham wrote:
I think we need to be more careful here. GetAddressOf is really meant to do "can you find an address in the target for this object". We use it that way in a whole bunch of places, e.g.:
```
cstr_address = GetAddressOf(true, &cstr_address_type);
} else {
// We have a pointer
cstr_address = GetPointerValue(&cstr_address_type);
}
if (cstr_address == 0 || cstr_address == LLDB_INVALID_ADDRESS) {
if (cstr_address_type == eAddressTypeHost && is_array) {
const char *cstr = GetDataExtractor().PeekCStr(0);
```
So in that case we are expecting a host address type to return an invalid address from GetAddressOf.
This change worries me, I don't think it will be what other code expects? Maybe you can get the value you need like the code above does instead?
https://github.com/llvm/llvm-project/pull/89110
More information about the lldb-commits
mailing list