From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1965 invoked by alias); 13 Nov 2004 22:42:38 -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 1862 invoked from network); 13 Nov 2004 22:42:28 -0000 Received: from unknown (HELO takamaka.act-europe.fr) (142.179.108.108) by sourceware.org with SMTP; 13 Nov 2004 22:42:28 -0000 Received: by takamaka.act-europe.fr (Postfix, from userid 507) id 4C2AA47DA0; Sat, 13 Nov 2004 14:42:27 -0800 (PST) Date: Sat, 13 Nov 2004 22:42:00 -0000 From: Joel Brobecker To: gdb-patches@sources.redhat.com Subject: [RFA/RFC/IRIX] Remove some deprecated_registers from irix5-nat.c Message-ID: <20041113224227.GK935@gnat.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="+HP7ph2BbKc20aGI" Content-Disposition: inline User-Agent: Mutt/1.4i X-SW-Source: 2004-11/txt/msg00292.txt.bz2 --+HP7ph2BbKc20aGI Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-length: 1637 Hello, Here is a patch that removes most of the uses of deprecated_registers in irix5-nat.c. I am not too familiar with the regcache yet, I hope I got it right. There was also a small issue with type size, where I introduced a temporary (regval) to make sure that the buffer given to regcache_raw_read_signed would always be large enough. Not sure whether it was the best way to do it (this shows my lack of C knowledge). 2004-11-13 Joel Brobecker * irix5-nat.c (fill_gregset): Replace use of deprecated_registers with equivalent code. (fill_fpregset): Likewise. Tested on mips-irix. There is an occasional screwup during the execution of gdb.threads/killed.exp that causes the testsuite to abort before the end: ERROR: (DejaGnu) proc "(gdb) {$}" does not exist. The error code is NONE The info on the error is: close: invalid spawn id (8) while executing "close -i 8" invoked from within "catch "close -i $spawn_id"" Given that the testsuite takes a fair bit of time to run on our IRIX machine, and given that it can happen several times in a row before I get a clean run, I am reluctant to retry. So it's a bit more difficult to compare the two testsuite results. But I verified that we didn't have any change in all the testsuite up until this point. OK to apply? The last couple of uses of deprecated_registers will be removed shortly. I decided to handle them separately because they are used when loading the registers from a core file. I wanted to evaluate the attached change first. Thanks, -- Joel --+HP7ph2BbKc20aGI Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="irix5-nat.c.diff" Content-length: 3560 Index: irix5-nat.c =================================================================== RCS file: /cvs/src/src/gdb/irix5-nat.c,v retrieving revision 1.35 diff -u -p -r1.35 irix5-nat.c --- irix5-nat.c 30 Oct 2004 22:36:34 -0000 1.35 +++ irix5-nat.c 13 Nov 2004 22:33:07 -0000 @@ -83,6 +83,7 @@ fill_gregset (gregset_t *gregsetp, int r { int regi; greg_t *regp = &(*gregsetp)[0]; + LONGEST regval; /* Under Irix6, if GDB is built with N32 ABI and is debugging an O32 executable, we have to sign extend the registers to 64 bits before @@ -90,30 +91,39 @@ fill_gregset (gregset_t *gregsetp, int r for (regi = 0; regi <= CTX_RA; regi++) if ((regno == -1) || (regno == regi)) - *(regp + regi) = - extract_signed_integer (&deprecated_registers[DEPRECATED_REGISTER_BYTE (regi)], - register_size (current_gdbarch, regi)); + { + regcache_raw_read_signed (current_regcache, regi, ®val); + *(regp + regi) = regval; + } if ((regno == -1) || (regno == PC_REGNUM)) - *(regp + CTX_EPC) = - extract_signed_integer (&deprecated_registers[DEPRECATED_REGISTER_BYTE (mips_regnum (current_gdbarch)->pc)], - register_size (current_gdbarch, mips_regnum (current_gdbarch)->pc)); + { + regcache_raw_read_signed + (current_regcache, mips_regnum (current_gdbarch)->pc, ®val); + *(regp + CTX_EPC) = regval; + } if ((regno == -1) || (regno == mips_regnum (current_gdbarch)->cause)) - *(regp + CTX_CAUSE) = - extract_signed_integer (&deprecated_registers[DEPRECATED_REGISTER_BYTE (mips_regnum (current_gdbarch)->cause)], - register_size (current_gdbarch, mips_regnum (current_gdbarch)->cause)); + { + regcache_raw_read_signed + (current_regcache, mips_regnum (current_gdbarch)->cause, ®val); + *(regp + CTX_CAUSE) = regval; + } if ((regno == -1) || (regno == mips_regnum (current_gdbarch)->hi)) - *(regp + CTX_MDHI) = - extract_signed_integer (&deprecated_registers[DEPRECATED_REGISTER_BYTE (mips_regnum (current_gdbarch)->hi)], - register_size (current_gdbarch, mips_regnum (current_gdbarch)->hi)); + { + regcache_raw_read_signed + (current_regcache, mips_regnum (current_gdbarch)->hi, ®val); + *(regp + CTX_MDHI) = regval; + } if ((regno == -1) || (regno == mips_regnum (current_gdbarch)->lo)) - *(regp + CTX_MDLO) = - extract_signed_integer (&deprecated_registers[DEPRECATED_REGISTER_BYTE (mips_regnum (current_gdbarch)->lo)], - register_size (current_gdbarch, mips_regnum (current_gdbarch)->lo)); + { + regcache_raw_read_signed + (current_regcache, mips_regnum (current_gdbarch)->lo, ®val); + *(regp + CTX_MDLO) = regval; + } } /* @@ -158,15 +168,16 @@ fill_fpregset (fpregset_t *fpregsetp, in { if ((regno == -1) || (regno == regi)) { - from = (char *) &deprecated_registers[DEPRECATED_REGISTER_BYTE (regi)]; to = (char *) &(fpregsetp->fp_r.fp_regs[regi - FP0_REGNUM]); - memcpy (to, from, register_size (current_gdbarch, regi)); + regcache_raw_read (current_regcache, regi, to); } } if ((regno == -1) || (regno == mips_regnum (current_gdbarch)->fp_control_status)) - fpregsetp->fp_csr = *(unsigned *) &deprecated_registers[DEPRECATED_REGISTER_BYTE (mips_regnum (current_gdbarch)->fp_control_status)]; + regcache_raw_read (current_regcache, + mips_regnum (current_gdbarch)->fp_control_status, + &fpregsetp->fp_csr); } --+HP7ph2BbKc20aGI--