From 460014f572f44fe3e8deb146cb92fd312c4c3339 Mon Sep 17 00:00:00 2001 From: Jan Kratochvil Date: Wed, 20 Mar 2013 15:46:24 +0000 Subject: [PATCH] gdb/ Code cleanup. * bfd-target.c (target_bfd_xclose): Remove parameter quitting. * bsd-kvm.c (bsd_kvm_close): Likewise. * bsd-uthread.c (bsd_uthread_close): Likewise. * corelow.c (core_close): Likewise. (core_close_cleanup): Remove parameter quitting from a caller. * event-top.c (async_disconnect): Likewise. * exec.c (exec_close_1): Remove parameter quitting. * go32-nat.c (go32_close): Likewise. * linux-nat.c (linux_nat_close): Remove parameter quitting. Remove parameter quitting from a caller. * mips-linux-nat.c (super_close): Remove parameter quitting from the variable. (mips_linux_close): Remove parameter quitting. Remove parameter quitting from a caller. * monitor.c (monitor_close): Remove parameter quitting. * monitor.h (monitor_close): Likewise. * record-btrace.c (record_btrace_close): Likewise. * record-full.c (record_full_close): Likewise. * remote-m32r-sdi.c (m32r_close): Remove parameter quitting and remove it also from fprintf_unfiltered. * remote-mips.c (mips_close): Remove parameter quitting. (mips_detach): Remove parameter quitting from a caller. * remote-sim.c (gdbsim_close): Remove parameter quitting. (gdbsim_close): Remove duplicate function comment. Remove parameter quitting and remove it also from printf_filtered. * remote.c (remote_close): Remove parameter quitting. * solib-svr4.c (enable_break): Remove parameter quitting from a caller. * target.c (update_current_target): Remove parameter int from to_close de_fault. (push_target, unpush_target, pop_target): Remove parameter quitting from a caller. (pop_all_targets_above, pop_all_targets): Remove parameter quitting. Remove parameter quitting from a caller. (target_preopen): Remove parameter quitting from a caller. (target_close): Remove parameter quitting. Remove parameter quitting from a caller two times. Remove parameter quitting also from fprintf_unfiltered. * target.h (struct target_ops): Remove parameter quitting and as int from fields to_xclose and to_close. (extern struct target_ops current_target): (target_close, pop_all_targets): Remove parameter quitting. Update the comment. (pop_all_targets_above): Remove parameter quitting. * top.c (quit_target): Remove parameter quitting from a caller. * tracepoint.c (tfile_close): Remove parameter quitting. * windows-nat.c (windows_close): Remove parameter quitting. --- gdb/ChangeLog | 50 +++++++++++++++++++++++++++++++++++++++++++ gdb/bfd-target.c | 2 +- gdb/bsd-kvm.c | 2 +- gdb/bsd-uthread.c | 2 +- gdb/corelow.c | 6 +++--- gdb/event-top.c | 2 +- gdb/exec.c | 2 +- gdb/go32-nat.c | 4 ++-- gdb/linux-nat.c | 4 ++-- gdb/mips-linux-nat.c | 6 +++--- gdb/monitor.c | 2 +- gdb/monitor.h | 2 +- gdb/record-btrace.c | 2 +- gdb/record-full.c | 2 +- gdb/remote-m32r-sdi.c | 4 ++-- gdb/remote-mips.c | 6 +++--- gdb/remote-sim.c | 13 +++-------- gdb/remote.c | 4 ++-- gdb/solib-svr4.c | 2 +- gdb/target.c | 26 +++++++++++----------- gdb/target.h | 28 ++++++++++-------------- gdb/top.c | 2 +- gdb/tracepoint.c | 2 +- gdb/windows-nat.c | 2 +- 24 files changed, 107 insertions(+), 70 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index b0799145d11..709a55b9e26 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,53 @@ +2013-03-20 Jan Kratochvil + + Code cleanup. + * bfd-target.c (target_bfd_xclose): Remove parameter quitting. + * bsd-kvm.c (bsd_kvm_close): Likewise. + * bsd-uthread.c (bsd_uthread_close): Likewise. + * corelow.c (core_close): Likewise. + (core_close_cleanup): Remove parameter quitting from a caller. + * event-top.c (async_disconnect): Likewise. + * exec.c (exec_close_1): Remove parameter quitting. + * go32-nat.c (go32_close): Likewise. + * linux-nat.c (linux_nat_close): Remove parameter quitting. Remove + parameter quitting from a caller. + * mips-linux-nat.c (super_close): Remove parameter quitting from the + variable. + (mips_linux_close): Remove parameter quitting. Remove parameter + quitting from a caller. + * monitor.c (monitor_close): Remove parameter quitting. + * monitor.h (monitor_close): Likewise. + * record-btrace.c (record_btrace_close): Likewise. + * record-full.c (record_full_close): Likewise. + * remote-m32r-sdi.c (m32r_close): Remove parameter quitting and remove + it also from fprintf_unfiltered. + * remote-mips.c (mips_close): Remove parameter quitting. + (mips_detach): Remove parameter quitting from a caller. + * remote-sim.c (gdbsim_close): Remove parameter quitting. + (gdbsim_close): Remove duplicate function comment. Remove parameter + quitting and remove it also from printf_filtered. + * remote.c (remote_close): Remove parameter quitting. + * solib-svr4.c (enable_break): Remove parameter quitting from a caller. + * target.c (update_current_target): Remove parameter int from to_close + de_fault. + (push_target, unpush_target, pop_target): Remove parameter quitting from + a caller. + (pop_all_targets_above, pop_all_targets): Remove parameter quitting. + Remove parameter quitting from a caller. + (target_preopen): Remove parameter quitting from a caller. + (target_close): Remove parameter quitting. Remove parameter quitting + from a caller two times. Remove parameter quitting also from + fprintf_unfiltered. + * target.h (struct target_ops): Remove parameter quitting and as int + from fields to_xclose and to_close. + (extern struct target_ops current_target): + (target_close, pop_all_targets): Remove parameter quitting. Update the + comment. + (pop_all_targets_above): Remove parameter quitting. + * top.c (quit_target): Remove parameter quitting from a caller. + * tracepoint.c (tfile_close): Remove parameter quitting. + * windows-nat.c (windows_close): Remove parameter quitting. + 2013-03-20 Corinna Vinschen * windows-nat.c (handle_output_debug_string): Replace call diff --git a/gdb/bfd-target.c b/gdb/bfd-target.c index ca32ffe9e9d..a7dee242008 100644 --- a/gdb/bfd-target.c +++ b/gdb/bfd-target.c @@ -67,7 +67,7 @@ target_bfd_get_section_table (struct target_ops *ops) } static void -target_bfd_xclose (struct target_ops *t, int quitting) +target_bfd_xclose (struct target_ops *t) { struct target_bfd_data *data = t->to_data; diff --git a/gdb/bsd-kvm.c b/gdb/bsd-kvm.c index 82694bd898a..1e43ccc936c 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 (int quitting) +bsd_kvm_close (void) { if (core_kd) { diff --git a/gdb/bsd-uthread.c b/gdb/bsd-uthread.c index 74716adb3ba..6a07985a5df 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 (int quitting) +bsd_uthread_close (void) { bsd_uthread_active = 0; bsd_uthread_thread_run_addr = 0; diff --git a/gdb/corelow.c b/gdb/corelow.c index a98ae548fe1..77bab82fa8a 100644 --- a/gdb/corelow.c +++ b/gdb/corelow.c @@ -85,7 +85,7 @@ static void core_open (char *, int); static void core_detach (struct target_ops *ops, char *, int); -static void core_close (int); +static void core_close (void); static void core_close_cleanup (void *ignore); @@ -192,7 +192,7 @@ gdb_check_format (bfd *abfd) stack spaces as empty. */ static void -core_close (int quitting) +core_close (void) { if (core_bfd) { @@ -223,7 +223,7 @@ core_close (int quitting) static void core_close_cleanup (void *ignore) { - core_close (0/*ignored*/); + core_close (); } /* Look for sections whose names start with `.reg/' so that we can diff --git a/gdb/event-top.c b/gdb/event-top.c index 6f3dfab55e3..bd92ef1cd28 100644 --- a/gdb/event-top.c +++ b/gdb/event-top.c @@ -867,7 +867,7 @@ async_disconnect (gdb_client_data arg) TRY_CATCH (exception, RETURN_MASK_ALL) { - pop_all_targets (1); + pop_all_targets (); } signal (SIGHUP, SIG_DFL); /*FIXME: ??????????? */ diff --git a/gdb/exec.c b/gdb/exec.c index 221e67952d8..f550194b18f 100644 --- a/gdb/exec.c +++ b/gdb/exec.c @@ -115,7 +115,7 @@ exec_close (void) sections and closes all executable bfds from all program spaces. */ static void -exec_close_1 (int quitting) +exec_close_1 (void) { struct vmap *vp, *nxt; diff --git a/gdb/go32-nat.c b/gdb/go32-nat.c index 3fab6683e00..ea6d1ca8fc8 100644 --- a/gdb/go32-nat.c +++ b/gdb/go32-nat.c @@ -234,7 +234,7 @@ static int dr_ref_count[4]; static int prog_has_started = 0; static void go32_open (char *name, int from_tty); -static void go32_close (int quitting); +static void go32_close (void); static void go32_attach (struct target_ops *ops, char *args, int from_tty); static void go32_detach (struct target_ops *ops, char *args, int from_tty); static void go32_resume (struct target_ops *ops, @@ -370,7 +370,7 @@ go32_open (char *name, int from_tty) } static void -go32_close (int quitting) +go32_close (void) { } diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c index 0713edd4451..3cbd126807e 100644 --- a/gdb/linux-nat.c +++ b/gdb/linux-nat.c @@ -5022,14 +5022,14 @@ linux_nat_stop (ptid_t ptid) } static void -linux_nat_close (int quitting) +linux_nat_close (void) { /* Unregister from the event loop. */ if (linux_nat_is_async_p ()) linux_nat_async (NULL, 0); if (linux_ops->to_close) - linux_ops->to_close (quitting); + linux_ops->to_close (); } /* 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 61e83c6339f..d323a82a24b 100644 --- a/gdb/mips-linux-nat.c +++ b/gdb/mips-linux-nat.c @@ -60,7 +60,7 @@ static void (*super_fetch_registers) (struct target_ops *, static void (*super_store_registers) (struct target_ops *, struct regcache *, int); -static void (*super_close) (int); +static void (*super_close) (void); /* Map gdb internal register number to ptrace ``address''. These ``addresses'' are normally defined in . @@ -1114,7 +1114,7 @@ mips_linux_remove_watchpoint (CORE_ADDR addr, int len, int type, super implementation. */ static void -mips_linux_close (int quitting) +mips_linux_close (void) { struct mips_watchpoint *w; struct mips_watchpoint *nw; @@ -1130,7 +1130,7 @@ mips_linux_close (int quitting) current_watches = NULL; if (super_close) - super_close (quitting); + super_close (); } void _initialize_mips_linux_nat (void); diff --git a/gdb/monitor.c b/gdb/monitor.c index e6a97669b03..0337075959b 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 (int quitting) +monitor_close (void) { if (monitor_desc) serial_close (monitor_desc); diff --git a/gdb/monitor.h b/gdb/monitor.h index e7157290751..f66d1e7ae36 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 (int quitting); +extern void monitor_close (void); 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 bbb0bd57df3..e85de5e50f8 100644 --- a/gdb/record-btrace.c +++ b/gdb/record-btrace.c @@ -190,7 +190,7 @@ record_btrace_stop_recording (void) /* The to_close method of target record-btrace. */ static void -record_btrace_close (int quitting) +record_btrace_close (void) { /* We already stopped recording. */ } diff --git a/gdb/record-full.c b/gdb/record-full.c index e7af504d5af..23b8833cd42 100644 --- a/gdb/record-full.c +++ b/gdb/record-full.c @@ -1021,7 +1021,7 @@ record_full_open (char *name, int from_tty) /* "to_close" target method. Close the process record target. */ static void -record_full_close (int quitting) +record_full_close (void) { struct record_full_core_buf_entry *entry; diff --git a/gdb/remote-m32r-sdi.c b/gdb/remote-m32r-sdi.c index 2b23273fb5d..7ac63224ea1 100644 --- a/gdb/remote-m32r-sdi.c +++ b/gdb/remote-m32r-sdi.c @@ -430,10 +430,10 @@ m32r_open (char *args, int from_tty) /* Close out all files and local state before this target loses control. */ static void -m32r_close (int quitting) +m32r_close (void) { if (remote_debug) - fprintf_unfiltered (gdb_stdlog, "m32r_close(%d)\n", quitting); + fprintf_unfiltered (gdb_stdlog, "m32r_close()\n"); if (sdi_desc) { diff --git a/gdb/remote-mips.c b/gdb/remote-mips.c index f832d84bade..bc36a00bd85 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 (int quitting); +static void mips_close (void); static void mips_detach (struct target_ops *ops, char *args, int from_tty); @@ -1723,7 +1723,7 @@ lsi_open (char *name, int from_tty) /* Close a connection to the remote board. */ static void -mips_close (int quitting) +mips_close (void) { if (mips_is_open) { @@ -1746,7 +1746,7 @@ mips_detach (struct target_ops *ops, char *args, int from_tty) pop_target (); - mips_close (1); + mips_close (); if (from_tty) printf_unfiltered ("Ending remote MIPS debugging.\n"); diff --git a/gdb/remote-sim.c b/gdb/remote-sim.c index a578bbc0740..ae039502dde 100644 --- a/gdb/remote-sim.c +++ b/gdb/remote-sim.c @@ -78,7 +78,7 @@ static void gdbsim_load (char *prog, int fromtty); static void gdbsim_open (char *args, int from_tty); -static void gdbsim_close (int quitting); +static void gdbsim_close (void); static void gdbsim_detach (struct target_ops *ops, char *args, int from_tty); @@ -782,23 +782,16 @@ gdbsim_close_inferior (struct inferior *inf, void *arg) return 0; } -/* Does whatever cleanup is required for a target that we are no longer - going to be calling. Argument says whether we are quitting gdb and - should not get hung in case of errors, or whether we want a clean - termination even if it takes a while. This routine is automatically - always called just before a routine is popped off the target stack. - Closing file descriptors and freeing memory are typical things it should - do. */ /* Close out all files and local state before this target loses control. */ static void -gdbsim_close (int quitting) +gdbsim_close (void) { struct sim_inferior_data *sim_data = get_sim_inferior_data (current_inferior (), SIM_INSTANCE_NOT_NEEDED); if (remote_debug) - printf_filtered ("gdbsim_close: quitting %d\n", quitting); + printf_filtered ("gdbsim_close\n"); iterate_over_inferiors (gdbsim_close_inferior, NULL); diff --git a/gdb/remote.c b/gdb/remote.c index 21d86f7b41e..d0a2ee9876b 100644 --- a/gdb/remote.c +++ b/gdb/remote.c @@ -108,7 +108,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 (int quitting); +static void remote_close (void); static void remote_mourn (struct target_ops *ops); @@ -3001,7 +3001,7 @@ extended_remote_restart (void) /* Clean up connection to a remote debugger. */ static void -remote_close (int quitting) +remote_close (void) { if (remote_desc == NULL) return; /* already closed */ diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c index 0f70097e089..601e34daa90 100644 --- a/gdb/solib-svr4.c +++ b/gdb/solib-svr4.c @@ -1675,7 +1675,7 @@ enable_break (struct svr4_info *info, int from_tty) /* We're done with both the temporary bfd and target. Closing the target closes the underlying bfd, because it holds the only remaining reference. */ - target_close (tmp_bfd_target, 0); + target_close (tmp_bfd_target); if (sym_addr != 0) { diff --git a/gdb/target.c b/gdb/target.c index a961d7b831e..9193c97ea14 100644 --- a/gdb/target.c +++ b/gdb/target.c @@ -738,7 +738,7 @@ update_current_target (void) (void (*) (char *, int)) tcomplain); de_fault (to_close, - (void (*) (int)) + (void (*) (void)) target_ignore); de_fault (to_post_attach, (void (*) (int)) @@ -1015,7 +1015,7 @@ push_target (struct target_ops *t) (*cur) = (*cur)->beneath; tmp->beneath = NULL; - target_close (tmp, 0); + target_close (tmp); } /* We have removed all targets in our stratum, now add the new one. */ @@ -1062,7 +1062,7 @@ unpush_target (struct target_ops *t) /* Finally close the target. Note we do this after unchaining, so any target method calls from within the target_close implementation don't end up in T anymore. */ - target_close (t, 0); + target_close (t); return 1; } @@ -1070,7 +1070,7 @@ unpush_target (struct target_ops *t) void pop_target (void) { - target_close (target_stack, 0); /* Let it clean up. */ + target_close (target_stack); /* Let it clean up. */ if (unpush_target (target_stack) == 1) return; @@ -1082,11 +1082,11 @@ pop_target (void) } void -pop_all_targets_above (enum strata above_stratum, int quitting) +pop_all_targets_above (enum strata above_stratum) { while ((int) (current_target.to_stratum) > (int) above_stratum) { - target_close (target_stack, quitting); + target_close (target_stack); if (!unpush_target (target_stack)) { fprintf_unfiltered (gdb_stderr, @@ -1100,9 +1100,9 @@ pop_all_targets_above (enum strata above_stratum, int quitting) } void -pop_all_targets (int quitting) +pop_all_targets (void) { - pop_all_targets_above (dummy_stratum, quitting); + pop_all_targets_above (dummy_stratum); } /* Return 1 if T is now pushed in the target stack. Return 0 otherwise. */ @@ -2573,7 +2573,7 @@ target_preopen (int from_tty) it doesn't (which seems like a win for UDI), remove it now. */ /* Leave the exec target, though. The user may be switching from a live process to a core of the same program. */ - pop_all_targets_above (file_stratum, 0); + pop_all_targets_above (file_stratum); target_pre_inferior (from_tty); } @@ -3775,15 +3775,15 @@ debug_to_open (char *args, int from_tty) } void -target_close (struct target_ops *targ, int quitting) +target_close (struct target_ops *targ) { if (targ->to_xclose != NULL) - targ->to_xclose (targ, quitting); + targ->to_xclose (targ); else if (targ->to_close != NULL) - targ->to_close (quitting); + targ->to_close (); if (targetdebug) - fprintf_unfiltered (gdb_stdlog, "target_close (%d)\n", quitting); + fprintf_unfiltered (gdb_stdlog, "target_close ()\n"); } void diff --git a/gdb/target.h b/gdb/target.h index c030ee68b21..ee3fbff4b0c 100644 --- a/gdb/target.h +++ b/gdb/target.h @@ -420,8 +420,8 @@ struct target_ops /* Old targets with a static target vector provide "to_close". 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, int quitting); - void (*to_close) (int); + void (*to_xclose) (struct target_ops *targ); + void (*to_close) (void); void (*to_attach) (struct target_ops *ops, char *, int); void (*to_post_attach) (int); void (*to_detach) (struct target_ops *ops, char *, int); @@ -959,15 +959,13 @@ extern struct target_ops current_target; #define target_longname (current_target.to_longname) /* Does whatever cleanup is required for a target that we are no - longer going to be calling. QUITTING indicates that GDB is exiting - and should not get hung on an error (otherwise it is important to - perform clean termination, even if it takes a while). This routine - is automatically always called after popping the target off the - target stack - the target's own methods are no longer available - through the target vector. Closing file descriptors and freeing all - memory allocated memory are typical things it should do. */ + longer going to be calling. This routine is automatically always + called after popping the target off the target stack - the target's + own methods are no longer available through the target vector. + Closing file descriptors and freeing all memory allocated memory are + typical things it should do. */ -void target_close (struct target_ops *targ, int quitting); +void target_close (struct target_ops *targ); /* Attaches to a process on the target side. Arguments are as passed to the `attach' command by the user. This routine can be called @@ -1858,16 +1856,12 @@ extern void target_preopen (int); extern void pop_target (void); -/* Does whatever cleanup is required to get rid of all pushed targets. - QUITTING is propagated to target_close; it indicates that GDB is - exiting and should not get hung on an error (otherwise it is - important to perform clean termination, even if it takes a - while). */ -extern void pop_all_targets (int quitting); +/* Does whatever cleanup is required to get rid of all pushed targets. */ +extern void pop_all_targets (void); /* Like pop_all_targets, but pops only targets whose stratum is strictly above ABOVE_STRATUM. */ -extern void pop_all_targets_above (enum strata above_stratum, int quitting); +extern void pop_all_targets_above (enum strata above_stratum); extern int target_is_pushed (struct target_ops *t); diff --git a/gdb/top.c b/gdb/top.c index 3c6371ceb7a..e06c5ee7760 100644 --- a/gdb/top.c +++ b/gdb/top.c @@ -1295,7 +1295,7 @@ quit_target (void *arg) /* Give all pushed targets a chance to do minimal cleanup, and pop them all out. */ - pop_all_targets (1); + pop_all_targets (); /* Save the history information if it is appropriate to do so. */ if (write_history_p && history_filename) diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c index 28d34a7250c..a33905a479c 100644 --- a/gdb/tracepoint.c +++ b/gdb/tracepoint.c @@ -4625,7 +4625,7 @@ parse_tsv_definition (char *line, struct uploaded_tsv **utsvp) /* Close the trace file and generally clean up. */ static void -tfile_close (int quitting) +tfile_close (void) { int pid; diff --git a/gdb/windows-nat.c b/gdb/windows-nat.c index e648d5fa90e..f61bb79fcaf 100644 --- a/gdb/windows-nat.c +++ b/gdb/windows-nat.c @@ -2367,7 +2367,7 @@ windows_can_run (void) } static void -windows_close (int x) +windows_close (void) { DEBUG_EVENTS (("gdb: windows_close, inferior_ptid=%d\n", PIDGET (inferior_ptid))); -- 2.30.2