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.
This commit is contained in:
parent
14064aa202
commit
7d85a9c0e3
17 changed files with 63 additions and 44 deletions
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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 ();
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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 */
|
||||
}
|
||||
|
|
|
@ -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 ();
|
||||
}
|
||||
|
|
|
@ -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)) /* ? */
|
||||
{
|
||||
|
|
|
@ -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");
|
||||
|
|
|
@ -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)));
|
||||
}
|
||||
|
|
|
@ -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 ();
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
34
gdb/target.c
34
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 *);
|
||||
|
@ -256,6 +254,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)
|
||||
{
|
||||
|
@ -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);
|
||||
|
@ -3024,14 +3037,6 @@ debug_to_terminal_info (char *arg, int from_tty)
|
|||
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)
|
||||
{
|
||||
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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));
|
||||
|
||||
|
|
Loading…
Reference in a new issue