1 /* Default child (native) target interface, for GDB when running under
4 Copyright (C) 1988-1996, 1998-2002, 2004-2005, 2007-2012 Free
5 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"
29 #include "inf-child.h"
31 /* Fetch register REGNUM from the inferior. If REGNUM is -1, do this
35 inf_child_fetch_inferior_registers (struct target_ops
*ops
,
36 struct regcache
*regcache
, int regnum
)
41 regnum
< gdbarch_num_regs (get_regcache_arch (regcache
));
43 regcache_raw_supply (regcache
, regnum
, NULL
);
46 regcache_raw_supply (regcache
, regnum
, NULL
);
49 /* Store register REGNUM back into the inferior. If REGNUM is -1, do
50 this for all registers (including the floating point registers). */
53 inf_child_store_inferior_registers (struct target_ops
*ops
,
54 struct regcache
*regcache
, int regnum
)
59 inf_child_post_attach (int pid
)
61 /* This version of Unix doesn't require a meaningful "post attach"
62 operation by a debugger. */
65 /* Get ready to modify the registers array. On machines which store
66 individual registers, this doesn't need to do anything. On
67 machines which store all the registers in one fell swoop, this
68 makes sure that registers contains all the registers from the
69 program being debugged. */
72 inf_child_prepare_to_store (struct regcache
*regcache
)
77 inf_child_open (char *arg
, int from_tty
)
79 error (_("Use the \"run\" command to start a Unix child process."));
83 inf_child_post_startup_inferior (ptid_t ptid
)
85 /* This version of Unix doesn't require a meaningful "post startup
86 inferior" operation by a debugger. */
90 inf_child_follow_fork (struct target_ops
*ops
, int follow_child
)
92 /* This version of Unix doesn't support following fork or vfork
98 inf_child_can_run (void)
104 inf_child_pid_to_exec_file (int pid
)
106 /* This version of Unix doesn't support translation of a process ID
107 to the filename of the executable file. */
112 inf_child_target (void)
114 struct target_ops
*t
= XZALLOC (struct target_ops
);
116 t
->to_shortname
= "child";
117 t
->to_longname
= "Unix child process";
118 t
->to_doc
= "Unix child process (started by the \"run\" command).";
119 t
->to_open
= inf_child_open
;
120 t
->to_post_attach
= inf_child_post_attach
;
121 t
->to_fetch_registers
= inf_child_fetch_inferior_registers
;
122 t
->to_store_registers
= inf_child_store_inferior_registers
;
123 t
->to_prepare_to_store
= inf_child_prepare_to_store
;
124 t
->to_insert_breakpoint
= memory_insert_breakpoint
;
125 t
->to_remove_breakpoint
= memory_remove_breakpoint
;
126 t
->to_terminal_init
= terminal_init_inferior
;
127 t
->to_terminal_inferior
= terminal_inferior
;
128 t
->to_terminal_ours_for_output
= terminal_ours_for_output
;
129 t
->to_terminal_save_ours
= terminal_save_ours
;
130 t
->to_terminal_ours
= terminal_ours
;
131 t
->to_terminal_info
= child_terminal_info
;
132 t
->to_post_startup_inferior
= inf_child_post_startup_inferior
;
133 t
->to_follow_fork
= inf_child_follow_fork
;
134 t
->to_can_run
= inf_child_can_run
;
135 t
->to_pid_to_exec_file
= inf_child_pid_to_exec_file
;
136 t
->to_stratum
= process_stratum
;
137 t
->to_has_all_memory
= default_child_has_all_memory
;
138 t
->to_has_memory
= default_child_has_memory
;
139 t
->to_has_stack
= default_child_has_stack
;
140 t
->to_has_registers
= default_child_has_registers
;
141 t
->to_has_execution
= default_child_has_execution
;
142 t
->to_magic
= OPS_MAGIC
;