This is the mail archive of the
mailing list for the GDB project.
Re: [RFC][patch 3/9] export hooks mechanism to Python
> The Python code installs hooks so that users can write Python that
> reacts to gdb events. I wasn't sure what would be an acceptable
> approach here, and for the short term I just disabled this code. But,
> this is not a good solution.
> A lot of this stuff is marked deprecated. Why is that? Is there some
> other approach the Python code should use instead?
I am not 100% sure why these hooks were marked as deprecated, I haven't
checked the exact history, but if these are meant to be called when
something specific happens, we prefer now to use "observers". With
hooks, you can have only one user of the hook - although we did manage
to get around this limitation with a little tap dance but that was
Observers are a relatively recent addition to our code compared to these
hooks - see doc/observer.texi, and the generated file observer.h (and
observer-inc.c I think). The generation is performed by observer.sh.
Since you need to be able to write some python code that "reacts to
*GDB events*", I think that observers are exactly what you are looking