From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5520 invoked by alias); 29 Jan 2002 19:22:16 -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 5483 invoked from network); 29 Jan 2002 19:22:15 -0000 Received: from unknown (HELO localhost.cygnus.com) (216.138.202.10) by sources.redhat.com with SMTP; 29 Jan 2002 19:22:15 -0000 Received: from cygnus.com (localhost [127.0.0.1]) by localhost.cygnus.com (Postfix) with ESMTP id 7855A3D61; Tue, 29 Jan 2002 14:22:09 -0500 (EST) Message-ID: <3C56F660.5040902@cygnus.com> Date: Tue, 29 Jan 2002 11:22:00 -0000 From: Andrew Cagney User-Agent: Mozilla/5.0 (X11; U; NetBSD macppc; en-US; rv:0.9.7) Gecko/20020103 X-Accept-Language: en-us MIME-Version: 1.0 To: Michael Snyder Cc: gdb-patches@sources.redhat.com Subject: Re: [RFA] legacy_[read/write]_register_gen References: <200201290102.g0T12Uk24471@reddwarf.cygnus.com> <3C5614AF.4050809@cygnus.com> <3C56EC48.8ACAC16B@redhat.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-SW-Source: 2002-01/txt/msg00761.txt.bz2 > Simplest case -- say you want to have a pseudo-register that > mirrors the contents of a real register. > > static void > my_fetch_pseudo_register (int regnum) > { > if (regnum == MY_MIRROR_REGNUM) > { > char buf[REGISTER_SIZE]; > regcache_read (MY_REAL_REGNUM, buf); > regcache_write (MY_MIRROR_REGNUM, buf); > } > } > > You can't do that unles legacy_write_register_bytes can address > the regcache location of your pseudo-register. That should be implemented as: my_register_read (int regnum, ...) { if (regnum == MY_MIRROR_REGNUM) regcache_read (MY_REAL_REGNUM, buf) else regcache_read (regnum, buf); } GDB no longer needs to have duplicated register values in the regcache. Anyway, I have figured out why the change is needed. You can end up with ``real'' registers in the [NUM_REGS .. NUM_REGS+NUM_PSEUDO_REGS) range. This happens (at present still theory) when a register that isn't in the G packet is fetched. Andrew