From: Grace Sainsbury Date: Wed, 3 Jul 2002 21:23:02 +0000 (+0000) Subject: * config/mcore/tm-mcore.h (REGISTER_BYTES, NUM_REGS, PC_REGNUM) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=4e0d9804feffffee56f37acb75ee8dbd9f67c4a6;p=binutils-gdb.git * config/mcore/tm-mcore.h (REGISTER_BYTES, NUM_REGS, PC_REGNUM) (SP_REGNUM, FP_REGNUM, FUNCTION_START_OFFSET, DECR_PC_AFTER_BREAK) (BREAKPOINT_FROM_PC, INNER_THAN, SAVED_PC_AFTER_CALL) (INIT_EXTRA_FRAME_INFO, FRAME_INIT_SAVED_REGS, INIT_FRAME_PC) (FRAME_CHAIN, FRAME_CHAIN_VALID, FRAME_SAVED_PC) (STORE_RETURN_VALUE, DEPRECATED_EXTRACT_RETURN_VALUE) (STORE_STRUCT_RETURN, DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS) (SKIP_PROLOGUE, FRAME_ARGS_SKIP, FRAME_ARGS_ADDRESS) (FRAME_LOCALS_ADDRESS, FRAME_NUM_ARGS, POP_FRAME) (PUSH_RETURN_ADDRESS, PUSH_DUMMY_FRAME, PUSH_ARGUMENTS): Remove. * mcore-tdep.c (mcore_init_extra_frame_info): Add fromleaf argument so the function fits the prototype in the architecture vector. (mcore_pop_frame): Remove argument so the function fits the prototype. Use get_current_frame instead of the argument. (mcore_push_arguments): Change type of struct_return so the function can be used in the architecture vector. (mcore_store_struct_return): Add. (mcore_frame_init_saved_regs): Add. (mcore_gdbarch_init): Add function calls to replace the macros removed from tm-mcore.h --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 915ab3e8cbb..317951be86c 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,27 @@ +2002-07-03 Grace Sainsbury + + * config/mcore/tm-mcore.h (REGISTER_BYTES, NUM_REGS, PC_REGNUM) + (SP_REGNUM, FP_REGNUM, FUNCTION_START_OFFSET, DECR_PC_AFTER_BREAK) + (BREAKPOINT_FROM_PC, INNER_THAN, SAVED_PC_AFTER_CALL) + (INIT_EXTRA_FRAME_INFO, FRAME_INIT_SAVED_REGS, INIT_FRAME_PC) + (FRAME_CHAIN, FRAME_CHAIN_VALID, FRAME_SAVED_PC) + (STORE_RETURN_VALUE, DEPRECATED_EXTRACT_RETURN_VALUE) + (STORE_STRUCT_RETURN, DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS) + (SKIP_PROLOGUE, FRAME_ARGS_SKIP, FRAME_ARGS_ADDRESS) + (FRAME_LOCALS_ADDRESS, FRAME_NUM_ARGS, POP_FRAME) + (PUSH_RETURN_ADDRESS, PUSH_DUMMY_FRAME, PUSH_ARGUMENTS): Remove. + * mcore-tdep.c (mcore_init_extra_frame_info): Add fromleaf + argument so the function fits the prototype in the architecture + vector. + (mcore_pop_frame): Remove argument so the function fits the + prototype. Use get_current_frame instead of the argument. + (mcore_push_arguments): Change type of struct_return so the + function can be used in the architecture vector. + (mcore_store_struct_return): Add. + (mcore_frame_init_saved_regs): Add. + (mcore_gdbarch_init): Add function calls to replace the macros + removed from tm-mcore.h + 2002-07-03 Andrew Cagney * infcmd.c (print_return_value): Remove compatibility code calling diff --git a/gdb/config/mcore/tm-mcore.h b/gdb/config/mcore/tm-mcore.h index ee65f0c4c73..c47052ab2d9 100644 --- a/gdb/config/mcore/tm-mcore.h +++ b/gdb/config/mcore/tm-mcore.h @@ -37,9 +37,9 @@ #define REGISTER_RAW_SIZE(REG) 4 #define MAX_REGISTER_VIRTUAL_SIZE 4 -#endif #define REGISTER_BYTES (NUM_REGS * REGISTER_SIZE) +#endif #if !GDB_MULTI_ARCH extern char *mcore_register_names[]; @@ -54,10 +54,12 @@ extern char *mcore_register_names[]; + 1 pc ------ 65 registers */ +#if !GDB_MULTI_ARCH #define NUM_REGS 65 #define PC_REGNUM 64 #define SP_REGNUM 0 #define FP_REGNUM (SP_REGNUM) +#endif #define PR_REGNUM 15 #define FIRST_ARGREG 2 #define LAST_ARGREG 7 @@ -65,6 +67,7 @@ extern char *mcore_register_names[]; /* Offset from address of function to start of its code. Zero on most machines. */ +#if !GDB_MULTI_ARCH #define FUNCTION_START_OFFSET 0 #define DECR_PC_AFTER_BREAK 0 @@ -78,11 +81,13 @@ extern const unsigned char *mcore_breakpoint_from_pc (CORE_ADDR *pcptr, #define INNER_THAN(LHS,RHS) ((LHS) < (RHS)) #define SAVED_PC_AFTER_CALL(FRAME) read_register (PR_REGNUM) +#endif struct frame_info; struct type; struct value; +#if !GDB_MULTI_ARCH extern void mcore_init_extra_frame_info (struct frame_info *fi); #define INIT_EXTRA_FRAME_INFO(FROMLEAF, FI) mcore_init_extra_frame_info ((FI)) #define INIT_FRAME_PC /* Not necessary */ @@ -122,6 +127,7 @@ extern CORE_ADDR mcore_frame_locals_address (struct frame_info *fi); extern void mcore_pop_frame (struct frame_info *fi); #define POP_FRAME mcore_pop_frame (get_current_frame ()) +#endif #if !GDB_MULTI_ARCH #define USE_GENERIC_DUMMY_FRAMES 1 @@ -133,7 +139,6 @@ extern void mcore_pop_frame (struct frame_info *fi); #define CALL_DUMMY_ADDRESS() entry_point_address () #define SIZEOF_CALL_DUMMY_WORDS 0 #define SAVE_DUMMY_FRAME_TOS(SP) generic_save_dummy_frame_tos (SP) -#endif extern CORE_ADDR mcore_push_return_address (CORE_ADDR, CORE_ADDR); #define PUSH_RETURN_ADDRESS(PC, SP) mcore_push_return_address (PC, SP) @@ -144,6 +149,7 @@ extern CORE_ADDR mcore_push_arguments (int, struct value **, CORE_ADDR, unsigned char, CORE_ADDR); #define PUSH_ARGUMENTS(NARGS, ARGS, SP, STRUCT_RETURN, STRUCT_ADDR) \ (SP) = mcore_push_arguments (NARGS, ARGS, SP, STRUCT_RETURN, STRUCT_ADDR) +#endif #if !GDB_MULTI_ARCH #define PC_IN_CALL_DUMMY(PC, SP, FP) generic_pc_in_call_dummy (PC, SP, FP) diff --git a/gdb/mcore-tdep.c b/gdb/mcore-tdep.c index f16f66352fe..ec2be104bca 100644 --- a/gdb/mcore-tdep.c +++ b/gdb/mcore-tdep.c @@ -26,6 +26,7 @@ #include "symfile.h" #include "gdbcore.h" #include "inferior.h" +#include "arch-utils.h" /* Functions declared and used only in this file */ @@ -41,7 +42,7 @@ int mcore_use_struct_convention (int gcc_p, struct type *type); void _initialize_mcore (void); -void mcore_init_extra_frame_info (struct frame_info *fi); +void mcore_init_extra_frame_info (int fromleaf, struct frame_info *fi); CORE_ADDR mcore_frame_saved_pc (struct frame_info *fi); @@ -54,9 +55,9 @@ CORE_ADDR mcore_frame_locals_address (struct frame_info *fi); CORE_ADDR mcore_push_return_address (CORE_ADDR pc, CORE_ADDR sp); CORE_ADDR mcore_push_arguments (int nargs, struct value ** args, CORE_ADDR sp, - unsigned char struct_return, CORE_ADDR struct_addr); + int struct_return, CORE_ADDR struct_addr); -void mcore_pop_frame (struct frame_info *fi); +void mcore_pop_frame (); CORE_ADDR mcore_skip_prologue (CORE_ADDR pc); @@ -243,6 +244,26 @@ mcore_breakpoint_from_pc (CORE_ADDR * bp_addr, int *bp_size) return breakpoint; } +static CORE_ADDR +mcore_saved_pc_after_call (struct frame_info *frame) +{ + return read_register (PR_REGNUM); +} + +/* This is currently handled by init_extra_frame_info. */ +static void +mcore_frame_init_saved_regs (struct frame_info *frame) +{ + +} + +/* This is currently handled by mcore_push_arguments */ +static void +mcore_store_struct_return (CORE_ADDR addr, CORE_ADDR sp) +{ + +} + /* Helper function for several routines below. This funtion simply sets up a fake, aka dummy, frame (not a _call_ dummy frame) that we can analyze with mcore_analyze_prologue. */ @@ -749,9 +770,10 @@ mcore_frame_saved_pc (struct frame_info * fi) command, or the call dummy breakpoint gets hit. */ void -mcore_pop_frame (struct frame_info *fi) +mcore_pop_frame () { int rn; + struct frame_info *fi = get_current_frame (); if (PC_IN_CALL_DUMMY (fi->pc, fi->frame, fi->frame)) generic_pop_dummy_frame (); @@ -798,7 +820,7 @@ mcore_pop_frame (struct frame_info *fi) CORE_ADDR mcore_push_arguments (int nargs, struct value **args, CORE_ADDR sp, - unsigned char struct_return, CORE_ADDR struct_addr) + int struct_return, CORE_ADDR struct_addr) { int argreg; int argnum; @@ -998,9 +1020,9 @@ mcore_store_return_value (struct type *type, char *valbuf) the prologue of this frame. */ void -mcore_init_extra_frame_info (struct frame_info *fi) +mcore_init_extra_frame_info (int fromleaf, struct frame_info *fi) { - if (fi->next) + if (fi && fi->next) fi->pc = FRAME_SAVED_PC (fi->next); frame_saved_regs_zalloc (fi); @@ -1047,16 +1069,24 @@ mcore_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) gdbarch = gdbarch_alloc (&info, 0); + /* Registers: */ + /* All registers are 32 bits */ set_gdbarch_register_size (gdbarch, MCORE_REG_SIZE); set_gdbarch_max_register_raw_size (gdbarch, MCORE_REG_SIZE); set_gdbarch_max_register_virtual_size (gdbarch, MCORE_REG_SIZE); - set_gdbarch_register_name (gdbarch, mcore_register_name); set_gdbarch_register_virtual_type (gdbarch, mcore_register_virtual_type); set_gdbarch_register_virtual_size (gdbarch, mcore_register_size); set_gdbarch_register_raw_size (gdbarch, mcore_register_size); set_gdbarch_register_byte (gdbarch, mcore_register_byte); + set_gdbarch_register_bytes (gdbarch, MCORE_REG_SIZE * MCORE_NUM_REGS); + set_gdbarch_num_regs (gdbarch, MCORE_NUM_REGS); + set_gdbarch_pc_regnum (gdbarch, 64); + set_gdbarch_sp_regnum (gdbarch, 0); + set_gdbarch_fp_regnum (gdbarch, 0); + + /* Call Dummies: */ set_gdbarch_call_dummy_p (gdbarch, 1); set_gdbarch_use_generic_dummy_frames (gdbarch, 1); @@ -1071,6 +1101,38 @@ mcore_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_save_dummy_frame_tos (gdbarch, generic_save_dummy_frame_tos); set_gdbarch_pc_in_call_dummy (gdbarch, generic_pc_in_call_dummy); set_gdbarch_call_dummy_stack_adjust_p (gdbarch, 0); + set_gdbarch_saved_pc_after_call (gdbarch, mcore_saved_pc_after_call); + set_gdbarch_function_start_offset (gdbarch, 0); + set_gdbarch_decr_pc_after_break (gdbarch, 0); + set_gdbarch_breakpoint_from_pc (gdbarch, mcore_breakpoint_from_pc); + set_gdbarch_push_return_address (gdbarch, mcore_push_return_address); + set_gdbarch_push_dummy_frame (gdbarch, generic_push_dummy_frame); + set_gdbarch_push_arguments (gdbarch, mcore_push_arguments); + + /* Frames: */ + + set_gdbarch_init_extra_frame_info (gdbarch, mcore_init_extra_frame_info); + set_gdbarch_frame_chain (gdbarch, mcore_frame_chain); + set_gdbarch_frame_chain_valid (gdbarch, generic_file_frame_chain_valid); + set_gdbarch_frame_init_saved_regs (gdbarch, mcore_frame_init_saved_regs); + set_gdbarch_frame_saved_pc (gdbarch, mcore_frame_saved_pc); + set_gdbarch_store_return_value (gdbarch, mcore_store_return_value); + set_gdbarch_deprecated_extract_return_value (gdbarch, + mcore_extract_return_value); + set_gdbarch_store_struct_return (gdbarch, mcore_store_struct_return); + set_gdbarch_deprecated_extract_struct_value_address (gdbarch, + mcore_extract_struct_value_address); + set_gdbarch_skip_prologue (gdbarch, mcore_skip_prologue); + set_gdbarch_frame_args_skip (gdbarch, 0); + set_gdbarch_frame_args_address (gdbarch, mcore_frame_args_address); + set_gdbarch_frame_locals_address (gdbarch, mcore_frame_locals_address); + set_gdbarch_frame_num_args (gdbarch, frame_num_args_unknown); + set_gdbarch_pop_frame (gdbarch, mcore_pop_frame); + + /* Misc.: */ + + /* Stack grows down. */ + set_gdbarch_inner_than (gdbarch, core_addr_lessthan); return gdbarch; }