diff options
author | Michael Snyder <msnyder@vmware.com> | 1996-11-27 19:10:07 +0000 |
---|---|---|
committer | Michael Snyder <msnyder@vmware.com> | 1996-11-27 19:10:07 +0000 |
commit | dc1b349d39a95d3944428155d352ff04c3115963 (patch) | |
tree | 432c778d293c925ed3e29a2f838719dcd574022c /gdb/config | |
parent | 3bb3fe44e0f0ace7fb3894ce1e37f542aa5f4d89 (diff) | |
download | gdb-dc1b349d39a95d3944428155d352ff04c3115963.zip gdb-dc1b349d39a95d3944428155d352ff04c3115963.tar.gz gdb-dc1b349d39a95d3944428155d352ff04c3115963.tar.bz2 |
Added target function calls for SH, M32R and H8300.
Added some generic target-independant code for managing call-dummy frames.
Wed Nov 27 10:32:14 1996 Michael Snyder <msnyder@cleaver.cygnus.com>
* breakpoint.c: DELETE command will not delete CALL_DUMMY breakpoint.
* blockframe.c: Add target-independant support for managing
CALL_DUMMY frames on the host side.
* frame.h: Declarations for generic CALL_DUMMY frame support.
* h8300-tdep.c: Add target function calls using generic frame support.
* config/h8300/tm-h8300.h: config for generic target function calls.
start-sanitize-m32r
* m32r-tdep.c: Add target function calls using generic frame support.
* config/m32r/tm-m32r.h: config for generic target function calls.
end-sanitize-m32r
* sh-tdep.c: Add target function calls using generic frame support.
* config/sh/tm-sh.h: config for generic target function calls.
start-sanitize-v850
* v850-tdep.c: Add target function calls using generic frame support.
* config/v850/tm-v850.h: config for generic target function calls.
end-sanitize-v850
* valops.c: ADD PUSH_RETURN_ADDRESS so that it doesn't have to be
done by PUSH_ARGUMENTS when there's no CALL_DUMMY.
Diffstat (limited to 'gdb/config')
-rw-r--r-- | gdb/config/h8300/tm-h8300.h | 86 | ||||
-rw-r--r-- | gdb/config/m32r/tm-m32r.h | 86 | ||||
-rw-r--r-- | gdb/config/sh/tm-sh.h | 78 | ||||
-rw-r--r-- | gdb/config/v850/tm-v850.h | 60 |
4 files changed, 200 insertions, 110 deletions
diff --git a/gdb/config/h8300/tm-h8300.h b/gdb/config/h8300/tm-h8300.h index ee270b2..5f5f613 100644 --- a/gdb/config/h8300/tm-h8300.h +++ b/gdb/config/h8300/tm-h8300.h @@ -19,6 +19,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* Contributed by Steve Chamberlain sac@cygnus.com */ +#ifdef __STDC__ +struct frame_info; +struct frame_saved_regs; +struct value; +struct type; +#endif /* 1 if debugging H8/300H application */ extern int h8300hmode; @@ -41,9 +47,9 @@ extern int h8300smode; indicate real, cached values. */ #define INIT_EXTRA_FRAME_INFO(fromleaf, fi) \ - init_extra_frame_info (fromleaf, fi) + h8300_init_extra_frame_info (fromleaf, fi) -extern void init_extra_frame_info (); +extern void h8300_init_extra_frame_info (); #define IEEE_FLOAT /* Define the bit, byte, and word ordering of the machine. */ @@ -142,10 +148,12 @@ extern CORE_ADDR h8300_skip_prologue (); to be actual register numbers as far as the user is concerned but do serve to get the desired values when passed to read_register. */ -#define FP_REGNUM 6 /* Contains address of executing stack frame */ -#define SP_REGNUM 7 /* Contains address of top of stack */ -#define CCR_REGNUM 8 /* Contains processor status */ -#define PC_REGNUM 9 /* Contains program counter */ +#define ARG0_REGNUM 0 /* first reg in which an arg may be passed */ +#define ARGLAST_REGNUM 2 /* last reg in which an arg may be passed */ +#define FP_REGNUM 6 /* Contain saddress of executing stack frame */ +#define SP_REGNUM 7 /* Contains address of top of stack */ +#define CCR_REGNUM 8 /* Contains processor status */ +#define PC_REGNUM 9 /* Contains program counter */ /* Extract from an array REGBUF containing the (raw) register state a function return value of type TYPE, and copy that, in virtual format, @@ -153,24 +161,33 @@ extern CORE_ADDR h8300_skip_prologue (); /* FIXME: Won't work with both h8/300's. */ +extern void h8300_extract_return_value PARAMS((struct type *, char *, char *)); #define EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \ - memcpy (VALBUF, (char *)(REGBUF), TYPE_LENGTH(TYPE)) + h8300_extract_return_value (TYPE, (char *)(REGBUF), (char *)(VALBUF)) /* Write into appropriate registers a function return value of type TYPE, given in virtual format. Assumes floats are passed in d0/d1. */ /* FIXME: Won't work with both h8/300's. */ +extern void h8300_store_return_value PARAMS((struct type *, char *)); #define STORE_RETURN_VALUE(TYPE,VALBUF) \ - write_register_bytes (0, VALBUF, TYPE_LENGTH (TYPE)) + h8300_store_return_value(TYPE, (char *) (VALBUF)) + +/* struct passing and returning stuff */ +#define STORE_STRUCT_RETURN(STRUCT_ADDR, SP) \ + write_register (0, STRUCT_ADDR) + +#define USE_STRUCT_CONVENTION(gcc_p, type) (1) /* Extract from an array REGBUF containing the (raw) register state the address in which a function should return its structure value, as a CORE_ADDR (or an expression that can be used as one). */ -/* FIXME: Won't work with both h8/300's. */ -#define EXTRACT_STRUCT_VALUE_ADDRESS(REGBUF) (*(CORE_ADDR *)(REGBUF)) - +#define EXTRACT_STRUCT_VALUE_ADDRESS(REGBUF) \ + extract_address (REGBUF + REGISTER_BYTE (0), \ + REGISTER_RAW_SIZE (0)) + /* Describe the pointer in each stack frame to the previous stack frame (its caller). */ @@ -181,7 +198,6 @@ extern CORE_ADDR h8300_skip_prologue (); it means the given frame is the outermost one and has no caller. */ #define FRAME_CHAIN(FRAME) h8300_frame_chain(FRAME) -struct frame_info ; CORE_ADDR h8300_frame_chain PARAMS ((struct frame_info *)); /* In the case of the H8/300, the frame's nominal address @@ -212,7 +228,7 @@ CORE_ADDR h8300_frame_chain PARAMS ((struct frame_info *)); LOCALS1 <-SP POINTS HERE */ -#define FRAME_SAVED_PC(FRAME) frame_saved_pc(FRAME) +#define FRAME_SAVED_PC(FRAME) h8300_frame_saved_pc(FRAME) #define FRAME_ARGS_ADDRESS(fi) frame_args_address(fi) @@ -237,17 +253,9 @@ CORE_ADDR h8300_frame_chain PARAMS ((struct frame_info *)); the address we return for it IS the sp for the next frame. */ #define FRAME_FIND_SAVED_REGS(frame_info, frame_saved_regs) \ - frame_find_saved_regs(frame_info, &(frame_saved_regs)) + h8300_frame_find_saved_regs(frame_info, &(frame_saved_regs)) -/* Push an empty stack frame, to record the current PC, etc. */ - -/*#define PUSH_DUMMY_FRAME { h8300_push_dummy_frame (); }*/ - -/* Discard from the stack the innermost frame, restoring all registers. */ - -#define POP_FRAME { h8300_pop_frame (); } - typedef unsigned short INSN_WORD; @@ -259,3 +267,37 @@ typedef unsigned short INSN_WORD; #define NOP { 0x01, 0x80} /* A sleep insn */ #define BELIEVE_PCC_PROMOTION 1 + +/* + * CALL_DUMMY stuff: + */ + +#define CALL_DUMMY {0} +#define CALL_DUMMY_LENGTH (0) +#define CALL_DUMMY_ADDRESS() entry_point_address () +#define CALL_DUMMY_LOCATION AT_ENTRY_POINT +#define CALL_DUMMY_START_OFFSET (0) +#define CALL_DUMMY_BREAKPOINT_OFFSET (0) + +extern CORE_ADDR h8300_push_arguments PARAMS ((int nargs, + struct value **args, + CORE_ADDR sp, + unsigned char struct_return, + CORE_ADDR struct_addr)); +extern CORE_ADDR h8300_push_return_address PARAMS ((CORE_ADDR, CORE_ADDR)); + +#define PC_IN_CALL_DUMMY(PC, SP, FP) generic_pc_in_call_dummy (PC, SP) +#define FIX_CALL_DUMMY(DUMMY, START_SP, FUNADDR, NARGS, ARGS, TYPE, GCCP) +#define PUSH_ARGUMENTS(NARGS, ARGS, SP, STRUCT_RETURN, STRUCT_ADDR) \ + (SP) = h8300_push_arguments (NARGS, ARGS, SP, STRUCT_RETURN, STRUCT_ADDR) +/* Push an empty stack frame, to record the current PC, etc. */ +#define PUSH_DUMMY_FRAME generic_push_dummy_frame () +/* Discard from the stack the innermost frame, restoring all registers. */ +#define POP_FRAME h8300_pop_frame () +#define PUSH_RETURN_ADDRESS(PC, SP) h8300_push_return_address (PC, SP) + +/* override the standard get_saved_register function with + one that takes account of generic CALL_DUMMY frames */ +#define GET_SAVED_REGISTER + + diff --git a/gdb/config/m32r/tm-m32r.h b/gdb/config/m32r/tm-m32r.h index 8eac68e..c9342e1 100644 --- a/gdb/config/m32r/tm-m32r.h +++ b/gdb/config/m32r/tm-m32r.h @@ -128,16 +128,15 @@ m32r_frame_find_saved_regs PARAMS ((struct frame_info *fi, extern CORE_ADDR m32r_frame_chain PARAMS ((struct frame_info *fi)); /* mvs_check FRAME_CHAIN */ -#define FRAME_CHAIN(fi) m32r_frame_chain (fi) +#define FRAME_CHAIN(fi) m32r_frame_chain (fi) -extern int generic_frame_chain_valid PARAMS ((CORE_ADDR, struct frame_info *)); -#define FRAME_CHAIN_VALID(fp, frame) (generic_frame_chain_valid (fp, frame)) +#define FRAME_CHAIN_VALID(fp, frame) generic_frame_chain_valid (fp, frame) extern CORE_ADDR m32r_find_callers_reg PARAMS ((struct frame_info *fi, int regnum)); extern CORE_ADDR m32r_frame_saved_pc PARAMS((struct frame_info *)); /* mvs_check FRAME_SAVED_PC */ -#define FRAME_SAVED_PC(fi) (m32r_frame_saved_pc (fi)) +#define FRAME_SAVED_PC(fi) m32r_frame_saved_pc (fi) /* mvs_check EXTRACT_RETURN_VALUE */ #define EXTRACT_RETURN_VALUE(TYPE, REGBUF, VALBUF) \ @@ -183,32 +182,16 @@ extern CORE_ADDR m32r_skip_prologue PARAMS ((CORE_ADDR pc)); (TYPE_LENGTH (TYPE) > 8) #define EXTRACT_STRUCT_VALUE_ADDRESS(REGBUF) \ - (extract_address (REGBUF + REGISTER_BYTE (V0_REGNUM), \ - REGISTER_RAW_SIZE (V0_REGNUM))) + extract_address (REGBUF + REGISTER_BYTE (V0_REGNUM), \ + REGISTER_RAW_SIZE (V0_REGNUM)) #define REG_STRUCT_HAS_ADDR(gcc_p,type) (TYPE_LENGTH (type) > 8) - - - /* generic dummy frame stuff */ -extern CORE_ADDR generic_read_register_dummy PARAMS ((struct frame_info *fi, - int regno)); - -extern void generic_push_dummy_frame PARAMS ((void)); -extern void generic_pop_dummy_frame PARAMS ((void)); - -extern int generic_pc_in_call_dummy PARAMS ((CORE_ADDR pc, - CORE_ADDR fp, - CORE_ADDR sp)); -extern char * generic_find_dummy_frame PARAMS ((CORE_ADDR pc, - CORE_ADDR fp, - CORE_ADDR sp)); - -#define PUSH_DUMMY_FRAME (generic_push_dummy_frame ()) -#define PC_IN_CALL_DUMMY(PC, SP, FP) (generic_pc_in_call_dummy (PC, SP, FP)) +#define PUSH_DUMMY_FRAME generic_push_dummy_frame () +#define PC_IN_CALL_DUMMY(PC, SP, FP) generic_pc_in_call_dummy (PC, SP) /* target-specific dummy_frame stuff */ @@ -220,7 +203,7 @@ extern struct frame_info *m32r_pop_frame PARAMS ((struct frame_info *frame)); /* mvs_no_check STACK_ALIGN */ /* #define STACK_ALIGN(x) ((x + 3) & ~3) */ -extern void m32r_push_return_address PARAMS ((CORE_ADDR)); +extern CORE_ADDR m32r_push_return_address PARAMS ((CORE_ADDR, CORE_ADDR)); extern CORE_ADDR m32r_push_arguments PARAMS ((int nargs, struct value **args, CORE_ADDR sp, @@ -233,18 +216,41 @@ extern CORE_ADDR m32r_push_arguments PARAMS ((int nargs, #define PUSH_ARGUMENTS(NARGS, ARGS, SP, STRUCT_RETURN, STRUCT_ADDR) \ (SP) = m32r_push_arguments (NARGS, ARGS, SP, STRUCT_RETURN, STRUCT_ADDR) - - -#define CALL_DUMMY { } /* mvs_no_check CALL_DUMMY */ -#define CALL_DUMMY_ADDRESS() (entry_point_address ()) /* mvs_no_check CALL_DUMMY_ADDRESS */ - -#define CALL_DUMMY_START_OFFSET (0) /* mvs_no_check CALL_DUMMY_START_OFFSET */ -#define CALL_DUMMY_BREAKPOINT_OFFSET (0) /* mvs_no_check CALL_DUMMY_BREAKPOINT_OFFSET */ -#define CALL_DUMMY_LENGTH (0) /* mvs_no_check CALL_DUMMY_LENGTH */ - -/* mvs_no_check FIX_CALL_DUMMY */ -#define FIX_CALL_DUMMY(DUMMY1, START_SP, FUNADDR, NARGS, \ - ARGS, VALUE_TYPE, USING_GCC) - -#define CALL_DUMMY_LOCATION AT_ENTRY_POINT -#define PUSH_RETURN_ADDRESS(pc) (m32r_push_return_address (pc)) +#define PUSH_RETURN_ADDRESS(PC, SP) m32r_push_return_address (PC, SP) + +/* override the standard get_saved_register function with + one that takes account of generic CALL_DUMMY frames */ +#define GET_SAVED_REGISTER + +#if 1 +#define CALL_DUMMY {0} +#define CALL_DUMMY_LENGTH (0) +#define CALL_DUMMY_START_OFFSET (0) +#define CALL_DUMMY_BREAKPOINT_OFFSET (0) +#define FIX_CALL_DUMMY(DUMMY1, STARTADDR, FUNADDR, NARGS, ARGS, TYPE, GCCP) +#define CALL_DUMMY_LOCATION AT_ENTRY_POINT +#define CALL_DUMMY_ADDRESS() entry_point_address () + +#else +/* +/* Use these defines if, for whatever reason, you want to use a + genuine call_dummy sequence (A sequence of machine instructions + that GDB will write into the target address space, usually on the + stack, for calling a function in the inferior): + + This sequence of words defines the instructions: + + ld24 R8, <destination> + jl R8 + nop + trap +*/ +#define CALL_DUMMY { 0xe8000000, 0x1ec87000, 0x10f110f1 } +#define CALL_DUMMY_LENGTH (12) +#define CALL_DUMMY_START_OFFSET (0) +#define CALL_DUMMY_BREAKPOINT_OFFSET (8) +#define FIX_CALL_DUMMY(DUMMY1, STARTADDR, FUNADDR, NARGS, ARGS, TYPE, GCCP) \ + m32r_fix_call_dummy (DUMMY1, STARTADDR, FUNADDR, NARGS, ARGS, TYPE, GCCP) +#define CALL_DUMMY_LOCATION ON_STACK +#define NEED_TEXT_START_END +#endif diff --git a/gdb/config/sh/tm-sh.h b/gdb/config/sh/tm-sh.h index 2b879d1..5347d72 100644 --- a/gdb/config/sh/tm-sh.h +++ b/gdb/config/sh/tm-sh.h @@ -55,8 +55,7 @@ extern CORE_ADDR sh_skip_prologue (); The return address is the value saved in the PR register + 4 */ -#define SAVED_PC_AFTER_CALL(frame) \ - (ADDR_BITS_REMOVE(read_register(PR_REGNUM))) +#define SAVED_PC_AFTER_CALL(frame) (ADDR_BITS_REMOVE(read_register(PR_REGNUM))) /* Stack grows downward. */ @@ -110,7 +109,7 @@ extern CORE_ADDR sh_skip_prologue (); #define REGISTER_VIRTUAL_TYPE(N) \ ((((N) >= FP0_REGNUM && (N) <= FP15_REGNUM) \ || (N) == FPUL_REGNUM) \ - ? builtin_type_float : builtin_type_int) + ? builtin_type_float : builtin_type_int) /* Initializer for an array of names of registers. Entries beyond the first NUM_REGS are ignored. */ @@ -189,8 +188,9 @@ extern void sh_extract_return_value PARAMS ((struct type *, void *, void *)); the address in which a function should return its structure value, as a CORE_ADDR (or an expression that can be used as one). */ -#define EXTRACT_STRUCT_VALUE_ADDRESS(REGBUF) (*(CORE_ADDR *)(REGBUF)) - +#define EXTRACT_STRUCT_VALUE_ADDRESS(REGBUF) \ + extract_address (REGBUF, REGISTER_RAW_SIZE (0)) + /* Define other aspects of the stack frame. we keep a copy of the worked out return pc lying around, since it @@ -242,43 +242,63 @@ extern void sh_frame_find_saved_regs PARAMS ((struct frame_info *fi, typedef unsigned short INSN_WORD; -extern CORE_ADDR generic_read_register_dummy PARAMS ((struct frame_info *, - int regno)); - -extern void generic_push_dummy_frame PARAMS ((void)); -extern void generic_pop_dummy_frame PARAMS ((void)); - -extern int generic_pc_in_call_dummy PARAMS ((CORE_ADDR pc, - CORE_ADDR fp, - CORE_ADDR sp)); -extern char * generic_find_dummy_frame PARAMS ((CORE_ADDR pc, - CORE_ADDR fp, - CORE_ADDR sp)); - -extern void sh_push_return_address PARAMS ((CORE_ADDR)); extern CORE_ADDR sh_push_arguments PARAMS ((int nargs, struct value **args, CORE_ADDR sp, unsigned char struct_return, CORE_ADDR struct_addr)); -extern int generic_frame_chain_valid PARAMS((CORE_ADDR, struct frame_info *)); +#if 0 +/* Use these defines if, for whatever reason, you want to use a + genuine call_dummy sequence (A sequence of machine instructions + that GDB will write into the target address space, usually on the + stack, for calling a function in the inferior): + + This sequence of words defines the instructions: + mov.w @(2,PC), R8 + jsr @R8 + nop + trap + <destination> -#define CALL_DUMMY { } + Note that the destination address is actually written into a word + 8 bytes after the start of the CALL_DUMMY. The first instruction + loads it from here using PC-relative addressing. Note also the + NOP that must follow the jsr instruction to fill up the delay slot. +*/ + +#define CALL_DUMMY { 0xd801480b, 0x0009c3c3, 0x32323232, } +#define CALL_DUMMY_LENGTH (12) +#define CALL_DUMMY_START_OFFSET (0) +#define CALL_DUMMY_BREAKPOINT_OFFSET (6) +#define FIX_CALL_DUMMY(DUMMY, STARTADDR, FUNADDR, NARGS, ARGS, TYPE, GCCP) \ + sh_fix_call_dummy(DUMMY, STARTADDR, FUNADDR, NARGS, ARGS, TYPE, GCCP) +#define CALL_DUMMY_LOCATION ON_STACK + +#else /* These defines write NO instructions into the inferior process, + and are therefore preferred because they make target calls faster. */ +#define CALL_DUMMY {0} #define CALL_DUMMY_LENGTH (0) #define CALL_DUMMY_START_OFFSET (0) #define CALL_DUMMY_BREAKPOINT_OFFSET (0) +#define FIX_CALL_DUMMY(DUMMY, STARTADDR, FUNADDR, NARGS, ARGS, TYPE, GCCP) #define CALL_DUMMY_LOCATION AT_ENTRY_POINT -#define CALL_DUMMY_ADDRESS() (entry_point_address ()) -#define PUSH_RETURN_ADDRESS(PC) (sh_push_return_address (PC)) -#define FRAME_CHAIN(FRAME) (sh_frame_chain(FRAME)) -#define PUSH_DUMMY_FRAME (generic_push_dummy_frame ()) -#define FRAME_CHAIN_VALID(FP, FRAME) (generic_frame_chain_valid (FP, FRAME)) -#define PC_IN_CALL_DUMMY(PC, SP, FP) (generic_pc_in_call_dummy (PC, SP, FP)) -#define FIX_CALL_DUMMY(DUMMYNAME, STARTADDR, FUNADDR, NARGS, ARGS, TYPE, GCCP) +#define CALL_DUMMY_ADDRESS() entry_point_address () +extern CORE_ADDR sh_push_return_address PARAMS ((CORE_ADDR, CORE_ADDR)); +#define PUSH_RETURN_ADDRESS(PC, SP) sh_push_return_address (PC, SP) +#endif + +#define FRAME_CHAIN(FRAME) sh_frame_chain(FRAME) +#define PUSH_DUMMY_FRAME generic_push_dummy_frame () +#define FRAME_CHAIN_VALID(FP, FRAME) generic_frame_chain_valid (FP, FRAME) +#define PC_IN_CALL_DUMMY(PC, SP, FP) generic_pc_in_call_dummy (PC, SP) #define PUSH_ARGUMENTS(NARGS, ARGS, SP, STRUCT_RETURN, STRUCT_ADDR) \ - (SP) = sh_push_arguments (NARGS, ARGS, SP, STRUCT_RETURN, STRUCT_ADDR) + (SP) = sh_push_arguments (NARGS, ARGS, SP, STRUCT_RETURN, STRUCT_ADDR) + +/* override the standard get_saved_register function with + one that takes account of generic CALL_DUMMY frames */ +#define GET_SAVED_REGISTER /* Discard from the stack the innermost frame, restoring all saved registers. */ diff --git a/gdb/config/v850/tm-v850.h b/gdb/config/v850/tm-v850.h index eec0911..1bc61c4 100644 --- a/gdb/config/v850/tm-v850.h +++ b/gdb/config/v850/tm-v850.h @@ -85,16 +85,18 @@ extern void v850_frame_find_saved_regs PARAMS ((struct frame_info *fi, struct fr extern CORE_ADDR v850_frame_chain PARAMS ((struct frame_info *fi)); #define FRAME_CHAIN(fi) v850_frame_chain (fi) +#define FRAME_CHAIN_VALID(FP, FI) generic_frame_chain_valid (FP, FI) extern CORE_ADDR v850_find_callers_reg PARAMS ((struct frame_info *fi, int regnum)); -#define FRAME_SAVED_PC(fi) (v850_find_callers_reg (fi, RP_REGNUM)) +extern CORE_ADDR v850_frame_saved_pc PARAMS ((struct frame_info *)); +#define FRAME_SAVED_PC(FI) (v850_frame_saved_pc (FI)) #define EXTRACT_RETURN_VALUE(TYPE, REGBUF, VALBUF) \ memcpy (VALBUF, REGBUF + REGISTER_BYTE (V0_REGNUM), TYPE_LENGTH (TYPE)) #define EXTRACT_STRUCT_VALUE_ADDRESS(REGBUF) \ - (extract_address (REGBUF + REGISTER_BYTE (V0_REGNUM), \ - REGISTER_RAW_SIZE (V0_REGNUM))) + extract_address (REGBUF + REGISTER_BYTE (V0_REGNUM), \ + REGISTER_RAW_SIZE (V0_REGNUM)) #define STORE_RETURN_VALUE(TYPE, VALBUF) \ write_register_bytes(REGISTER_BYTE (V0_REGNUM), VALBUF, TYPE_LENGTH (TYPE)); @@ -108,23 +110,41 @@ extern CORE_ADDR v850_skip_prologue PARAMS ((CORE_ADDR pc)); #define FRAME_LOCALS_ADDRESS(fi) ((fi)->frame) #define FRAME_NUM_ARGS(val, fi) ((val) = -1) -extern struct frame_info *v850_pop_frame PARAMS ((struct frame_info *frame)); +extern void v850_pop_frame PARAMS ((struct frame_info *frame)); #define POP_FRAME v850_pop_frame (get_current_frame ()) -#define CALL_DUMMY { 0 } - -#define CALL_DUMMY_START_OFFSET (0) - +#if 0 +/* Use these defines if, for whatever reason, you want to use a + genuine call_dummy sequence (A sequence of machine instructions + that GDB will write into the target address space, usually on the + stack, for calling a function in the inferior): + + This sequence of words defines the instructions: + + jarl <offset24>, r31 + trap +*/ +#define CALL_DUMMY { 0x0000ff80, 0xffffffff } +#define CALL_DUMMY_LENGTH (8) +#define CALL_DUMMY_START_OFFSET (0) +#define CALL_DUMMY_BREAKPOINT_OFFSET (4) +#define CALL_DUMMY_LOCATION ON_STACK +#define FIX_CALL_DUMMY(DUMMY, START, FUNADDR, NARGS, ARGS, TYPE, GCCP) \ + v850_fix_call_dummy (DUMMY, START, FUNADDR, NARGS, ARGS, TYPE, GCCP); + +#else /* These defines write NO instructions into the inferior process, + and are therefore preferred because they make target calls faster. */ +#define CALL_DUMMY {0} +#define CALL_DUMMY_START_OFFSET (0) #define CALL_DUMMY_BREAKPOINT_OFFSET (0) +#define CALL_DUMMY_LOCATION AT_ENTRY_POINT +#define FIX_CALL_DUMMY(DUMMY, START, FUNADDR, NARGS, ARGS, TYPE, GCCP) +#define CALL_DUMMY_ADDRESS() entry_point_address () +extern CORE_ADDR v850_push_return_address PARAMS ((CORE_ADDR, CORE_ADDR)); +#define PUSH_RETURN_ADDRESS(PC, SP) v850_push_return_address (PC, SP) +#endif -extern void v850_push_dummy_frame PARAMS ((void)); -#define PUSH_DUMMY_FRAME v850_push_dummy_frame () - -#define FIX_CALL_DUMMY(DUMMY1, START_SP, FUNADDR, NARGS, ARGS, VALUE_TYPE, USING_GCC) - -#define CALL_DUMMY_LOCATION AT_ENTRY_POINT - -#define STACK_ALIGN(x) ((x + 3) & ~3) +#define PUSH_DUMMY_FRAME generic_push_dummy_frame () extern CORE_ADDR v850_push_arguments PARAMS ((int nargs, struct value **args, CORE_ADDR sp, @@ -135,14 +155,16 @@ v850_push_arguments PARAMS ((int nargs, struct value **args, CORE_ADDR sp, #define STORE_STRUCT_RETURN(STRUCT_ADDR, SP) -#define CALL_DUMMY_ADDRESS() (entry_point_address ()) -extern int v850_pc_in_call_dummy PARAMS ((CORE_ADDR pc)); -#define PC_IN_CALL_DUMMY(PC, SP, FP) v850_pc_in_call_dummy (PC) +#define PC_IN_CALL_DUMMY(PC, SP, FP) generic_pc_in_call_dummy (PC, SP) #define USE_STRUCT_CONVENTION(GCC_P, TYPE) \ (TYPE_NFIELDS (TYPE) > 1 || TYPE_LENGTH (TYPE) > 4) +/* override the default get_saved_register function with + one that takes account of generic CALL_DUMMY frames */ +#define GET_SAVED_REGISTER + /* Define this for Wingdb */ #define TARGET_V850 |