]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gdb/inf-child.c
2004-09-12 Andrew Cagney <cagney@gnu.org>
[thirdparty/binutils-gdb.git] / gdb / inf-child.c
CommitLineData
5bf970f9
AC
1/* Default child (native) target interface, for GDB when running under
2 Unix.
3
4 Copyright 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996,
5 1998, 1999, 2000, 2001, 2002, 2004 Free Software Foundation, Inc.
6
7 This file is part of GDB.
8
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 2 of the License, or
12 (at your option) any later version.
13
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.
18
19 You should have received a copy of the GNU General Public License
20 along with this program; if not, write to the Free Software
21 Foundation, Inc., 59 Temple Place - Suite 330,
22 Boston, MA 02111-1307, USA. */
23
24#include "defs.h"
25#include "regcache.h"
26#include "memattr.h"
27#include "symtab.h"
28#include "target.h"
29#include "inferior.h"
30
31/* Fetch register REGNUM from the inferior. If REGNUM is -1, do this
32 for all registers. */
33
34static void
35inf_child_fetch_inferior_registers (int regnum)
36{
37 if (regnum == -1)
38 {
39 for (regnum = 0; regnum < NUM_REGS; regnum++)
40 regcache_raw_supply (current_regcache, regnum, NULL);
41 }
42 else
43 regcache_raw_supply (current_regcache, regnum, NULL);
44}
45
46/* Store register REGNUM back into the inferior. If REGNUM is -1, do
47 this for all registers (including the floating point registers). */
48
49static void
50inf_child_store_inferior_registers (int regnum)
51{
52}
53
54void
55inf_child_post_wait (ptid_t ptid, int wait_status)
56{
57 /* This version of Unix doesn't require a meaningful "post wait"
58 operation.
59 */
60}
61
62static void
63inf_child_post_attach (int pid)
64{
65 /* This version of Unix doesn't require a meaningful "post attach"
66 operation by a debugger. */
67}
68
69/* Get ready to modify the registers array. On machines which store
70 individual registers, this doesn't need to do anything. On
71 machines which store all the registers in one fell swoop, this
72 makes sure that registers contains all the registers from the
73 program being debugged. */
74
75static void
76inf_child_prepare_to_store (void)
77{
78}
79
80static void
81inf_child_open (char *arg, int from_tty)
82{
83 error ("Use the \"run\" command to start a Unix child process.");
84}
85
86static void
87inf_child_post_startup_inferior (ptid_t ptid)
88{
89 /* This version of Unix doesn't require a meaningful "post startup
90 inferior" operation by a debugger. */
91}
92
93static void
94inf_child_acknowledge_created_inferior (int pid)
95{
96 /* This version of Unix doesn't require a meaningful "acknowledge
97 created inferior" operation by a debugger. */
98}
99
100static int
101inf_child_insert_fork_catchpoint (int pid)
102{
103 /* This version of Unix doesn't support notification of fork
104 events. */
105 return 0;
106}
107
108static int
109inf_child_remove_fork_catchpoint (int pid)
110{
111 /* This version of Unix doesn't support notification of fork
112 events. */
113 return 0;
114}
115
116static int
117inf_child_insert_vfork_catchpoint (int pid)
118{
119 /* This version of Unix doesn't support notification of vfork
120 events. */
121 return 0;
122}
123
124static int
125inf_child_remove_vfork_catchpoint (int pid)
126{
127 /* This version of Unix doesn't support notification of vfork
128 events. */
129 return 0;
130}
131
132static int
133inf_child_follow_fork (int follow_child)
134{
135 /* This version of Unix doesn't support following fork or vfork
136 events. */
137 return 0;
138}
139
140static int
141inf_child_insert_exec_catchpoint (int pid)
142{
143 /* This version of Unix doesn't support notification of exec
144 events. */
145 return 0;
146}
147
148static int
149inf_child_remove_exec_catchpoint (int pid)
150{
151 /* This version of Unix doesn't support notification of exec
152 events. */
153 return 0;
154}
155
156static int
157inf_child_reported_exec_events_per_exec_call (void)
158{
159 /* This version of Unix doesn't support notification of exec
160 events. */
161 return 1;
162}
163
164static int
165inf_child_can_run (void)
166{
167 return 1;
168}
169
170static struct symtab_and_line *
171inf_child_enable_exception_callback (enum exception_event_kind kind,
172 int enable)
173{
174 return (struct symtab_and_line *) NULL;
175}
176
177static struct exception_event_record *
178inf_child_get_current_exception_event (void)
179{
180 return (struct exception_event_record *) NULL;
181}
182
183static char *
184inf_child_pid_to_exec_file (int pid)
185{
186 /* This version of Unix doesn't support translation of a process ID
187 to the filename of the executable file. */
188 return NULL;
189}
190
191static char *
192inf_child_core_file_to_sym_file (char *core)
193{
194 /* The target stratum for a running executable need not support this
195 operation. */
196 return NULL;
197}
198
199struct target_ops *
200inf_child_target (void)
201{
202 struct target_ops *t = XZALLOC (struct target_ops);
203 t->to_shortname = "child";
204 t->to_longname = "Unix child process";
205 t->to_doc = "Unix child process (started by the \"run\" command).";
206 t->to_open = inf_child_open;
207 t->to_post_attach = inf_child_post_attach;
208 t->to_post_wait = inf_child_post_wait;
209 t->to_prepare_to_store = inf_child_prepare_to_store;
210 t->to_insert_breakpoint = memory_insert_breakpoint;
211 t->to_remove_breakpoint = memory_remove_breakpoint;
212 t->to_terminal_init = terminal_init_inferior;
213 t->to_terminal_inferior = terminal_inferior;
214 t->to_terminal_ours_for_output = terminal_ours_for_output;
215 t->to_terminal_save_ours = terminal_save_ours;
216 t->to_terminal_ours = terminal_ours;
217 t->to_terminal_info = child_terminal_info;
218 t->to_post_startup_inferior = inf_child_post_startup_inferior;
219 t->to_acknowledge_created_inferior = inf_child_acknowledge_created_inferior;
220 t->to_insert_fork_catchpoint = inf_child_insert_fork_catchpoint;
221 t->to_remove_fork_catchpoint = inf_child_remove_fork_catchpoint;
222 t->to_insert_vfork_catchpoint = inf_child_insert_vfork_catchpoint;
223 t->to_remove_vfork_catchpoint = inf_child_remove_vfork_catchpoint;
224 t->to_follow_fork = inf_child_follow_fork;
225 t->to_insert_exec_catchpoint = inf_child_insert_exec_catchpoint;
226 t->to_remove_exec_catchpoint = inf_child_remove_exec_catchpoint;
227 t->to_reported_exec_events_per_exec_call =
228 inf_child_reported_exec_events_per_exec_call;
229 t->to_can_run = inf_child_can_run;
230 t->to_enable_exception_callback = inf_child_enable_exception_callback;
231 t->to_get_current_exception_event = inf_child_get_current_exception_event;
232 t->to_pid_to_exec_file = inf_child_pid_to_exec_file;
233 t->to_stratum = process_stratum;
234 t->to_has_all_memory = 1;
235 t->to_has_memory = 1;
236 t->to_has_stack = 1;
237 t->to_has_registers = 1;
238 t->to_has_execution = 1;
239 t->to_magic = OPS_MAGIC;
240 return t;
241}