+start-sanitize-d30v
+Fri Dec 19 09:49:49 1997 David Taylor <taylor@texas.cygnus.com>
+
+ * d30v-tdep.c (d30v_frame_chain): test end_of_stack
+ (d30v_frame_find_saved_regs): set it.
+ * config/d30v/tm-d30v.h: improved FRAME_CHAIN_VALID
+
+end-sanitize-d30v
Thu Dec 18 12:34:28 1997 Andrew Cagney <cagney@b1.cygnus.com>
From Gavin Koch <gavin@cygnus.com>: mips-tdep.c
#define FRAME_CHAIN(FRAME) d30v_frame_chain(FRAME)
#if 0
-#define FRAME_CHAIN_VALID(chain,frame) \
- ((chain) != 0 && (frame) != 0 && (frame)->pc > IMEM_START)
-#else
-#if 0
#define FRAME_CHAIN_VALID(chain,fi) \
- ((chain) != 0 && (fi) != 0 && (fi)->frame <= STACK_START)
+ ((chain) != 0 && (fi) != 0 && (fi)->return_pc != 0)
#else
#define FRAME_CHAIN_VALID(chain,fi) \
- ((chain) != 0 && (fi) != 0 && (fi)->return_pc != 0)
-#endif
+ ((chain) != 0 && (fi) != 0 && (fi)->frame <= chain)
#endif
#define FRAME_SAVED_PC(FRAME) ((FRAME)->return_pc)
#define FRAME_ARGS_ADDRESS(fi) (fi)->frame
#define OP_ADD_SP_IMM 0x080bffc0 /* add sp,sp,imm */
#define OP_ADD_R22_SP_IMM 0x08096fc0 /* add r22,sp,imm */
#define OP_STW_FP_SP_IMM 0x054bdfc0 /* stw fp,@(sp,imm) */
+#define OP_OR_SP_R0_IMM 0x03abf000 /* or sp,r0,imm */
/* no mask */
#define OP_OR_FP_R0_SP 0x03a3d03f /* or fp,r0,sp */
return pc;
}
+static int end_of_stack;
+
/* Given a GDB frame, determine the address of the calling function's frame.
This will be used to create a new GDB frame struct, and then
INIT_EXTRA_FRAME_INFO and INIT_FRAME_PC will be called for the new frame.
d30v_frame_find_saved_regs (frame, &fsr);
+ if (end_of_stack)
+ return (CORE_ADDR)0;
+
if (frame->return_pc == IMEM_START)
return (CORE_ADDR)0;
return 1;
}
+ /* stw fp,@(sp,imm) -- observed */
+ if ((op & OP_MASK_ALL_BUT_IMM) == OP_STW_FP_SP_IMM)
+ {
+ offset = EXTRACT_IMM6(op);
+ fsr->regs[FP_REGNUM] = (offset - frame_size);
+ return 1;
+ }
return 0;
}
memset (fsr, 0, sizeof (*fsr));
next_addr = 0;
frame_size = 0;
+ end_of_stack = 0;
pc = get_pc_function_start (fi->pc);
fsr->regs[n] = (offset - frame_size);
fsr->regs[n+1] = (offset - frame_size) + 4;
}
+ else if ((opl & OP_MASK_ALL_BUT_IMM) == OP_OR_SP_R0_IMM)
+ {
+ end_of_stack = 1;
+ }
else
break;
}
}
fi->size = frame_size;
- if (!fp || !uses_frame)
#if 0
- fp = read_register(SP_REGNUM) | DMEM_START;
+ if (!fp || !uses_frame)
+ fp = read_register(SP_REGNUM);
#else
+ if (!fp)
fp = read_register(SP_REGNUM);
#endif
for (i=0; i<NUM_REGS-1; i++)