From: Grace Sainsbury Date: Wed, 26 Jun 2002 17:09:30 +0000 (+0000) Subject: * config/m68k/tm-m68k.h: Rearrange code so macros not in the X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=6300c360ea913043e2cf58c45597f60a03df6a13;p=binutils-gdb.git * config/m68k/tm-m68k.h: Rearrange code so macros not in the gdbarch vector are at the top. (NUM_REGS): Remove. (FP_REGNUM, SP_REGNUM, PS_REGNUM, PC_REGNUM, FP0_REGNUM): Remove. (FRAME_ARGS_ADDRESS): Remove. (FRAME_LOCALS_ADDRESS): Remove. (FRAME_NUM_ARGS): Remove. (FRAME_ARGS_SKIP): Remove. * m68k-tdep.c (enum): Add eumeration of special register numbers. (m68k_gdbarch_init): Add gdbarch initializations for macros undefined in tm-m68k.h --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index d61da7c9150..00c823696af 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -22,6 +22,20 @@ (s390_frame_chain): Ditto. * cris-tdep.c (cris_frame_init_saved_regs): Ditto. +2002-06-26 Grace Sainsbury + + * config/m68k/tm-m68k.h: Rearrange code so macros not in the + gdbarch vector are at the top. + (NUM_REGS): Remove. + (FP_REGNUM, SP_REGNUM, PS_REGNUM, PC_REGNUM, FP0_REGNUM): Remove. + (FRAME_ARGS_ADDRESS): Remove. + (FRAME_LOCALS_ADDRESS): Remove. + (FRAME_NUM_ARGS): Remove. + (FRAME_ARGS_SKIP): Remove. + * m68k-tdep.c (enum): Add eumeration of special register numbers. + (m68k_gdbarch_init): Add gdbarch initializations for macros + undefined in tm-m68k.h + 2002-06-26 Grace Sainsbury * monitor.h: Add the function regname to monitor_ops diff --git a/gdb/config/m68k/tm-m68k.h b/gdb/config/m68k/tm-m68k.h index c08ab997ef4..fd8656406f7 100644 --- a/gdb/config/m68k/tm-m68k.h +++ b/gdb/config/m68k/tm-m68k.h @@ -25,6 +25,53 @@ /* Generic 68000 stuff, to be included by other tm-*.h files. */ +struct frame_info; + +/* Sequence of bytes for breakpoint instruction. + This is a TRAP instruction. The last 4 bits (0xf below) is the + vector. Systems which don't use 0xf should define BPT_VECTOR + themselves before including this file. */ + +#if !defined (BPT_VECTOR) +#define BPT_VECTOR 0xf +#endif + +#if !defined (BREAKPOINT) +#define BREAKPOINT {0x4e, (0x40 | BPT_VECTOR)} +#endif + +/* We default to vector 1 for the "remote" target, but allow targets + to override. */ +#if !defined (REMOTE_BPT_VECTOR) +#define REMOTE_BPT_VECTOR 1 +#endif + +#if !defined (REMOTE_BREAKPOINT) +#define REMOTE_BREAKPOINT {0x4e, (0x40 | REMOTE_BPT_VECTOR)} +#endif + +#define REGISTER_BYTES_FP (16*4 + 8 + 8*12 + 3*4) +#define REGISTER_BYTES_NOFP (16*4 + 8) + + +#define NUM_FREGS (NUM_REGS-24) + +/* This was determined by experimentation on hp300 BSD 4.3. Perhaps + it corresponds to some offset in /usr/include/sys/user.h or + something like that. Using some system include file would + have the advantage of probably being more robust in the face + of OS upgrades, but the disadvantage of being wrong for + cross-debugging. */ + +#define SIG_PC_FP_OFFSET 530 + +/* Offset from SP to first arg on stack at first instruction of a function */ + +#define SP_ARG0 (1 * 4) + +#define TARGET_M68K + + #if !GDB_MULTI_ARCH #define TARGET_LONG_DOUBLE_FORMAT &floatformat_m68881_ext @@ -50,8 +97,6 @@ extern CORE_ADDR m68k_skip_prologue (CORE_ADDR ip); the new frame is not set up until the new function executes some instructions. */ -struct frame_info; - #if !GDB_MULTI_ARCH extern CORE_ADDR m68k_saved_pc_after_call (struct frame_info *); @@ -69,29 +114,6 @@ extern CORE_ADDR m68k_saved_pc_after_call (struct frame_info *); #define STACK_ALIGN(ADDR) (((ADDR) + 1) & ~1) #endif -/* Sequence of bytes for breakpoint instruction. - This is a TRAP instruction. The last 4 bits (0xf below) is the - vector. Systems which don't use 0xf should define BPT_VECTOR - themselves before including this file. */ - -#if !defined (BPT_VECTOR) -#define BPT_VECTOR 0xf -#endif - -#if !defined (BREAKPOINT) -#define BREAKPOINT {0x4e, (0x40 | BPT_VECTOR)} -#endif - -/* We default to vector 1 for the "remote" target, but allow targets - to override. */ -#if !defined (REMOTE_BPT_VECTOR) -#define REMOTE_BPT_VECTOR 1 -#endif - -#if !defined (REMOTE_BREAKPOINT) -#define REMOTE_BREAKPOINT {0x4e, (0x40 | REMOTE_BPT_VECTOR)} -#endif - /* If your kernel resets the pc after the trap happens you may need to define this before including this file. */ @@ -101,6 +123,12 @@ extern CORE_ADDR m68k_saved_pc_after_call (struct frame_info *); #endif #endif +#if !GDB_MULTI_ARCH +#ifndef NUM_REGS +#define NUM_REGS 29 +#endif +#endif + /* Say how long (ordinary) registers are. This is a piece of bogosity used in push_word and a few other places; REGISTER_RAW_SIZE is the real way to know how big a register is. */ @@ -109,17 +137,6 @@ extern CORE_ADDR m68k_saved_pc_after_call (struct frame_info *); #define REGISTER_SIZE 4 #endif -#define REGISTER_BYTES_FP (16*4 + 8 + 8*12 + 3*4) -#define REGISTER_BYTES_NOFP (16*4 + 8) - - -#ifndef NUM_REGS -#define NUM_REGS 29 -#endif - - -#define NUM_FREGS (NUM_REGS-24) - #if !GDB_MULTI_ARCH #ifndef REGISTER_BYTES_OK #define REGISTER_BYTES_OK(b) \ @@ -197,14 +214,17 @@ extern CORE_ADDR m68k_saved_pc_after_call (struct frame_info *); 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 D0_REGNUM 0 #define A0_REGNUM 8 #define A1_REGNUM 9 +#if !GDB_MULTI_ARCH #define FP_REGNUM 14 /* Contains address of executing stack frame */ #define SP_REGNUM 15 /* Contains address of top of stack */ #define PS_REGNUM 16 /* Contains processor status */ #define PC_REGNUM 17 /* Contains program counter */ #define FP0_REGNUM 18 /* Floating point register 0 */ +#endif #define FPC_REGNUM 26 /* 68881 control register */ #define FPS_REGNUM 27 /* 68881 status register */ #define FPI_REGNUM 28 /* 68881 iaddr register */ @@ -277,14 +297,7 @@ extern CORE_ADDR m68k_saved_pc_after_call (struct frame_info *); (((FI)->signal_handler_caller) ? 0 : frameless_look_for_prologue(FI)) #endif -/* This was determined by experimentation on hp300 BSD 4.3. Perhaps - it corresponds to some offset in /usr/include/sys/user.h or - something like that. Using some system include file would - have the advantage of probably being more robust in the face - of OS upgrades, but the disadvantage of being wrong for - cross-debugging. */ -#define SIG_PC_FP_OFFSET 530 #if !GDB_MULTI_ARCH #define FRAME_SAVED_PC(FRAME) \ @@ -298,22 +311,27 @@ extern CORE_ADDR m68k_saved_pc_after_call (struct frame_info *); ) #endif +#if !GDB_MULTI_ARCH #define FRAME_ARGS_ADDRESS(fi) ((fi)->frame) #define FRAME_LOCALS_ADDRESS(fi) ((fi)->frame) +#endif /* Set VAL to the number of args passed to frame described by FI. Can set VAL to -1, meaning no way to tell. */ /* We can't tell how many args there are now that the C compiler delays popping them. */ +#if !GDB_MULTI_ARCH #if !defined (FRAME_NUM_ARGS) #define FRAME_NUM_ARGS(fi) (-1) #endif + /* Return number of bytes at start of arglist that are not really args. */ #define FRAME_ARGS_SKIP 8 +#endif /* Put here the code to store, into a struct frame_saved_regs, the addresses of the saved registers of frame described by FRAME_INFO. @@ -385,12 +403,7 @@ extern void m68k_pop_frame (void); /* Discard from the stack the innermost frame, restoring all registers. */ #define POP_FRAME { m68k_pop_frame (); } -#endif -/* Offset from SP to first arg on stack at first instruction of a function */ - -#define SP_ARG0 (1 * 4) -#define TARGET_M68K /* Figure out where the longjmp will land. Slurp the args out of the stack. We expect the first arg to be a pointer to the jmp_buf structure from which @@ -398,3 +411,4 @@ extern void m68k_pop_frame (void); This routine returns true on success */ extern int m68k_get_longjmp_target (CORE_ADDR *); +#endif diff --git a/gdb/m68k-tdep.c b/gdb/m68k-tdep.c index 7450d212ec5..d1ab13fb6e1 100644 --- a/gdb/m68k-tdep.c +++ b/gdb/m68k-tdep.c @@ -42,6 +42,15 @@ #define P_FMOVM 0xf237 #define P_TRAP 0x4e40 +enum +{ + E_FP_REGNUM = 14, /* Contains address of executing stack frame */ + E_SP_REGNUM = 15, /* Contains address of top of stack */ + E_PS_REGNUM = 16, /* Contains processor status */ + E_PC_REGNUM = 17, /* Contains program counter */ + E_FP0_REGNUM = 18 /* Floating point register 0 */ +}; + void m68k_frame_init_saved_regs (struct frame_info *frame_info); static int @@ -917,7 +926,7 @@ m68k_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) #if 0 tdep = (struct gdbarch_tdep *) xmalloc (sizeof (struct gdbarch_tdep)); #endif - + gdbarch = gdbarch_alloc (&info, 0); set_gdbarch_long_double_format (gdbarch, &floatformat_m68881_ext); @@ -932,6 +941,8 @@ m68k_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_inner_than (gdbarch, core_addr_lessthan); set_gdbarch_stack_align (gdbarch, m68k_stack_align); + + set_gdbarch_believe_pcc_promotion (gdbarch, 1); set_gdbarch_decr_pc_after_break (gdbarch, 2); set_gdbarch_store_struct_return (gdbarch, m68k_store_struct_return); @@ -940,10 +951,16 @@ m68k_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_store_return_value (gdbarch, m68k_store_return_value); set_gdbarch_frame_chain (gdbarch, m68k_frame_chain); + set_gdbarch_frame_chain_valid (gdbarch, generic_func_frame_chain_valid); set_gdbarch_frame_saved_pc (gdbarch, m68k_frame_saved_pc); set_gdbarch_frame_init_saved_regs (gdbarch, m68k_frame_init_saved_regs); set_gdbarch_frameless_function_invocation (gdbarch, m68k_frameless_function_invocation); + /* OK to default this value to 'unknown'. */ + set_gdbarch_frame_num_args (gdbarch, frame_num_args_unknown); + set_gdbarch_frame_args_skip (gdbarch, 8); + set_gdbarch_frame_args_address (gdbarch, default_frame_address); + set_gdbarch_frame_locals_address (gdbarch, default_frame_address); set_gdbarch_register_raw_size (gdbarch, m68k_register_raw_size); set_gdbarch_register_virtual_size (gdbarch, m68k_register_virtual_size); @@ -956,6 +973,11 @@ m68k_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_num_regs (gdbarch, 29); set_gdbarch_register_bytes_ok (gdbarch, m68k_register_bytes_ok); set_gdbarch_register_bytes (gdbarch, (16 * 4 + 8 + 8 * 12 + 3 * 4)); + set_gdbarch_sp_regnum (gdbarch, E_SP_REGNUM); + set_gdbarch_fp_regnum (gdbarch, E_FP_REGNUM); + set_gdbarch_pc_regnum (gdbarch, E_PC_REGNUM); + set_gdbarch_ps_regnum (gdbarch, E_PS_REGNUM); + set_gdbarch_fp0_regnum (gdbarch, E_FP0_REGNUM); set_gdbarch_use_generic_dummy_frames (gdbarch, 0); set_gdbarch_call_dummy_location (gdbarch, ON_STACK);