+2003-03-05 Andrew Cagney <cagney@redhat.com>
+
+ * d10v-tdep.c (struct frame_extra_info): Delete unused structure.
+ (struct d10v_unwind_cache): Delete field "frameless". Replace
+ "next_addr" with "sp_offset". Add "r11_offset".
+ (d10v_frame_unwind_cache): Update.
+ (prologue_find_regs): Update. When "mv r11, sp", save the
+ "sp_offset" in "r11_offset". Recognize "st rn, @r11", note that
+ RN was saved in r11_offset.
+
2003-03-05 Andrew Cagney <cagney@redhat.com>
* frame.c (deprecated_update_frame_pc_hack): Also update the the
#include "gdb_assert.h"
-struct frame_extra_info
- {
- CORE_ADDR return_pc;
- int frameless;
- int size;
- };
-
struct gdbarch_tdep
{
int a0_regnum;
struct d10v_unwind_cache
{
CORE_ADDR return_pc;
- int frameless;
int size;
CORE_ADDR *saved_regs;
- CORE_ADDR next_addr;
+ /* How far the SP and r11 (FP) have been offset from the start of
+ the stack frame (as defined by the previous frame's stack
+ pointer). */
+ LONGEST sp_offset;
+ LONGEST r11_offset;
int uses_frame;
void **regs;
};
if ((op & 0x7E1F) == 0x6C1F)
{
n = (op & 0x1E0) >> 5;
- info->next_addr -= 2;
- info->saved_regs[n] = info->next_addr;
+ info->sp_offset -= 2;
+ info->saved_regs[n] = info->sp_offset;
return 1;
}
else if ((op & 0x7E3F) == 0x6E1F)
{
n = (op & 0x1E0) >> 5;
- info->next_addr -= 4;
- info->saved_regs[n] = info->next_addr;
- info->saved_regs[n + 1] = info->next_addr + 2;
+ info->sp_offset -= 4;
+ info->saved_regs[n] = info->sp_offset;
+ info->saved_regs[n + 1] = info->sp_offset + 2;
return 1;
}
n = (op & 0x1E) >> 1;
if (n == 0)
n = 16;
- info->next_addr -= n;
+ info->sp_offset -= n;
return 1;
}
if (op == 0x417E)
{
info->uses_frame = 1;
+ info->r11_offset = info->sp_offset;
+ return 1;
+ }
+
+ /* st rn, @r11 */
+ if ((op & 0x7E1F) == 0x6816)
+ {
+ n = (op & 0x1E0) >> 5;
+ info->saved_regs[n] = info->r11_offset;
return 1;
}
if ((op & 0x7E1F) == 0x681E)
{
n = (op & 0x1E0) >> 5;
- info->saved_regs[n] = info->next_addr;
+ info->saved_regs[n] = info->sp_offset;
return 1;
}
if ((op & 0x7E3F) == 0x3A1E)
{
n = (op & 0x1E0) >> 5;
- info->saved_regs[n] = info->next_addr;
- info->saved_regs[n + 1] = info->next_addr + 2;
+ info->saved_regs[n] = info->sp_offset;
+ info->saved_regs[n + 1] = info->sp_offset + 2;
return 1;
}
(*cache) = info;
info->saved_regs = frame_obstack_zalloc (SIZEOF_FRAME_SAVED_REGS);
- info->frameless = 0;
info->size = 0;
info->return_pc = 0;
fp = get_frame_base (fi);
- info->next_addr = 0;
+ info->sp_offset = 0;
pc = get_pc_function_start (get_frame_pc (fi));
{
/* add3 sp,sp,n */
short n = op & 0xFFFF;
- info->next_addr += n;
+ info->sp_offset += n;
}
else if ((op & 0x3F0F0000) == 0x340F0000)
{
/* st rn, @(offset,sp) */
short offset = op & 0xFFFF;
short n = (op >> 20) & 0xF;
- info->saved_regs[n] = info->next_addr + offset;
+ info->saved_regs[n] = info->sp_offset + offset;
}
else if ((op & 0x3F1F0000) == 0x350F0000)
{
/* st2w rn, @(offset,sp) */
short offset = op & 0xFFFF;
short n = (op >> 20) & 0xF;
- info->saved_regs[n] = info->next_addr + offset;
- info->saved_regs[n + 1] = info->next_addr + offset + 2;
+ info->saved_regs[n] = info->sp_offset + offset;
+ info->saved_regs[n + 1] = info->sp_offset + offset + 2;
}
else
break;
pc += 4;
}
- info->size = -info->next_addr;
+ info->size = -info->sp_offset;
if (!(fp & 0xffff))
fp = d10v_read_sp ();
for (i = 0; i < NUM_REGS - 1; i++)
if (info->saved_regs[i])
{
- info->saved_regs[i] = fp - (info->next_addr - info->saved_regs[i]);
+ info->saved_regs[i] = fp - (info->sp_offset - info->saved_regs[i]);
}
if (info->saved_regs[LR_REGNUM])
else
{
info->saved_regs[SP_REGNUM] = fp + info->size;
- info->frameless = 1;
info->saved_regs[FP_REGNUM] = 0;
}
}