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, 2008, 2009, 2010, 2011
6 Free Software Foundation, Inc.
8 This file is part of GDB.
10 This program is free software; you can redistribute it and/or modify
11 it under the terms of the GNU General Public License as published by
12 the Free Software Foundation; either version 3 of the License, or
13 (at your option) any later version.
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License for more details.
20 You should have received a copy of the GNU General Public License
21 along with this program. If not, see <http://www.gnu.org/licenses/>. */
29 #include "gdb_string.h"
30 #include "inf-child.h"
32 /* Fetch register REGNUM from the inferior. If REGNUM is -1, do this
36 inf_child_fetch_inferior_registers (struct target_ops
*ops
,
37 struct regcache
*regcache
, int regnum
)
42 regnum
< gdbarch_num_regs (get_regcache_arch (regcache
));
44 regcache_raw_supply (regcache
, regnum
, NULL
);
47 regcache_raw_supply (regcache
, regnum
, NULL
);
50 /* Store register REGNUM back into the inferior. If REGNUM is -1, do
51 this for all registers (including the floating point registers). */
54 inf_child_store_inferior_registers (struct target_ops
*ops
,
55 struct regcache
*regcache
, int regnum
)
60 inf_child_post_attach (int pid
)
62 /* This version of Unix doesn't require a meaningful "post attach"
63 operation by a debugger. */
66 /* Get ready to modify the registers array. On machines which store
67 individual registers, this doesn't need to do anything. On
68 machines which store all the registers in one fell swoop, this
69 makes sure that registers contains all the registers from the
70 program being debugged. */
73 inf_child_prepare_to_store (struct regcache
*regcache
)
78 inf_child_open (char *arg
, int from_tty
)
80 error (_("Use the \"run\" command to start a Unix child process."));
84 inf_child_post_startup_inferior (ptid_t ptid
)
86 /* This version of Unix doesn't require a meaningful "post startup
87 inferior" operation by a debugger. */
91 inf_child_follow_fork (struct target_ops
*ops
, int follow_child
)
93 /* This version of Unix doesn't support following fork or vfork
99 inf_child_can_run (void)
105 inf_child_pid_to_exec_file (int pid
)
107 /* This version of Unix doesn't support translation of a process ID
108 to the filename of the executable file. */
113 inf_child_target (void)
115 struct target_ops
*t
= XZALLOC (struct target_ops
);
117 t
->to_shortname
= "child";
118 t
->to_longname
= "Unix child process";
119 t
->to_doc
= "Unix child process (started by the \"run\" command).";
120 t
->to_open
= inf_child_open
;
121 t
->to_post_attach
= inf_child_post_attach
;
122 t
->to_fetch_registers
= inf_child_fetch_inferior_registers
;
123 t
->to_store_registers
= inf_child_store_inferior_registers
;
124 t
->to_prepare_to_store
= inf_child_prepare_to_store
;
125 t
->to_insert_breakpoint
= memory_insert_breakpoint
;
126 t
->to_remove_breakpoint
= memory_remove_breakpoint
;
127 t
->to_terminal_init
= terminal_init_inferior
;
128 t
->to_terminal_inferior
= terminal_inferior
;
129 t
->to_terminal_ours_for_output
= terminal_ours_for_output
;
130 t
->to_terminal_save_ours
= terminal_save_ours
;
131 t
->to_terminal_ours
= terminal_ours
;
132 t
->to_terminal_info
= child_terminal_info
;
133 t
->to_post_startup_inferior
= inf_child_post_startup_inferior
;
134 t
->to_follow_fork
= inf_child_follow_fork
;
135 t
->to_can_run
= inf_child_can_run
;
136 t
->to_pid_to_exec_file
= inf_child_pid_to_exec_file
;
137 t
->to_stratum
= process_stratum
;
138 t
->to_has_all_memory
= default_child_has_all_memory
;
139 t
->to_has_memory
= default_child_has_memory
;
140 t
->to_has_stack
= default_child_has_stack
;
141 t
->to_has_registers
= default_child_has_registers
;
142 t
->to_has_execution
= default_child_has_execution
;
143 t
->to_magic
= OPS_MAGIC
;