From 42a4fec513f11d4ff346f62fc0df3731ce9f7d59 Mon Sep 17 00:00:00 2001 From: Simon Marchi Date: Fri, 4 Dec 2020 16:43:51 -0500 Subject: 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 --- gdb/solib.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'gdb/solib.c') diff --git a/gdb/solib.c b/gdb/solib.c index b11c6f3..1f6e915 100644 --- a/gdb/solib.c +++ b/gdb/solib.c @@ -1557,6 +1557,10 @@ _initialize_solib () solib_data = gdbarch_data_register_pre_init (solib_init); gdb::observers::free_objfile.attach (remove_user_added_objfile); + gdb::observers::inferior_execd.attach ([] (inferior *inf) + { + solib_create_inferior_hook (0); + }); add_com ("sharedlibrary", class_files, sharedlibrary_command, _("Load shared object library symbols for files matching REGEXP.")); -- cgit v1.1