2002-09-17 Andrew Cagney * arch-utils.c (legacy_virtual_frame_pointer): If FP_REGNUM is invalid, return SP_REGNUM. Index: arch-utils.c =================================================================== RCS file: /cvs/src/src/gdb/arch-utils.c,v retrieving revision 1.68 diff -u -r1.68 arch-utils.c --- arch-utils.c 14 Sep 2002 09:40:36 -0000 1.68 +++ arch-utils.c 17 Sep 2002 21:17:58 -0000 @@ -423,8 +423,19 @@ int *frame_regnum, LONGEST *frame_offset) { - gdb_assert (FP_REGNUM >= 0); - *frame_regnum = FP_REGNUM; + /* FIXME: cagney/2002-09-13: This code is used when identifying the + frame pointer of the current PC. It is assuming that a single + register and an offset can determine this. I think it should + instead generate a byte code expression as that would work better + with things like Dwarf2's CFI. */ + if (FP_REGNUM >= 0 && FP_REGNUM < NUM_REGS) + *frame_regnum = FP_REGNUM; + else if (SP_REGNUM >= 0 && SP_REGNUM < NUM_REGS) + *frame_regnum = SP_REGNUM; + else + /* Should this be an internal error? I guess so, it is reflecting + an architectural limitation in the current design. */ + internal_error (__FILE__, __LINE__, "No virtual frame pointer available"); *frame_offset = 0; }