From de90e03d4c19cf5327b4eaea4ad8666a3a1bfad5 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Tue, 17 Dec 2013 21:27:56 -0700 Subject: [PATCH] Add target_ops argument to to_close 2014-02-19 Tom Tromey * windows-nat.c (windows_close): Add 'self' argument. * tracepoint.c (tfile_close): Add 'self' argument. * target.h (struct target_ops) : Add argument. * target.c (target_close): Add argument. (update_current_target): Update. * remote.c (remote_close): Add 'self' argument. * remote-sim.c (gdbsim_close): Add 'self' argument. * remote-mips.c (mips_close): Add 'self' argument. * remote-m32r-sdi.c (m32r_close): Add 'self' argument. * record-full.c (record_full_close): Add 'self' argument. * record-btrace.c (record_btrace_close): Add 'self' argument. * monitor.h (monitor_close): Add 'self' argument. * monitor.c (monitor_close): Add 'self' argument. * mips-linux-nat.c (mips_linux_close): Add 'self' argument. * linux-nat.c (linux_nat_close): Add argument. * go32-nat.c (go32_close): Add 'self' argument. * exec.c (exec_close_1): Add 'self' argument. * ctf.c (ctf_close): Add 'self' argument. * corelow.c (core_close): Add 'self' argument. (core_close_cleanup): Update. * bsd-uthread.c (bsd_uthread_close): Add 'self' argument. * bsd-kvm.c (bsd_kvm_close): Add 'self' argument. --- gdb/ChangeLog | 25 +++++++++++++++++++++++++ gdb/bsd-kvm.c | 2 +- gdb/bsd-uthread.c | 2 +- gdb/corelow.c | 6 +++--- gdb/ctf.c | 2 +- gdb/exec.c | 2 +- gdb/go32-nat.c | 3 +-- gdb/linux-nat.c | 4 ++-- gdb/mips-linux-nat.c | 2 +- gdb/monitor.c | 2 +- gdb/monitor.h | 2 +- gdb/record-btrace.c | 2 +- gdb/record-full.c | 2 +- gdb/remote-m32r-sdi.c | 2 +- gdb/remote-mips.c | 4 ++-- gdb/remote-sim.c | 4 ++-- gdb/remote.c | 4 ++-- gdb/target.c | 4 ++-- gdb/target.h | 2 +- gdb/tracepoint.c | 2 +- gdb/windows-nat.c | 2 +- 21 files changed, 52 insertions(+), 28 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 83910b0a9a8..a98901b10ea 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,28 @@ +2014-02-19 Tom Tromey + + * windows-nat.c (windows_close): Add 'self' argument. + * tracepoint.c (tfile_close): Add 'self' argument. + * target.h (struct target_ops) : Add argument. + * target.c (target_close): Add argument. + (update_current_target): Update. + * remote.c (remote_close): Add 'self' argument. + * remote-sim.c (gdbsim_close): Add 'self' argument. + * remote-mips.c (mips_close): Add 'self' argument. + * remote-m32r-sdi.c (m32r_close): Add 'self' argument. + * record-full.c (record_full_close): Add 'self' argument. + * record-btrace.c (record_btrace_close): Add 'self' argument. + * monitor.h (monitor_close): Add 'self' argument. + * monitor.c (monitor_close): Add 'self' argument. + * mips-linux-nat.c (mips_linux_close): Add 'self' argument. + * linux-nat.c (linux_nat_close): Add argument. + * go32-nat.c (go32_close): Add 'self' argument. + * exec.c (exec_close_1): Add 'self' argument. + * ctf.c (ctf_close): Add 'self' argument. + * corelow.c (core_close): Add 'self' argument. + (core_close_cleanup): Update. + * bsd-uthread.c (bsd_uthread_close): Add 'self' argument. + * bsd-kvm.c (bsd_kvm_close): Add 'self' argument. + 2014-02-19 Tom Tromey * remote.c (remote_load): New function. diff --git a/gdb/bsd-kvm.c b/gdb/bsd-kvm.c index fa7f83c0c8d..35ecebb1c00 100644 --- a/gdb/bsd-kvm.c +++ b/gdb/bsd-kvm.c @@ -105,7 +105,7 @@ bsd_kvm_open (char *filename, int from_tty) } static void -bsd_kvm_close (void) +bsd_kvm_close (struct target_ops *self) { if (core_kd) { diff --git a/gdb/bsd-uthread.c b/gdb/bsd-uthread.c index bf6c390f376..d235f41c7fe 100644 --- a/gdb/bsd-uthread.c +++ b/gdb/bsd-uthread.c @@ -204,7 +204,7 @@ bsd_uthread_activate (struct objfile *objfile) /* Cleanup due to deactivation. */ static void -bsd_uthread_close (void) +bsd_uthread_close (struct target_ops *self) { bsd_uthread_active = 0; bsd_uthread_thread_run_addr = 0; diff --git a/gdb/corelow.c b/gdb/corelow.c index 382bbb2004c..8a80be36ffa 100644 --- a/gdb/corelow.c +++ b/gdb/corelow.c @@ -85,7 +85,7 @@ static int gdb_check_format (bfd *); static void core_open (char *, int); -static void core_close (void); +static void core_close (struct target_ops *self); static void core_close_cleanup (void *ignore); @@ -192,7 +192,7 @@ gdb_check_format (bfd *abfd) stack spaces as empty. */ static void -core_close (void) +core_close (struct target_ops *self) { if (core_bfd) { @@ -223,7 +223,7 @@ core_close (void) static void core_close_cleanup (void *ignore) { - core_close (); + core_close (NULL); } /* Look for sections whose names start with `.reg/' so that we can diff --git a/gdb/ctf.c b/gdb/ctf.c index 71453dfe324..38c8abb7812 100644 --- a/gdb/ctf.c +++ b/gdb/ctf.c @@ -1204,7 +1204,7 @@ ctf_open (char *dirname, int from_tty) CTF iterator and context. */ static void -ctf_close (void) +ctf_close (struct target_ops *self) { int pid; diff --git a/gdb/exec.c b/gdb/exec.c index 23d61876f68..1885afd74e1 100644 --- a/gdb/exec.c +++ b/gdb/exec.c @@ -112,7 +112,7 @@ exec_close (void) sections and closes all executable bfds from all program spaces. */ static void -exec_close_1 (void) +exec_close_1 (struct target_ops *self) { using_exec_ops = 0; diff --git a/gdb/go32-nat.c b/gdb/go32-nat.c index 7dc6307c708..1529cc3d5ae 100644 --- a/gdb/go32-nat.c +++ b/gdb/go32-nat.c @@ -234,7 +234,6 @@ static int dr_ref_count[4]; #define SOME_PID 42 static int prog_has_started = 0; - static void go32_mourn_inferior (struct target_ops *ops); static struct target_ops go32_ops; @@ -347,7 +346,7 @@ go32_open (char *name, int from_tty) } static void -go32_close (void) +go32_close (struct target_ops *self) { } diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c index 6c31c3b2fd1..a76ba304389 100644 --- a/gdb/linux-nat.c +++ b/gdb/linux-nat.c @@ -4788,14 +4788,14 @@ linux_nat_stop (ptid_t ptid) } static void -linux_nat_close (void) +linux_nat_close (struct target_ops *self) { /* Unregister from the event loop. */ if (linux_nat_is_async_p (NULL)) linux_nat_async (NULL, NULL, 0); if (linux_ops->to_close) - linux_ops->to_close (); + linux_ops->to_close (linux_ops); } /* When requests are passed down from the linux-nat layer to the diff --git a/gdb/mips-linux-nat.c b/gdb/mips-linux-nat.c index 627241fa815..98f8d96d669 100644 --- a/gdb/mips-linux-nat.c +++ b/gdb/mips-linux-nat.c @@ -744,7 +744,7 @@ mips_linux_remove_watchpoint (CORE_ADDR addr, int len, int type, super implementation. */ static void -mips_linux_close (void) +mips_linux_close (struct target_ops *self) { struct mips_watchpoint *w; struct mips_watchpoint *nw; diff --git a/gdb/monitor.c b/gdb/monitor.c index 6c5154f38da..e88b28cf854 100644 --- a/gdb/monitor.c +++ b/gdb/monitor.c @@ -853,7 +853,7 @@ monitor_open (char *args, struct monitor_ops *mon_ops, int from_tty) control. */ void -monitor_close (void) +monitor_close (struct target_ops *self) { if (monitor_desc) serial_close (monitor_desc); diff --git a/gdb/monitor.h b/gdb/monitor.h index c7e7af83d09..07caf97fb7e 100644 --- a/gdb/monitor.h +++ b/gdb/monitor.h @@ -240,7 +240,7 @@ struct monitor_ops #define SREC_SIZE 160 extern void monitor_open (char *args, struct monitor_ops *ops, int from_tty); -extern void monitor_close (void); +extern void monitor_close (struct target_ops *self); extern char *monitor_supply_register (struct regcache *regcache, int regno, char *valstr); extern int monitor_expect (char *prompt, char *buf, int buflen); diff --git a/gdb/record-btrace.c b/gdb/record-btrace.c index b7a549ad3f1..75a1364228f 100644 --- a/gdb/record-btrace.c +++ b/gdb/record-btrace.c @@ -211,7 +211,7 @@ record_btrace_stop_recording (void) /* The to_close method of target record-btrace. */ static void -record_btrace_close (void) +record_btrace_close (struct target_ops *self) { struct thread_info *tp; diff --git a/gdb/record-full.c b/gdb/record-full.c index 0452dcadf5f..04ba714d11e 100644 --- a/gdb/record-full.c +++ b/gdb/record-full.c @@ -877,7 +877,7 @@ record_full_open (char *name, int from_tty) /* "to_close" target method. Close the process record target. */ static void -record_full_close (void) +record_full_close (struct target_ops *self) { struct record_full_core_buf_entry *entry; diff --git a/gdb/remote-m32r-sdi.c b/gdb/remote-m32r-sdi.c index 48c4b4bd27d..0bcfb1f69d6 100644 --- a/gdb/remote-m32r-sdi.c +++ b/gdb/remote-m32r-sdi.c @@ -429,7 +429,7 @@ m32r_open (char *args, int from_tty) /* Close out all files and local state before this target loses control. */ static void -m32r_close (void) +m32r_close (struct target_ops *self) { if (remote_debug) fprintf_unfiltered (gdb_stdlog, "m32r_close()\n"); diff --git a/gdb/remote-mips.c b/gdb/remote-mips.c index 6109e64bf6d..8dde5cc210f 100644 --- a/gdb/remote-mips.c +++ b/gdb/remote-mips.c @@ -84,7 +84,7 @@ static void ddb_open (char *name, int from_tty); static void lsi_open (char *name, int from_tty); -static void mips_close (void); +static void mips_close (struct target_ops *self); static int mips_map_regno (struct gdbarch *, int); @@ -1732,7 +1732,7 @@ lsi_open (char *name, int from_tty) /* Close a connection to the remote board. */ static void -mips_close (void) +mips_close (struct target_ops *self) { if (mips_is_open) { diff --git a/gdb/remote-sim.c b/gdb/remote-sim.c index 163af41ea89..1855f39ec55 100644 --- a/gdb/remote-sim.c +++ b/gdb/remote-sim.c @@ -76,7 +76,7 @@ static void gdbsim_load (char *prog, int fromtty); static void gdbsim_open (char *args, int from_tty); -static void gdbsim_close (void); +static void gdbsim_close (struct target_ops *self); static void gdbsim_detach (struct target_ops *ops, const char *args, int from_tty); @@ -788,7 +788,7 @@ gdbsim_close_inferior (struct inferior *inf, void *arg) /* Close out all files and local state before this target loses control. */ static void -gdbsim_close (void) +gdbsim_close (struct target_ops *self) { struct sim_inferior_data *sim_data = get_sim_inferior_data (current_inferior (), SIM_INSTANCE_NOT_NEEDED); diff --git a/gdb/remote.c b/gdb/remote.c index 9e0045adde5..fb90c5591ac 100644 --- a/gdb/remote.c +++ b/gdb/remote.c @@ -107,7 +107,7 @@ static void extended_remote_open (char *name, int from_tty); static void remote_open_1 (char *, int, struct target_ops *, int extended_p); -static void remote_close (void); +static void remote_close (struct target_ops *self); static void remote_mourn (struct target_ops *ops); @@ -2991,7 +2991,7 @@ extended_remote_restart (void) /* Clean up connection to a remote debugger. */ static void -remote_close (void) +remote_close (struct target_ops *self) { struct remote_state *rs = get_remote_state (); diff --git a/gdb/target.c b/gdb/target.c index 7ac87283e6b..e63725af670 100644 --- a/gdb/target.c +++ b/gdb/target.c @@ -718,7 +718,7 @@ update_current_target (void) (void (*) (char *, int)) tcomplain); de_fault (to_close, - (void (*) (void)) + (void (*) (struct target_ops *)) target_ignore); de_fault (to_post_attach, (void (*) (int)) @@ -3833,7 +3833,7 @@ target_close (struct target_ops *targ) if (targ->to_xclose != NULL) targ->to_xclose (targ); else if (targ->to_close != NULL) - targ->to_close (); + targ->to_close (targ); if (targetdebug) fprintf_unfiltered (gdb_stdlog, "target_close ()\n"); diff --git a/gdb/target.h b/gdb/target.h index 7709c16301f..125d649a88b 100644 --- a/gdb/target.h +++ b/gdb/target.h @@ -402,7 +402,7 @@ struct target_ops New re-entrant targets provide "to_xclose" and that is expected to xfree everything (including the "struct target_ops"). */ void (*to_xclose) (struct target_ops *targ); - void (*to_close) (void); + void (*to_close) (struct target_ops *); void (*to_attach) (struct target_ops *ops, char *, int); void (*to_post_attach) (int); void (*to_detach) (struct target_ops *ops, const char *, int); diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c index 80d0620a6af..47b31907564 100644 --- a/gdb/tracepoint.c +++ b/gdb/tracepoint.c @@ -4756,7 +4756,7 @@ parse_tsv_definition (char *line, struct uploaded_tsv **utsvp) /* Close the trace file and generally clean up. */ static void -tfile_close (void) +tfile_close (struct target_ops *self) { int pid; diff --git a/gdb/windows-nat.c b/gdb/windows-nat.c index 9212adfefd2..8dcc410c52c 100644 --- a/gdb/windows-nat.c +++ b/gdb/windows-nat.c @@ -2481,7 +2481,7 @@ windows_can_run (void) } static void -windows_close (void) +windows_close (struct target_ops *self) { DEBUG_EVENTS (("gdb: windows_close, inferior_ptid=%d\n", ptid_get_pid (inferior_ptid))); -- 2.30.2