From mboxrd@z Thu Jan 1 00:00:00 1970 From: Mark Kettenis To: gdb-patches@sources.redhat.com Subject: [PATCH] Fix hppa_frame_prev_register_helper Date: Sun, 30 May 2004 14:11:00 -0000 Message-id: <200405301411.i4UEB4id091424@elgar.kettenis.dyndns.org> X-SW-Source: 2004-05/msg00783.html 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 * 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); } -