From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4787 invoked by alias); 15 May 2002 19:43:26 -0000 Mailing-List: contact gdb-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sources.redhat.com Received: (qmail 4759 invoked from network); 15 May 2002 19:43:25 -0000 Received: from unknown (HELO localhost.redhat.com) (216.138.202.10) by sources.redhat.com with SMTP; 15 May 2002 19:43:25 -0000 Received: from cygnus.com (localhost [127.0.0.1]) by localhost.redhat.com (Postfix) with ESMTP id A184D3D61; Wed, 15 May 2002 15:43:33 -0400 (EDT) Message-ID: <3CE2BA65.4090001@cygnus.com> Date: Wed, 15 May 2002 12:43:00 -0000 From: Andrew Cagney User-Agent: Mozilla/5.0 (X11; U; NetBSD macppc; en-US; rv:1.0rc1) Gecko/20020429 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Richard.Earnshaw@arm.com, Elena Zannoni Cc: gdb@sources.redhat.com Subject: Re: read_register_byte can't work with pseudo-reg model References: <200205151652.RAA12242@cam-mail2.cambridge.arm.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-SW-Source: 2002-05/txt/msg00182.txt.bz2 > Given the following code in read_register_byte: [read_register_bytes] > reg_start = REGISTER_BYTE (regnum); > reg_len = REGISTER_RAW_SIZE (regnum); > reg_end = reg_start + reg_len; > > if (reg_end <= in_start || in_end <= reg_start) > /* The range the user wants to read doesn't overlap with regnum. */ > continue; > > if (REGISTER_NAME (regnum) != NULL && *REGISTER_NAME (regnum) != > '\0') > /* Force the cache to fetch the entire register. */ > read_register_gen (regnum, reg_buf); > else > /* Legacy note: even though this register is ``invalid'' we > still need to return something. It would appear that some > code relies on apparent gaps in the register array also > being returned. */ > /* FIXME: cagney/2001-08-18: This is just silly. It defeats > the entire register read/write flow of control. Must > resist temptation to return 0xdeadbeef. */ > memcpy (reg_buf, registers + reg_start, reg_len); I'm guessing. Try: if (REGISTER_READ_P ()) { do something fairly sane; } else { all the legacy cruft including the call to legacy_read_register_gen() and that test. } Thing is that there is only one target in the FSF using READ_REGISTER_P() so there is this dividing line - something using read_register_p() can be given far stronger requirements than for the older code. ``do something sane'' would be go straight through to the raw cache (regcache_read) for [0..REG_NUM) and go via READ_REGISTER() for anything else. Elena, how would sh5 cope with this change? > Then the new model of having all named registers be pseudos will never > re-read the registers, because all registers with an entry in registers[] > will not have a name. > > Shouldn't the "REGISTER_NAME" check be a direct check for > register_cached(regno) == 0 > > That would mean that we could change the above to be something like > > reg_start = REGISTER_BYTE (regnum); > reg_len = REGISTER_RAW_SIZE (regnum); > reg_end = reg_start + reg_len; > > if (reg_end <= in_start || in_end <= reg_start) > /* The range the user wants to read doesn't overlap with regnum. */ > continue; > > if (register_cached (regnum) == 0) > /* Force the cache to fetch the entire register. */ > legacy_read_register_gen (regnum, reg_buf); Thinking about it, my sugestion isn't sufficent :-( One of the problems with read_register_bytes is that it is used to both read the raw register cache (a rawreg thing) and read sequences of pseudo registers (a cookedreg thing). > else > /* Legacy note: even though this register is ``invalid'' we > still need to return something. It would appear that some > code relies on apparent gaps in the register array also > being returned. */ > /* FIXME: cagney/2001-08-18: This is just silly. It defeats > the entire register read/write flow of control. Must > resist temptation to return 0xdeadbeef. */ > memcpy (reg_buf, registers + reg_start, reg_len); > > Though I'm still not sure what we should do for a pseudo with no entry in > the cache. Andrew