Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Yao Qi <yao@codesourcery.com>
To: <gdb-patches@sourceware.org>
Subject: [committed]: [PATCH 1/5] Define target_core_of_thread in gdbserver.
Date: Thu, 19 Apr 2012 06:03:00 -0000	[thread overview]
Message-ID: <4F8F9D88.6000302@codesourcery.com> (raw)
In-Reply-To: <8762d3y1xq.fsf@fleche.redhat.com>

On 04/14/2012 01:30 AM, Tom Tromey wrote:
>>>>>> "Yao" == Yao Qi <yao@codesourcery.com> writes:
> 
> Yao> On 03/16/2012 10:42 PM, Yao Qi wrote:
>>> In ITSET, it needs to know the core number for a given thread id.  It is done
>>> by target_core_of_thread in GDB.  In GDBserver, we do have code for this
>>> purpose, but both side is not unified.  In this patch, a new macro
>>> `target_core_of_thread' is defined, so code in gdb/common/ can use
>>> target_core_of_thread without #if/#else/#endif wrappings.
>>>
> 
> Yao> Please ignore these patches in this thread.  I'll re-send them in a new
> Yao> thread later.
> 
> ... and of course I saw this later :)

This is what I committed.

http://sourceware.org/ml/gdb-cvs/2012-04/msg00140.html

-- 
Yao (齐尧) 

gdb/gdbserver:

2012-04-19  Yao Qi  <yao@codesourcery.com>

	* remote-utils.c (prepare_resume_reply): Replace with macro
	target_core_of_thread.
	* server.c (handle_qxfer_threads_proper): Likewise.
	* target.h (traget_core_of_thread): New macro.
---
 gdb/gdbserver/remote-utils.c |    4 ++--
 gdb/gdbserver/server.c       |    5 +----
 gdb/gdbserver/target.h       |    4 ++++
 3 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/gdb/gdbserver/remote-utils.c b/gdb/gdbserver/remote-utils.c
index 4e35bb7..995e3b1 100644
--- a/gdb/gdbserver/remote-utils.c
+++ b/gdb/gdbserver/remote-utils.c
@@ -1390,8 +1390,8 @@ prepare_resume_reply (char *buf, ptid_t ptid,
 		strcat (buf, ";");
 		buf += strlen (buf);
 
-		if (the_target->core_of_thread)
-		  core = (*the_target->core_of_thread) (ptid);
+		core = target_core_of_thread (ptid);
+
 		if (core != -1)
 		  {
 		    sprintf (buf, "core:");
diff --git a/gdb/gdbserver/server.c b/gdb/gdbserver/server.c
index 9c7159f..23c9d47 100644
--- a/gdb/gdbserver/server.c
+++ b/gdb/gdbserver/server.c
@@ -1161,14 +1161,11 @@ handle_qxfer_threads_proper (struct buffer *buffer)
     {
       ptid_t ptid = thread_to_gdb_id ((struct thread_info *)thread);
       char ptid_s[100];
-      int core = -1;
+      int core = target_core_of_thread (ptid);
       char core_s[21];
 
       write_ptid (ptid_s, ptid);
 
-      if (the_target->core_of_thread)
-	core = (*the_target->core_of_thread) (ptid);
-
       if (core != -1)
 	{
 	  sprintf (core_s, "%d", core);
diff --git a/gdb/gdbserver/target.h b/gdb/gdbserver/target.h
index 256cfd9..dcf0230 100644
--- a/gdb/gdbserver/target.h
+++ b/gdb/gdbserver/target.h
@@ -540,6 +540,10 @@ ptid_t mywait (ptid_t ptid, struct target_waitstatus *ourstatus, int options,
 	(*the_target->done_accessing_memory) ();  	\
     } while (0)
 
+#define target_core_of_thread(ptid)		\
+  (the_target->core_of_thread ? (*the_target->core_of_thread) (ptid) \
+   : -1)
+
 int read_inferior_memory (CORE_ADDR memaddr, unsigned char *myaddr, int len);
 
 int write_inferior_memory (CORE_ADDR memaddr, const unsigned char *myaddr,
-- 
1.7.0.4


      reply	other threads:[~2012-04-19  5:07 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-16 14:44 Yao Qi
2012-03-16 14:44 ` [PATCH 2/5] Move vec to common/ Yao Qi
2012-04-13 17:30   ` Tom Tromey
2012-04-19  7:15     ` [committed]: " Yao Qi
2012-03-16 14:47 ` [PATCH 1/5] Define target_core_of_thread in gdbserver Yao Qi
2012-04-13 17:35   ` Tom Tromey
2012-04-19  6:03     ` Yao Qi [this message]

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=4F8F9D88.6000302@codesourcery.com \
    --to=yao@codesourcery.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