From a7aba2668a7b392182e296392d8e19516e1a6ec5 Mon Sep 17 00:00:00 2001 From: Simon Marchi Date: Fri, 2 Oct 2020 10:46:38 -0400 Subject: [PATCH] gdb: remove arguments from inferior_created observable 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 : Remove parameters. Update all listeners. * inferior.h (post_create_inferior): Remove target parameter. Update all callers. Change-Id: I8944cefdc4447ed5347dc927b75abf1e7a0e27e6 --- gdb/ChangeLog | 7 +++++++ 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 +- 15 files changed, 24 insertions(+), 18 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 9dd2123d60e..8788c60899f 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,10 @@ +2020-10-02 Simon Marchi + + * observable.h : Remove parameters. Update all + listeners. + * inferior.h (post_create_inferior): Remove target parameter. + Update all callers. + 2020-10-02 Nitika Achra * dwarf2/macro.c (dwarf_decode_macro_bytes): Handle DW_MACRO_define_strx diff --git a/gdb/bsd-uthread.c b/gdb/bsd-uthread.c index 144e8b920fa..e83707fd7c5 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 de15895c80b..e82c183eae5 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 d47cfd2d9a2..1952d2eb6f3 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 81ce36dafe2..d8f95977a18 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 70edf21b34b..d016161fb05 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 daf10417842..a150585bd5a 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 5634c9e2b5d..9298ac0f487 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 878e7bd183f..c625cefead2 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 dcc7e089608..e4fc2faecb2 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 da0a9b12f74..d9d0f149f6f 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 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 cc94ff8e1ea..a7c59ad325a 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 78096fcbae1..5f212e10323 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 2c9a7495bfa..0c4f66dd581 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 fd7bab822a1..9cf68c5cb6e 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.30.2