public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Sergio Durigan Junior <sergiodj@redhat.com>
To: GDB Patches <gdb-patches@sourceware.org>
Cc: Sergio Durigan Junior <sergiodj@redhat.com>
Subject: [PATCH 2/2] Share target_wait prototype between GDB and gdbserver
Date: Mon, 29 Aug 2016 04:12:00 -0000	[thread overview]
Message-ID: <1472443911-29056-3-git-send-email-sergiodj@redhat.com> (raw)
In-Reply-To: <1472443911-29056-1-git-send-email-sergiodj@redhat.com>

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-08-29  Sergio Durigan Junior  <sergiodj@redhat.com>

	* target.c (mywait): Call target_wait instead of
	the_target->wait.
	(target_wait): New function.

gdb/ChangeLog:
2016-08-29  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.
---
 gdb/gdbserver/target.c | 10 +++++++++-
 gdb/target.c           |  2 ++
 gdb/target.h           | 12 ------------
 gdb/target/target.h    | 12 ++++++++++++
 4 files changed, 23 insertions(+), 13 deletions(-)

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 (&current_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..2af405a 100644
--- a/gdb/target.h
+++ b/gdb/target.h
@@ -1341,18 +1341,6 @@ 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);
-
 /* The default target_ops::to_wait implementation.  */
 
 extern ptid_t default_target_wait (struct target_ops *ops,
diff --git a/gdb/target/target.h b/gdb/target/target.h
index 1bfa1b0..a95fbe4 100644
--- a/gdb/target/target.h
+++ b/gdb/target/target.h
@@ -76,4 +76,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 */
-- 
2.4.3

  parent reply	other threads:[~2016-08-29  4:12 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-29  4:12 [PATCH 0/2] Consolidate target_{wait,resume} calls " Sergio Durigan Junior
2016-08-29  4:12 ` [PATCH 1/2] Use target_continue{,_no_signal} instead of target_resume Sergio Durigan Junior
2016-08-31 10:25   ` Pedro Alves
2016-09-01 18:57     ` Sergio Durigan Junior
2016-08-29  4:12 ` Sergio Durigan Junior [this message]
2016-08-31 10:29   ` [PATCH 2/2] Share target_wait prototype between GDB and gdbserver Pedro Alves
2016-08-31 10:30     ` Pedro Alves
2016-09-01 18:58     ` Sergio Durigan Junior

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1472443911-29056-3-git-send-email-sergiodj@redhat.com \
    --to=sergiodj@redhat.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).