gdb: add inferior_execd observable

I want to add another action (clearing displaced stepping state) that
happens when an inferior execs.  I think it would be cleaner to have an
observer for this event, rather than have infrun know about each other
sub-component.

Replace the calls to solib_create_inferior_hook and
jit_inferior_created_hook in follow_exec by observers.

gdb/ChangeLog:

	* observable.h (inferior_execd): Declare new observable.
	* observable.c (inferior_execd): Declare new observable.
	* infrun.c (follow_exec): Notify inferior_execd observer.
	* jit.c (jit_inferior_created_hook): Make static.
	(_initialize_jit): Register inferior_execd observer.
	* jit.h (jit_inferior_created_hook): Remove declaration.
	* solib.c (_initialize_solib): Register inferior_execd observer.

Change-Id: I000cce00094e23baa67df693d912646b6ae38e44
This commit is contained in:
Simon Marchi
2020-12-04 16:43:51 -05:00
parent aafdfb4edd
commit 42a4fec513
7 changed files with 26 additions and 12 deletions

View File

@ -89,6 +89,9 @@ extern observable<> executable_changed;
information on the inferior has been printed. */
extern observable<inferior */* inferior */> inferior_created;
/* The inferior INF has exec'ed a new executable file. */
extern observable<struct inferior */* inf */> inferior_execd;
/* The status of process record for inferior inferior in gdb has
changed. The process record is started if STARTED is true, and
the process record is stopped if STARTED is false.