diff options
author | Joel Brobecker <brobecker@gnat.com> | 2002-12-26 20:10:13 +0000 |
---|---|---|
committer | Joel Brobecker <brobecker@gnat.com> | 2002-12-26 20:10:13 +0000 |
commit | 60383d105dfd53cf5dc18cdb2f161aee974b40d8 (patch) | |
tree | 9f51cea6eca07f9cf25669f77c91700dec7a063a /gdb/config | |
parent | 60e1ff2716f2ef348d75b0d9b1dc2cb9206469f8 (diff) | |
download | gdb-60383d105dfd53cf5dc18cdb2f161aee974b40d8.zip gdb-60383d105dfd53cf5dc18cdb2f161aee974b40d8.tar.gz gdb-60383d105dfd53cf5dc18cdb2f161aee974b40d8.tar.bz2 |
Continuing work to convert the hppa targets to multiarch partil.
* hppa-tdep.c: Add some missing forward declarations.
(frameless_function_invocation): Prefix the function name
by "hppa_" to avoid polluting the namespace. Update all calls
to use the new function name.
(saved_pc_after_call): Ditto.
(init_extra_frame_info): Ditto.
(frame_chain): Ditto.
(push_dummy_frame): Ditto.
(target_read_pc): Ditto.
(target_write_pc): Ditto.
(in_solib_call_trampoline): Ditto.
(in_solib_return_trampoline): Ditto.
(skip_trampoline_code): Ditto.
(hppa_read_fp): New function, renamed from target_read_fp.
(hppa_target_read_fp): New function, using hppa_read_fp.
This function conforms to the function profile for the
READ_FP gdbarch method.
(hppa_extract_struct_value_address): New function, extracted
from the definition of the DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS
macro.
(hppa_frame_num_args): New function.
(hppa_gdbarch_init): Setup the gdbarch vector for the hppa target.
* config/pa/tm-hppa.h: Wrap around all gdbarch-eligible macros
inside "#if !GDB_MULTI_ARCH ... #endif" conditional, in preparation
for the switch to multiarch partial.
Update some of the macros definitions to match some changes
described above in the name of the function they are calling.
(PUSH_DUMMY_FRAME): Add a FIXME explaining why this macro will
not be straightforward to convert. Do now wrap it inside
"#if !... #endif" to remember that this macro has still not
been taken care of.
(FIX_CALL_DUMMY): Likewise.
Diffstat (limited to 'gdb/config')
-rw-r--r-- | gdb/config/pa/tm-hppa.h | 183 |
1 files changed, 141 insertions, 42 deletions
diff --git a/gdb/config/pa/tm-hppa.h b/gdb/config/pa/tm-hppa.h index baed537..713931a 100644 --- a/gdb/config/pa/tm-hppa.h +++ b/gdb/config/pa/tm-hppa.h @@ -58,47 +58,67 @@ struct inferior_status; ((X) >> (31 - (TO)) & ((1 << ((TO) - (FROM) + 1)) - 1)) #endif +#if !GDB_MULTI_ARCH extern int hppa_reg_struct_has_addr (int gcc_p, struct type *type); #define REG_STRUCT_HAS_ADDR(gcc_p,type) hppa_reg_struct_has_addr (gcc_p,type) +#endif /* Offset from address of function to start of its code. Zero on most machines. */ +#if !GDB_MULTI_ARCH #define FUNCTION_START_OFFSET 0 +#endif /* Advance PC across any function entry prologue instructions to reach some "real" code. */ +#if !GDB_MULTI_ARCH extern CORE_ADDR hppa_skip_prologue (CORE_ADDR); #define SKIP_PROLOGUE(pc) (hppa_skip_prologue (pc)) +#endif /* If PC is in some function-call trampoline code, return the PC where the function itself actually starts. If not, return NULL. */ -#define SKIP_TRAMPOLINE_CODE(pc) skip_trampoline_code (pc, NULL) -extern CORE_ADDR skip_trampoline_code (CORE_ADDR, char *); +#if !GDB_MULTI_ARCH +#define SKIP_TRAMPOLINE_CODE(pc) hppa_skip_trampoline_code (pc) +extern CORE_ADDR hppa_skip_trampoline_code (CORE_ADDR); +#endif /* Return non-zero if we are in an appropriate trampoline. */ +#if !GDB_MULTI_ARCH #define IN_SOLIB_CALL_TRAMPOLINE(pc, name) \ - in_solib_call_trampoline (pc, name) -extern int in_solib_call_trampoline (CORE_ADDR, char *); + hppa_in_solib_call_trampoline (pc, name) +extern int hppa_in_solib_call_trampoline (CORE_ADDR, char *); +#endif +#if !GDB_MULTI_ARCH #define IN_SOLIB_RETURN_TRAMPOLINE(pc, name) \ - in_solib_return_trampoline (pc, name) -extern int in_solib_return_trampoline (CORE_ADDR, char *); + hppa_in_solib_return_trampoline (pc, name) +extern int hppa_in_solib_return_trampoline (CORE_ADDR, char *); +#endif +#if !GDB_MULTI_ARCH #undef SAVED_PC_AFTER_CALL -#define SAVED_PC_AFTER_CALL(frame) saved_pc_after_call (frame) -extern CORE_ADDR saved_pc_after_call (struct frame_info *); +#define SAVED_PC_AFTER_CALL(frame) hppa_saved_pc_after_call (frame) +extern CORE_ADDR hppa_saved_pc_after_call (struct frame_info *); +#endif +#if !GDB_MULTI_ARCH extern int hppa_inner_than (CORE_ADDR lhs, CORE_ADDR rhs); #define INNER_THAN(lhs,rhs) hppa_inner_than(lhs,rhs) +#endif +#if !GDB_MULTI_ARCH extern CORE_ADDR hppa_stack_align (CORE_ADDR sp); #define STACK_ALIGN(sp) hppa_stack_align (sp) +#endif +#if !GDB_MULTI_ARCH #define EXTRA_STACK_ALIGNMENT_NEEDED 0 +#endif /* Sequence of bytes for breakpoint instruction. */ @@ -111,7 +131,9 @@ extern CORE_ADDR hppa_stack_align (CORE_ADDR sp); Not on the PA-RISC */ +#if !GDB_MULTI_ARCH #define DECR_PC_AFTER_BREAK 0 +#endif extern int hppa_pc_requires_run_before_use (CORE_ADDR pc); #define PC_REQUIRES_RUN_BEFORE_USE(pc) hppa_pc_requires_run_before_use (pc) @@ -120,11 +142,15 @@ extern int hppa_pc_requires_run_before_use (CORE_ADDR pc); used in push_word and a few other places; REGISTER_RAW_SIZE is the real way to know how big a register is. */ +#if !GDB_MULTI_ARCH #define REGISTER_SIZE 4 +#endif /* Number of machine registers */ +#if !GDB_MULTI_ARCH #define NUM_REGS 128 +#endif /* Initializer for an array of names of registers. There should be NUM_REGS strings in this initializer. @@ -159,9 +185,13 @@ extern int hppa_pc_requires_run_before_use (CORE_ADDR pc); other r registers. */ #define FLAGS_REGNUM 0 /* Various status flags */ #define RP_REGNUM 2 /* return pointer */ +#if !GDB_MULTI_ARCH #define FP_REGNUM 3 /* Contains address of executing stack */ /* frame */ +#endif +#if !GDB_MULTI_ARCH #define SP_REGNUM 30 /* Contains address of top of stack */ +#endif #define SAR_REGNUM 32 /* Shift Amount Register */ #define IPSW_REGNUM 41 /* Interrupt Processor Status Word */ #define PCOQ_HEAD_REGNUM 33 /* instruction offset queue head */ @@ -176,7 +206,9 @@ extern int hppa_pc_requires_run_before_use (CORE_ADDR pc); #define CCR_REGNUM 54 /* Coprocessor Configuration Register */ #define TR0_REGNUM 57 /* Temporary Registers (cr24 -> cr31) */ #define CR27_REGNUM 60 /* Base register for thread-local storage, cr27 */ +#if !GDB_MULTI_ARCH #define FP0_REGNUM 64 /* floating point reg. 0 (fspr) */ +#endif #define FP4_REGNUM 72 #define ARG0_REGNUM 26 /* The first argument of a callee. */ @@ -185,8 +217,12 @@ extern int hppa_pc_requires_run_before_use (CORE_ADDR pc); #define ARG3_REGNUM 23 /* The fourth argument of a callee. */ /* compatibility with the rest of gdb. */ +#if !GDB_MULTI_ARCH #define PC_REGNUM PCOQ_HEAD_REGNUM +#endif +#if !GDB_MULTI_ARCH #define NPC_REGNUM PCOQ_TAIL_REGNUM +#endif /* * Processor Status Word Masks @@ -240,42 +276,60 @@ extern int hppa_instruction_nullified (void); for register N. On the PA-RISC, all regs are 4 bytes, including the FP registers (they're accessed as two 4 byte halves). */ +#if !GDB_MULTI_ARCH extern int hppa_register_raw_size (int reg_nr); #define REGISTER_RAW_SIZE(N) hppa_register_raw_size (N) +#endif /* Total amount of space needed to store our copies of the machine's register state, the array `registers'. */ +#if !GDB_MULTI_ARCH #define REGISTER_BYTES (NUM_REGS * 4) +#endif +#if !GDB_MULTI_ARCH extern int hppa_register_byte (int reg_nr); #define REGISTER_BYTE(N) hppa_register_byte (N) +#endif /* Number of bytes of storage in the program's representation for register N. */ +#if !GDB_MULTI_ARCH #define REGISTER_VIRTUAL_SIZE(N) REGISTER_RAW_SIZE(N) +#endif /* Largest value REGISTER_RAW_SIZE can have. */ +#if !GDB_MULTI_ARCH #define MAX_REGISTER_RAW_SIZE 4 +#endif /* Largest value REGISTER_VIRTUAL_SIZE can have. */ +#if !GDB_MULTI_ARCH #define MAX_REGISTER_VIRTUAL_SIZE 8 +#endif +#if !GDB_MULTI_ARCH extern struct type * hppa_register_virtual_type (int reg_nr); #define REGISTER_VIRTUAL_TYPE(N) hppa_register_virtual_type (N) +#endif +#if !GDB_MULTI_ARCH extern void hppa_store_struct_return (CORE_ADDR addr, CORE_ADDR sp); #define STORE_STRUCT_RETURN(ADDR, SP) hppa_store_struct_return (ADDR, SP) +#endif /* 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. */ +#if !GDB_MULTI_ARCH void hppa_extract_return_value (struct type *type, char *regbuf, char *valbuf); #define DEPRECATED_EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \ hppa_extract_return_value (TYPE, REGBUF, VALBUF); +#endif /* elz: decide whether the function returning a value of type type will put it on the stack or in the registers. @@ -288,23 +342,25 @@ void hppa_extract_return_value (struct type *type, char *regbuf, char *valbuf); sr1: space identifier (32-bit) stack: any lager than 64-bit, with the address in r28 */ +#if !GDB_MULTI_ARCH extern use_struct_convention_fn hppa_use_struct_convention; #define USE_STRUCT_CONVENTION(gcc_p,type) hppa_use_struct_convention (gcc_p,type) +#endif /* Write into appropriate registers a function return value of type TYPE, given in virtual format. */ - +#if !GDB_MULTI_ARCH extern void hppa_store_return_value (struct type *type, char *valbuf); #define DEPRECATED_STORE_RETURN_VALUE(TYPE,VALBUF) \ hppa_store_return_value (TYPE, VALBUF); +#endif -/* 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). */ - +#if !GDB_MULTI_ARCH +extern CORE_ADDR hppa_extract_struct_value_address (char *regbuf); #define DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS(REGBUF) \ - (*(int *)((REGBUF) + REGISTER_BYTE (28))) + hppa_extract_struct_value_address (REGBUF) +#endif /* elz: Return a large value, which is stored on the stack at addr. This is defined only for the hppa, at this moment. The above macro @@ -321,11 +377,15 @@ struct value *hppa_value_returned_from_stack (register struct type *valtype, #define VALUE_RETURNED_FROM_STACK(valtype,addr) \ hppa_value_returned_from_stack (valtype, addr) +#if !GDB_MULTI_ARCH extern int hppa_cannot_store_register (int regnum); #define CANNOT_STORE_REGISTER(regno) hppa_cannot_store_register (regno) +#endif -#define INIT_EXTRA_FRAME_INFO(fromleaf, frame) init_extra_frame_info (fromleaf, frame) -extern void init_extra_frame_info (int, struct frame_info *); +#if !GDB_MULTI_ARCH +#define INIT_EXTRA_FRAME_INFO(fromleaf, frame) hppa_init_extra_frame_info (fromleaf, frame) +extern void hppa_init_extra_frame_info (int, struct frame_info *); +#endif /* Describe the pointer in each stack frame to the previous stack frame (its caller). */ @@ -337,40 +397,50 @@ extern void init_extra_frame_info (int, struct frame_info *); is the address of a 4-byte word containing the calling frame's address (previous FP). */ -#define FRAME_CHAIN(thisframe) frame_chain (thisframe) -extern CORE_ADDR frame_chain (struct frame_info *); +#if !GDB_MULTI_ARCH +#define FRAME_CHAIN(thisframe) hppa_frame_chain (thisframe) +extern CORE_ADDR hppa_frame_chain (struct frame_info *); +#endif +#if !GDB_MULTI_ARCH extern int hppa_frame_chain_valid (CORE_ADDR, struct frame_info *); #define FRAME_CHAIN_VALID(chain, thisframe) hppa_frame_chain_valid (chain, thisframe) +#endif /* Define other aspects of the stack frame. */ /* A macro that tells us whether the function invocation represented by FI does not have a frame on the stack associated with it. If it does not, FRAMELESS is set to 1, else 0. */ +#if !GDB_MULTI_ARCH #define FRAMELESS_FUNCTION_INVOCATION(FI) \ - (frameless_function_invocation (FI)) -extern int frameless_function_invocation (struct frame_info *); + (hppa_frameless_function_invocation (FI)) +extern int hppa_frameless_function_invocation (struct frame_info *); +#endif +#if !GDB_MULTI_ARCH extern CORE_ADDR hppa_frame_saved_pc (struct frame_info *frame); #define FRAME_SAVED_PC(FRAME) hppa_frame_saved_pc (FRAME) +#endif +#if !GDB_MULTI_ARCH extern CORE_ADDR hppa_frame_args_address (struct frame_info *fi); #define FRAME_ARGS_ADDRESS(fi) hppa_frame_args_address (fi) +#endif +#if !GDB_MULTI_ARCH extern CORE_ADDR hppa_frame_locals_address (struct frame_info *fi); #define FRAME_LOCALS_ADDRESS(fi) hppa_frame_locals_address (fi) +#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. */ -#define FRAME_NUM_ARGS(fi) (-1) - -/* Return number of bytes at start of arglist that are not really args. */ +#if !GDB_MULTI_ARCH +extern int hppa_frame_num_args (struct frame_info *frame); +#define FRAME_NUM_ARGS(fi) hppa_frame_num_args (fi) +#endif +#if !GDB_MULTI_ARCH #define FRAME_ARGS_SKIP 0 +#endif #define FRAME_FIND_SAVED_REGS(frame_info, frame_saved_regs) \ hppa_frame_find_saved_regs (frame_info, &frame_saved_regs) @@ -382,13 +452,20 @@ hppa_frame_find_saved_regs (struct frame_info *, struct frame_saved_regs *); /* Push an empty stack frame, to record the current PC, etc. */ -#define PUSH_DUMMY_FRAME push_dummy_frame (inf_status) -extern void push_dummy_frame (struct inferior_status *); +/* FIXME: brobecker 2002-12-26. This macro definition takes advantage + of the fact that PUSH_DUMMY_FRAME is called within a function where + a variable inf_status of type struct inferior_status * is defined. + Ugh! Until this is fixed, we will not be able to move to multiarch + partial. */ +#define PUSH_DUMMY_FRAME hppa_push_dummy_frame (inf_status) +extern void hppa_push_dummy_frame (struct inferior_status *); /* Discard from the stack the innermost frame, restoring all saved registers. */ +#if !GDB_MULTI_ARCH #define POP_FRAME hppa_pop_frame () extern void hppa_pop_frame (void); +#endif #define INSTRUCTION_SIZE 4 @@ -475,11 +552,16 @@ extern void hppa_pop_frame (void); 0xe6c00002, 0xe4202000, 0x6bdf3fd1, 0x00010004,\ 0x00151820, 0xe6c00002, 0x08000240, 0x08000240} +#if !GDB_MULTI_ARCH #define CALL_DUMMY_LENGTH (INSTRUCTION_SIZE * 28) +#endif #define REG_PARM_STACK_SPACE 16 #else /* defined PA_LEVEL_0 */ +/* FIXME: brobecker 2002-12-26. PA_LEVEL_0 is only defined for the + hppa-pro target, which should be obsoleted soon. The following + section will therefore not be included in the multiarch conversion. */ /* This is the call dummy for a level 0 PA. Level 0's don't have space registers (or floating point?), so we skip all that inter-space call stuff, and avoid touching the fp regs. @@ -510,9 +592,11 @@ extern void hppa_pop_frame (void); #define CALL_DUMMY_LENGTH (INSTRUCTION_SIZE * 12) -#endif +#endif /* defined PA_LEVEL_0 */ +#if !GDB_MULTI_ARCH #define CALL_DUMMY_START_OFFSET 0 +#endif /* If we've reached a trap instruction within the call dummy, then we'll consider that to mean that we've reached the call dummy's @@ -531,23 +615,31 @@ extern void hppa_pop_frame (void); * inferior to do the function call. */ +/* FIXME: brobecker 2002-12-26. This macro is going to cause us some + problems before we can go to multiarch partial as it has been diverted + on HPUX to return the value of the PC! */ #define FIX_CALL_DUMMY hppa_fix_call_dummy +extern CORE_ADDR hppa_fix_call_dummy (char *, CORE_ADDR, CORE_ADDR, int, + struct value **, struct type *, int); -extern CORE_ADDR -hppa_fix_call_dummy (char *, CORE_ADDR, CORE_ADDR, int, - struct value **, struct type *, int); - +#if !GDB_MULTI_ARCH #define PUSH_ARGUMENTS(nargs, args, sp, struct_return, struct_addr) \ (hppa_push_arguments((nargs), (args), (sp), (struct_return), (struct_addr))) extern CORE_ADDR hppa_push_arguments (int, struct value **, CORE_ADDR, int, CORE_ADDR); +#endif + +#if !GDB_MULTI_ARCH extern CORE_ADDR hppa_smash_text_address (CORE_ADDR addr); #define SMASH_TEXT_ADDRESS(addr) hppa_smash_text_address (addr) +#endif #define GDB_TARGET_IS_HPPA +#if !GDB_MULTI_ARCH #define BELIEVE_PCC_PROMOTION 1 +#endif /* * Unwind table and descriptor. @@ -674,19 +766,24 @@ extern CORE_ADDR target_read_pc (int); extern CORE_ADDR skip_trampoline_code (CORE_ADDR, char *); #endif -#define TARGET_READ_PC(pid) target_read_pc (pid) -extern CORE_ADDR target_read_pc (ptid_t); +#if !GDB_MULTI_ARCH +#define TARGET_READ_PC(pid) hppa_target_read_pc (pid) +extern CORE_ADDR hppa_target_read_pc (ptid_t); +#endif -#define TARGET_WRITE_PC(v,pid) target_write_pc (v,pid) -extern void target_write_pc (CORE_ADDR, ptid_t); +#if !GDB_MULTI_ARCH +#define TARGET_WRITE_PC(v,pid) hppa_target_write_pc (v,pid) +extern void hppa_target_write_pc (CORE_ADDR, ptid_t); +#endif -#define TARGET_READ_FP() target_read_fp (PIDGET (inferior_ptid)) -extern CORE_ADDR target_read_fp (int); +#if !GDB_MULTI_ARCH +#define TARGET_READ_FP() hppa_target_read_fp () +extern CORE_ADDR hppa_target_read_fp (void); +#endif /* For a number of horrible reasons we may have to adjust the location of variables on the stack. Ugh. */ #define HPREAD_ADJUST_STACK_ADDRESS(ADDR) hpread_adjust_stack_address(ADDR) - extern int hpread_adjust_stack_address (CORE_ADDR); /* If the current gcc for for this target does not produce correct debugging @@ -694,10 +791,12 @@ extern int hpread_adjust_stack_address (CORE_ADDR); define this macro. This forces gdb to always assume that floats are passed as doubles and then converted in the callee. */ +#if !GDB_MULTI_ARCH extern int hppa_coerce_float_to_double (struct type *formal, struct type *actual); #define COERCE_FLOAT_TO_DOUBLE(formal, actual) \ hppa_coerce_float_to_double (formal, actual) +#endif /* Here's how to step off a permanent breakpoint. */ #define SKIP_PERMANENT_BREAKPOINT (hppa_skip_permanent_breakpoint) |