[Lldb-commits] [lldb] Add SBDebugger::AddCreateCallback API (PR #111206)

via lldb-commits lldb-commits at lists.llvm.org
Mon Oct 7 12:22:48 PDT 2024


jimingham wrote:

I don't think there's a lot of reason to support registering lists of lldb commands for the event, just having a python callback should be enough.  I think it's better to just do a scripted callback, and then have some command that lets you add callbacks by module & class name, etc.

I do think that the callbacks from the hooks should pass back a "return control to the user?" boolean value - the way stop hooks do.  That would be convenient for "return control to me when this particular target, process, etc is created".  I would also like eventually to have the stop-hooks use this mechanism and it needs that feature.

The other thing I really don't like about the target stop-hook mechanism is that there's no general way to access the results of the hook.  For instance, if I have a stop hook that displays some values, once that's printed to the terminal, there's no way to look at that report again.  It would have been better if the stop hooks had a "result" type object the way the commands do, which it accumulates results to.  Then when the process stopped, by default the driver would gather and print this info (it would also mean we could control when it's printed better).  But you could still look it up later.  In the case of stop-hooks you'd probably flush this on continue.  Not sure what a good model for the other hooks is.

Jim

> On Oct 7, 2024, at 10:36 AM, jeffreytan81 ***@***.***> wrote:
> 
> 
> @jimingham <https://github.com/jimingham> , @clayborg <https://github.com/clayborg>, do you guys prefer target stop-hook style approach or SBNotificationCallback style python API callback?
> 
> @clayborg <https://github.com/clayborg>, for SBNotificationCallback, does lldb::SBExecutionContext wrap the process, target or debugger object that is creating/destroying?
> 
>> Reply to this email directly, view it on GitHub <https://github.com/llvm/llvm-project/pull/111206#issuecomment-2397513434>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/ADUPVW2TVG3VA2UB6Q2YXR3Z2LBARAVCNFSM6AAAAABPMR6QDOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGOJXGUYTGNBTGQ>.
> You are receiving this because you were mentioned.
> 



https://github.com/llvm/llvm-project/pull/111206


More information about the lldb-commits mailing list