diff options
author | Joel Brobecker <brobecker@gnat.com> | 2009-03-17 19:28:09 +0000 |
---|---|---|
committer | Joel Brobecker <brobecker@gnat.com> | 2009-03-17 19:28:09 +0000 |
commit | 7d85a9c0e3639345cb6d19c139ccb9da5095fc76 (patch) | |
tree | 72a4cba16ffa78f6e727bde589b242829e4facab /gdb | |
parent | 14064aa202f80cd07434295c44268f44944859aa (diff) | |
download | gdb-7d85a9c0e3639345cb6d19c139ccb9da5095fc76.zip gdb-7d85a9c0e3639345cb6d19c139ccb9da5095fc76.tar.gz gdb-7d85a9c0e3639345cb6d19c139ccb9da5095fc76.tar.bz2 |
Add a target_ops parameter to the to_kill method in struct target_ops.
* target.h (struct target_ops): Add a "target_ops *" parameter to
method to_kill.
(target_kill): Remove macro. Add declaration.
* target.c (debug_to_kill): Delete, no longer necessary.
(target_kill): New function.
(update_current_target): Stop inheriting the to_kill method.
Do not de_fault it to no_process either.
(setup_target_debug): Do not set current_target.to_kill.
* gnu-nat.c, go32-nat.c, hpux-thread.c, inf-ptrace.c, inf-ttrace.c,
linux-nat.c, monitor.c, nto-procfs.c, procfs.c, remote-m32r-sdi.c,
remote-mips.c, remote-sim.c, remote.c, windows-nat.c: Update
accordingly.
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/ChangeLog | 17 | ||||
-rw-r--r-- | gdb/gnu-nat.c | 2 | ||||
-rw-r--r-- | gdb/go32-nat.c | 8 | ||||
-rw-r--r-- | gdb/hpux-thread.c | 4 | ||||
-rw-r--r-- | gdb/inf-ptrace.c | 2 | ||||
-rw-r--r-- | gdb/inf-ttrace.c | 2 | ||||
-rw-r--r-- | gdb/linux-nat.c | 2 | ||||
-rw-r--r-- | gdb/monitor.c | 2 | ||||
-rw-r--r-- | gdb/nto-procfs.c | 2 | ||||
-rw-r--r-- | gdb/procfs.c | 4 | ||||
-rw-r--r-- | gdb/remote-m32r-sdi.c | 2 | ||||
-rw-r--r-- | gdb/remote-mips.c | 3 | ||||
-rw-r--r-- | gdb/remote-sim.c | 6 | ||||
-rw-r--r-- | gdb/remote.c | 6 | ||||
-rw-r--r-- | gdb/target.c | 34 | ||||
-rw-r--r-- | gdb/target.h | 5 | ||||
-rw-r--r-- | gdb/windows-nat.c | 6 |
17 files changed, 63 insertions, 44 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index ce50ba2..1759b0b 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,20 @@ +2009-03-17 Joel Brobecker <brobecker@adacore.com> + + Add a target_ops parameter to the to_kill method in struct target_ops. + + * target.h (struct target_ops): Add a "target_ops *" parameter to + method to_kill. + (target_kill): Remove macro. Add declaration. + * target.c (debug_to_kill): Delete, no longer necessary. + (target_kill): New function. + (update_current_target): Stop inheriting the to_kill method. + Do not de_fault it to no_process either. + (setup_target_debug): Do not set current_target.to_kill. + * gnu-nat.c, go32-nat.c, hpux-thread.c, inf-ptrace.c, inf-ttrace.c, + linux-nat.c, monitor.c, nto-procfs.c, procfs.c, remote-m32r-sdi.c, + remote-mips.c, remote-sim.c, remote.c, windows-nat.c: Update + accordingly. + 2009-03-17 Doug Evans <dje@google.com> * amd64-linux-nat.c (si_timerid,si_overrun): Provide definition for diff --git a/gdb/gnu-nat.c b/gdb/gnu-nat.c index a43a47d..20b5958 100644 --- a/gdb/gnu-nat.c +++ b/gdb/gnu-nat.c @@ -2030,7 +2030,7 @@ gnu_resume (struct target_ops *ops, static void -gnu_kill_inferior (void) +gnu_kill_inferior (struct target_ops *ops) { struct proc *task = gnu_current_inf->task; if (task) diff --git a/gdb/go32-nat.c b/gdb/go32-nat.c index ce8b6dc..e1f793e 100644 --- a/gdb/go32-nat.c +++ b/gdb/go32-nat.c @@ -184,7 +184,7 @@ static int go32_xfer_memory (CORE_ADDR memaddr, gdb_byte *myaddr, int len, struct target_ops *target); static void go32_files_info (struct target_ops *target); static void go32_stop (ptid_t); -static void go32_kill_inferior (void); +static void go32_kill_inferior (struct target_ops *ops); static void go32_create_inferior (struct target_ops *ops, char *exec_file, char *args, char **env, int from_tty); static void go32_mourn_inferior (struct target_ops *ops); @@ -580,7 +580,7 @@ go32_stop (ptid_t ptid) } static void -go32_kill_inferior (void) +go32_kill_inferior (struct target_ops *ops) { redir_cmdline_delete (&child_cmd); resume_signal = -1; @@ -608,7 +608,7 @@ go32_create_inferior (struct target_ops *ops, char *exec_file, if (prog_has_started) { go32_stop (inferior_ptid); - go32_kill_inferior (); + go32_kill_inferior (ops); } resume_signal = -1; resume_is_step = 0; @@ -691,7 +691,7 @@ go32_mourn_inferior (struct target_ops *ops) at all times, but it doesn't, probably under an assumption that the OS cleans up when the debuggee exits. */ i386_cleanup_dregs (); - go32_kill_inferior (); + go32_kill_inferior (ops); generic_mourn_inferior (); } diff --git a/gdb/hpux-thread.c b/gdb/hpux-thread.c index f0acfcf..bdc547d 100644 --- a/gdb/hpux-thread.c +++ b/gdb/hpux-thread.c @@ -426,9 +426,9 @@ hpux_thread_files_info (struct target_ops *ignore) } static void -hpux_thread_kill_inferior (void) +hpux_thread_kill_inferior (struct target_ops *ops) { - deprecated_child_ops.to_kill (); + deprecated_child_ops.to_kill (&deprecated_child_ops); } static void diff --git a/gdb/inf-ptrace.c b/gdb/inf-ptrace.c index f40b6b7..f088ffd 100644 --- a/gdb/inf-ptrace.c +++ b/gdb/inf-ptrace.c @@ -320,7 +320,7 @@ inf_ptrace_detach (struct target_ops *ops, char *args, int from_tty) /* Kill the inferior. */ static void -inf_ptrace_kill (void) +inf_ptrace_kill (struct target_ops *ops) { pid_t pid = ptid_get_pid (inferior_ptid); int status; diff --git a/gdb/inf-ttrace.c b/gdb/inf-ttrace.c index 965282a..3014c2c 100644 --- a/gdb/inf-ttrace.c +++ b/gdb/inf-ttrace.c @@ -814,7 +814,7 @@ inf_ttrace_detach (struct target_ops *ops, char *args, int from_tty) } static void -inf_ttrace_kill (void) +inf_ttrace_kill (struct target_ops *ops) { pid_t pid = ptid_get_pid (inferior_ptid); diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c index 12b786e..cc5d3e7 100644 --- a/gdb/linux-nat.c +++ b/gdb/linux-nat.c @@ -3167,7 +3167,7 @@ kill_wait_callback (struct lwp_info *lp, void *data) } static void -linux_nat_kill (void) +linux_nat_kill (struct target_ops *ops) { struct target_waitstatus last; ptid_t last_ptid; diff --git a/gdb/monitor.c b/gdb/monitor.c index 5557998..60db1dc 100644 --- a/gdb/monitor.c +++ b/gdb/monitor.c @@ -1991,7 +1991,7 @@ monitor_xfer_memory (CORE_ADDR memaddr, gdb_byte *myaddr, int len, int write, } static void -monitor_kill (void) +monitor_kill (struct target_ops *ops) { return; /* ignore attempts to kill target system */ } diff --git a/gdb/nto-procfs.c b/gdb/nto-procfs.c index 75102f1..b46c64d 100644 --- a/gdb/nto-procfs.c +++ b/gdb/nto-procfs.c @@ -1120,7 +1120,7 @@ procfs_stop (ptid_t ptid) } static void -procfs_kill_inferior (void) +procfs_kill_inferior (struct target_ops *ops) { target_mourn_inferior (); } diff --git a/gdb/procfs.c b/gdb/procfs.c index c4b6b55..adb44f4 100644 --- a/gdb/procfs.c +++ b/gdb/procfs.c @@ -123,7 +123,7 @@ static void procfs_fetch_registers (struct target_ops *, static void procfs_store_registers (struct target_ops *, struct regcache *, int); static void procfs_notice_signals (ptid_t); -static void procfs_kill_inferior (void); +static void procfs_kill_inferior (struct target_ops *ops); static void procfs_mourn_inferior (struct target_ops *ops); static void procfs_create_inferior (struct target_ops *, char *, char *, char **, int); @@ -4764,7 +4764,7 @@ unconditionally_kill_inferior (procinfo *pi) */ static void -procfs_kill_inferior (void) +procfs_kill_inferior (struct target_ops *ops) { if (!ptid_equal (inferior_ptid, null_ptid)) /* ? */ { diff --git a/gdb/remote-m32r-sdi.c b/gdb/remote-m32r-sdi.c index baf9c61..c7f908e 100644 --- a/gdb/remote-m32r-sdi.c +++ b/gdb/remote-m32r-sdi.c @@ -1112,7 +1112,7 @@ m32r_xfer_memory (CORE_ADDR memaddr, gdb_byte *myaddr, int len, } static void -m32r_kill (void) +m32r_kill (struct target_ops *ops) { if (remote_debug) fprintf_unfiltered (gdb_stdlog, "m32r_kill()\n"); diff --git a/gdb/remote-mips.c b/gdb/remote-mips.c index 9b514b1..b35bb62 100644 --- a/gdb/remote-mips.c +++ b/gdb/remote-mips.c @@ -2129,7 +2129,7 @@ mips_files_info (struct target_ops *ignore) right port, we could interrupt the process with a break signal. */ static void -mips_kill (void) +mips_kill (struct target_ops *ops) { if (!mips_wait_flag) return; @@ -3276,7 +3276,6 @@ mips_load (char *file, int from_tty) to a different value than GDB thinks it has. The following ensures that the write_pc() WILL update the PC value: */ struct regcache *regcache = get_current_regcache (); - regcache_invalidate (regcache, gdbarch_pc_regnum (get_regcache_arch (regcache))); } diff --git a/gdb/remote-sim.c b/gdb/remote-sim.c index bb67b88..4eae65a 100644 --- a/gdb/remote-sim.c +++ b/gdb/remote-sim.c @@ -72,7 +72,7 @@ static void gdb_os_evprintf_filtered (host_callback *, const char *, va_list); static void gdb_os_error (host_callback *, const char *, ...) ATTR_NORETURN; -static void gdbsim_kill (void); +static void gdbsim_kill (struct target_ops *); static void gdbsim_load (char *prog, int fromtty); @@ -378,7 +378,7 @@ gdbsim_store_register (struct target_ops *ops, and releasing other resources acquired by the simulated program. */ static void -gdbsim_kill (void) +gdbsim_kill (struct target_ops *ops) { if (remote_debug) printf_filtered ("gdbsim_kill\n"); @@ -451,7 +451,7 @@ gdbsim_create_inferior (struct target_ops *target, char *exec_file, char *args, args); if (ptid_equal (inferior_ptid, remote_sim_ptid)) - gdbsim_kill (); + gdbsim_kill (target); remove_breakpoints (); init_wait_for_inferior (); diff --git a/gdb/remote.c b/gdb/remote.c index 0c27307..e3a7170b 100644 --- a/gdb/remote.c +++ b/gdb/remote.c @@ -111,7 +111,7 @@ static void remote_send (char **buf, long *sizeof_buf_p); static int readchar (int timeout); -static void remote_kill (void); +static void remote_kill (struct target_ops *ops); static int tohex (int nib); @@ -6528,7 +6528,7 @@ getpkt_or_notif_sane (char **buf, long *sizeof_buf, int forever) static void -remote_kill (void) +remote_kill (struct target_ops *ops) { /* Use catch_errors so the user can quit from gdb even when we aren't on speaking terms with the remote system. */ @@ -6560,7 +6560,7 @@ remote_vkill (int pid, struct remote_state *rs) } static void -extended_remote_kill (void) +extended_remote_kill (struct target_ops *ops) { int res; int pid = ptid_get_pid (inferior_ptid); diff --git a/gdb/target.c b/gdb/target.c index b89d551..86cdb71 100644 --- a/gdb/target.c +++ b/gdb/target.c @@ -136,8 +136,6 @@ static void debug_to_terminal_ours (void); static void debug_to_terminal_info (char *, int); -static void debug_to_kill (void); - static void debug_to_load (char *, int); static int debug_to_lookup_symbol (char *, CORE_ADDR *); @@ -257,6 +255,24 @@ target_ignore (void) } void +target_kill (void) +{ + struct target_ops *t; + + for (t = current_target.beneath; t != NULL; t = t->beneath) + if (t->to_kill != NULL) + { + if (targetdebug) + fprintf_unfiltered (gdb_stdlog, "target_kill ()\n"); + + t->to_kill (t); + return; + } + + noprocess (); +} + +void target_load (char *arg, int from_tty) { dcache_invalidate (target_dcache); @@ -430,7 +446,7 @@ update_current_target (void) INHERIT (to_terminal_ours, t); INHERIT (to_terminal_save_ours, t); INHERIT (to_terminal_info, t); - INHERIT (to_kill, t); + /* Do not inherit to_kill. */ INHERIT (to_load, t); INHERIT (to_lookup_symbol, t); /* Do no inherit to_create_inferior. */ @@ -556,9 +572,6 @@ update_current_target (void) target_ignore); de_fault (to_terminal_info, default_terminal_info); - de_fault (to_kill, - (void (*) (void)) - noprocess); de_fault (to_load, (void (*) (char *, int)) tcomplain); @@ -3025,14 +3038,6 @@ debug_to_terminal_info (char *arg, int from_tty) } static void -debug_to_kill (void) -{ - debug_target.to_kill (); - - fprintf_unfiltered (gdb_stdlog, "target_kill ()\n"); -} - -static void debug_to_load (char *args, int from_tty) { debug_target.to_load (args, from_tty); @@ -3227,7 +3232,6 @@ setup_target_debug (void) current_target.to_terminal_ours = debug_to_terminal_ours; current_target.to_terminal_save_ours = debug_to_terminal_save_ours; current_target.to_terminal_info = debug_to_terminal_info; - current_target.to_kill = debug_to_kill; current_target.to_load = debug_to_load; current_target.to_lookup_symbol = debug_to_lookup_symbol; current_target.to_post_startup_inferior = debug_to_post_startup_inferior; diff --git a/gdb/target.h b/gdb/target.h index 7f4cd8f..e7f087b 100644 --- a/gdb/target.h +++ b/gdb/target.h @@ -378,7 +378,7 @@ struct target_ops void (*to_terminal_ours) (void); void (*to_terminal_save_ours) (void); void (*to_terminal_info) (char *, int); - void (*to_kill) (void); + void (*to_kill) (struct target_ops *); void (*to_load) (char *, int); int (*to_lookup_symbol) (char *, CORE_ADDR *); void (*to_create_inferior) (struct target_ops *, @@ -790,8 +790,7 @@ extern void print_section_info (struct target_ops *, bfd *); /* Kill the inferior process. Make it go away. */ -#define target_kill() \ - (*current_target.to_kill) () +extern void target_kill (void); /* Load an executable file into the target process. This is expected to not only bring new code into the target process, but also to diff --git a/gdb/windows-nat.c b/gdb/windows-nat.c index 33ff1a0..2ab1709 100644 --- a/gdb/windows-nat.c +++ b/gdb/windows-nat.c @@ -114,7 +114,7 @@ static int debug_registers_used; static void windows_stop (ptid_t); static int windows_thread_alive (struct target_ops *, ptid_t); -static void windows_kill_inferior (void); +static void windows_kill_inferior (struct target_ops *); static enum target_signal last_sig = TARGET_SIGNAL_0; /* Set if a signal was received from the debugged process */ @@ -1493,7 +1493,7 @@ windows_wait (struct target_ops *ops, detach = deprecated_ui_loop_hook (0); if (detach) - windows_kill_inferior (); + windows_kill_inferior (ops); } } } @@ -2014,7 +2014,7 @@ windows_xfer_memory (CORE_ADDR memaddr, gdb_byte *our, int len, } static void -windows_kill_inferior (void) +windows_kill_inferior (struct target_ops *ops) { CHECK (TerminateProcess (current_process_handle, 0)); |