[Lldb-commits] [lldb] Add a python JIT loader class. (PR #142514)
Med Ismail Bennani via lldb-commits
lldb-commits at lists.llvm.org
Tue Jun 3 12:37:46 PDT 2025
medismailben wrote:
> Hey @clayborg, this is pretty cool. I'm glad you were able to use and extend the ScriptedPythonInterface to implement this, hopefully it wasn't too complicated. LGTM!
I meant LGTM on the scripting side of things. I still thing we should address Jim's comments:
> For the case of hooks, I wonder if we could augment the -C options we currently use to add affordances backed by a Python class with a __call__ method so you could say:
>
> `target stop-hook add -C my_python_class --shared-instance 1 --call_method stop_hook_handler `
>
If you use a `OptionGroupPythonClassWithDict`, you automatically get `-C` option to specify either a class or a function to a CommandObject.
I like the idea of being able to create or share instances between scripted affordances but I think we need a way to list the existing instances (and what scripted affordance are they driving), otherwise, how would the user be able to tell what number to pass to `--shared-instance` ?
Suggestion: if you make this more generic, you could implement a template that's included in the lldb python module like we do for other scripted affordances (ScriptedProcess, ScriptedThread, ScriptedThreadPlan ...) with a base implementation for every function the script should implement. That would make it easier to write new scripts for this.
https://github.com/llvm/llvm-project/pull/142514
More information about the lldb-commits
mailing list