From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32527 invoked by alias); 16 May 2002 15:36:22 -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 32448 invoked from network); 16 May 2002 15:36:11 -0000 Received: from unknown (HELO fw-cam.cambridge.arm.com) (193.131.176.3) by sources.redhat.com with SMTP; 16 May 2002 15:36:11 -0000 Received: by fw-cam.cambridge.arm.com; id QAA04102; Thu, 16 May 2002 16:36:10 +0100 (BST) Received: from unknown(172.16.1.2) by fw-cam.cambridge.arm.com via smap (V5.5) id xma003292; Thu, 16 May 02 16:35:40 +0100 Received: from cam-mail2.cambridge.arm.com (cam-mail2.cambridge.arm.com [172.16.1.91]) by cam-admin0.cambridge.arm.com (8.9.3/8.9.3) with ESMTP id QAA06340; Thu, 16 May 2002 16:35:39 +0100 (BST) Received: from sun18.cambridge.arm.com (sun18.cambridge.arm.com [172.16.2.18]) by cam-mail2.cambridge.arm.com (8.9.3/8.9.3) with ESMTP id QAA09516; Thu, 16 May 2002 16:35:39 +0100 (BST) Message-Id: <200205161535.QAA09516@cam-mail2.cambridge.arm.com> To: Andrew Cagney cc: Richard.Earnshaw@arm.com, Elena Zannoni , gdb@sources.redhat.com Reply-To: Richard.Earnshaw@arm.com Organization: ARM Ltd. X-Telephone: +44 1223 400569 (direct+voicemail), +44 1223 400400 (switchbd) X-Fax: +44 1223 400410 X-Address: ARM Ltd., 110 Fulbourn Road, Cherry Hinton, Cambridge CB1 9NJ. X-Url: http://www.arm.com/ Subject: Re: read_register_byte can't work with pseudo-reg model In-reply-to: Your message of "Thu, 16 May 2002 09:41:20 EDT." <3CE3B700.3060302@cygnus.com> Mime-Version: 1.0 Content-Type: multipart/mixed ; boundary="==_Exmh_-2334779890" Date: Thu, 16 May 2002 08:36:00 -0000 From: Richard Earnshaw X-SW-Source: 2002-05/txt/msg00190.txt.bz2 This is a multipart MIME message. --==_Exmh_-2334779890 Content-Type: text/plain; charset=us-ascii Content-length: 1526 > > 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. > > > > > > Which target is that, and where is READ_REGISTER_P ? I can't find > > anything in the either the source or the mailing lists. Mind you, the > > web-based mailing list search even fails to find your message when I > > search for READ_REGISTER_P. Ok, the following solves my problem; it also makes saving/restoring the regcache far more efficient on machines that have that have READ_REGISTER_P. The only assumption is that if this is defined, then pseudos do not need unique entries in the regcache (ie they always map onto physical registers), so we can copy the regcache simply by iterating over 0..NUM_REGS. I need to re-baseline my testsuite runs, but the results look pretty encouraging compared to previous runs. Elena, would this be compatible with the SH model? R. * regcache.c (read_register_bytes): If read_register_p is defined and we are saving the entire register set, then short-cut the save operation. (write_register_bytes): Similarly for write_register_p and restoring the register set. --==_Exmh_-2334779890 Content-Type: text/x-patch ; name="gdb-regbytes.patch"; charset=us-ascii Content-Description: gdb-regbytes.patch Content-Disposition: attachment; filename="gdb-regbytes.patch" Content-length: 1971 Index: regcache.c =================================================================== RCS file: /cvs/src/src/gdb/regcache.c,v retrieving revision 1.34 diff -p -r1.34 regcache.c *** regcache.c 6 Apr 2002 00:02:50 -0000 1.34 --- regcache.c 16 May 2002 15:31:56 -0000 *************** read_register_bytes (int in_start, char *** 228,233 **** --- 228,248 ---- int regnum; char *reg_buf = alloca (MAX_REGISTER_RAW_SIZE); + if (gdbarch_register_read_p (current_gdbarch) + && in_start == 0 && in_len == REGISTER_BYTES) /* OK Use. */ + { + /* We assume that if the target has set register_read_p() then + all the pseuos will be correctly mapped onto raw registers. + Therefore, the regcache describes only the registers in the + range [0..NUM_REGS) and the code for reading the entire + regset becomes much simpler. */ + + for (regnum = 0; regnum < NUM_REGS; regnum++) + regcache_read (regnum, in_buf + REGISTER_BYTE (regnum)); + + return; + } + /* See if we are trying to read bytes from out-of-date registers. If so, update just those registers. */ *************** write_register_bytes (int myregstart, ch *** 397,402 **** --- 412,432 ---- int regnum; target_prepare_to_store (); + + if (gdbarch_register_write_p (current_gdbarch) + && myregstart == 0 && inlen == REGISTER_BYTES) /* OK Use. */ + { + /* We assume that if the target has set register_write_p() then + all the pseuos will be correctly mapped onto raw registers. + Therefore, the regcache describes only the registers in the + range [0..NUM_REGS) and the code for restoring things becomes + much simpler. */ + + for (regnum = 0; regnum < NUM_REGS; regnum++) + regcache_write (regnum, myaddr + REGISTER_BYTE (regnum)); + + return; + } /* Scan through the registers updating any that are covered by the range myregstart<=>myregend using write_register_gen, which does --==_Exmh_-2334779890--