From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29408 invoked by alias); 30 Jan 2011 23:14:02 -0000 Received: (qmail 29396 invoked by uid 22791); 30 Jan 2011 23:14:01 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL,BAYES_00,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mail.codesourcery.com (HELO mail.codesourcery.com) (38.113.113.100) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sun, 30 Jan 2011 23:13:55 +0000 Received: (qmail 5292 invoked from network); 30 Jan 2011 23:13:53 -0000 Received: from unknown (HELO ?192.168.0.101?) (yao@127.0.0.2) by mail.codesourcery.com with ESMTPA; 30 Jan 2011 23:13:53 -0000 Message-ID: <4D45F0AC.3080200@codesourcery.com> Date: Sun, 30 Jan 2011 23:31:00 -0000 From: Yao Qi User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.13) Gecko/20101208 Thunderbird/3.1.7 MIME-Version: 1.0 To: Pedro Alves CC: gdb-patches@sourceware.org Subject: Re: s/regcache_valid_p/regcache_register_status; add enum register_status References: <201101251249.04269.pedro@codesourcery.com> <4D44D91F.6030504@codesourcery.com> <201101301150.49147.pedro@codesourcery.com> In-Reply-To: <201101301150.49147.pedro@codesourcery.com> Content-Type: multipart/mixed; boundary="------------030402010207050000070909" X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2011-01/txt/msg00568.txt.bz2 This is a multi-part message in MIME format. --------------030402010207050000070909 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Content-length: 329 On 01/30/2011 07:50 PM, Pedro Alves wrote: >> > OK to apply? > Not as is. Please use 'if (regcache_register_status (..) == REG_VALID)' > instead of 'if (regcache_register_status (..)'. Okay with that > change. > Revise patch as Pedro suggested, and rebuild native GDB on ARM. Everything looks OK. Applied. -- Yao (齐尧) --------------030402010207050000070909 Content-Type: text/x-patch; name="regcache_valid_p.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="regcache_valid_p.patch" Content-length: 10599 gdb/ 2011-01-30 Yao Qi * arm-linux-nat.c: Update calls to regcache_register_status instead of regcache_valid_p. * aix-thread.c: Likewise. * i386gnu-nat.c: Likewise. Index: gdb/aix-thread.c =================================================================== RCS file: /cvs/src/src/gdb/aix-thread.c,v retrieving revision 1.74 diff -u -r1.74 aix-thread.c --- gdb/aix-thread.c 7 Jan 2011 19:36:15 -0000 1.74 +++ gdb/aix-thread.c 30 Jan 2011 22:39:08 -0000 @@ -1321,7 +1321,8 @@ int regno; for (regno = 0; regno < ppc_num_gprs; regno++) - if (regcache_valid_p (regcache, tdep->ppc_gp0_regnum + regno)) + if (REG_VALID == regcache_register_status (regcache, + tdep->ppc_gp0_regnum + regno)) regcache_raw_collect (regcache, tdep->ppc_gp0_regnum + regno, vals + regno); } @@ -1333,7 +1334,8 @@ int regno; for (regno = 0; regno < ppc_num_gprs; regno++) - if (regcache_valid_p (regcache, tdep->ppc_gp0_regnum + regno)) + if (REG_VALID == regcache_register_status (regcache, + tdep->ppc_gp0_regnum + regno)) regcache_raw_collect (regcache, tdep->ppc_gp0_regnum + regno, vals + regno); } @@ -1353,7 +1355,7 @@ for (regno = tdep->ppc_fp0_regnum; regno < tdep->ppc_fp0_regnum + ppc_num_fprs; regno++) - if (regcache_valid_p (regcache, regno)) + if (REG_VALID == regcache_register_status (regcache, regno)) regcache_raw_collect (regcache, regno, vals + regno); } @@ -1377,20 +1379,22 @@ gdb_assert (sizeof (*iar) == register_size (gdbarch, gdbarch_pc_regnum (gdbarch))); - if (regcache_valid_p (regcache, gdbarch_pc_regnum (gdbarch))) + if (REG_VALID == regcache_register_status (regcache, + gdbarch_pc_regnum (gdbarch))) regcache_raw_collect (regcache, gdbarch_pc_regnum (gdbarch), iar); - if (regcache_valid_p (regcache, tdep->ppc_ps_regnum)) + if (REG_VALID == regcache_register_status (regcache, tdep->ppc_ps_regnum)) regcache_raw_collect (regcache, tdep->ppc_ps_regnum, msr); - if (regcache_valid_p (regcache, tdep->ppc_cr_regnum)) + if (REG_VALID == regcache_register_status (regcache, tdep->ppc_cr_regnum)) regcache_raw_collect (regcache, tdep->ppc_cr_regnum, cr); - if (regcache_valid_p (regcache, tdep->ppc_lr_regnum)) + if (REG_VALID == regcache_register_status (regcache, tdep->ppc_lr_regnum)) regcache_raw_collect (regcache, tdep->ppc_lr_regnum, lr); - if (regcache_valid_p (regcache, tdep->ppc_ctr_regnum)) + if (REG_VALID == regcache_register_status (regcache, tdep->ppc_ctr_regnum)) regcache_raw_collect (regcache, tdep->ppc_ctr_regnum, ctr); - if (regcache_valid_p (regcache, tdep->ppc_xer_regnum)) + if (REG_VALID == regcache_register_status (regcache, tdep->ppc_xer_regnum)) regcache_raw_collect (regcache, tdep->ppc_xer_regnum, xer); if (tdep->ppc_fpscr_regnum >= 0 - && regcache_valid_p (regcache, tdep->ppc_fpscr_regnum)) + && REG_VALID == regcache_register_status (regcache, + tdep->ppc_fpscr_regnum)) regcache_raw_collect (regcache, tdep->ppc_fpscr_regnum, fpscr); } @@ -1411,20 +1415,21 @@ gdb_assert (sizeof (*iar) == register_size (gdbarch, gdbarch_pc_regnum (gdbarch))); - if (regcache_valid_p (regcache, gdbarch_pc_regnum (gdbarch))) + if (REG_VALID == regcache_register_status (regcache, + gdbarch_pc_regnum (gdbarch))) regcache_raw_collect (regcache, gdbarch_pc_regnum (gdbarch), iar); - if (regcache_valid_p (regcache, tdep->ppc_ps_regnum)) + if (REG_VALID == regcache_register_status (regcache, tdep->ppc_ps_regnum)) regcache_raw_collect (regcache, tdep->ppc_ps_regnum, msr); - if (regcache_valid_p (regcache, tdep->ppc_cr_regnum)) + if (REG_VALID == regcache_register_status (regcache, tdep->ppc_cr_regnum)) regcache_raw_collect (regcache, tdep->ppc_cr_regnum, cr); - if (regcache_valid_p (regcache, tdep->ppc_lr_regnum)) + if (REG_VALID == regcache_register_status (regcache, tdep->ppc_lr_regnum)) regcache_raw_collect (regcache, tdep->ppc_lr_regnum, lr); - if (regcache_valid_p (regcache, tdep->ppc_ctr_regnum)) + if (REG_VALID == regcache_register_status (regcache, tdep->ppc_ctr_regnum)) regcache_raw_collect (regcache, tdep->ppc_ctr_regnum, ctr); - if (regcache_valid_p (regcache, tdep->ppc_xer_regnum)) + if (REG_VALID == regcache_register_status (regcache, tdep->ppc_xer_regnum)) regcache_raw_collect (regcache, tdep->ppc_xer_regnum, xer); if (tdep->ppc_fpscr_regnum >= 0 - && regcache_valid_p (regcache, tdep->ppc_fpscr_regnum)) + && REG_VALID == regcache_register_status (regcache, tdep->ppc_fpscr_regnum)) regcache_raw_collect (regcache, tdep->ppc_fpscr_regnum, fpscr); } @@ -1459,7 +1464,8 @@ /* Collect general-purpose register values from the regcache. */ for (i = 0; i < ppc_num_gprs; i++) - if (regcache_valid_p (regcache, tdep->ppc_gp0_regnum + i)) + if (REG_VALID == regcache_register_status (regcache, + tdep->ppc_gp0_regnum + i)) { if (arch64) { @@ -1494,19 +1500,23 @@ fill_sprs32 (regcache, &tmp_iar, &tmp_msr, &tmp_cr, &tmp_lr, &tmp_ctr, &tmp_xer, &tmp_fpscr); - if (regcache_valid_p (regcache, gdbarch_pc_regnum (gdbarch))) + if (REG_VALID == regcache_register_status (regcache, + gdbarch_pc_regnum (gdbarch))) ctx.iar = tmp_iar; - if (regcache_valid_p (regcache, tdep->ppc_ps_regnum)) + if (REG_VALID == regcache_register_status (regcache, tdep->ppc_ps_regnum)) ctx.msr = tmp_msr; - if (regcache_valid_p (regcache, tdep->ppc_cr_regnum)) + if (REG_VALID == regcache_register_status (regcache, tdep->ppc_cr_regnum)) ctx.cr = tmp_cr; - if (regcache_valid_p (regcache, tdep->ppc_lr_regnum)) + if (REG_VALID == regcache_register_status (regcache, tdep->ppc_lr_regnum)) ctx.lr = tmp_lr; - if (regcache_valid_p (regcache, tdep->ppc_ctr_regnum)) + if (REG_VALID == regcache_register_status (regcache, + tdep->ppc_ctr_regnum)) ctx.ctr = tmp_ctr; - if (regcache_valid_p (regcache, tdep->ppc_xer_regnum)) + if (REG_VALID == regcache_register_status (regcache, + tdep->ppc_xer_regnum)) ctx.xer = tmp_xer; - if (regcache_valid_p (regcache, tdep->ppc_xer_regnum)) + if (REG_VALID == regcache_register_status (regcache, + tdep->ppc_xer_regnum)) ctx.fpscr = tmp_fpscr; } @@ -1620,7 +1630,8 @@ sprs32.pt_fpscr = tmp_fpscr; if (tdep->ppc_mq_regnum >= 0) - if (regcache_valid_p (regcache, tdep->ppc_mq_regnum)) + if (REG_VALID == regcache_register_status (regcache, + tdep->ppc_mq_regnum)) regcache_raw_collect (regcache, tdep->ppc_mq_regnum, &sprs32.pt_mq); Index: gdb/i386gnu-nat.c =================================================================== RCS file: /cvs/src/src/gdb/i386gnu-nat.c,v retrieving revision 1.41 diff -u -r1.41 i386gnu-nat.c --- gdb/i386gnu-nat.c 9 Jan 2011 03:08:56 -0000 1.41 +++ gdb/i386gnu-nat.c 30 Jan 2011 22:39:08 -0000 @@ -272,7 +272,7 @@ proc_debug (thread, "storing all registers"); for (i = 0; i < I386_NUM_GREGS; i++) - if (regcache_valid_p (regcache, i)) + if (REG_VALID == regcache_register_status (regcache, i)) regcache_raw_collect (regcache, i, REG_ADDR (state, i)); } else @@ -280,7 +280,7 @@ proc_debug (thread, "storing register %s", gdbarch_register_name (gdbarch, regno)); - gdb_assert (regcache_valid_p (regcache, regno)); + gdb_assert (REG_VALID == regcache_register_status (regcache, regno)); regcache_raw_collect (regcache, regno, REG_ADDR (state, regno)); } Index: gdb/arm-linux-nat.c =================================================================== RCS file: /cvs/src/src/gdb/arm-linux-nat.c,v retrieving revision 1.45 diff -u -r1.45 arm-linux-nat.c --- gdb/arm-linux-nat.c 7 Jan 2011 19:36:15 -0000 1.45 +++ gdb/arm-linux-nat.c 30 Jan 2011 22:39:09 -0000 @@ -190,7 +190,8 @@ } /* Store fpsr. */ - if (ARM_FPS_REGNUM == regno && regcache_valid_p (regcache, ARM_FPS_REGNUM)) + if (ARM_FPS_REGNUM == regno + && REG_VALID == regcache_register_status (regcache, ARM_FPS_REGNUM)) regcache_raw_collect (regcache, ARM_FPS_REGNUM, fp + NWFPE_FPSR_OFFSET); /* Store the floating point register. */ @@ -226,12 +227,12 @@ } /* Store fpsr. */ - if (regcache_valid_p (regcache, ARM_FPS_REGNUM)) + if (REG_VALID == regcache_register_status (regcache, ARM_FPS_REGNUM)) regcache_raw_collect (regcache, ARM_FPS_REGNUM, fp + NWFPE_FPSR_OFFSET); /* Store the floating point registers. */ for (regno = ARM_F0_REGNUM; regno <= ARM_F7_REGNUM; regno++) - if (regcache_valid_p (regcache, regno)) + if (REG_VALID == regcache_register_status (regcache, regno)) collect_nwfpe_register (regcache, regno, fp); ret = ptrace (PTRACE_SETFPREGS, tid, 0, fp); @@ -328,7 +329,7 @@ int ret, tid; elf_gregset_t regs; - if (!regcache_valid_p (regcache, regno)) + if (REG_VALID != regcache_register_status (regcache, regno)) return; /* Get the thread id for the ptrace call. */ @@ -378,11 +379,11 @@ for (regno = ARM_A1_REGNUM; regno <= ARM_PC_REGNUM; regno++) { - if (regcache_valid_p (regcache, regno)) + if (REG_VALID == regcache_register_status (regcache, regno)) regcache_raw_collect (regcache, regno, (char *) ®s[regno]); } - if (arm_apcs_32 && regcache_valid_p (regcache, ARM_PS_REGNUM)) + if (arm_apcs_32 && REG_VALID == regcache_register_status (regcache, ARM_PS_REGNUM)) regcache_raw_collect (regcache, ARM_PS_REGNUM, (char *) ®s[ARM_CPSR_GREGNUM]); @@ -446,17 +447,20 @@ } for (regno = 0; regno < 16; regno++) - if (regcache_valid_p (regcache, regno + ARM_WR0_REGNUM)) + if (REG_VALID == regcache_register_status (regcache, + regno + ARM_WR0_REGNUM)) regcache_raw_collect (regcache, regno + ARM_WR0_REGNUM, ®buf[regno * 8]); for (regno = 0; regno < 2; regno++) - if (regcache_valid_p (regcache, regno + ARM_WCSSF_REGNUM)) + if (REG_VALID == regcache_register_status (regcache, + regno + ARM_WCSSF_REGNUM)) regcache_raw_collect (regcache, regno + ARM_WCSSF_REGNUM, ®buf[16 * 8 + regno * 4]); for (regno = 0; regno < 4; regno++) - if (regcache_valid_p (regcache, regno + ARM_WCGR0_REGNUM)) + if (REG_VALID == regcache_register_status (regcache, + regno + ARM_WCGR0_REGNUM)) regcache_raw_collect (regcache, regno + ARM_WCGR0_REGNUM, ®buf[16 * 8 + 2 * 4 + regno * 4]); --------------030402010207050000070909--