gdb: add inferior parameter to inferior_created observable

I think it would make sense for the inferior_created observable to say
which inferior is being dealt with, rather than relying on it being the
current inferior.

This patch adds an inferior parameter to inferior_created, but does not
change the callbacks to use it.

gdb/ChangeLog:

	* aix-thread.c (aix_thread_inferior_created): Add inferior
	parameter.
	* bsd-uthread.c (bsd_uthread_inferior_created): Likewise.
	* dummy-frame.c (cleanup_dummy_frames): Likewise.
	* jit.c (jit_inferior_created): Likewise.
	* linux-thread-db.c (thread_db_inferior_created): Likewise.
	* m68k-linux-tdep.c (m68k_linux_inferior_created): Likewise.
	* observable.h (inferior_created): Likewise.
	* ravenscar-thread.c (ravenscar_inferior_created): Likewise.
	* symfile-mem.c (add_vsyscall_page): Likewise.
	* infcmd.c (post_create_inferior): Pass inferior argument.

Change-Id: I2543d19ff055a9df6b269929faea10b27d2adc5e
This commit is contained in:
Simon Marchi 2020-10-24 22:59:04 -04:00 committed by Simon Marchi
parent 0c70050a4b
commit a0ff652f4c
11 changed files with 24 additions and 10 deletions

View File

@ -1,3 +1,17 @@
2020-10-24 Simon Marchi <simon.marchi@efficios.com>
* aix-thread.c (aix_thread_inferior_created): Add inferior
parameter.
* bsd-uthread.c (bsd_uthread_inferior_created): Likewise.
* dummy-frame.c (cleanup_dummy_frames): Likewise.
* jit.c (jit_inferior_created): Likewise.
* linux-thread-db.c (thread_db_inferior_created): Likewise.
* m68k-linux-tdep.c (m68k_linux_inferior_created): Likewise.
* observable.h (inferior_created): Likewise.
* ravenscar-thread.c (ravenscar_inferior_created): Likewise.
* symfile-mem.c (add_vsyscall_page): Likewise.
* infcmd.c (post_create_inferior): Pass inferior argument.
2020-10-24 Joel Brobecker <brobecker@adacore.com>
GDB 10.1 released.

View File

@ -1015,7 +1015,7 @@ new_objfile (struct objfile *objfile)
/* Attach to process specified by ARGS. */
static void
aix_thread_inferior_created ()
aix_thread_inferior_created (inferior *inf)
{
pd_enable ();
}

View File

@ -263,7 +263,7 @@ bsd_uthread_deactivate (void)
}
static void
bsd_uthread_inferior_created ()
bsd_uthread_inferior_created (inferior *inf)
{
bsd_uthread_activate (NULL);
}

View File

@ -273,7 +273,7 @@ find_dummy_frame_dtor (dummy_frame_dtor_ftype *dtor, void *dtor_data)
them up at least once whenever we start a new inferior. */
static void
cleanup_dummy_frames ()
cleanup_dummy_frames (inferior *inf)
{
while (dummy_frame_stack != NULL)
remove_dummy_frame (&dummy_frame_stack);

View File

@ -347,7 +347,7 @@ post_create_inferior (int from_tty)
if the now pushed target supports hardware watchpoints. */
breakpoint_re_set ();
gdb::observers::inferior_created.notify ();
gdb::observers::inferior_created.notify (current_inferior ());
}
/* Kill the inferior if already running. This function is designed

View File

@ -1232,7 +1232,7 @@ jit_inferior_init (struct gdbarch *gdbarch)
/* inferior_created observer. */
static void
jit_inferior_created ()
jit_inferior_created (inferior *inf)
{
jit_inferior_created_hook ();
}

View File

@ -1310,7 +1310,7 @@ check_pid_namespace_match (void)
This handles the case of debugging statically linked executables. */
static void
thread_db_inferior_created ()
thread_db_inferior_created (inferior *inf)
{
check_pid_namespace_match ();
check_for_thread_db ();

View File

@ -211,7 +211,7 @@ struct m68k_linux_sigtramp_info
static int target_is_uclinux;
static void
m68k_linux_inferior_created ()
m68k_linux_inferior_created (inferior *inf)
{
/* Record that we will need to re-evaluate whether we are running on a
uClinux or normal GNU/Linux target (see m68k_linux_get_sigtramp_info). */

View File

@ -87,7 +87,7 @@ extern observable<> executable_changed;
instruction. For 'attach' and 'core', gdb calls this observer
immediately after connecting to the inferior, and before any
information on the inferior has been printed. */
extern observable<> inferior_created;
extern observable<inferior */* inferior */> inferior_created;
/* The status of process record for inferior inferior in gdb has
changed. The process record is started if STARTED is true, and

View File

@ -657,7 +657,7 @@ ravenscar_thread_target::xfer_partial (enum target_object object,
/* Observer on inferior_created: push ravenscar thread stratum if needed. */
static void
ravenscar_inferior_created ()
ravenscar_inferior_created (inferior *inf)
{
const char *err_msg;

View File

@ -157,7 +157,7 @@ add_symbol_file_from_memory_command (const char *args, int from_tty)
This function is called via the inferior_created observer. */
static void
add_vsyscall_page ()
add_vsyscall_page (inferior *inf)
{
struct mem_range vsyscall_range;