Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Mark Kettenis <kettenis@chello.nl>
To: gdb-patches@sources.redhat.com
Subject: [PATCH] Fix hppa_frame_prev_register_helper
Date: Sun, 30 May 2004 14:11:00 -0000	[thread overview]
Message-ID: <200405301411.i4UEB4id091424@elgar.kettenis.dyndns.org> (raw)

The current version of this function has a serious bug; it doesn't
deal correctly with VALUEP being null.  This causes GDB to crash if
you use "info frame".  This patch replaces the function with an
implementation that's similar to m88k.  This also makes the
information printed by "info frame" more correct.

Committed,

Mark


Index: ChangeLog
from  Mark Kettenis  <kettenis@gnu.org>
 
	* hppa-tdep.c (hppa_frame_prev_register_helper): Reimplement to
	handle VALUEP being null.

 
Index: hppa-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/hppa-tdep.c,v
retrieving revision 1.165
diff -u -p -r1.165 hppa-tdep.c
--- hppa-tdep.c 26 May 2004 04:02:24 -0000 1.165
+++ hppa-tdep.c 30 May 2004 14:08:24 -0000
@@ -2316,20 +2316,32 @@ hppa_frame_prev_register_helper (struct 
 				 enum lval_type *lvalp, CORE_ADDR *addrp,
 				 int *realnump, void *valuep)
 {
-  int pcoqt = (regnum == HPPA_PCOQ_TAIL_REGNUM);
-  struct gdbarch *gdbarch = get_frame_arch (next_frame);
-  int regsize = register_size (gdbarch, HPPA_PCOQ_HEAD_REGNUM);
-
-  if (pcoqt)
-    regnum = HPPA_PCOQ_HEAD_REGNUM;
+  if (regnum == HPPA_PCOQ_TAIL_REGNUM)
+    {
+      if (valuep)
+	{
+	  CORE_ADDR pc;
+
+	  trad_frame_prev_register (next_frame, saved_regs,
+				    HPPA_PCOQ_HEAD_REGNUM, optimizedp,
+				    lvalp, addrp, realnump, valuep);
+
+	  pc = extract_unsigned_integer (valuep, 4);
+	  store_unsigned_integer (valuep, 4, pc + 4);
+	}
+
+      /* It's a computed value.  */
+      *optimizedp = 0;
+      *lvalp = not_lval;
+      *addrp = 0;
+      *realnump = -1;
+      return;
+    }
 
   trad_frame_prev_register (next_frame, saved_regs, regnum,
                             optimizedp, lvalp, addrp, realnump, valuep);
-
-  if (pcoqt)
-    store_unsigned_integer (valuep, regsize, 
-		      	    extract_unsigned_integer (valuep, regsize) + 4);
 }
+\f
 
 /* Here is a table of C type sizes on hppa with various compiles
    and options.  I measured this on PA 9000/800 with HP-UX 11.11
@@ -2559,4 +2571,3 @@ be no argument or the argument must be a
 				  &hppa_debug, "Set hppa debugging.\n\
 When non-zero, hppa specific debugging is enabled.", &setdebuglist), &showdebuglist);
 }
-


                 reply	other threads:[~2004-05-30 14:11 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=200405301411.i4UEB4id091424@elgar.kettenis.dyndns.org \
    --to=kettenis@chello.nl \
    --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