Defining Synthetic Children Through the c++ API and returning custom data

Hello,

For a bit of context I’m working on a debugger for a language which transpiles into c++ (unrelated to llvm). On the windows side of things I’m using Microsofts DbgEng.dll and for other desktop platforms and mobile I’m using the LLDB c++ api. I’ve ran into what I think is a bit of a limitation with the c++ api (specifically synthetic types) and was hoping for some clarification that I’m not missing anything and some ideas for potential workarounds.

From what I can tell its not possible to define synthetic types with the public c++ api. I’ve found the function for getting a type summary using a function pointer but nothing for defining synethic types, this seems to be exposed only through python scripting.
Doing some digging in the llvm repo I found the SytheticChildrenFrontEnd class and some usage of it (such as DummySyntheticFrontEnd, and some for std classes), this appears to be the c++ equivilent of the synthetic children in python but only accessible through the private api, is this correct?

Another limit seems to be I can only return ValueObjects from synthetic children and I can’t see a way to return, say, a c++ class of my own making in a value object. In the Microsoft side of things its very easy to add properties and even functions which return any type you like with their equivilent of synthetic types / children. This is very useful for my use case as I can read data from the debugger target and return it in classes which can be directly consumed by the language which is transpiled to c++.

Sorry if this was a bit rambly, hopefully it makes sense. I guess in short I’m looking for a way to define formatters in c++ (so I can benifit from the format finding / regular expression support provided) and have a way to return custom data of my liking from that formatter.

Thanks,
Aidan.

1 Like