-
Notifications
You must be signed in to change notification settings - Fork 351
[NOT FOR MERGING] [LLDB] Add a Swift ScriptIntepreter #3524
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: stable/20210726
Are you sure you want to change the base?
Conversation
This uses the JIT to compile swift code on the fly and the Swift C++ interop feature to expose the LLDB SBAPI in the Swift language.
|
@swift-ci please test |
|
Really cool. What, if anything, do you plan to do next?
We essentially lose out on the extensions added in the SWIG I would guess that most C++ interop will require some wrapper code (like overlays?) to expose a conventional Swift API, so this issue doesn't seem specific to this case.
Can you give an example?
It seems this could be mostly achieved by the boundary of the Swift wrappers that need to be created. At least for OOB/Optional handling. |
Not necessarily anything. I might play with some Clang tooling to generate some of the wrapper code we talk about below, but from my PoV this was just an experience and I don't plan to personally put in the work to make it production-ready.
Correct. I also fee like a lot of this can be autogenerated with a few heuristics.
The patch has this piece:
I don't think so, but maybe I'm not understanding what you're saying. There's nothing preventing anyone from doing: and this will crash LLDB itself. Of course this example is contrived, but you can see how this can happen quite easily in really code (in other words, I'm not that concerned about SB API usage, but about the code wrapping it). |
|
@swift-ci test |
This PR implements a rough Swift ScriptInterpreter that allows you to extend LLDB in Swift. It leverages the Orc JIT and Swift's C++ interop to achieve this.
There are a number of reasons this is not good enough:
Get...AtIndex()methods).constannotations are missing.command script importliterally imports a Python module with its namespacing. This implementation doesn't do this.