[Lldb-commits] [lldb] Make only one function that needs to be implemented when searching for types (PR #74786)
Michael Buch via lldb-commits
lldb-commits at lists.llvm.org
Tue Jan 2 11:41:31 PST 2024
Michael137 wrote:
> FWIW, we're seeing this breaking a pretty printer in google - previously a lookup was able to find `absl::cord_internal::RefcountAndFlags::Flags::kNumFlags` ( https://github.com/abseil/abseil-cpp/blob/8184f16e898fcb13b310b40430e13ba40679cf0e/absl/strings/internal/cord_internal.h#L202 ) (the name components are, in order: namespace, namespace, class, unscoped enumeration, enumerator)
>
> The code we have (working via [gala](https://github.com/sivachandra/gala)) has been doing this query twice to workaround this bug: #53904 - but it looks like since this change, that workaround has even broken and the name is no longer found?
>
> I don't have a fully isolated repro yet, but figured I'd start with raising the flag in case anyone recognizes this.
FWIW, you might be able to make use of the recently added [`SBType::FindDirectNestedType`](https://github.com/llvm/llvm-project/pull/68705), to get to the enum value. Something like:
```
>>> var = lldb.frame.FindVariable('myVar')
>>> var_type = var.GetType()
>>> flags = var_type.FindDirectNestedType('Flags')
>>> flags
enum Flags {
kNumFlags,
kImmortalFlag
}
>>> flags.GetEnumMembers()['kNumFlags].GetValueAsUnsigned()
1
```
https://github.com/llvm/llvm-project/pull/74786
More information about the lldb-commits
mailing list