Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Daniel Jacobowitz <drow@mvista.com>
To: gdb-patches@sources.redhat.com
Subject: Re: [PATCH] Add support for fpscr for Power / PowerPC targets
Date: Thu, 11 Apr 2002 13:31:00 -0000	[thread overview]
Message-ID: <20020411163120.A18405@nevyn.them.org> (raw)
In-Reply-To: <1020411201015.ZM3342@localhost.localdomain>

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  <drow@mvista.com>

        * 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


  reply	other threads:[~2002-04-11 20:31 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-04-11 12:17 Kevin Buettner
2002-04-11 12:25 ` Daniel Jacobowitz
2002-04-11 13:10   ` Kevin Buettner
2002-04-11 13:31     ` Daniel Jacobowitz [this message]
2002-04-11 13:08 ` Andrew Cagney
2002-04-11 13:39   ` Kevin Buettner
2002-04-14 14:52     ` Andrew Cagney

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20020411163120.A18405@nevyn.them.org \
    --to=drow@mvista.com \
    --cc=gdb-patches@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox