#ifndef TARGET_H
#define TARGET_H
+/* This structure describes how to resume a particular thread (or
+ all threads) based on the client's request. If thread is -1, then
+ this entry applies to all threads. These are generally passed around
+ as an array, and terminated by a thread == -1 entry. */
+
+struct thread_resume
+{
+ int thread;
+
+ /* If non-zero, leave this thread stopped. */
+ int leave_stopped;
+
+ /* If non-zero, we want to single-step. */
+ int step;
+
+ /* If non-zero, send this signal when we resume. */
+ int sig;
+};
+
struct target_ops
{
/* Start a new process.
ARGS is a standard NULL-terminated array of arguments,
to be passed to the inferior as ``argv''.
- Returns 0 on success, -1 on failure. Registers the new
+ Returns the new PID on success, -1 on failure. Registers the new
process with the process list. */
int (*create_inferior) (char *program, char **args);
void (*kill) (void);
- /* Return 1 iff the thread with process ID PID is alive. */
+ /* Detach from all inferiors. */
- int (*thread_alive) (int pid);
+ void (*detach) (void);
- /* Resume the inferior process.
+ /* Return 1 iff the thread with process ID PID is alive. */
- If STEP is non-zero, we want to single-step.
+ int (*thread_alive) (int pid);
- If SIGNAL is nonzero, send the process that signal as we resume it.
- */
+ /* Resume the inferior process. */
- void (*resume) (int step, int signo);
+ void (*resume) (struct thread_resume *resume_info);
/* Wait for the inferior process to change state.
void (*store_registers) (int regno);
- /* Read memory from the inferior process.
+ /* Read memory from the inferior process. This should generally be
+ called through read_inferior_memory, which handles breakpoint shadowing.
Read LEN bytes at MEMADDR into a buffer at MYADDR. */
void (*read_memory) (CORE_ADDR memaddr, char *myaddr, int len);
- /* Write memory to the inferior process.
+ /* Write memory to the inferior process. This should generally be
+ called through write_inferior_memory, which handles breakpoint shadowing.
Write LEN bytes from the buffer at MYADDR to MEMADDR.
Returns 0 on success and errno on failure. */
- int (*write_memory) (CORE_ADDR memaddr, char *myaddr, int len);
+ int (*write_memory) (CORE_ADDR memaddr, const char *myaddr, int len);
+
+ /* Query GDB for the values of any symbols we're interested in.
+ This function is called whenever we receive a "qSymbols::"
+ query, which corresponds to every time more symbols (might)
+ become available. NULL if we aren't interested in any
+ symbols. */
+
+ void (*look_up_symbols) (void);
+
+ /* Send a signal to the inferior process, however is appropriate. */
+ void (*send_signal) (int);
};
extern struct target_ops *the_target;
#define kill_inferior() \
(*the_target->kill) ()
+#define detach_inferior() \
+ (*the_target->detach) ()
+
#define mythread_alive(pid) \
(*the_target->thread_alive) (pid)
-#define myresume(step,signo) \
- (*the_target->resume) (step, signo)
-
-#define mywait(statusp) \
- (*the_target->wait) (statusp)
-
#define fetch_inferior_registers(regno) \
(*the_target->fetch_registers) (regno)
#define store_inferior_registers(regno) \
(*the_target->store_registers) (regno)
-#define read_inferior_memory(memaddr,myaddr,len) \
- (*the_target->read_memory) (memaddr, myaddr, len)
+unsigned char mywait (char *statusp, int connected_wait);
+
+void read_inferior_memory (CORE_ADDR memaddr, char *myaddr, int len);
+
+int write_inferior_memory (CORE_ADDR memaddr, const char *myaddr, int len);
-#define write_inferior_memory(memaddr,myaddr,len) \
- (*the_target->write_memory) (memaddr, myaddr, len)
+void set_desired_inferior (int id);
#endif /* TARGET_H */