From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1487 invoked by alias); 2 Aug 2004 15:51:29 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 1464 invoked from network); 2 Aug 2004 15:51:26 -0000 Received: from unknown (HELO zmamail03.zma.compaq.com) (161.114.64.103) by sourceware.org with SMTP; 2 Aug 2004 15:51:26 -0000 Received: from mailrelay01.cac.cpqcorp.net (mailrelay01.cac.cpqcorp.net [16.47.132.152]) by zmamail03.zma.compaq.com (Postfix) with ESMTP id 6AD18CA; Mon, 2 Aug 2004 11:51:25 -0400 (EDT) Received: from kitche.zk3.dec.com (kitche2.zk3.dec.com [16.140.160.162]) by mailrelay01.cac.cpqcorp.net (Postfix) with ESMTP id 83C132B8; Mon, 2 Aug 2004 08:51:24 -0700 (PDT) Received: from hp.com by kitche.zk3.dec.com (8.9.3/1.1.27.5/27Oct00-1235PM) id LAA0001466271; Mon, 2 Aug 2004 11:51:23 -0400 (EDT) Message-ID: <410E623C.3020107@hp.com> Date: Mon, 02 Aug 2004 15:51:00 -0000 From: Robert Picco User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6) Gecko/20040510 MIME-Version: 1.0 To: Andrew Cagney Cc: gdb-patches@sources.redhat.com Subject: Re: new gdb remote packet type References: <407F2BAB.4060408@hp.com> <40802711.3040104@gnu.org> <4087E8C0.30806@hp.com> <4087EE4B.4010805@gnu.org> <40912015.7070902@hp.com> <40928D64.8010209@gnu.org> <4097D9DE.2030004@hp.com> <40993C21.1040500@gnu.org> <409A95AB.6020101@hp.com> <40A26AF4.4050001@gnu.org> In-Reply-To: <40A26AF4.4050001@gnu.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-SW-Source: 2004-08/txt/msg00032.txt.bz2 Andrew Cagney wrote: > > To get this in, there's some additional leg work: > > - copyright assignment? > > - documentation (see gdb/doc/gdb.texinfo near the end) > > - a corresponding gdbserver patch > > - not to forget, ChangeLogs :-) > > Andrew > > Hi Andrew, FSF has a copyright assignment on file for me. The other items you mentioned are contained in the patch below with the exception of gdbserver patch. There wasn't any feedback on 'P' packet support not being in gdbserver. So I'm assuming that not adding 'p' packet support is o.k. thanks, Bob diff -ruN gdb-6.1.1-orig/gdb/ChangeLog gdb-6.1.1/gdb/ChangeLog --- gdb-6.1.1-orig/gdb/ChangeLog 2004-06-14 18:39:49.000000000 -0400 +++ gdb-6.1.1/gdb/ChangeLog 2004-08-02 10:33:03.993382712 -0400 @@ -1,3 +1,9 @@ +2004-06-28 Robert Picco + * Add new 'p' packet to gdb/remote.c. The 'p' is for fetching + the value of a single register. It complements the 'P' which + writes a single register. Should the remote gdbserver support + the 'p', then 'g' packets aren't used. + 2004-06-14 GDB Administrator GDB 6.1.1 released. diff -ruN gdb-6.1.1-orig/gdb/doc/gdb.texinfo gdb-6.1.1/gdb/doc/gdb.texinfo --- gdb-6.1.1-orig/gdb/doc/gdb.texinfo 2004-06-14 18:25:29.000000000 -0400 +++ gdb-6.1.1/gdb/doc/gdb.texinfo 2004-08-02 10:33:28.011731368 -0400 @@ -19896,19 +19896,18 @@ @item @code{O} --- reserved -Reserved for future use. - -@item @code{p}@var{n@dots{}} --- read reg @strong{(reserved)} +@item @code{p}@var{hex value of register} --- read register packet @cindex @code{p} packet -@xref{write register packet}. - Reply: @table @samp @item @var{r@dots{}.} -The hex encoded value of the register in target byte order. +Two hex values for each byte of register content in target byte order. +@item E@var{NN} +for an error @end table + @item @code{P}@var{n@dots{}}@code{=}@var{r@dots{}} --- write register @anchor{write register packet} @cindex @code{P} packet diff -ruN gdb-6.1.1-orig/gdb/remote.c gdb-6.1.1/gdb/remote.c --- gdb-6.1.1-orig/gdb/remote.c 2004-02-25 15:41:00.000000000 -0500 +++ gdb-6.1.1/gdb/remote.c 2004-08-02 10:32:48.960668032 -0400 @@ -809,6 +809,23 @@ show_packet_config_cmd (&remote_protocol_E); } +static struct packet_config remote_protocol_p; + +static void +set_remote_protocol_p_packet_cmd (char *args, int from_tty, + struct cmd_list_element *c) +{ + update_packet_config (&remote_protocol_p); +} + +static void +show_remote_protocol_p_packet_cmd (char *args, int from_tty, + struct cmd_list_element *c) +{ + show_packet_config_cmd (&remote_protocol_p); +} + + /* Should we try the 'P' (set register) request? */ @@ -2080,6 +2097,7 @@ update_packet_config (&remote_protocol_e); update_packet_config (&remote_protocol_E); update_packet_config (&remote_protocol_P); + update_packet_config (&remote_protocol_p); update_packet_config (&remote_protocol_qSymbol); update_packet_config (&remote_protocol_vcont); for (i = 0; i < NR_Z_PACKET_TYPES; i++) @@ -3240,6 +3258,36 @@ /* Read the remote registers into the block REGS. */ /* Currently we just read all the registers, so we don't use regnum. */ +static int +fetch_register_using_p (int regnum) +{ + struct remote_state *rs = get_remote_state (); + char *buf = alloca (rs->remote_packet_size), *p; + char regp[MAX_REGISTER_SIZE]; + int i; + + buf[0] = 'p'; + bin2hex((char *) ®num, &buf[1], sizeof(regnum)); + buf[9] = 0; + remote_send (buf, rs->remote_packet_size); + if (buf[0] != 0 && buf[0] != 'E') { + p = buf; + i = 0; + while (p[0] != 0) { + if (p[1] == 0) { + error("fetch_register_using_p: early buf termination"); + return 0; + } + regp[i++] = fromhex (p[0]) * 16 + fromhex (p[1]); + p += 2; + } + regcache_raw_supply (current_regcache, regnum, regp); + return 1; + } + + return 0; +} + static void remote_fetch_registers (int regnum) { @@ -3260,6 +3308,31 @@ "Attempt to fetch a non G-packet register when this " "remote.c does not support the p-packet."); } + switch (remote_protocol_p.support) + { + case PACKET_DISABLE: + break; + case PACKET_ENABLE: + if (fetch_register_using_p (regnum)) + return; + else + error ("Protocol error: p packet not recognized by stub"); + case PACKET_SUPPORT_UNKNOWN: + if (fetch_register_using_p (regnum)) + { + /* The stub recognized the 'p' packet. Remember this. */ + remote_protocol_p.support = PACKET_ENABLE; + return; + } + else + { + /* The stub does not support the 'P' packet. Use 'G' + instead, and don't try using 'P' in the future (it + will just waste our time). */ + remote_protocol_p.support = PACKET_DISABLE; + break; + } + } sprintf (buf, "g"); remote_send (buf, (rs->remote_packet_size)); @@ -5419,6 +5492,7 @@ show_remote_protocol_e_packet_cmd (args, from_tty, NULL); show_remote_protocol_E_packet_cmd (args, from_tty, NULL); show_remote_protocol_P_packet_cmd (args, from_tty, NULL); + show_remote_protocol_p_packet_cmd (args, from_tty, NULL); show_remote_protocol_qSymbol_packet_cmd (args, from_tty, NULL); show_remote_protocol_vcont_packet_cmd (args, from_tty, NULL); show_remote_protocol_binary_download_cmd (args, from_tty, NULL); @@ -5631,6 +5705,13 @@ &remote_set_cmdlist, &remote_show_cmdlist, 1); + add_packet_config_cmd (&remote_protocol_p, + "p", "fetch-register", + set_remote_protocol_p_packet_cmd, + show_remote_protocol_p_packet_cmd, + &remote_set_cmdlist, &remote_show_cmdlist, + 1); + add_packet_config_cmd (&remote_protocol_Z[Z_PACKET_SOFTWARE_BP], "Z0", "software-breakpoint", set_remote_protocol_Z_software_bp_packet_cmd,