diff --git a/gdb/ChangeLog b/gdb/ChangeLog index a7b9fa00e6..b52729ade2 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,13 @@ +2003-03-05 Andrew Cagney + + * 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 * frame.c (deprecated_update_frame_pc_hack): Also update the the diff --git a/gdb/d10v-tdep.c b/gdb/d10v-tdep.c index addf9caee9..f37f191b91 100644 --- a/gdb/d10v-tdep.c +++ b/gdb/d10v-tdep.c @@ -45,13 +45,6 @@ #include "gdb_assert.h" -struct frame_extra_info - { - CORE_ADDR return_pc; - int frameless; - int size; - }; - struct gdbarch_tdep { int a0_regnum; @@ -617,10 +610,13 @@ d10v_skip_prologue (CORE_ADDR pc) 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; }; @@ -635,8 +631,8 @@ prologue_find_regs (struct d10v_unwind_cache *info, unsigned short op, 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; } @@ -644,9 +640,9 @@ prologue_find_regs (struct d10v_unwind_cache *info, unsigned short op, 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; } @@ -656,7 +652,7 @@ prologue_find_regs (struct d10v_unwind_cache *info, unsigned short op, n = (op & 0x1E) >> 1; if (n == 0) n = 16; - info->next_addr -= n; + info->sp_offset -= n; return 1; } @@ -664,6 +660,15 @@ prologue_find_regs (struct d10v_unwind_cache *info, unsigned short op, 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; } @@ -675,7 +680,7 @@ prologue_find_regs (struct d10v_unwind_cache *info, unsigned short op, if ((op & 0x7E1F) == 0x681E) { n = (op & 0x1E0) >> 5; - info->saved_regs[n] = info->next_addr; + info->saved_regs[n] = info->sp_offset; return 1; } @@ -683,8 +688,8 @@ prologue_find_regs (struct d10v_unwind_cache *info, unsigned short op, 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; } @@ -714,12 +719,11 @@ d10v_frame_unwind_cache (struct frame_info *fi, (*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)); @@ -734,22 +738,22 @@ d10v_frame_unwind_cache (struct frame_info *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; @@ -774,7 +778,7 @@ d10v_frame_unwind_cache (struct frame_info *fi, pc += 4; } - info->size = -info->next_addr; + info->size = -info->sp_offset; if (!(fp & 0xffff)) fp = d10v_read_sp (); @@ -782,7 +786,7 @@ d10v_frame_unwind_cache (struct frame_info *fi, 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]) @@ -810,7 +814,6 @@ d10v_frame_unwind_cache (struct frame_info *fi, else { info->saved_regs[SP_REGNUM] = fp + info->size; - info->frameless = 1; info->saved_regs[FP_REGNUM] = 0; } }