From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16034 invoked by alias); 29 Jan 2002 18:45:52 -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 15881 invoked from network); 29 Jan 2002 18:45:42 -0000 Received: from unknown (HELO cygnus.com) (205.180.230.5) by sources.redhat.com with SMTP; 29 Jan 2002 18:45:42 -0000 Received: from redhat.com (reddwarf.sfbay.redhat.com [205.180.231.12]) by runyon.cygnus.com (8.8.7-cygnus/8.8.7) with ESMTP id KAA14951; Tue, 29 Jan 2002 10:45:39 -0800 (PST) Message-ID: <3C56EC48.8ACAC16B@redhat.com> Date: Tue, 29 Jan 2002 10:45:00 -0000 From: Michael Snyder Organization: Red Hat, Inc. X-Mailer: Mozilla 4.76 [en] (X11; U; Linux 2.4.2-2smp i686) X-Accept-Language: en MIME-Version: 1.0 To: Andrew Cagney CC: Michael Snyder , gdb-patches@sources.redhat.com, cagney@redhat.com Subject: Re: [RFA] legacy_[read/write]_register_gen References: <200201290102.g0T12Uk24471@reddwarf.cygnus.com> <3C5614AF.4050809@cygnus.com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-SW-Source: 2002-01/txt/msg00758.txt.bz2 Andrew Cagney wrote: > > > These two functions need to be able to read/write > > a pseudo-register as well as a real register. > > > > 2002-01-28 Michael Snyder > > > > * regcache.c (legacy_read_register_gen): Need to be able to > > read pseudo-register as well as real register. > > (legacy_write_register_gen): Ditto. > > Michael, > > When is this occuring? Dig dig, I've a similar patch sitting in my > sand-pit so, hmm, I've also seen it but don't remember why :-( > > Andrew 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. > > Index: regcache.c > > =================================================================== > > RCS file: /cvs/src/src/gdb/regcache.c,v > > retrieving revision 1.30 > > diff -c -3 -p -r1.30 regcache.c > > *** regcache.c 2002/01/15 02:06:46 1.30 > > --- regcache.c 2002/01/29 01:02:29 > > *************** legacy_read_register_gen (int regnum, ch > > *** 310,316 **** > > void > > regcache_read (int rawnum, char *buf) > > { > > ! gdb_assert (rawnum >= 0 && rawnum < NUM_REGS); > > /* For moment, just use underlying legacy code. Ulgh!!! */ > > legacy_read_register_gen (rawnum, buf); > > } > > --- 310,316 ---- > > void > > regcache_read (int rawnum, char *buf) > > { > > ! gdb_assert (rawnum >= 0 && rawnum < (NUM_REGS + NUM_PSEUDO_REGS)); > > /* For moment, just use underlying legacy code. Ulgh!!! */ > > legacy_read_register_gen (rawnum, buf); > > } > > *************** legacy_write_register_gen (int regnum, c > > *** 369,375 **** > > void > > regcache_write (int rawnum, char *buf) > > { > > ! gdb_assert (rawnum >= 0 && rawnum < NUM_REGS); > > /* For moment, just use underlying legacy code. Ulgh!!! */ > > legacy_write_register_gen (rawnum, buf); > > } > > --- 369,375 ---- > > void > > regcache_write (int rawnum, char *buf) > > { > > ! gdb_assert (rawnum >= 0 && rawnum < (NUM_REGS + NUM_PSEUDO_REGS)); > > /* For moment, just use underlying legacy code. Ulgh!!! */ > > legacy_write_register_gen (rawnum, buf); > > } > > > > > >