From ee9f9641e044af38cd83b957504141a2d558bfa8 Mon Sep 17 00:00:00 2001 From: Jim Blandy Date: Wed, 9 May 2001 02:22:35 +0000 Subject: [PATCH] * mn10300-tdep.c (mn10300_pop_frame): Split the mn10300-specific stuff out into mn10300_pop_frame_regular, and use generic_pop_current_frame. This lets us share code, and also makes this function's prototype match that expected by gdbarch. Make this function static. (mn10300_pop_frame_regular): New function. (mn10300_gdbarch_init): Register mn10300_pop_frame as the gdbarch's pop_frame method. * config/mn10300/tm-mn10300.h (POP_FRAME): Delete definition. (mn10300_pop_frame): Delete declaration. --- gdb/ChangeLog | 11 +++++++ gdb/config/mn10300/tm-mn10300.h | 3 -- gdb/mn10300-tdep.c | 58 ++++++++++++++++++--------------- 3 files changed, 42 insertions(+), 30 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index b45731b230..85ff1c1d18 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,16 @@ 2001-05-08 Jim Blandy + * mn10300-tdep.c (mn10300_pop_frame): Split the mn10300-specific + stuff out into mn10300_pop_frame_regular, and use + generic_pop_current_frame. This lets us share code, and also + makes this function's prototype match that expected by gdbarch. + Make this function static. + (mn10300_pop_frame_regular): New function. + (mn10300_gdbarch_init): Register mn10300_pop_frame as the + gdbarch's pop_frame method. + * config/mn10300/tm-mn10300.h (POP_FRAME): Delete definition. + (mn10300_pop_frame): Delete declaration. + * mn10300-tdep.c (mn10300_saved_pc_after_call, mn10300_extract_return_value, mn10300_extract_struct_value_address, mn10300_store_return_value, diff --git a/gdb/config/mn10300/tm-mn10300.h b/gdb/config/mn10300/tm-mn10300.h index 7bdeb372aa..87d842336a 100644 --- a/gdb/config/mn10300/tm-mn10300.h +++ b/gdb/config/mn10300/tm-mn10300.h @@ -57,9 +57,6 @@ #define INIT_FRAME_PC /* Not necessary */ -extern void mn10300_pop_frame (struct frame_info *); -#define POP_FRAME mn10300_pop_frame (get_current_frame ()) - /* Cons up virtual frame pointer for trace */ extern void mn10300_virtual_frame_pointer (CORE_ADDR, long *, long *); #define TARGET_VIRTUAL_FRAME_POINTER(PC, REGP, OFFP) \ diff --git a/gdb/mn10300-tdep.c b/gdb/mn10300-tdep.c index 7fad2e29cb..49dcf05e52 100644 --- a/gdb/mn10300-tdep.c +++ b/gdb/mn10300-tdep.c @@ -592,38 +592,41 @@ mn10300_skip_prologue (CORE_ADDR pc) return mn10300_analyze_prologue (NULL, pc); } +/* generic_pop_current_frame calls this function if the current + frame isn't a dummy frame. */ +static void +mn10300_pop_frame_regular (struct frame_info *frame) +{ + int regnum; + + write_register (PC_REGNUM, FRAME_SAVED_PC (frame)); + + /* Restore any saved registers. */ + for (regnum = 0; regnum < NUM_REGS; regnum++) + if (frame->saved_regs[regnum] != 0) + { + ULONGEST value; + + value = read_memory_unsigned_integer (frame->saved_regs[regnum], + REGISTER_RAW_SIZE (regnum)); + write_register (regnum, value); + } + + /* Actually cut back the stack. */ + write_register (SP_REGNUM, FRAME_FP (frame)); + + /* Don't we need to set the PC?!? XXX FIXME. */ +} /* Function: pop_frame This routine gets called when either the user uses the `return' command, or the call dummy breakpoint gets hit. */ - -void -mn10300_pop_frame (struct frame_info *frame) +static void +mn10300_pop_frame (void) { - int regnum; - - if (PC_IN_CALL_DUMMY (frame->pc, frame->frame, frame->frame)) - generic_pop_dummy_frame (); - else - { - write_register (PC_REGNUM, FRAME_SAVED_PC (frame)); - - /* Restore any saved registers. */ - for (regnum = 0; regnum < NUM_REGS; regnum++) - if (frame->saved_regs[regnum] != 0) - { - ULONGEST value; - - value = read_memory_unsigned_integer (frame->saved_regs[regnum], - REGISTER_RAW_SIZE (regnum)); - write_register (regnum, value); - } - - /* Actually cut back the stack. */ - write_register (SP_REGNUM, FRAME_FP (frame)); - - /* Don't we need to set the PC?!? XXX FIXME. */ - } + /* This function checks for and handles generic dummy frames, and + calls back to our function for ordinary frames. */ + generic_pop_current_frame (mn10300_pop_frame_regular); /* Throw away any cached frame information. */ flush_cached_frames (); @@ -1025,6 +1028,7 @@ mn10300_gdbarch_init (struct gdbarch_info info, (gdbarch, mn10300_extract_struct_value_address); set_gdbarch_store_return_value (gdbarch, mn10300_store_return_value); set_gdbarch_store_struct_return (gdbarch, mn10300_store_struct_return); + set_gdbarch_pop_frame (gdbarch, mn10300_pop_frame); set_gdbarch_skip_prologue (gdbarch, mn10300_skip_prologue); set_gdbarch_frame_args_skip (gdbarch, 0); set_gdbarch_frame_args_address (gdbarch, default_frame_address);