From 95404a3ece6de2f0ccb7e604c8f7931e1f6bc97a Mon Sep 17 00:00:00 2001 From: Andrew Cagney Date: Sun, 1 Jun 2003 15:45:57 +0000 Subject: [PATCH] 2003-06-01 Andrew Cagney * mips-tdep.c (is_mips16_addr): New function. (make_mips16_addr, unmake_mips16_addr): New functions. (pc_is_mips16, mips_fetch_instruction): Use. (gdb_print_insn_mips, mips_breakpoint_from_pc): Use. (gdb_print_insn_mips): Eliminate TM_PRINT_INSN_MACH. (mips_dump_tdep): Delete print of TM_PRINT_INSN_MACH, UNMAKE_MIPS16_ADDR, MAKE_MIPS16_ADDR, IS_MIPS16_ADDR and TARGET_MIPS. * config/mips/tm-mips.h: Update copyright. (TARGET_MIPS, TM_PRINT_INSN_MACH): Delete. (DEPRECATED_REGISTER_SIZE, DEPRECATED_REGISTER_BYTES): Delete. (IS_MIPS16_ADDR, MAKE_MIPS16_ADDR, UNMAKE_MIPS16_ADDR): Delete. * config/mips/tm-irix6.h (DEPRECATED_REGISTER_BYTES): Delete. (TM_PRINT_INSN_MACH): Delete. * config/mips/tm-irix5.h (DEPRECATED_REGISTER_BYTES): Delete. --- gdb/ChangeLog | 16 +++++++++++++ gdb/config/mips/tm-irix5.h | 3 --- gdb/config/mips/tm-irix6.h | 7 ------ gdb/config/mips/tm-mips.h | 31 ++----------------------- gdb/mips-tdep.c | 46 +++++++++++++++++++++++--------------- 5 files changed, 46 insertions(+), 57 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 9972ceb903a..3b8d79d5c12 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,21 @@ 2003-06-01 Andrew Cagney + * mips-tdep.c (is_mips16_addr): New function. + (make_mips16_addr, unmake_mips16_addr): New functions. + (pc_is_mips16, mips_fetch_instruction): Use. + (gdb_print_insn_mips, mips_breakpoint_from_pc): Use. + (gdb_print_insn_mips): Eliminate TM_PRINT_INSN_MACH. + (mips_dump_tdep): Delete print of TM_PRINT_INSN_MACH, + UNMAKE_MIPS16_ADDR, MAKE_MIPS16_ADDR, IS_MIPS16_ADDR and + TARGET_MIPS. + * config/mips/tm-mips.h: Update copyright. + (TARGET_MIPS, TM_PRINT_INSN_MACH): Delete. + (DEPRECATED_REGISTER_SIZE, DEPRECATED_REGISTER_BYTES): Delete. + (IS_MIPS16_ADDR, MAKE_MIPS16_ADDR, UNMAKE_MIPS16_ADDR): Delete. + * config/mips/tm-irix6.h (DEPRECATED_REGISTER_BYTES): Delete. + (TM_PRINT_INSN_MACH): Delete. + * config/mips/tm-irix5.h (DEPRECATED_REGISTER_BYTES): Delete. + * configure.tgt: Replace mips64*vr4xxx*el-*-elf*, mips64*vr4xxx*-*-elf*, mips64*vr4300*el-*-elf*, mips64*vr4300*-*-elf*, mips64*vr4100*el-*-elf*, diff --git a/gdb/config/mips/tm-irix5.h b/gdb/config/mips/tm-irix5.h index d3dfdc46903..3d598c9dae1 100644 --- a/gdb/config/mips/tm-irix5.h +++ b/gdb/config/mips/tm-irix5.h @@ -30,9 +30,6 @@ * Irix 6 (n32 ABI) has 32-bit GP regs and 64-bit FP regs */ -#undef DEPRECATED_REGISTER_BYTES -#define DEPRECATED_REGISTER_BYTES (MIPS_NUMREGS * 8 + (NUM_REGS - MIPS_NUMREGS) * MIPS_REGSIZE) - #undef REGISTER_BYTE #define REGISTER_BYTE(N) \ (((N) < FP0_REGNUM) ? (N) * MIPS_REGSIZE : \ diff --git a/gdb/config/mips/tm-irix6.h b/gdb/config/mips/tm-irix6.h index 8f3c31e714b..14de12e4c4f 100644 --- a/gdb/config/mips/tm-irix6.h +++ b/gdb/config/mips/tm-irix6.h @@ -62,9 +62,6 @@ #define FCRIR_REGNUM 70 /* FP implementation/revision */ -#undef DEPRECATED_REGISTER_BYTES -#define DEPRECATED_REGISTER_BYTES (MIPS_NUMREGS * 8 + (NUM_REGS - MIPS_NUMREGS) * MIPS_REGSIZE) - #undef REGISTER_BYTE #define REGISTER_BYTE(N) \ (((N) < FP0_REGNUM) ? (N) * MIPS_REGSIZE : \ @@ -96,9 +93,5 @@ #define SIGFRAME_FPREGSAVE_OFF (SIGFRAME_BASE + 2 * 4 + 8 + 32 * 8 + 4) #define SIGFRAME_REG_SIZE 8 -/* Select the disassembler */ -#undef TM_PRINT_INSN_MACH -#define TM_PRINT_INSN_MACH bfd_mach_mips8000 - /* Undefine those methods which have been multiarched. */ #undef REGISTER_VIRTUAL_TYPE diff --git a/gdb/config/mips/tm-mips.h b/gdb/config/mips/tm-mips.h index 540db163080..7ae05a4b203 100644 --- a/gdb/config/mips/tm-mips.h +++ b/gdb/config/mips/tm-mips.h @@ -1,7 +1,7 @@ /* Definitions to make GDB run on a mips box under 4.3bsd. Copyright 1986, 1987, 1989, 1991, 1992, 1993, 1994, 1995, 1996, - 1997, 1998, 1999, 2000, 2002 Free Software Foundation, Inc. + 1997, 1998, 1999, 2000, 2002, 2003 Free Software Foundation, Inc. Contributed by Per Bothner (bothner@cs.wisc.edu) at U.Wisconsin and by Alessandro Forin (af@cs.cmu.edu) at CMU.. @@ -45,15 +45,7 @@ extern int mips_step_skips_delay (CORE_ADDR); #define STEP_SKIPS_DELAY_P (1) #define STEP_SKIPS_DELAY(pc) (mips_step_skips_delay (pc)) -/* 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. */ - -#define DEPRECATED_REGISTER_SIZE 4 - -/* The size of a register. This is predefined in tm-mips64.h. We - can't use DEPRECATED_REGISTER_SIZE because that is used for various other - things. */ +/* The size of a register. This is predefined in tm-mips64.h. */ #ifndef MIPS_REGSIZE #define MIPS_REGSIZE 4 @@ -103,11 +95,6 @@ extern int mips_step_skips_delay (CORE_ADDR); #define PRID_REGNUM 89 /* Processor ID */ #define LAST_EMBED_REGNUM 89 /* Last one */ -/* Total amount of space needed to store our copies of the machine's - register state, the array `registers'. */ - -#define DEPRECATED_REGISTER_BYTES (NUM_REGS*MIPS_REGSIZE) - /* Index within `registers' of the first byte of the space for register N. */ @@ -182,10 +169,6 @@ extern void mips_print_extra_frame_info (struct frame_info *frame); #define SETUP_ARBITRARY_FRAME(argc, argv) setup_arbitrary_frame (argc, argv) extern struct frame_info *setup_arbitrary_frame (int, CORE_ADDR *); -/* Select the default mips disassembler */ - -#define TM_PRINT_INSN_MACH 0 - /* These are defined in mdebugread.c and are used in mips-tdep.c */ extern CORE_ADDR sigtramp_address, sigtramp_end; extern void fixup_sigtramp (void); @@ -197,22 +180,12 @@ extern char *mips_read_processor_type (void); #define IGNORE_HELPER_CALL(pc) mips_ignore_helper (pc) extern int mips_ignore_helper (CORE_ADDR pc); -#ifndef TARGET_MIPS -#define TARGET_MIPS -#endif - /* Definitions and declarations used by mips-tdep.c and remote-mips.c */ #define MIPS_INSTLEN 4 /* Length of an instruction */ #define MIPS16_INSTLEN 2 /* Length of an instruction on MIPS16 */ #define MIPS_NUMREGS 32 /* Number of integer or float registers */ typedef unsigned long t_inst; /* Integer big enough to hold an instruction */ -/* MIPS16 function addresses are odd (bit 0 is set). Here are some - macros to test, set, or clear bit 0 of addresses. */ -#define IS_MIPS16_ADDR(addr) ((addr) & 1) -#define MAKE_MIPS16_ADDR(addr) ((addr) | 1) -#define UNMAKE_MIPS16_ADDR(addr) ((addr) & ~1) - #endif /* TM_MIPS_H */ /* Command to set the processor type. */ diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c index f1732a01ee6..7b2a7004a4f 100644 --- a/gdb/mips-tdep.c +++ b/gdb/mips-tdep.c @@ -152,6 +152,27 @@ static const char *mips_saved_regsize_string = size_auto; #define MIPS_SAVED_REGSIZE (mips_saved_regsize()) +/* MIPS16 function addresses are odd (bit 0 is set). Here are some + functions to test, set, or clear bit 0 of addresses. */ + +static CORE_ADDR +is_mips16_addr (CORE_ADDR addr) +{ + return ((addr) & 1); +} + +static CORE_ADDR +make_mips16_addr (CORE_ADDR addr) +{ + return ((addr) | 1); +} + +static CORE_ADDR +unmake_mips16_addr (CORE_ADDR addr) +{ + return ((addr) & ~1); +} + /* Return the contents of register REGNUM as a signed integer. */ static LONGEST @@ -789,7 +810,7 @@ pc_is_mips16 (bfd_vma memaddr) struct minimal_symbol *sym; /* If bit 0 of the address is set, assume this is a MIPS16 address. */ - if (IS_MIPS16_ADDR (memaddr)) + if (is_mips16_addr (memaddr)) return 1; /* A flag indicating that this is a MIPS16 function is stored by elfread.c in @@ -922,7 +943,7 @@ mips_fetch_instruction (CORE_ADDR addr) if (pc_is_mips16 (addr)) { instlen = MIPS16_INSTLEN; - addr = UNMAKE_MIPS16_ADDR (addr); + addr = unmake_mips16_addr (addr); } else instlen = MIPS_INSTLEN; @@ -5108,7 +5129,7 @@ gdb_print_insn_mips (bfd_vma memaddr, disassemble_info *info) the search would fail because the symbol table says the function starts at an odd address, i.e. 1 byte past the given address. */ memaddr = ADDR_BITS_REMOVE (memaddr); - proc_desc = non_heuristic_proc_desc (MAKE_MIPS16_ADDR (memaddr), NULL); + proc_desc = non_heuristic_proc_desc (make_mips16_addr (memaddr), NULL); /* Make an attempt to determine if this is a 16-bit function. If the procedure descriptor exists and the address therein is odd, @@ -5116,10 +5137,10 @@ gdb_print_insn_mips (bfd_vma memaddr, disassemble_info *info) guess that if the address passed in is odd, it's 16-bits. */ if (proc_desc) info->mach = pc_is_mips16 (PROC_LOW_ADDR (proc_desc)) ? - bfd_mach_mips16 : TM_PRINT_INSN_MACH; + bfd_mach_mips16 : 0; else info->mach = pc_is_mips16 (memaddr) ? - bfd_mach_mips16 : TM_PRINT_INSN_MACH; + bfd_mach_mips16 : 0; /* Round down the instruction address to the appropriate boundary. */ memaddr &= (info->mach == bfd_mach_mips16 ? ~1 : ~3); @@ -5146,7 +5167,7 @@ mips_breakpoint_from_pc (CORE_ADDR * pcptr, int *lenptr) if (pc_is_mips16 (*pcptr)) { static unsigned char mips16_big_breakpoint[] = {0xe8, 0xa5}; - *pcptr = UNMAKE_MIPS16_ADDR (*pcptr); + *pcptr = unmake_mips16_addr (*pcptr); *lenptr = sizeof (mips16_big_breakpoint); return mips16_big_breakpoint; } @@ -5176,7 +5197,7 @@ mips_breakpoint_from_pc (CORE_ADDR * pcptr, int *lenptr) if (pc_is_mips16 (*pcptr)) { static unsigned char mips16_little_breakpoint[] = {0xa5, 0xe8}; - *pcptr = UNMAKE_MIPS16_ADDR (*pcptr); + *pcptr = unmake_mips16_addr (*pcptr); *lenptr = sizeof (mips16_little_breakpoint); return mips16_little_breakpoint; } @@ -6163,8 +6184,6 @@ mips_dump_tdep (struct gdbarch *current_gdbarch, struct ui_file *file) fprintf_unfiltered (file, "mips_dump_tdep: IN_SOLIB_RETURN_TRAMPOLINE # %s\n", XSTRING (IN_SOLIB_RETURN_TRAMPOLINE (PC, NAME))); - fprintf_unfiltered (file, - "mips_dump_tdep: IS_MIPS16_ADDR = FIXME!\n"); fprintf_unfiltered (file, "mips_dump_tdep: LAST_EMBED_REGNUM = %d\n", LAST_EMBED_REGNUM); @@ -6186,8 +6205,6 @@ mips_dump_tdep (struct gdbarch *current_gdbarch, struct ui_file *file) "mips_dump_tdep: MACHINE_CPROC_SP_OFFSET = %d\n", MACHINE_CPROC_SP_OFFSET); #endif - fprintf_unfiltered (file, - "mips_dump_tdep: MAKE_MIPS16_ADDR = FIXME!\n"); fprintf_unfiltered (file, "mips_dump_tdep: MIPS16_INSTLEN = %d\n", MIPS16_INSTLEN); @@ -6334,11 +6351,6 @@ mips_dump_tdep (struct gdbarch *current_gdbarch, struct ui_file *file) fprintf_unfiltered (file, "mips_dump_tdep: TARGET_HAS_HARDWARE_WATCHPOINTS # %s\n", XSTRING (TARGET_HAS_HARDWARE_WATCHPOINTS)); - fprintf_unfiltered (file, - "mips_dump_tdep: TARGET_MIPS = used?\n"); - fprintf_unfiltered (file, - "mips_dump_tdep: TM_PRINT_INSN_MACH # %s\n", - XSTRING (TM_PRINT_INSN_MACH)); #ifdef TRACE_CLEAR fprintf_unfiltered (file, "mips_dump_tdep: TRACE_CLEAR # %s\n", @@ -6359,8 +6371,6 @@ mips_dump_tdep (struct gdbarch *current_gdbarch, struct ui_file *file) "mips_dump_tdep: TRACE_SET # %s\n", XSTRING (TRACE_SET (X,STATE))); #endif - fprintf_unfiltered (file, - "mips_dump_tdep: UNMAKE_MIPS16_ADDR = function?\n"); #ifdef UNUSED_REGNUM fprintf_unfiltered (file, "mips_dump_tdep: UNUSED_REGNUM = %d\n", -- 2.30.2