From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12274 invoked by alias); 26 Feb 2007 19:29:43 -0000 Received: (qmail 12265 invoked by uid 22791); 26 Feb 2007 19:29:43 -0000 X-Spam-Check-By: sourceware.org Received: from nevyn.them.org (HELO nevyn.them.org) (66.93.172.17) by sourceware.org (qpsmtpd/0.31.1) with ESMTP; Mon, 26 Feb 2007 19:29:32 +0000 Received: from dsl093-172-095.pit1.dsl.speakeasy.net ([66.93.172.95] helo=caradoc.them.org) by nevyn.them.org with esmtp (Exim 4.63) (envelope-from ) id 1HLlXN-00068d-Dr for gdb-patches@sourceware.org; Mon, 26 Feb 2007 14:29:29 -0500 Received: from drow by caradoc.them.org with local (Exim 4.63) (envelope-from ) id 1HLlXN-0000sc-8E for gdb-patches@sourceware.org; Mon, 26 Feb 2007 14:29:29 -0500 Date: Mon, 26 Feb 2007 19:29:00 -0000 From: Daniel Jacobowitz To: gdb-patches@sourceware.org Subject: [commit] Fix a zero-sized registers bug Message-ID: <20070226192929.GA3023@caradoc.them.org> Mail-Followup-To: gdb-patches@sourceware.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.13 (2006-08-11) 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: 2007-02/txt/msg00321.txt.bz2 A followon to the ARM iWMMXt patches, found during basic ARM testing. If we do not add a special case for zero-sized registers, we'll get an internal error during 'g' packet parsing - they appear to be past the end of the 'g' packet, even though they occupy no bytes in it. The right answer is to neither fetch nor store registers without contents, of course. Anything else runs the risk of wasted 'p' / 'P' packets going back and forth. Tested on arm-linux and checked in. -- Daniel Jacobowitz CodeSourcery 2007-02-26 Daniel Jacobowitz * remote.c (init_remote_state): Add special handling for placeholder registers. --- gdb/remote.c | 8 +++++++- 1 files changed, 7 insertions(+), 1 deletion(-) Index: gdb-6.6.50/gdb/remote.c =================================================================== --- gdb-6.6.50.orig/gdb/remote.c 2007-02-26 05:03:30.000000000 -0800 +++ gdb-6.6.50/gdb/remote.c 2007-02-26 05:22:46.000000000 -0800 @@ -340,7 +340,13 @@ init_remote_state (struct gdbarch *gdbar for (regnum = 0; regnum < NUM_REGS; regnum++) { struct packet_reg *r = &rsa->regs[regnum]; - r->pnum = gdbarch_remote_register_number (gdbarch, regnum); + + if (register_size (current_gdbarch, regnum) == 0) + /* Do not try to fetch zero-sized (placeholder) registers. */ + r->pnum = -1; + else + r->pnum = gdbarch_remote_register_number (gdbarch, regnum); + r->regnum = regnum; }