From a0ff652f4cacc3557795204ae5e73fa9f5d2ea30 Mon Sep 17 00:00:00 2001 From: Simon Marchi Date: Sat, 24 Oct 2020 22:59:04 -0400 Subject: [PATCH] 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 --- gdb/ChangeLog | 14 ++++++++++++++ gdb/aix-thread.c | 2 +- gdb/bsd-uthread.c | 2 +- gdb/dummy-frame.c | 2 +- gdb/infcmd.c | 2 +- gdb/jit.c | 2 +- gdb/linux-thread-db.c | 2 +- gdb/m68k-linux-tdep.c | 2 +- gdb/observable.h | 2 +- gdb/ravenscar-thread.c | 2 +- gdb/symfile-mem.c | 2 +- 11 files changed, 24 insertions(+), 10 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 88d01a01ebb..0f2a87bf7d7 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,17 @@ +2020-10-24 Simon Marchi + + * 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 GDB 10.1 released. diff --git a/gdb/aix-thread.c b/gdb/aix-thread.c index b4100a55ae9..bedd97d439a 100644 --- a/gdb/aix-thread.c +++ b/gdb/aix-thread.c @@ -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 (); } diff --git a/gdb/bsd-uthread.c b/gdb/bsd-uthread.c index e83707fd7c5..ffbee4a15f9 100644 --- a/gdb/bsd-uthread.c +++ b/gdb/bsd-uthread.c @@ -263,7 +263,7 @@ bsd_uthread_deactivate (void) } static void -bsd_uthread_inferior_created () +bsd_uthread_inferior_created (inferior *inf) { bsd_uthread_activate (NULL); } diff --git a/gdb/dummy-frame.c b/gdb/dummy-frame.c index 1952d2eb6f3..0b99e5c1c6a 100644 --- a/gdb/dummy-frame.c +++ b/gdb/dummy-frame.c @@ -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); diff --git a/gdb/infcmd.c b/gdb/infcmd.c index 498089fdb52..068de96941a 100644 --- a/gdb/infcmd.c +++ b/gdb/infcmd.c @@ -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 diff --git a/gdb/jit.c b/gdb/jit.c index 9298ac0f487..6f1f7e69d5e 100644 --- a/gdb/jit.c +++ b/gdb/jit.c @@ -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 (); } diff --git a/gdb/linux-thread-db.c b/gdb/linux-thread-db.c index c625cefead2..e759ecc9513 100644 --- a/gdb/linux-thread-db.c +++ b/gdb/linux-thread-db.c @@ -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 (); diff --git a/gdb/m68k-linux-tdep.c b/gdb/m68k-linux-tdep.c index e4fc2faecb2..752260e8616 100644 --- a/gdb/m68k-linux-tdep.c +++ b/gdb/m68k-linux-tdep.c @@ -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). */ diff --git a/gdb/observable.h b/gdb/observable.h index d9d0f149f6f..9114b28d04f 100644 --- a/gdb/observable.h +++ b/gdb/observable.h @@ -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_created; /* The status of process record for inferior inferior in gdb has changed. The process record is started if STARTED is true, and diff --git a/gdb/ravenscar-thread.c b/gdb/ravenscar-thread.c index a7c59ad325a..29f8ae1ae5f 100644 --- a/gdb/ravenscar-thread.c +++ b/gdb/ravenscar-thread.c @@ -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; diff --git a/gdb/symfile-mem.c b/gdb/symfile-mem.c index 5f212e10323..18ab9357dbb 100644 --- a/gdb/symfile-mem.c +++ b/gdb/symfile-mem.c @@ -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; -- 2.30.2