* [PATCH] gdb: remove arguments from inferior_created observable
@ 2020-10-02 2:13 Simon Marchi
2020-10-02 9:49 ` Andrew Burgess
0 siblings, 1 reply; 3+ messages in thread
From: Simon Marchi @ 2020-10-02 2:13 UTC (permalink / raw)
To: gdb-patches
I noticed that non of the listeners of the inferior_created observable
used either of the arguments. Remove them. This in turn allows
removing the target parameter of post_create_inferior.
Tested only by rebuilding.
gdb/ChangeLog:
* observable.h <inferior_created>: Remove parameters. Update all
listeners.
* inferior.h (post_create_inferior): Remove target parameter.
Update all callers.
Change-Id: I8944cefdc4447ed5347dc927b75abf1e7a0e27e6
---
gdb/bsd-uthread.c | 2 +-
gdb/corelow.c | 2 +-
gdb/dummy-frame.c | 2 +-
gdb/infcmd.c | 8 ++++----
gdb/inferior.h | 2 +-
gdb/infrun.c | 2 +-
gdb/jit.c | 2 +-
gdb/linux-thread-db.c | 2 +-
gdb/m68k-linux-tdep.c | 2 +-
gdb/observable.h | 3 +--
gdb/ravenscar-thread.c | 2 +-
gdb/symfile-mem.c | 2 +-
gdb/tracectf.c | 2 +-
gdb/tracefile-tfile.c | 2 +-
14 files changed, 17 insertions(+), 18 deletions(-)
diff --git a/gdb/bsd-uthread.c b/gdb/bsd-uthread.c
index 144e8b920fa9..e83707fd7c50 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 (struct target_ops *ops, int from_tty)
+bsd_uthread_inferior_created ()
{
bsd_uthread_activate (NULL);
}
diff --git a/gdb/corelow.c b/gdb/corelow.c
index de15895c80b5..e82c183eae5a 100644
--- a/gdb/corelow.c
+++ b/gdb/corelow.c
@@ -516,7 +516,7 @@ core_target_open (const char *arg, int from_tty)
if (exec_bfd == nullptr)
locate_exec_from_corefile_build_id (core_bfd, from_tty);
- post_create_inferior (target, from_tty);
+ post_create_inferior (from_tty);
/* Now go through the target stack looking for threads since there
may be a thread_stratum target loaded on top of target core by
diff --git a/gdb/dummy-frame.c b/gdb/dummy-frame.c
index d47cfd2d9a2d..1952d2eb6f30 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 (struct target_ops *target, int from_tty)
+cleanup_dummy_frames ()
{
while (dummy_frame_stack != NULL)
remove_dummy_frame (&dummy_frame_stack);
diff --git a/gdb/infcmd.c b/gdb/infcmd.c
index 81ce36dafe26..d8f95977a18c 100644
--- a/gdb/infcmd.c
+++ b/gdb/infcmd.c
@@ -279,7 +279,7 @@ strip_bg_char (const char *args, int *bg_char_p)
should be stopped. */
void
-post_create_inferior (struct target_ops *target, int from_tty)
+post_create_inferior (int from_tty)
{
/* Be sure we own the terminal in case write operations are performed. */
@@ -347,7 +347,7 @@ post_create_inferior (struct target_ops *target, int from_tty)
if the now pushed target supports hardware watchpoints. */
breakpoint_re_set ();
- gdb::observers::inferior_created.notify (target, from_tty);
+ gdb::observers::inferior_created.notify ();
}
/* Kill the inferior if already running. This function is designed
@@ -520,7 +520,7 @@ run_command_1 (const char *args, int from_tty, enum run_how run_how)
/* Pass zero for FROM_TTY, because at this point the "run" command
has done its thing; now we are setting up the running program. */
- post_create_inferior (current_top_target (), 0);
+ post_create_inferior (0);
/* Queue a pending event so that the program stops immediately. */
if (run_how == RUN_STOP_AT_FIRST_INSN)
@@ -2432,7 +2432,7 @@ setup_inferior (int from_tty)
/* Take any necessary post-attaching actions for this platform. */
target_post_attach (inferior_ptid.pid ());
- post_create_inferior (current_top_target (), from_tty);
+ post_create_inferior (from_tty);
}
/* What to do after the first program stops after attaching. */
diff --git a/gdb/inferior.h b/gdb/inferior.h
index 70edf21b34bc..d016161fb051 100644
--- a/gdb/inferior.h
+++ b/gdb/inferior.h
@@ -196,7 +196,7 @@ extern ptid_t gdb_startup_inferior (pid_t pid, int num_traps);
extern void setup_inferior (int from_tty);
-extern void post_create_inferior (struct target_ops *, int);
+extern void post_create_inferior (int from_tty);
extern void attach_command (const char *, int);
diff --git a/gdb/infrun.c b/gdb/infrun.c
index daf10417842f..a150585bd5ad 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -3185,7 +3185,7 @@ start_remote (int from_tty)
/* Now that the inferior has stopped, do any bookkeeping like
loading shared libraries. We want to do this before normal_stop,
so that the displayed frame is up to date. */
- post_create_inferior (current_top_target (), from_tty);
+ post_create_inferior (from_tty);
normal_stop ();
}
diff --git a/gdb/jit.c b/gdb/jit.c
index 5634c9e2b5d3..9298ac0f4877 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 (struct target_ops *ops, int from_tty)
+jit_inferior_created ()
{
jit_inferior_created_hook ();
}
diff --git a/gdb/linux-thread-db.c b/gdb/linux-thread-db.c
index 878e7bd183f6..c625cefead2f 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 (struct target_ops *target, int from_tty)
+thread_db_inferior_created ()
{
check_pid_namespace_match ();
check_for_thread_db ();
diff --git a/gdb/m68k-linux-tdep.c b/gdb/m68k-linux-tdep.c
index dcc7e089608e..e4fc2faecb20 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 (struct target_ops *objfile, int from_tty)
+m68k_linux_inferior_created ()
{
/* 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 da0a9b12f74c..d9d0f149f6f5 100644
--- a/gdb/observable.h
+++ b/gdb/observable.h
@@ -87,8 +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<struct target_ops */* target */,
- int /* from_tty */> 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 cc94ff8e1ea3..a7c59ad325a3 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 (struct target_ops *target, int from_tty)
+ravenscar_inferior_created ()
{
const char *err_msg;
diff --git a/gdb/symfile-mem.c b/gdb/symfile-mem.c
index 78096fcbae19..5f212e10323f 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 (struct target_ops *target, int from_tty)
+add_vsyscall_page ()
{
struct mem_range vsyscall_range;
diff --git a/gdb/tracectf.c b/gdb/tracectf.c
index 2c9a7495bfad..0c4f66dd5816 100644
--- a/gdb/tracectf.c
+++ b/gdb/tracectf.c
@@ -1175,7 +1175,7 @@ ctf_target_open (const char *dirname, int from_tty)
merge_uploaded_trace_state_variables (&uploaded_tsvs);
merge_uploaded_tracepoints (&uploaded_tps);
- post_create_inferior (&ctf_ops, from_tty);
+ post_create_inferior (from_tty);
}
/* This is the implementation of target_ops method to_close. Destroy
diff --git a/gdb/tracefile-tfile.c b/gdb/tracefile-tfile.c
index fd7bab822a12..9cf68c5cb6ec 100644
--- a/gdb/tracefile-tfile.c
+++ b/gdb/tracefile-tfile.c
@@ -571,7 +571,7 @@ tfile_target_open (const char *arg, int from_tty)
merge_uploaded_tracepoints (&uploaded_tps);
- post_create_inferior (&tfile_ops, from_tty);
+ post_create_inferior (from_tty);
}
/* Interpret the given line from the definitions part of the trace
--
2.28.0
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] gdb: remove arguments from inferior_created observable
2020-10-02 2:13 [PATCH] gdb: remove arguments from inferior_created observable Simon Marchi
@ 2020-10-02 9:49 ` Andrew Burgess
2020-10-02 15:33 ` Simon Marchi
0 siblings, 1 reply; 3+ messages in thread
From: Andrew Burgess @ 2020-10-02 9:49 UTC (permalink / raw)
To: Simon Marchi; +Cc: gdb-patches
* Simon Marchi via Gdb-patches <gdb-patches@sourceware.org> [2020-10-01 22:13:25 -0400]:
> I noticed that non of the listeners of the inferior_created observable
> used either of the arguments. Remove them. This in turn allows
> removing the target parameter of post_create_inferior.
>
> Tested only by rebuilding.
>
> gdb/ChangeLog:
>
> * observable.h <inferior_created>: Remove parameters. Update all
> listeners.
> * inferior.h (post_create_inferior): Remove target parameter.
> Update all callers.
LGTM.
Thanks,
Andrew
>
> Change-Id: I8944cefdc4447ed5347dc927b75abf1e7a0e27e6
> ---
> gdb/bsd-uthread.c | 2 +-
> gdb/corelow.c | 2 +-
> gdb/dummy-frame.c | 2 +-
> gdb/infcmd.c | 8 ++++----
> gdb/inferior.h | 2 +-
> gdb/infrun.c | 2 +-
> gdb/jit.c | 2 +-
> gdb/linux-thread-db.c | 2 +-
> gdb/m68k-linux-tdep.c | 2 +-
> gdb/observable.h | 3 +--
> gdb/ravenscar-thread.c | 2 +-
> gdb/symfile-mem.c | 2 +-
> gdb/tracectf.c | 2 +-
> gdb/tracefile-tfile.c | 2 +-
> 14 files changed, 17 insertions(+), 18 deletions(-)
>
> diff --git a/gdb/bsd-uthread.c b/gdb/bsd-uthread.c
> index 144e8b920fa9..e83707fd7c50 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 (struct target_ops *ops, int from_tty)
> +bsd_uthread_inferior_created ()
> {
> bsd_uthread_activate (NULL);
> }
> diff --git a/gdb/corelow.c b/gdb/corelow.c
> index de15895c80b5..e82c183eae5a 100644
> --- a/gdb/corelow.c
> +++ b/gdb/corelow.c
> @@ -516,7 +516,7 @@ core_target_open (const char *arg, int from_tty)
> if (exec_bfd == nullptr)
> locate_exec_from_corefile_build_id (core_bfd, from_tty);
>
> - post_create_inferior (target, from_tty);
> + post_create_inferior (from_tty);
>
> /* Now go through the target stack looking for threads since there
> may be a thread_stratum target loaded on top of target core by
> diff --git a/gdb/dummy-frame.c b/gdb/dummy-frame.c
> index d47cfd2d9a2d..1952d2eb6f30 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 (struct target_ops *target, int from_tty)
> +cleanup_dummy_frames ()
> {
> while (dummy_frame_stack != NULL)
> remove_dummy_frame (&dummy_frame_stack);
> diff --git a/gdb/infcmd.c b/gdb/infcmd.c
> index 81ce36dafe26..d8f95977a18c 100644
> --- a/gdb/infcmd.c
> +++ b/gdb/infcmd.c
> @@ -279,7 +279,7 @@ strip_bg_char (const char *args, int *bg_char_p)
> should be stopped. */
>
> void
> -post_create_inferior (struct target_ops *target, int from_tty)
> +post_create_inferior (int from_tty)
> {
>
> /* Be sure we own the terminal in case write operations are performed. */
> @@ -347,7 +347,7 @@ post_create_inferior (struct target_ops *target, int from_tty)
> if the now pushed target supports hardware watchpoints. */
> breakpoint_re_set ();
>
> - gdb::observers::inferior_created.notify (target, from_tty);
> + gdb::observers::inferior_created.notify ();
> }
>
> /* Kill the inferior if already running. This function is designed
> @@ -520,7 +520,7 @@ run_command_1 (const char *args, int from_tty, enum run_how run_how)
>
> /* Pass zero for FROM_TTY, because at this point the "run" command
> has done its thing; now we are setting up the running program. */
> - post_create_inferior (current_top_target (), 0);
> + post_create_inferior (0);
>
> /* Queue a pending event so that the program stops immediately. */
> if (run_how == RUN_STOP_AT_FIRST_INSN)
> @@ -2432,7 +2432,7 @@ setup_inferior (int from_tty)
> /* Take any necessary post-attaching actions for this platform. */
> target_post_attach (inferior_ptid.pid ());
>
> - post_create_inferior (current_top_target (), from_tty);
> + post_create_inferior (from_tty);
> }
>
> /* What to do after the first program stops after attaching. */
> diff --git a/gdb/inferior.h b/gdb/inferior.h
> index 70edf21b34bc..d016161fb051 100644
> --- a/gdb/inferior.h
> +++ b/gdb/inferior.h
> @@ -196,7 +196,7 @@ extern ptid_t gdb_startup_inferior (pid_t pid, int num_traps);
>
> extern void setup_inferior (int from_tty);
>
> -extern void post_create_inferior (struct target_ops *, int);
> +extern void post_create_inferior (int from_tty);
>
> extern void attach_command (const char *, int);
>
> diff --git a/gdb/infrun.c b/gdb/infrun.c
> index daf10417842f..a150585bd5ad 100644
> --- a/gdb/infrun.c
> +++ b/gdb/infrun.c
> @@ -3185,7 +3185,7 @@ start_remote (int from_tty)
> /* Now that the inferior has stopped, do any bookkeeping like
> loading shared libraries. We want to do this before normal_stop,
> so that the displayed frame is up to date. */
> - post_create_inferior (current_top_target (), from_tty);
> + post_create_inferior (from_tty);
>
> normal_stop ();
> }
> diff --git a/gdb/jit.c b/gdb/jit.c
> index 5634c9e2b5d3..9298ac0f4877 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 (struct target_ops *ops, int from_tty)
> +jit_inferior_created ()
> {
> jit_inferior_created_hook ();
> }
> diff --git a/gdb/linux-thread-db.c b/gdb/linux-thread-db.c
> index 878e7bd183f6..c625cefead2f 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 (struct target_ops *target, int from_tty)
> +thread_db_inferior_created ()
> {
> check_pid_namespace_match ();
> check_for_thread_db ();
> diff --git a/gdb/m68k-linux-tdep.c b/gdb/m68k-linux-tdep.c
> index dcc7e089608e..e4fc2faecb20 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 (struct target_ops *objfile, int from_tty)
> +m68k_linux_inferior_created ()
> {
> /* 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 da0a9b12f74c..d9d0f149f6f5 100644
> --- a/gdb/observable.h
> +++ b/gdb/observable.h
> @@ -87,8 +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<struct target_ops */* target */,
> - int /* from_tty */> 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 cc94ff8e1ea3..a7c59ad325a3 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 (struct target_ops *target, int from_tty)
> +ravenscar_inferior_created ()
> {
> const char *err_msg;
>
> diff --git a/gdb/symfile-mem.c b/gdb/symfile-mem.c
> index 78096fcbae19..5f212e10323f 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 (struct target_ops *target, int from_tty)
> +add_vsyscall_page ()
> {
> struct mem_range vsyscall_range;
>
> diff --git a/gdb/tracectf.c b/gdb/tracectf.c
> index 2c9a7495bfad..0c4f66dd5816 100644
> --- a/gdb/tracectf.c
> +++ b/gdb/tracectf.c
> @@ -1175,7 +1175,7 @@ ctf_target_open (const char *dirname, int from_tty)
> merge_uploaded_trace_state_variables (&uploaded_tsvs);
> merge_uploaded_tracepoints (&uploaded_tps);
>
> - post_create_inferior (&ctf_ops, from_tty);
> + post_create_inferior (from_tty);
> }
>
> /* This is the implementation of target_ops method to_close. Destroy
> diff --git a/gdb/tracefile-tfile.c b/gdb/tracefile-tfile.c
> index fd7bab822a12..9cf68c5cb6ec 100644
> --- a/gdb/tracefile-tfile.c
> +++ b/gdb/tracefile-tfile.c
> @@ -571,7 +571,7 @@ tfile_target_open (const char *arg, int from_tty)
>
> merge_uploaded_tracepoints (&uploaded_tps);
>
> - post_create_inferior (&tfile_ops, from_tty);
> + post_create_inferior (from_tty);
> }
>
> /* Interpret the given line from the definitions part of the trace
> --
> 2.28.0
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] gdb: remove arguments from inferior_created observable
2020-10-02 9:49 ` Andrew Burgess
@ 2020-10-02 15:33 ` Simon Marchi
0 siblings, 0 replies; 3+ messages in thread
From: Simon Marchi @ 2020-10-02 15:33 UTC (permalink / raw)
To: Andrew Burgess; +Cc: gdb-patches
On 2020-10-02 5:49 a.m., Andrew Burgess wrote:
> * Simon Marchi via Gdb-patches <gdb-patches@sourceware.org> [2020-10-01 22:13:25 -0400]:
>
>> I noticed that non of the listeners of the inferior_created observable
>> used either of the arguments. Remove them. This in turn allows
>> removing the target parameter of post_create_inferior.
>>
>> Tested only by rebuilding.
>>
>> gdb/ChangeLog:
>>
>> * observable.h <inferior_created>: Remove parameters. Update all
>> listeners.
>> * inferior.h (post_create_inferior): Remove target parameter.
>> Update all callers.
>
> LGTM.
>
> Thanks,
> Andrew
Thanks, pushed.
Simon
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-10-02 15:33 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-02 2:13 [PATCH] gdb: remove arguments from inferior_created observable Simon Marchi
2020-10-02 9:49 ` Andrew Burgess
2020-10-02 15:33 ` Simon Marchi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).