From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21159 invoked by alias); 29 Apr 2004 15:31:35 -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 21064 invoked from network); 29 Apr 2004 15:31:33 -0000 Received: from unknown (HELO zmamail05.zma.compaq.com) (161.114.64.105) by sources.redhat.com with SMTP; 29 Apr 2004 15:31:33 -0000 Received: from taynzmail03.nz-tay.cpqcorp.net (taynzmail03.nz-tay.cpqcorp.net [16.47.4.103]) by zmamail05.zma.compaq.com (Postfix) with ESMTP id 1F1F5AD90; Thu, 29 Apr 2004 11:31:33 -0400 (EDT) Received: from kitche.zk3.dec.com (kitche2.zk3.dec.com [16.140.160.162]) by taynzmail03.nz-tay.cpqcorp.net (Postfix) with ESMTP id F20C635E; Thu, 29 Apr 2004 11:31:32 -0400 (EDT) Received: from hp.com by kitche.zk3.dec.com (8.9.3/1.1.27.5/27Oct00-1235PM) id LAA0001193057; Thu, 29 Apr 2004 11:31:32 -0400 (EDT) Message-ID: <40912015.7070902@hp.com> Date: Thu, 29 Apr 2004 15:31:00 -0000 From: Robert Picco User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4.1) Gecko/20031030 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> In-Reply-To: <4087EE4B.4010805@gnu.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-SW-Source: 2004-04/txt/msg00674.txt.bz2 Andrew Cagney wrote: >> you'd prefer that I use the q-packet mechanism? > > > Yes, the qPart packet was designed for exactly the situtation you > encountered. It can specify a length/offset and return a short transfer. > > Andrew > > Hi: Does this represent what you are expecting of the qPart packet? I saw no reason to export the type because this packet is only useful in remote.c thanks, Bob --- gdb-6.1-orig/gdb/remote.c 2004-02-25 15:41:00.000000000 -0500 +++ gdb-6.1/gdb/remote.c 2004-04-29 09:16:36.000000000 -0400 @@ -2003,6 +2003,57 @@ objfile_relocate (symfile_objfile, offs); } +static int register_init; + +static void +remote_register_size(void) +{ + struct remote_state *rs = get_remote_state (); + char *buf = alloca (rs->remote_packet_size); + int regnum, offset, size, i, sz = 4; + + + register_init = 1; + + for (size = 0, regnum = 0; regnum < NUM_REGS + NUM_PSEUDO_REGS; regnum++) + { + struct packet_reg *r = &rs->regs[regnum]; + snprintf (buf, rs->remote_packet_size, + "qPart:gpacket:read::"); + bin2hex((char *) ®num, &buf[20], sizeof (regnum)); + buf[20 + sizeof(regnum) * 2] = ','; + bin2hex((char *) &sz, &buf[20 + sizeof(regnum) * 2 + 1], sizeof (sz)); + buf[20 + sizeof(regnum) * 2 + 1 + sizeof(size) * 2] = 0; + i = putpkt (buf); + if (i < 0) + goto bad; + buf[0] = '\0'; + getpkt (buf, rs->remote_packet_size, 0); + if (buf[0] == 'O' && buf[1] == 'K' && buf[2] == '\0') + goto bad; + else if (buf[0] == 'E') + goto bad; + + hex2bin(&buf[0], (char *)&offset, sizeof(offset)); + r->offset = offset; + if (offset != -1) { + r->in_g_packet = 1; + size += register_size (current_gdbarch, regnum); + } + else + r->in_g_packet = 0; + + } + rs->sizeof_g_packet = size; + return; + +bad: + if (regnum) + fprintf_unfiltered (gdb_stdlog, + "Received some valid register packets and later failed\n"); + return; +} + /* Stub for catch_errors. */ static int @@ -2025,6 +2076,8 @@ /* Let the stub know that we want it to return the thread. */ set_thread (-1, 0); + if (!register_init) + remote_register_size(); inferior_ptid = remote_current_thread (inferior_ptid); get_offsets (); /* Get text, data & bss offsets */ @@ -3257,8 +3310,8 @@ gdb_assert (reg != NULL); if (!reg->in_g_packet) internal_error (__FILE__, __LINE__, - "Attempt to fetch a non G-packet register when this " - "remote.c does not support the p-packet."); + "Attempt to fetch a non G-packet register (%d) when this " + "remote.c does not support the p-packet.", regnum); } sprintf (buf, "g");