From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2230 invoked by alias); 19 Apr 2012 05:07:34 -0000 Received: (qmail 2213 invoked by uid 22791); 19 Apr 2012 05:07:33 -0000 X-SWARE-Spam-Status: No, hits=-3.9 required=5.0 tests=AWL,BAYES_00,FROM_12LTRDOM,KHOP_RCVD_UNTRUST,KHOP_THREADED,RCVD_IN_HOSTKARMA_W,RCVD_IN_HOSTKARMA_WL X-Spam-Check-By: sourceware.org Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 19 Apr 2012 05:06:58 +0000 Received: from svr-orw-exc-10.mgc.mentorg.com ([147.34.98.58]) by relay1.mentorg.com with esmtp id 1SKja5-0004N6-Jw from Yao_Qi@mentor.com for gdb-patches@sourceware.org; Wed, 18 Apr 2012 22:06:57 -0700 Received: from SVR-ORW-FEM-04.mgc.mentorg.com ([147.34.97.41]) by SVR-ORW-EXC-10.mgc.mentorg.com with Microsoft SMTPSVC(6.0.3790.4675); Wed, 18 Apr 2012 22:06:14 -0700 Received: from [127.0.0.1] (147.34.91.1) by svr-orw-fem-04.mgc.mentorg.com (147.34.97.41) with Microsoft SMTP Server id 14.1.289.1; Wed, 18 Apr 2012 22:06:56 -0700 Message-ID: <4F8F9D88.6000302@codesourcery.com> Date: Thu, 19 Apr 2012 06:03:00 -0000 From: Yao Qi User-Agent: Mozilla/5.0 (X11; Linux i686; rv:11.0) Gecko/20120329 Thunderbird/11.0.1 MIME-Version: 1.0 To: Subject: [committed]: [PATCH 1/5] Define target_core_of_thread in gdbserver. References: <1331908966-5527-2-git-send-email-yao@codesourcery.com> <4F63523E.6060900@codesourcery.com> <8762d3y1xq.fsf@fleche.redhat.com> In-Reply-To: <8762d3y1xq.fsf@fleche.redhat.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2012-04/txt/msg00616.txt.bz2 On 04/14/2012 01:30 AM, Tom Tromey wrote: >>>>>> "Yao" == Yao Qi 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 * 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