This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
[PATCH]: Fix return command for HC11 (pop_frame, prologue analysis)
- To: gdb-patches at sources dot redhat dot com
- Subject: [PATCH]: Fix return command for HC11 (pop_frame, prologue analysis)
- From: Stephane Carrez <Stephane dot Carrez at worldnet dot fr>
- Date: Sun, 20 May 2001 13:58:21 +0200
Hi!
I've committed the following patch that fixes the 'return' command for HC11/HC12.
- When poping the frame, the stack pointer was not set correctly,
- During 68HC12 prologue analysis, the pc was not updated for some instructions
- The save address of registers saved during the prologue was not correct
(need to take into account the stack correction for HC11)
Stephane
2001-05-20 Stephane Carrez <Stephane.Carrez@worldnet.fr>
* m68hc11-tdep.c (m68hc11_pop_frame): Fix stack pointer computation.
(m68hc11_analyze_instruction): Update the pc correctly.
(m68hc11_guess_from_prologue): Take into account the stack correction
for the saving address.
Index: m68hc11-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/m68hc11-tdep.c,v
retrieving revision 1.12
diff -u -p -r1.12 m68hc11-tdep.c
--- m68hc11-tdep.c 2001/03/01 01:39:21 1.12
+++ m68hc11-tdep.c 2001/05/20 11:38:49
@@ -334,7 +334,7 @@ m68hc11_pop_frame (void)
read_memory_integer (frame->saved_regs[regnum], 2));
write_register (HARD_PC_REGNUM, frame->extra_info->return_pc);
- sp = fp + frame->extra_info->size;
+ sp = (fp + frame->extra_info->size + 2) & 0x0ffff;
write_register (HARD_SP_REGNUM, sp);
}
flush_cached_frames ();
@@ -489,10 +489,12 @@ m68hc11_analyze_instruction (struct insn
v = read_memory_unsigned_integer (*pc + j + 1, 1);
if (buffer[j] & 1)
v |= 0xff00;
+ *pc = *pc + 1;
}
else if (buffer[j] == 0xf2)
{
v = read_memory_unsigned_integer (*pc + j + 1, 2);
+ *pc = *pc + 2;
}
cur_val = v;
break;
@@ -587,7 +589,7 @@ m68hc11_guess_from_prologue (CORE_ADDR p
func_end = pc + 128;
found_frame_point = 0;
*frame_offset = 0;
- save_addr = fp;
+ save_addr = fp + STACK_CORRECTION;
while (!done && pc + 2 < func_end)
{
struct insn_sequence *seq;