Copyright year update in most files of the GDB Project.
[deliverable/binutils-gdb.git] / gdb / inf-child.c
CommitLineData
5bf970f9
AC
1/* Default child (native) target interface, for GDB when running under
2 Unix.
3
0b302171
JB
4 Copyright (C) 1988-1996, 1998-2002, 2004-2005, 2007-2012 Free
5 Software Foundation, Inc.
5bf970f9
AC
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
a9762ec7 11 the Free Software Foundation; either version 3 of the License, or
5bf970f9
AC
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
a9762ec7 20 along with this program. If not, see <http://www.gnu.org/licenses/>. */
5bf970f9
AC
21
22#include "defs.h"
23#include "regcache.h"
24#include "memattr.h"
25#include "symtab.h"
26#include "target.h"
27#include "inferior.h"
7681f339 28#include "gdb_string.h"
2c0b251b 29#include "inf-child.h"
5bf970f9
AC
30
31/* Fetch register REGNUM from the inferior. If REGNUM is -1, do this
32 for all registers. */
33
34static void
28439f5e
PA
35inf_child_fetch_inferior_registers (struct target_ops *ops,
36 struct regcache *regcache, int regnum)
5bf970f9
AC
37{
38 if (regnum == -1)
39 {
b1a653ae
UW
40 for (regnum = 0;
41 regnum < gdbarch_num_regs (get_regcache_arch (regcache));
42 regnum++)
56be3814 43 regcache_raw_supply (regcache, regnum, NULL);
5bf970f9
AC
44 }
45 else
56be3814 46 regcache_raw_supply (regcache, regnum, NULL);
5bf970f9
AC
47}
48
49/* Store register REGNUM back into the inferior. If REGNUM is -1, do
50 this for all registers (including the floating point registers). */
51
52static void
28439f5e
PA
53inf_child_store_inferior_registers (struct target_ops *ops,
54 struct regcache *regcache, int regnum)
5bf970f9
AC
55{
56}
57
5bf970f9
AC
58static void
59inf_child_post_attach (int pid)
60{
61 /* This version of Unix doesn't require a meaningful "post attach"
62 operation by a debugger. */
63}
64
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. */
70
71static void
316f2060 72inf_child_prepare_to_store (struct regcache *regcache)
5bf970f9
AC
73{
74}
75
76static void
77inf_child_open (char *arg, int from_tty)
78{
8a3fe4f8 79 error (_("Use the \"run\" command to start a Unix child process."));
5bf970f9
AC
80}
81
82static void
83inf_child_post_startup_inferior (ptid_t ptid)
84{
85 /* This version of Unix doesn't require a meaningful "post startup
86 inferior" operation by a debugger. */
87}
88
5bf970f9 89static int
ee057212 90inf_child_follow_fork (struct target_ops *ops, int follow_child)
5bf970f9
AC
91{
92 /* This version of Unix doesn't support following fork or vfork
93 events. */
94 return 0;
95}
96
5bf970f9
AC
97static int
98inf_child_can_run (void)
99{
100 return 1;
101}
102
5bf970f9
AC
103static char *
104inf_child_pid_to_exec_file (int pid)
105{
106 /* This version of Unix doesn't support translation of a process ID
107 to the filename of the executable file. */
108 return NULL;
109}
110
5bf970f9
AC
111struct target_ops *
112inf_child_target (void)
113{
114 struct target_ops *t = XZALLOC (struct target_ops);
abbb1732 115
5bf970f9
AC
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;
7681f339
AC
121 t->to_fetch_registers = inf_child_fetch_inferior_registers;
122 t->to_store_registers = inf_child_store_inferior_registers;
5bf970f9
AC
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;
5bf970f9 133 t->to_follow_fork = inf_child_follow_fork;
5bf970f9 134 t->to_can_run = inf_child_can_run;
5bf970f9
AC
135 t->to_pid_to_exec_file = inf_child_pid_to_exec_file;
136 t->to_stratum = process_stratum;
c35b1492
PA
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;
5bf970f9
AC
142 t->to_magic = OPS_MAGIC;
143 return t;
144}
This page took 0.665891 seconds and 4 git commands to generate.