+2020-12-04 Simon Marchi <simon.marchi@efficios.com>
+
+ * 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.
+
2020-12-04 Tom de Vries <tdevries@suse.de>
PR gdb/27003
registers. */
target_find_description ();
- solib_create_inferior_hook (0);
-
- jit_inferior_created_hook (inf);
+ gdb::observers::inferior_execd.notify (inf);
breakpoint_re_set ();
static const char jit_descriptor_name[] = "__jit_debug_descriptor";
+static void jit_inferior_created_hook (inferior *inf);
static void jit_inferior_exit_hook (struct inferior *inf);
/* An unwinder is registered for every gdbarch. This key is used to
}
}
-/* See jit.h. */
+/* Looks for the descriptor and registration symbols and breakpoints
+ the registration function. If it finds both, it registers all the
+ already JITed code. If it has already found the symbols, then it
+ doesn't try again. */
-void
+static void
jit_inferior_created_hook (inferior *inf)
{
jit_inferior_init (inf);
&setdebuglist, &showdebuglist);
gdb::observers::inferior_created.attach (jit_inferior_created_hook);
+ gdb::observers::inferior_execd.attach (jit_inferior_created_hook);
gdb::observers::inferior_exit.attach (jit_inferior_exit_hook);
gdb::observers::breakpoint_deleted.attach (jit_breakpoint_deleted);
CORE_ADDR addr;
};
-/* Looks for the descriptor and registration symbols and breakpoints
- the registration function. If it finds both, it registers all the
- already JITed code. If it has already found the symbols, then it
- doesn't try again. */
-
-extern void jit_inferior_created_hook (inferior *inf);
-
/* Re-establish the jit breakpoint(s). */
extern void jit_breakpoint_re_set (void);
DEFINE_OBSERVABLE (target_changed);
DEFINE_OBSERVABLE (executable_changed);
DEFINE_OBSERVABLE (inferior_created);
+DEFINE_OBSERVABLE (inferior_execd);
DEFINE_OBSERVABLE (record_changed);
DEFINE_OBSERVABLE (solib_loaded);
DEFINE_OBSERVABLE (solib_unloaded);
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.
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."));