diff options
author | Sergio Durigan Junior <sergiodj@redhat.com> | 2016-08-28 23:39:45 -0400 |
---|---|---|
committer | Sergio Durigan Junior <sergiodj@redhat.com> | 2016-09-01 14:55:15 -0400 |
commit | f2b9e3dfd4bc3c5149496fdbeaa5f0907220685f (patch) | |
tree | 7478f04b0d2ec5dbbda6985fe74e8ea3d70d18ae | |
parent | 049a857091cff98371b5688140832a3cf767153c (diff) | |
download | gdb-f2b9e3dfd4bc3c5149496fdbeaa5f0907220685f.zip gdb-f2b9e3dfd4bc3c5149496fdbeaa5f0907220685f.tar.gz gdb-f2b9e3dfd4bc3c5149496fdbeaa5f0907220685f.tar.bz2 |
Share target_wait prototype between GDB and gdbserver
This commit moves the target_wait prototype from the GDB-specific
target.h header to the common target/target.h header. Then, it
creates a compatible implementation of target_wait on gdbserver using
the_target->wait, and adjusts the (only) caller (mywait function).
Pretty straightforward, no regressions introduced.
gdb/gdbserver/ChangeLog:
2016-09-01 Sergio Durigan Junior <sergiodj@redhat.com>
* target.c (mywait): Call target_wait instead of
the_target->wait.
(target_wait): New function.
gdb/ChangeLog:
2016-09-01 Sergio Durigan Junior <sergiodj@redhat.com>
* target.c (target_wait): Mention that the function's prototype
can be found at target/target.h.
* target.h (target_wait): Move prototype from here...
* target/target.h (target_wait): ... to here.
-rw-r--r-- | gdb/ChangeLog | 7 | ||||
-rw-r--r-- | gdb/gdbserver/ChangeLog | 6 | ||||
-rw-r--r-- | gdb/gdbserver/target.c | 10 | ||||
-rw-r--r-- | gdb/target.c | 2 | ||||
-rw-r--r-- | gdb/target.h | 12 | ||||
-rw-r--r-- | gdb/target/target.h | 12 |
6 files changed, 37 insertions, 12 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 60b5950..08509fb 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,12 @@ 2016-09-01 Sergio Durigan Junior <sergiodj@redhat.com> + * target.c (target_wait): Mention that the function's prototype + can be found at target/target.h. + * target.h (target_wait): Move prototype from here... + * target/target.h (target_wait): ... to here. + +2016-09-01 Sergio Durigan Junior <sergiodj@redhat.com> + * fork-child.c (startup_inferior): Replace calls to target_resume by target_continue{,_no_signal}, depending on the case. * linux-nat.c (cleanup_target_stop): Call diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog index 921a5d4..97d8ca5 100644 --- a/gdb/gdbserver/ChangeLog +++ b/gdb/gdbserver/ChangeLog @@ -1,5 +1,11 @@ 2016-09-01 Sergio Durigan Junior <sergiodj@redhat.com> + * target.c (mywait): Call target_wait instead of + the_target->wait. + (target_wait): New function. + +2016-09-01 Sergio Durigan Junior <sergiodj@redhat.com> + * server.c (start_inferior): New variable 'ptid'. Replace calls to the_target->resume by target_continue{,_no_signal}, depending on the case. diff --git a/gdb/gdbserver/target.c b/gdb/gdbserver/target.c index 8435dc2..053629c 100644 --- a/gdb/gdbserver/target.c +++ b/gdb/gdbserver/target.c @@ -211,7 +211,7 @@ mywait (ptid_t ptid, struct target_waitstatus *ourstatus, int options, if (connected_wait) server_waiting = 1; - ret = (*the_target->wait) (ptid, ourstatus, options); + ret = target_wait (ptid, ourstatus, options); /* We don't expose _LOADED events to gdbserver core. See the `dlls_changed' global. */ @@ -258,6 +258,14 @@ target_stop_and_wait (ptid_t ptid) /* See target/target.h. */ +ptid_t +target_wait (ptid_t ptid, struct target_waitstatus *status, int options) +{ + return (*the_target->wait) (ptid, status, options); +} + +/* See target/target.h. */ + void target_continue_no_signal (ptid_t ptid) { diff --git a/gdb/target.c b/gdb/target.c index 87c9681..bca25bd 100644 --- a/gdb/target.c +++ b/gdb/target.c @@ -2283,6 +2283,8 @@ target_disconnect (const char *args, int from_tty) current_target.to_disconnect (¤t_target, args, from_tty); } +/* See target/target.h. */ + ptid_t target_wait (ptid_t ptid, struct target_waitstatus *status, int options) { diff --git a/gdb/target.h b/gdb/target.h index 9506e04..493a613 100644 --- a/gdb/target.h +++ b/gdb/target.h @@ -1341,17 +1341,7 @@ extern void target_disconnect (const char *, int); extern void target_resume (ptid_t ptid, int step, enum gdb_signal signal); -/* Wait for process pid to do something. PTID = -1 to wait for any - pid to do something. Return pid of child, or -1 in case of error; - store status through argument pointer STATUS. Note that it is - _NOT_ OK to throw_exception() out of target_wait() without popping - the debugging target from the stack; GDB isn't prepared to get back - to the prompt with a debugging target but without the frame cache, - stop_pc, etc., set up. OPTIONS is a bitwise OR of TARGET_W* - options. */ - -extern ptid_t target_wait (ptid_t ptid, struct target_waitstatus *status, - int options); +/* For target_read_memory see target/target.h. */ /* The default target_ops::to_wait implementation. */ diff --git a/gdb/target/target.h b/gdb/target/target.h index 64ef782..972bcb7 100644 --- a/gdb/target/target.h +++ b/gdb/target/target.h @@ -74,4 +74,16 @@ extern void target_continue_no_signal (ptid_t ptid); extern void target_continue (ptid_t ptid, enum gdb_signal signal); +/* Wait for process pid to do something. PTID = -1 to wait for any + pid to do something. Return pid of child, or -1 in case of error; + store status through argument pointer STATUS. Note that it is + _NOT_ OK to throw_exception() out of target_wait() without popping + the debugging target from the stack; GDB isn't prepared to get back + to the prompt with a debugging target but without the frame cache, + stop_pc, etc., set up. OPTIONS is a bitwise OR of TARGET_W* + options. */ + +extern ptid_t target_wait (ptid_t ptid, struct target_waitstatus *status, + int options); + #endif /* TARGET_COMMON_H */ |