From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18309 invoked by alias); 3 Jun 2003 22:22:36 -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 18257 invoked from network); 3 Jun 2003 22:22:35 -0000 Received: from unknown (HELO localhost.redhat.com) (207.219.125.131) by sources.redhat.com with SMTP; 3 Jun 2003 22:22:35 -0000 Received: from redhat.com (localhost [127.0.0.1]) by localhost.redhat.com (Postfix) with ESMTP id 9ED9C2B2F; Tue, 3 Jun 2003 18:22:27 -0400 (EDT) Message-ID: <3EDD1FA3.9020306@redhat.com> Date: Tue, 03 Jun 2003 22:22:00 -0000 From: Andrew Cagney User-Agent: Mozilla/5.0 (X11; U; NetBSD macppc; en-US; rv:1.0.2) Gecko/20030223 X-Accept-Language: en-us, en MIME-Version: 1.0 To: "Theodore A. Roth" Cc: gdb-patches@sources.redhat.com Subject: Re: [RFC/RFA] fix calculation of sizeof_g_packet References: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-SW-Source: 2003-06/txt/msg00148.txt.bz2 > The attached patch changes init_remote_state() so that sizeof_g_packet > computed using REGISTER_RAW_SIZE() instead of blindly set to > DEPRECATED_REGISTER_BYTES. > > I'm assuming two things which I'm not sure are true: > > 1) REGISTER_RAW_SIZE() is usable for all targets now > > 2) REGISTER_RAW_SIZE() is valid when passed pseudo register. > > Ok to commit? Just a few tweaks. > 2003-06-03 Theodore A. Roth > > * remote.c (init_remote_state): Compute sizeof_g_packet by > accumulation of the size of all registers instead of using > DEPRECATED_REGISTER_BYTES. > > Index: remote.c > =================================================================== > RCS file: /cvs/src/src/gdb/remote.c,v > retrieving revision 1.100 > diff -u -p -r1.100 remote.c > --- remote.c 17 May 2003 05:59:58 -0000 1.100 > +++ remote.c 3 Jun 2003 21:36:30 -0000 > @@ -261,9 +261,7 @@ init_remote_state (struct gdbarch *gdbar > int regnum; > struct remote_state *rs = xmalloc (sizeof (struct remote_state)); > > - /* Start out by having the remote protocol mimic the existing > - behavour - just copy in the description of the register cache. */ > - rs->sizeof_g_packet = DEPRECATED_REGISTER_BYTES; /* OK */ > + rs->sizeof_g_packet = 0; For the moment it is safer to do: if (DEPRECATED_REGISTER_BYTES_P ()) rs-> ... = ...; else rs-> ... = 0; > /* Assume a 1:1 regnum<->pnum table. */ > rs->regs = xcalloc (NUM_REGS + NUM_PSEUDO_REGS, sizeof (struct packet_reg)); > @@ -274,8 +272,10 @@ init_remote_state (struct gdbarch *gdbar > r->regnum = regnum; > r->offset = REGISTER_BYTE (regnum); > r->in_g_packet = (regnum < NUM_REGS); > - /* ...size = REGISTER_RAW_SIZE (regnum); */ > /* ...name = REGISTER_NAME (regnum); */ > + > + /* Compute packet size by accumulating the size of all registers. */ > + rs->sizeof_g_packet += REGISTER_RAW_SIZE (regnum); And here: if (!DEPRECATED_REGISTER_BYTES_P ()) rs-> ... += register_size (current_gdbarch); register_size is better. > } > > /* Default maximum number of characters in a packet body. Many The problem is that for some targets, the register sizes don't add up to REGISTER_BYTES. otherwize ok, Andrew