From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7891 invoked by alias); 28 Mar 2010 20:52:14 -0000 Received: (qmail 7878 invoked by uid 22791); 28 Mar 2010 20:52:13 -0000 X-SWARE-Spam-Status: No, hits=-0.6 required=5.0 tests=AWL,BAYES_00,NO_DNS_FOR_FROM,SARE_SUB_OBFU_Q1 X-Spam-Check-By: sourceware.org Received: from mga12.intel.com (HELO azsmga102.ch.intel.com) (143.182.124.36) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sun, 28 Mar 2010 20:52:09 +0000 Received: from azsmga001.ch.intel.com ([10.2.17.19]) by azsmga102.ch.intel.com with ESMTP; 28 Mar 2010 13:52:07 -0700 X-ExtLoop1: 1 Received: from gnu-6.sc.intel.com ([10.3.194.107]) by azsmga001.ch.intel.com with ESMTP; 28 Mar 2010 13:52:07 -0700 Received: by gnu-6.sc.intel.com (Postfix, from userid 500) id 75491812387; Sun, 28 Mar 2010 13:52:07 -0700 (PDT) Date: Sun, 28 Mar 2010 20:52:00 -0000 From: "H.J. Lu" To: GDB Subject: Re: PATCH: Add xmlRegisters= to qsupported query Message-ID: <20100328205207.GA11401@intel.com> Reply-To: "H.J. Lu" References: <20100328204807.GA10649@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20100328204807.GA10649@intel.com> User-Agent: Mutt/1.5.20 (2009-08-17) 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: 2010-03/txt/msg00957.txt.bz2 On Sun, Mar 28, 2010 at 01:48:07PM -0700, H.J. Lu wrote: > Hi, > > This patch adds xmlRegisters= to qsupported query. Any comments? > > Thanks. > > An updated patch. H.J. -- gdb/ 2010-03-28 H.J. Lu * i386-tdep.c: Include "remote.h". (i386_gdbarch_init): Call register_remote_support_xml. * remote.c (remote_support_xml): New. (register_remote_support_xml): Likewise. (remote_query_supported): Support remote_support_xml. * remote.h (register_remote_support_xml): New. gdb/doc/ 2010-03-28 H.J. Lu * gdb.texinfo (General Query Packets): Add xmlRegisters. diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo index 56dbe5d..ad84d2c 100644 --- a/gdb/doc/gdb.texinfo +++ b/gdb/doc/gdb.texinfo @@ -30603,6 +30603,12 @@ extensions to the remote protocol. @value{GDBN} does not use such extensions unless the stub also reports that it supports them by including @samp{multiprocess+} in its @samp{qSupported} reply. @xref{multiprocess extensions}, for details. + +@item xmlRegisters +This feature indicates that @value{GDBN} supports supports the XML +target description. If the stub sees @samp{xmlRegisters=} with +target specfic strings separated by comma, it can send @value{GDBN} +the XML target description. @end table Stubs should ignore any unknown values for diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c index 83275ac..d7af84a 100644 --- a/gdb/i386-tdep.c +++ b/gdb/i386-tdep.c @@ -44,6 +44,7 @@ #include "value.h" #include "dis-asm.h" #include "disasm.h" +#include "remote.h" #include "gdb_assert.h" #include "gdb_string.h" @@ -5943,6 +5944,9 @@ i386_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_fast_tracepoint_valid_at (gdbarch, i386_fast_tracepoint_valid_at); + /* Tell remote stub that we support XML target description. */ + register_remote_support_xml ("x86"); + return gdbarch; } diff --git a/gdb/remote.c b/gdb/remote.c index 0c791aa..bceb477 100644 --- a/gdb/remote.c +++ b/gdb/remote.c @@ -3464,6 +3464,39 @@ static struct protocol_feature remote_protocol_features[] = { PACKET_bs }, }; +static char *remote_support_xml; + +/* Register string appended to "xmlRegisters=" in qSupported query. */ + +void +register_remote_support_xml (const char *xml) +{ + if (remote_support_xml == NULL) + remote_support_xml = xstrdup (xml); + else + { + const char *str = strstr (remote_support_xml, xml); + int append; + + if (str) + { + if (str != remote_support_xml && *(str - 1) != ',') + append = 0; + else + { + size_t len = strlen (xml); + append = xml[len] != ',' && xml[len] != '\0'; + } + } + else + append = 1; + + if (append) + remote_support_xml = concat (xml, ",", remote_support_xml, + NULL); + } +} + static void remote_query_supported (void) { @@ -3483,14 +3516,35 @@ remote_query_supported (void) if (remote_protocol_packets[PACKET_qSupported].support != PACKET_DISABLE) { const char *qsupported = gdbarch_qsupported (target_gdbarch); - if (qsupported) + if (qsupported || remote_support_xml) { - char *q; + char *q, *x; + char *p = NULL; + const char *m; + if (rs->extended) - q = concat ("qSupported:multiprocess+;", qsupported, NULL); + m = "multiprocess+;"; else - q = concat ("qSupported:", qsupported, NULL); + m = ""; + + if (remote_support_xml) + { + if (qsupported) + p = concat ("xmlRegisters=", remote_support_xml, + ";", NULL); + else + p = concat ("xmlRegisters=", remote_support_xml, NULL); + x = p; + } + else + x = ""; + + q = concat ("qSupported:", m, x, + qsupported ? qsupported : "", + NULL); putpkt (q); + if (p) + xfree (p); xfree (q); } else diff --git a/gdb/remote.h b/gdb/remote.h index a82d0d7..d480e26 100644 --- a/gdb/remote.h +++ b/gdb/remote.h @@ -66,6 +66,7 @@ extern void (*deprecated_target_wait_loop_hook) (void); void register_remote_g_packet_guess (struct gdbarch *gdbarch, int bytes, const struct target_desc *tdesc); +void register_remote_support_xml (const char *); void remote_file_put (const char *local_file, const char *remote_file, int from_tty);