This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Fix hppa_frame_prev_register_helper


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);
 }
+
 
 /* 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);
 }
-


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]