1 /* Default child (native) target interface, for GDB when running under
4 Copyright (C) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1998,
5 1999, 2000, 2001, 2002, 2004, 2005, 2007 Free Software Foundation, Inc.
7 This file is part of GDB.
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 3 of the License, or
12 (at your option) any later version.
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
19 You should have received a copy of the GNU General Public License
20 along with this program. If not, see <http://www.gnu.org/licenses/>. */
28 #include "gdb_string.h"
30 /* Fetch register REGNUM from the inferior. If REGNUM is -1, do this
34 inf_child_fetch_inferior_registers (struct regcache
*regcache
, int regnum
)
39 regnum
< gdbarch_num_regs (get_regcache_arch (regcache
));
41 regcache_raw_supply (regcache
, regnum
, NULL
);
44 regcache_raw_supply (regcache
, regnum
, NULL
);
47 /* Store register REGNUM back into the inferior. If REGNUM is -1, do
48 this for all registers (including the floating point registers). */
51 inf_child_store_inferior_registers (struct regcache
*regcache
, int regnum
)
56 inf_child_post_attach (int pid
)
58 /* This version of Unix doesn't require a meaningful "post attach"
59 operation by a debugger. */
62 /* Get ready to modify the registers array. On machines which store
63 individual registers, this doesn't need to do anything. On
64 machines which store all the registers in one fell swoop, this
65 makes sure that registers contains all the registers from the
66 program being debugged. */
69 inf_child_prepare_to_store (struct regcache
*regcache
)
74 inf_child_open (char *arg
, int from_tty
)
76 error (_("Use the \"run\" command to start a Unix child process."));
80 inf_child_post_startup_inferior (ptid_t ptid
)
82 /* This version of Unix doesn't require a meaningful "post startup
83 inferior" operation by a debugger. */
87 inf_child_acknowledge_created_inferior (int pid
)
89 /* This version of Unix doesn't require a meaningful "acknowledge
90 created inferior" operation by a debugger. */
94 inf_child_insert_fork_catchpoint (int pid
)
96 /* This version of Unix doesn't support notification of fork
101 inf_child_remove_fork_catchpoint (int pid
)
103 /* This version of Unix doesn't support notification of fork
109 inf_child_insert_vfork_catchpoint (int pid
)
111 /* This version of Unix doesn't support notification of vfork
116 inf_child_remove_vfork_catchpoint (int pid
)
118 /* This version of Unix doesn't support notification of vfork
124 inf_child_follow_fork (struct target_ops
*ops
, int follow_child
)
126 /* This version of Unix doesn't support following fork or vfork
132 inf_child_insert_exec_catchpoint (int pid
)
134 /* This version of Unix doesn't support notification of exec
139 inf_child_remove_exec_catchpoint (int pid
)
141 /* This version of Unix doesn't support notification of exec
147 inf_child_reported_exec_events_per_exec_call (void)
149 /* This version of Unix doesn't support notification of exec
155 inf_child_can_run (void)
161 inf_child_pid_to_exec_file (int pid
)
163 /* This version of Unix doesn't support translation of a process ID
164 to the filename of the executable file. */
169 inf_child_target (void)
171 struct target_ops
*t
= XZALLOC (struct target_ops
);
172 t
->to_shortname
= "child";
173 t
->to_longname
= "Unix child process";
174 t
->to_doc
= "Unix child process (started by the \"run\" command).";
175 t
->to_open
= inf_child_open
;
176 t
->to_post_attach
= inf_child_post_attach
;
177 t
->to_fetch_registers
= inf_child_fetch_inferior_registers
;
178 t
->to_store_registers
= inf_child_store_inferior_registers
;
179 t
->to_prepare_to_store
= inf_child_prepare_to_store
;
180 t
->to_insert_breakpoint
= memory_insert_breakpoint
;
181 t
->to_remove_breakpoint
= memory_remove_breakpoint
;
182 t
->to_terminal_init
= terminal_init_inferior
;
183 t
->to_terminal_inferior
= terminal_inferior
;
184 t
->to_terminal_ours_for_output
= terminal_ours_for_output
;
185 t
->to_terminal_save_ours
= terminal_save_ours
;
186 t
->to_terminal_ours
= terminal_ours
;
187 t
->to_terminal_info
= child_terminal_info
;
188 t
->to_post_startup_inferior
= inf_child_post_startup_inferior
;
189 t
->to_acknowledge_created_inferior
= inf_child_acknowledge_created_inferior
;
190 t
->to_insert_fork_catchpoint
= inf_child_insert_fork_catchpoint
;
191 t
->to_remove_fork_catchpoint
= inf_child_remove_fork_catchpoint
;
192 t
->to_insert_vfork_catchpoint
= inf_child_insert_vfork_catchpoint
;
193 t
->to_remove_vfork_catchpoint
= inf_child_remove_vfork_catchpoint
;
194 t
->to_follow_fork
= inf_child_follow_fork
;
195 t
->to_insert_exec_catchpoint
= inf_child_insert_exec_catchpoint
;
196 t
->to_remove_exec_catchpoint
= inf_child_remove_exec_catchpoint
;
197 t
->to_reported_exec_events_per_exec_call
=
198 inf_child_reported_exec_events_per_exec_call
;
199 t
->to_can_run
= inf_child_can_run
;
200 t
->to_pid_to_exec_file
= inf_child_pid_to_exec_file
;
201 t
->to_stratum
= process_stratum
;
202 t
->to_has_all_memory
= 1;
203 t
->to_has_memory
= 1;
205 t
->to_has_registers
= 1;
206 t
->to_has_execution
= 1;
207 t
->to_magic
= OPS_MAGIC
;