diff options
author | Pedro Alves <palves@redhat.com> | 2009-04-01 22:31:45 +0000 |
---|---|---|
committer | Pedro Alves <palves@redhat.com> | 2009-04-01 22:31:45 +0000 |
commit | 5b1c542ea1c4ff247db390bd24a9e0665d0c2e48 (patch) | |
tree | 0596b3d42d4fdcbe13c72e148774b85d1795ff13 /gdb/gdbserver/target.h | |
parent | 2bd7c093f663139ad9e57ddc748ade12f6bfbe01 (diff) | |
download | gdb-5b1c542ea1c4ff247db390bd24a9e0665d0c2e48.zip gdb-5b1c542ea1c4ff247db390bd24a9e0665d0c2e48.tar.gz gdb-5b1c542ea1c4ff247db390bd24a9e0665d0c2e48.tar.bz2 |
Decouple target code from remote protocol.
* target.h (enum target_waitkind): New.
(struct target_waitstatus): New.
(struct target_ops) <wait>: Return an unsigned long. Take a
target_waitstatus pointer instead of a char pointer.
(mywait): Likewise.
* target.c (mywait): Change prototype to return an unsigned long.
Take a target_waitstatus pointer instead of a char pointer. Adjust.
* server.h (thread_from_wait, old_thread_from_wait): Delete
declarations.
(prepare_resume_reply): Change prototype to take a
target_waitstatus.
* server.c (thread_from_wait, old_thread_from_wait): Delete.
(last_status, last_ptid): New.
(start_inferior): Remove "statusptr" argument. Adjust. Return a
pid instead of a signal.
(attach_inferior): Remove "status" and "signal" parameters.
Adjust.
(handle_query): For qGetTLSAddr, parse the thread id with strtol,
not as an address.
(handle_v_cont, handle_v_attach, handle_v_run, handle_v_kill)
(handle_v_requests, myresume): Remove "status" and "signal"
parameters. Adjust.
(handle_status): New.
(main): Delete local `status'. Adjust.
* remote-utils.c: Include target.h.
(prepare_resume_reply): Change prototype to take a
target_waitstatus. Adjust.
* linux-low.c (linux_wait): Adjust to new target_ops->wait
interface.
* spu-low.c (spu_wait): Adjust.
* win32-low.c (enum target_waitkind, struct target_waitstatus):
Delete.
(win32_wait): Adjust.
Diffstat (limited to 'gdb/gdbserver/target.h')
-rw-r--r-- | gdb/gdbserver/target.h | 60 |
1 files changed, 51 insertions, 9 deletions
diff --git a/gdb/gdbserver/target.h b/gdb/gdbserver/target.h index 5bd5896..27f57ea 100644 --- a/gdb/gdbserver/target.h +++ b/gdb/gdbserver/target.h @@ -38,6 +38,53 @@ struct thread_resume int sig; }; +/* Generally, what has the program done? */ +enum target_waitkind + { + /* The program has exited. The exit status is in + value.integer. */ + TARGET_WAITKIND_EXITED, + + /* The program has stopped with a signal. Which signal is in + value.sig. */ + TARGET_WAITKIND_STOPPED, + + /* The program has terminated with a signal. Which signal is in + value.sig. */ + TARGET_WAITKIND_SIGNALLED, + + /* The program is letting us know that it dynamically loaded + something. */ + TARGET_WAITKIND_LOADED, + + /* The program has exec'ed a new executable file. The new file's + pathname is pointed to by value.execd_pathname. */ + TARGET_WAITKIND_EXECD, + + /* Nothing of interest to GDB happened, but we stopped anyway. */ + TARGET_WAITKIND_SPURIOUS, + + /* An event has occurred, but we should wait again. In this case, + we want to go back to the event loop and wait there for another + event from the inferior. */ + TARGET_WAITKIND_IGNORE + }; + +struct target_waitstatus + { + enum target_waitkind kind; + + /* Forked child pid, execd pathname, exit status or signal number. */ + union + { + int integer; + enum target_signal sig; + unsigned long related_pid; + char *execd_pathname; + } + value; + }; + struct target_ops { /* Start a new process. @@ -82,15 +129,10 @@ struct target_ops void (*resume) (struct thread_resume *resume_info, size_t n); - /* Wait for the inferior process to change state. - - STATUS will be filled in with a response code to send to GDB. - - Returns the signal which caused the process to stop, in the - remote protocol numbering (e.g. TARGET_SIGNAL_STOP), or the - exit code as an integer if *STATUS is 'W'. */ + /* Wait for the inferior process or thread to change state. Store + status through argument pointer STATUS. */ - unsigned char (*wait) (char *status); + unsigned long (*wait) (struct target_waitstatus *status); /* Fetch registers from the inferior process. @@ -225,7 +267,7 @@ void set_target_ops (struct target_ops *); #define join_inferior() \ (*the_target->join) () -unsigned char mywait (char *statusp, int connected_wait); +unsigned long mywait (struct target_waitstatus *ourstatus, int connected_wait); int read_inferior_memory (CORE_ADDR memaddr, unsigned char *myaddr, int len); |