SBTarget::FindTypes and SBTarget::FindFirstType should look in the persistent type declarations
- Dominant language
- LLVM
- Stars
- 40.5k
- Forks
- 18.7k
- PR merge metrics
- PR metrics pending
Description
You can use the expression evaluator to define persistent types in a debug session:
(lldb) expr struct $MyStruct { int a ; int b }
and then use that in future expressions:
(lldb) expr *($MyStruct *) 0x12345
etc.
However, another place where defining custom types is handy is to organize the synthetic children of some value. For instance, the NSDictionary synthetic child provider does that. That implementation is straightforward because it is done in lldb_private, so we can create the type directly in the AST and have immediate access to it.
It SHOULD be easy from Python:
target.EvaluateExpression("struct $MyStruct {int a; int b}")
type = target.FindFirstType("$MyStruct")
my_val.CreateChildValueObjectFromData("some_name", appropriate_data, type)
and return that as the appropriate synthetic child.
However, this doesn't work because FindFirstType and FindTypes don't consult the persistent declarations.
This shouldn't be hard to do, Target exposes GetPersistentExpressionStateForLanguage(Language) and that has GetCompilerTypeFromPersistentDecl(typename). So the building blocks are already present.
Contributor guide
Assessment
This issue has not been assessed yet.