OSDN Git Service

* linux-low.c (linux_create_inferior): Call setpgid. Return
[pf3gnuchains/pf3gnuchains3x.git] / gdb / gdbserver / target.h
1 /* Target operations for the remote server for GDB.
2    Copyright 2002
3    Free Software Foundation, Inc.
4
5    Contributed by MontaVista Software.
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 #ifndef TARGET_H
25 #define TARGET_H
26
27 struct target_ops
28 {
29   /* Start a new process.
30
31      PROGRAM is a path to the program to execute.
32      ARGS is a standard NULL-terminated array of arguments,
33      to be passed to the inferior as ``argv''.
34
35      Returns the new PID on success, -1 on failure.  Registers the new
36      process with the process list.  */
37
38   int (*create_inferior) (char *program, char **args);
39
40   /* Attach to a running process.
41
42      PID is the process ID to attach to, specified by the user
43      or a higher layer.  */
44
45   int (*attach) (int pid);
46
47   /* Kill all inferiors.  */
48
49   void (*kill) (void);
50
51   /* Return 1 iff the thread with process ID PID is alive.  */
52
53   int (*thread_alive) (int pid);
54
55   /* Resume the inferior process.
56
57      If STEP is non-zero, we want to single-step.
58
59      If SIGNAL is nonzero, send the process that signal as we resume it.
60    */
61
62   void (*resume) (int step, int signo);
63
64   /* Wait for the inferior process to change state.
65
66      STATUSP will be filled in with a response code to send to GDB.
67
68      Returns the signal which caused the process to stop.  */
69
70   unsigned char (*wait) (char *status);
71
72   /* Fetch registers from the inferior process.
73
74      If REGNO is -1, fetch all registers; otherwise, fetch at least REGNO.  */
75
76   void (*fetch_registers) (int regno);
77   
78   /* Store registers to the inferior process.
79
80      If REGNO is -1, store all registers; otherwise, store at least REGNO.  */
81
82   void (*store_registers) (int regno);
83
84   /* Read memory from the inferior process.  This should generally be
85      called through read_inferior_memory, which handles breakpoint shadowing.
86
87      Read LEN bytes at MEMADDR into a buffer at MYADDR.  */
88
89   void (*read_memory) (CORE_ADDR memaddr, char *myaddr, int len);
90
91   /* Write memory to the inferior process.  This should generally be
92      called through write_inferior_memory, which handles breakpoint shadowing.
93
94      Write LEN bytes from the buffer at MYADDR to MEMADDR.
95
96      Returns 0 on success and errno on failure.  */
97
98   int (*write_memory) (CORE_ADDR memaddr, const char *myaddr, int len);
99
100   /* Query GDB for the values of any symbols we're interested in.
101      This function is called whenever we receive a "qSymbols::"
102      query, which corresponds to every time more symbols (might)
103      become available.  NULL if we aren't interested in any
104      symbols.  */
105
106   void (*look_up_symbols) (void);
107 };
108
109 extern struct target_ops *the_target;
110
111 void set_target_ops (struct target_ops *);
112
113 #define create_inferior(program, args) \
114   (*the_target->create_inferior) (program, args)
115
116 #define myattach(pid) \
117   (*the_target->attach) (pid)
118
119 #define kill_inferior() \
120   (*the_target->kill) ()
121
122 #define mythread_alive(pid) \
123   (*the_target->thread_alive) (pid)
124
125 #define myresume(step,signo) \
126   (*the_target->resume) (step, signo)
127
128 #define fetch_inferior_registers(regno) \
129   (*the_target->fetch_registers) (regno)
130
131 #define store_inferior_registers(regno) \
132   (*the_target->store_registers) (regno)
133
134 unsigned char mywait (char *statusp, int connected_wait);
135
136 void read_inferior_memory (CORE_ADDR memaddr, char *myaddr, int len);
137
138 int write_inferior_memory (CORE_ADDR memaddr, const char *myaddr, int len);
139
140 void set_desired_inferior (int id);
141
142 #endif /* TARGET_H */