1 /* Target operations for the remote server for GDB.
3 Free Software Foundation, Inc.
5 Contributed by MontaVista Software.
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 2 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, write to the Free Software
21 Foundation, Inc., 59 Temple Place - Suite 330,
22 Boston, MA 02111-1307, USA. */
29 /* Start a new process.
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''.
35 Returns 0 on success, -1 on failure. Registers the new
36 process with the process list. */
38 int (*create_inferior) (char *program, char **args);
40 /* Attach to a running process.
42 PID is the process ID to attach to, specified by the user
45 int (*attach) (int pid);
47 /* Kill all inferiors. */
51 /* Return 1 iff the thread with process ID PID is alive. */
53 int (*thread_alive) (int pid);
55 /* Resume the inferior process.
57 If STEP is non-zero, we want to single-step.
59 If SIGNAL is nonzero, send the process that signal as we resume it.
62 void (*resume) (int step, int signo);
64 /* Wait for the inferior process to change state.
66 STATUSP will be filled in with a response code to send to GDB.
68 Returns the signal which caused the process to stop. */
70 unsigned char (*wait) (char *status);
72 /* Fetch registers from the inferior process.
74 If REGNO is -1, fetch all registers; otherwise, fetch at least REGNO. */
76 void (*fetch_registers) (int regno);
78 /* Store registers to the inferior process.
80 If REGNO is -1, store all registers; otherwise, store at least REGNO. */
82 void (*store_registers) (int regno);
84 /* Read memory from the inferior process. This should generally be
85 called through read_inferior_memory, which handles breakpoint shadowing.
87 Read LEN bytes at MEMADDR into a buffer at MYADDR. */
89 void (*read_memory) (CORE_ADDR memaddr, char *myaddr, int len);
91 /* Write memory to the inferior process. This should generally be
92 called through write_inferior_memory, which handles breakpoint shadowing.
94 Write LEN bytes from the buffer at MYADDR to MEMADDR.
96 Returns 0 on success and errno on failure. */
98 int (*write_memory) (CORE_ADDR memaddr, const char *myaddr, int len);
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
106 void (*look_up_symbols) (void);
108 /* Return the PID we should send a signal to. Used for asynchronous
109 interrupts (user hitting Control-C). */
111 int (*signal_pid) (void);
114 extern struct target_ops *the_target;
116 void set_target_ops (struct target_ops *);
118 #define create_inferior(program, args) \
119 (*the_target->create_inferior) (program, args)
121 #define myattach(pid) \
122 (*the_target->attach) (pid)
124 #define kill_inferior() \
125 (*the_target->kill) ()
127 #define mythread_alive(pid) \
128 (*the_target->thread_alive) (pid)
130 #define myresume(step,signo) \
131 (*the_target->resume) (step, signo)
133 #define fetch_inferior_registers(regno) \
134 (*the_target->fetch_registers) (regno)
136 #define store_inferior_registers(regno) \
137 (*the_target->store_registers) (regno)
139 unsigned char mywait (char *statusp, int connected_wait);
141 void read_inferior_memory (CORE_ADDR memaddr, char *myaddr, int len);
143 int write_inferior_memory (CORE_ADDR memaddr, const char *myaddr, int len);
145 void set_desired_inferior (int id);
147 #endif /* TARGET_H */