From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 31506 invoked by alias); 11 Apr 2002 20:31:12 -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 31495 invoked from network); 11 Apr 2002 20:31:08 -0000 Received: from unknown (HELO nevyn.them.org) (128.2.145.6) by sources.redhat.com with SMTP; 11 Apr 2002 20:31:08 -0000 Received: from drow by nevyn.them.org with local (Exim 3.35 #1 (Debian)) id 16vlE0-00052F-00 for ; Thu, 11 Apr 2002 16:31:20 -0400 Date: Thu, 11 Apr 2002 13:31:00 -0000 From: Daniel Jacobowitz To: gdb-patches@sources.redhat.com Subject: Re: [PATCH] Add support for fpscr for Power / PowerPC targets Message-ID: <20020411163120.A18405@nevyn.them.org> Mail-Followup-To: gdb-patches@sources.redhat.com References: <1020411191706.ZM3109@localhost.localdomain> <20020411152555.A16075@nevyn.them.org> <1020411201015.ZM3342@localhost.localdomain> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1020411201015.ZM3342@localhost.localdomain> User-Agent: Mutt/1.3.23i X-SW-Source: 2002-04/txt/msg00429.txt.bz2 On Thu, Apr 11, 2002 at 01:10:16PM -0700, Kevin Buettner wrote: > On Apr 11, 3:25pm, Daniel Jacobowitz wrote: > > What versions are we talking here? > > 2.2.X, for X <= 15. Probably for X > 15 too, but I haven't checked. > I don't think the 2.4 kernels have this problem though. > > > Is it worth silencing the gdbserver warning in this case? > > If it's only a warning, it probably doesn't hurt to leave it in, > though it'd be nice to structure it so that the warning is only > printed once. > > I would have preferred to not to have to add the above code to > ppc-linux-nat.c, but I was seeing too many regressions without it and > that made it difficult to evaluate the patch. It was worth it to add > the above code though because I ended up catching some regressions > that I would've missed otherwise. (I probably ought to just upgrade > my Linux/PPC box...) OK, I'll silence the warning, I think. That's easier. Committed. -- Daniel Jacobowitz Carnegie Mellon University MontaVista Software Debian GNU/Linux Developer 2002-04-11 Daniel Jacobowitz * gdbserver/linux-low.c (usr_store_inferior_registers): Support registers which are allowed to fail to store. * gdbserver/linux-low.h (linux_target_ops): Likewise. * gdbserver/linux-ppc-low.c (ppc_regmap): Support FPSCR. (ppc_cannot_store_register): FPSCR may not be storable. * regformats/reg-ppc.dat: Support FPSCR. Index: gdbserver/linux-low.c =================================================================== RCS file: /cvs/src/src/gdb/gdbserver/linux-low.c,v retrieving revision 1.13 diff -u -p -r1.13 linux-low.c --- gdbserver/linux-low.c 9 Apr 2002 23:52:05 -0000 1.13 +++ gdbserver/linux-low.c 11 Apr 2002 20:19:58 -0000 @@ -240,7 +240,7 @@ usr_store_inferior_registers (int regno) if (regno >= the_low_target.num_regs) return; - if ((*the_low_target.cannot_store_register) (regno)) + if ((*the_low_target.cannot_store_register) (regno) == 1) return; regaddr = register_addr (regno); @@ -254,14 +254,15 @@ usr_store_inferior_registers (int regno) *(int *) (register_data (regno) + i)); if (errno != 0) { - /* Warning, not error, in case we are attached; sometimes the - kernel doesn't let us at the registers. */ - char *err = strerror (errno); - char *msg = alloca (strlen (err) + 128); - sprintf (msg, "writing register %d: %s", - regno, err); - error (msg); - return; + if ((*the_low_target.cannot_store_register) (regno) == 0) + { + char *err = strerror (errno); + char *msg = alloca (strlen (err) + 128); + sprintf (msg, "writing register %d: %s", + regno, err); + error (msg); + return; + } } regaddr += sizeof (int); } Index: gdbserver/linux-low.h =================================================================== RCS file: /cvs/src/src/gdb/gdbserver/linux-low.h,v retrieving revision 1.3 diff -u -p -r1.3 linux-low.h --- gdbserver/linux-low.h 9 Apr 2002 22:44:43 -0000 1.3 +++ gdbserver/linux-low.h 11 Apr 2002 20:19:58 -0000 @@ -34,6 +34,10 @@ struct linux_target_ops int num_regs; int *regmap; int (*cannot_fetch_register) (int); + + /* Returns 0 if we can store the register, 1 if we can not + store the register, and 2 if failure to store the register + is acceptable. */ int (*cannot_store_register) (int); }; Index: gdbserver/linux-ppc-low.c =================================================================== RCS file: /cvs/src/src/gdb/gdbserver/linux-ppc-low.c,v retrieving revision 1.3 diff -u -p -r1.3 linux-ppc-low.c --- gdbserver/linux-ppc-low.c 9 Apr 2002 22:44:43 -0000 1.3 +++ gdbserver/linux-ppc-low.c 11 Apr 2002 20:19:58 -0000 @@ -46,11 +46,15 @@ static int ppc_regmap[] = PT_FPR0*4+192, PT_FPR0*4+200, PT_FPR0*4+208, PT_FPR0*4+216, PT_FPR0*4+224, PT_FPR0*4+232, PT_FPR0*4+240, PT_FPR0*4+248, PT_NIP * 4, PT_MSR * 4, PT_CCR * 4, PT_LNK * 4, - PT_CTR * 4, PT_XER * 4, -1, }; + PT_CTR * 4, PT_XER * 4, PT_FPSCR * 4, }; static int ppc_cannot_store_register (int regno) { + /* Some kernels do not allow us to store fpscr. */ + if (regno == find_regno ("fpscr")) + return 2; + return 0; } Index: regformats/reg-ppc.dat =================================================================== RCS file: /cvs/src/src/gdb/regformats/reg-ppc.dat,v retrieving revision 1.1 diff -u -p -r1.1 reg-ppc.dat --- regformats/reg-ppc.dat 1 Feb 2002 22:05:28 -0000 1.1 +++ regformats/reg-ppc.dat 11 Apr 2002 20:19:58 -0000 @@ -73,4 +73,4 @@ expedite:r1,pc 32:lr 32:ctr 32:xer -0: +32:fpscr