From 34e8f22dedd07c590a17569cb64d928f21433560 Mon Sep 17 00:00:00 2001 From: Richard Earnshaw Date: Mon, 11 Feb 2002 18:34:12 +0000 Subject: * arm-tdep.h: New file. * arm-tdep.c: Include arm-tdep.h. (arm_addr_bits_remove, arm_smash_text_address, arm_saved_pc_after_call) (arm_skip_prologue, arm_call_dummy_words, arm_fix_call_dummy) (arm_print_float_info, arm_register_type, convert_to_extended) (arm_elf_make_msymbols_special, arm_coff_make_msymbol_special) (arm_extract_return_value, arm_register_name): Make static. (arm_software_single_step): Similarly. Fix types in declaration. (arm_register_byte, arm_register_raw_size, arm_register_virtual_size) (arm_store_return_value, arm_store_struct_return): New functions. (arm_gdbarch_init): Register the above functions. Also register call_dummy_start_offset, sizeof_call_dummy_words, function_start_offset, inner_than, decr_pc_after_break, fp_regnum, sp_regnum, pc_regnum, register_bytes, num_regs, max_register_raw_size, max_register_virtual_size, register_size. Set up prologue_cache.saved_regs here, rather than ... (_initialize_arm_tdep): ... here. * config/arm/tm-arm.h (struct type, struct value): Delete forward declarations. (arm_addr_bits_remove, arm_smash_text_address, arm_saved_pc_after_call) (arm_skip_prologue, arm_call_dummy_words, arm_fix_call_dummy) (arm_print_float_info, arm_register_type, convert_to_extended) (arm_elf_make_msymbols_special, arm_coff_make_msymbol_special) (arm_extract_return_value, arm_register_name): Delete declarations. (SMASH_TEXT_ADDRESS, ADDR_BITS_REMOVE, FUNCTION_START_OFFSET) (SKIP_PROLOGUE, SAVED_PC_AFTER_CALL, INNER_THAN, BREAKPOINT_FROM_PC) (DECR_PC_AFTER_BREAK, PRINT_FLOAT_INFO, REGISTER_SIZE, NUM_REGS) (REGISTER_NAME, REGISTER_BYTES, REGISTER_BYTE, REGISTER_RAW_SIZE) (REGISTER_VIRTUAL_SIZE, MAX_REGISTER_RAW_SIZE) (MAX_REGISTER_VIRTUAL_SIZE, REGISTER_VIRTUAL_TYPE, STORE_STRUCT_RETURN) (EXTRACT_RETURN_VALUE, STORE_RETURN_VALUE, CALL_DUMMY_WORDS) (SIZEOF_CALL_DUMMY_WORDS, CALL_DUMMY_START_OFFSET, FIX_CALL_DUMMY) (SOFTWARE_SINGLE_STEP_P, SOFTWARE_SINGLE_STEP) (ELF_MAKE_MSYMBOL_SPECIAL, COFF_MAKE_MSYMBOL_SPECIAL) Delete. (arm_pc_is_thumb, arm_pc_is_thumb_dummy, thumb_get_next_pc) (arm_get_next_pc): No-longer static -- these are needed by the RDI interface. * arm-linux-nat.c arm-linux-tdep.c armnbsd-nat.c: Include arm-tdep.h. * remote-rdi.c remote-rdp.c: Likewise. * Makefile.in (arm-linux-nat.o, arm-linux-tdep.o arm-tdep.o) (armnbsd-nat.o, remote-rdi.o, remote_rdp.o): Update dependencies. * config/arm/tm-nbsd.h (SOFTWARE_SINGLE_STEP_P): Delete bogus definition. * arm-tdep.h (ARM_A1_REGNUM, ARM_A4_REGNUM, ARM_AP_REGNUM) (ARM_SP_REGNUM, ARM_LR_REGNUM, ARM_PC_REGNUM, ARM_F0_REGNUM) (ARM_F3_REGNUM, ARM_F7_REGNUM, ARM_FPS_REGNUM, ARM_PS_REGNUM): Renamed from non-ARM_ prefixed definitions. * arm-tdep.c armnbsd-nat.c arm-linux-nat.c arm-linux-tdep.c: Update all uses of above. * remote-rdi.c remote-rdp.c: Likewise. * arm-linux-nat.c (ARM_CPSR_REGNUM): Renamed from CPSR_REGNUM. --- gdb/config/arm/tm-arm.h | 257 +---------------------------------------------- gdb/config/arm/tm-nbsd.h | 3 - 2 files changed, 1 insertion(+), 259 deletions(-) (limited to 'gdb/config/arm') diff --git a/gdb/config/arm/tm-arm.h b/gdb/config/arm/tm-arm.h index 7067f0c..bd8f8f7 100644 --- a/gdb/config/arm/tm-arm.h +++ b/gdb/config/arm/tm-arm.h @@ -29,42 +29,11 @@ #include "regcache.h" #include "floatformat.h" -/* Forward declarations for prototypes. */ -struct type; -struct value; - /* IEEE format floating point. */ #define TARGET_DOUBLE_FORMAT (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG \ ? &floatformat_ieee_double_big \ : &floatformat_ieee_double_littlebyte_bigword) -CORE_ADDR arm_smash_text_address(CORE_ADDR); -#define SMASH_TEXT_ADDRESS(ADDR) arm_smash_text_address (ADDR) - -CORE_ADDR arm_addr_bits_remove (CORE_ADDR); -#define ADDR_BITS_REMOVE(VAL) arm_addr_bits_remove (VAL) - -/* Offset from address of function to start of its code. Zero on most - machines. */ - -#define FUNCTION_START_OFFSET 0 - -/* Advance PC across any function entry prologue instructions to reach - some "real" code. */ - -extern CORE_ADDR arm_skip_prologue (CORE_ADDR pc); - -#define SKIP_PROLOGUE(pc) (arm_skip_prologue (pc)) - -/* Immediately after a function call, return the saved pc. Can't - always go through the frames for this because on some machines the - new frame is not set up until the new function executes some - instructions. */ - -#define SAVED_PC_AFTER_CALL(frame) arm_saved_pc_after_call (frame) -struct frame_info; -extern CORE_ADDR arm_saved_pc_after_call (struct frame_info *); - /* The following define instruction sequences that will cause ARM cpu's to take an undefined instruction trap. These are used to signal a breakpoint to GDB. @@ -100,201 +69,11 @@ extern CORE_ADDR arm_saved_pc_after_call (struct frame_info *); #define THUMB_LE_BREAKPOINT {0xfe,0xdf} #define THUMB_BE_BREAKPOINT {0xdf,0xfe} -/* Stack grows downward. */ - -#define INNER_THAN(lhs,rhs) ((lhs) < (rhs)) - -/* !!!! if we're using RDP, then we're inserting breakpoints and - storing their handles instread of what was in memory. It is nice - that this is the same size as a handle - otherwise remote-rdp will - have to change. */ - -/* BREAKPOINT_FROM_PC uses the program counter value to determine - whether a 16- or 32-bit breakpoint should be used. It returns a - pointer to a string of bytes that encode a breakpoint instruction, - stores the length of the string to *lenptr, and adjusts the pc (if - necessary) to point to the actual memory location where the - breakpoint should be inserted. */ - -extern breakpoint_from_pc_fn arm_breakpoint_from_pc; -#define BREAKPOINT_FROM_PC(pcptr, lenptr) arm_breakpoint_from_pc (pcptr, lenptr) - -/* Amount PC must be decremented by after a breakpoint. This is often - the number of bytes in BREAKPOINT but not always. */ - -#define DECR_PC_AFTER_BREAK 0 - -void arm_print_float_info (void); -#define PRINT_FLOAT_INFO() arm_print_float_info () - -/* 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 REGISTER_SIZE 4 - -/* Say how long FP registers are. Used for documentation purposes and - code readability in this header. IEEE extended doubles are 80 - bits. DWORD aligned they use 96 bits. */ -#define FP_REGISTER_RAW_SIZE 12 - -/* GCC doesn't support long doubles (extended IEEE values). The FP - register virtual size is therefore 64 bits. Used for documentation - purposes and code readability in this header. */ -#define FP_REGISTER_VIRTUAL_SIZE 8 - -/* Status registers are the same size as general purpose registers. - Used for documentation purposes and code readability in this - header. */ -#define STATUS_REGISTER_SIZE REGISTER_SIZE - -/* Number of machine registers. The only define actually required - is NUM_REGS. The other definitions are used for documentation - purposes and code readability. */ -/* For 26 bit ARM code, a fake copy of the PC is placed in register 25 (PS) - (and called PS for processor status) so the status bits can be cleared - from the PC (register 15). For 32 bit ARM code, a copy of CPSR is placed - in PS. */ -#define NUM_FREGS 8 /* Number of floating point registers. */ -#define NUM_SREGS 2 /* Number of status registers. */ -#define NUM_GREGS 16 /* Number of general purpose registers. */ -#define NUM_REGS (NUM_GREGS + NUM_FREGS + NUM_SREGS) - -/* An array of names of registers. */ -extern char **arm_register_names; - -#define REGISTER_NAME(i) arm_register_name(i) -char *arm_register_name (int); - -/* Register numbers of various important registers. Note that some of - these values are "real" register numbers, and correspond to the - general registers of the machine, and some are "phony" register - numbers which are too large 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 A1_REGNUM 0 /* first integer-like argument */ -#define A4_REGNUM 3 /* last integer-like argument */ -#define AP_REGNUM 11 -#define FP_REGNUM 11 /* Contains address of executing stack frame */ -#define SP_REGNUM 13 /* Contains address of top of stack */ -#define LR_REGNUM 14 /* address to return to from a function call */ -#define PC_REGNUM 15 /* Contains program counter */ -#define F0_REGNUM 16 /* first floating point register */ -#define F3_REGNUM 19 /* last floating point argument register */ -#define F7_REGNUM 23 /* last floating point register */ -#define FPS_REGNUM 24 /* floating point status register */ -#define PS_REGNUM 25 /* Contains processor status */ - -#define THUMB_FP_REGNUM 7 /* R7 is frame register on Thumb */ - -#define ARM_NUM_ARG_REGS 4 -#define ARM_LAST_ARG_REGNUM A4_REGNUM -#define ARM_NUM_FP_ARG_REGS 4 -#define ARM_LAST_FP_ARG_REGNUM F3_REGNUM - -/* Instruction condition field values. */ -#define INST_EQ 0x0 -#define INST_NE 0x1 -#define INST_CS 0x2 -#define INST_CC 0x3 -#define INST_MI 0x4 -#define INST_PL 0x5 -#define INST_VS 0x6 -#define INST_VC 0x7 -#define INST_HI 0x8 -#define INST_LS 0x9 -#define INST_GE 0xa -#define INST_LT 0xb -#define INST_GT 0xc -#define INST_LE 0xd -#define INST_AL 0xe -#define INST_NV 0xf - -#define FLAG_N 0x80000000 -#define FLAG_Z 0x40000000 -#define FLAG_C 0x20000000 -#define FLAG_V 0x10000000 - - - -/* Total amount of space needed to store our copies of the machine's - register state, the array `registers'. */ - -#define REGISTER_BYTES ((NUM_GREGS * REGISTER_SIZE) + \ - (NUM_FREGS * FP_REGISTER_RAW_SIZE) + \ - (NUM_SREGS * STATUS_REGISTER_SIZE)) - -/* Index within `registers' of the first byte of the space for - register N. */ - -#define REGISTER_BYTE(N) \ - ((N) < F0_REGNUM \ - ? (N) * REGISTER_SIZE \ - : ((N) < PS_REGNUM \ - ? (NUM_GREGS * REGISTER_SIZE + \ - ((N) - F0_REGNUM) * FP_REGISTER_RAW_SIZE) \ - : (NUM_GREGS * REGISTER_SIZE + \ - NUM_FREGS * FP_REGISTER_RAW_SIZE + \ - ((N) - FPS_REGNUM) * STATUS_REGISTER_SIZE))) - -/* Number of bytes of storage in the actual machine representation for - register N. All registers are 4 bytes, except fp0 - fp7, which are - 12 bytes in length. */ -#define REGISTER_RAW_SIZE(N) \ - ((N) < F0_REGNUM ? REGISTER_SIZE : \ - (N) < FPS_REGNUM ? FP_REGISTER_RAW_SIZE : STATUS_REGISTER_SIZE) - -/* Number of bytes of storage in a program's representation - for register N. */ -#define REGISTER_VIRTUAL_SIZE(N) \ - ((N) < F0_REGNUM ? REGISTER_SIZE : \ - (N) < FPS_REGNUM ? FP_REGISTER_VIRTUAL_SIZE : STATUS_REGISTER_SIZE) - -/* Largest value REGISTER_RAW_SIZE can have. */ - -#define MAX_REGISTER_RAW_SIZE FP_REGISTER_RAW_SIZE - -/* Largest value REGISTER_VIRTUAL_SIZE can have. */ -#define MAX_REGISTER_VIRTUAL_SIZE FP_REGISTER_VIRTUAL_SIZE - -/* Return the GDB type object for the "standard" data type of data in - register N. */ - -extern struct type *arm_register_type (int regnum); -#define REGISTER_VIRTUAL_TYPE(N) arm_register_type (N) - /* The system C compiler uses a similar structure return convention to gcc */ extern use_struct_convention_fn arm_use_struct_convention; #define USE_STRUCT_CONVENTION(gcc_p, type) \ arm_use_struct_convention (gcc_p, type) -/* Store the address of the place in which to copy the structure the - subroutine will return. This is called from call_function. */ - -#define STORE_STRUCT_RETURN(ADDR, SP) \ - write_register (A1_REGNUM, (ADDR)) - -/* Extract from an array REGBUF containing the (raw) register state a - function return value of type TYPE, and copy that, in virtual - format, into VALBUF. */ - -extern void arm_extract_return_value (struct type *, char[], char *); -#define EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \ - arm_extract_return_value ((TYPE), (REGBUF), (VALBUF)) - -/* Write into appropriate registers a function return value of type - TYPE, given in virtual format. */ - -extern void convert_to_extended (void *dbl, void *ptr); -#define STORE_RETURN_VALUE(TYPE,VALBUF) \ - if (TYPE_CODE (TYPE) == TYPE_CODE_FLT) { \ - char _buf[MAX_REGISTER_RAW_SIZE]; \ - convert_to_extended (VALBUF, _buf); \ - write_register_bytes (REGISTER_BYTE (F0_REGNUM), _buf, MAX_REGISTER_RAW_SIZE); \ - } else \ - write_register_bytes (0, VALBUF, TYPE_LENGTH (TYPE)) - /* 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). */ @@ -307,44 +86,10 @@ extern void convert_to_extended (void *dbl, void *ptr); before in the executables list of symbols. */ #define VARIABLES_INSIDE_BLOCK(desc, gcc_p) (!(gcc_p)) -#define CALL_DUMMY_WORDS arm_call_dummy_words -extern LONGEST arm_call_dummy_words[]; - -#define SIZEOF_CALL_DUMMY_WORDS (3 * sizeof (LONGEST)) - -#define CALL_DUMMY_START_OFFSET 0 /* Start execution at beginning of dummy */ - +/* XXX This is NOT multi-arch compatible. */ #define CALL_DUMMY_BREAKPOINT_OFFSET arm_call_dummy_breakpoint_offset() extern int arm_call_dummy_breakpoint_offset (void); -/* Insert the specified number of args and function address into a - call sequence of the above form stored at DUMMYNAME. */ - -#define FIX_CALL_DUMMY(dummyname, pc, fun, nargs, args, type, gcc_p) \ - arm_fix_call_dummy ((dummyname), (pc), (fun), (nargs), (args), (type), (gcc_p)) - -void arm_fix_call_dummy (char *dummy, CORE_ADDR pc, CORE_ADDR fun, - int nargs, struct value ** args, - struct type * type, int gcc_p); - -/* Most ARMs don't have single stepping capability, so provide a - single-stepping mechanism by default */ -#undef SOFTWARE_SINGLE_STEP_P -#define SOFTWARE_SINGLE_STEP_P() 1 - -#define SOFTWARE_SINGLE_STEP(sig,bpt) arm_software_single_step((sig), (bpt)) -void arm_software_single_step (int, int); - -struct minimal_symbol; - -void arm_elf_make_msymbol_special(asymbol *, struct minimal_symbol *); -#define ELF_MAKE_MSYMBOL_SPECIAL(SYM,MSYM) \ - arm_elf_make_msymbol_special (SYM, MSYM) - -void arm_coff_make_msymbol_special(int, struct minimal_symbol *); -#define COFF_MAKE_MSYMBOL_SPECIAL(VAL,MSYM) \ - arm_coff_make_msymbol_special (VAL, MSYM) - /* The first 0x20 bytes are the trap vectors. */ #define LOWEST_PC 0x20 diff --git a/gdb/config/arm/tm-nbsd.h b/gdb/config/arm/tm-nbsd.h index cd52013..0eedfe2 100644 --- a/gdb/config/arm/tm-nbsd.h +++ b/gdb/config/arm/tm-nbsd.h @@ -21,9 +21,6 @@ #ifndef TM_NBSD_H #define TM_NBSD_H -/* NetBSD doesn't have single stepping support in ptrace(). */ -#define SOFTWARE_SINGLE_STEP_P 1 - #include "arm/tm-arm.h" #include "tm-nbsd.h" -- cgit v1.1