From 5ddf5b7810bc794c584ca9f326c53a04b8f2c59b Mon Sep 17 00:00:00 2001 From: thorpej Date: Sat, 19 Jan 2002 20:22:27 +0000 Subject: [PATCH] * alpha-tdep.c (alpha_register_virtual_type): New function. (alpha_init_frame_pc_first): Ditto. (alpha_fix_call_dummy): Ditto. (alpha_store_struct_return): Ditto. (alpha_extract_struct_value_address): Ditto. * config/alpha/tm-alpha.h (REGISTER_VIRTUAL_TYPE): Use alpha_register_virtual_type. (STORE_STRUCT_RETURN): Use alpha_store_struct_return. (EXTRACT_STRUCT_VALUE_ADDRESS): Use alpha_extract_struct_value_address. (FIX_CALL_DUMMY): Use alpha_fix_call_dummy. (INIT_FRAME_PC): Use init_frame_pc_noop. (INIT_FRAME_PC_FIRST): Use alpha_init_frame_pc_first. --- gdb/ChangeLog | 16 ++++++++++++++++ gdb/alpha-tdep.c | 40 ++++++++++++++++++++++++++++++++++++++++ gdb/config/alpha/tm-alpha.h | 32 +++++++++++++++----------------- 3 files changed, 71 insertions(+), 17 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 1ce0b5a619..761b577d92 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,19 @@ +2002-01-19 Jason Thorpe + + * alpha-tdep.c (alpha_register_virtual_type): New function. + (alpha_init_frame_pc_first): Ditto. + (alpha_fix_call_dummy): Ditto. + (alpha_store_struct_return): Ditto. + (alpha_extract_struct_value_address): Ditto. + * config/alpha/tm-alpha.h (REGISTER_VIRTUAL_TYPE): Use + alpha_register_virtual_type. + (STORE_STRUCT_RETURN): Use alpha_store_struct_return. + (EXTRACT_STRUCT_VALUE_ADDRESS): Use + alpha_extract_struct_value_address. + (FIX_CALL_DUMMY): Use alpha_fix_call_dummy. + (INIT_FRAME_PC): Use init_frame_pc_noop. + (INIT_FRAME_PC_FIRST): Use alpha_init_frame_pc_first. + 2002-01-19 Mark Kettenis * i386gnu-nat.c: Include "i386-tdep.h". diff --git a/gdb/alpha-tdep.c b/gdb/alpha-tdep.c index 6345279381..a717e101e6 100644 --- a/gdb/alpha-tdep.c +++ b/gdb/alpha-tdep.c @@ -315,6 +315,13 @@ alpha_register_convertible (int regno) { return (regno >= FP0_REGNUM && regno <= FP0_REGNUM + 31); } + +struct type * +alpha_register_virtual_type (int regno) +{ + return ((regno >= FP0_REGNUM && regno < (FP0_REGNUM+31)) + ? builtin_type_double : builtin_type_long); +} /* Guaranteed to set frame->saved_regs to some values (it never leaves it @@ -416,6 +423,13 @@ alpha_frame_init_saved_regs (struct frame_info *fi) fi->saved_regs[SP_REGNUM] = fi->frame; } +void +alpha_init_frame_pc_first (int fromleaf, struct frame_info *prev) +{ + prev->pc = (fromleaf ? SAVED_PC_AFTER_CALL (prev->next) : + prev->next ? FRAME_SAVED_PC (prev->next) : read_pc ()); +} + static CORE_ADDR read_next_frame_reg (struct frame_info *fi, int regno) { @@ -1479,6 +1493,18 @@ alpha_call_dummy_address (void) return SYMBOL_VALUE_ADDRESS (sym) + 4; } +void +alpha_fix_call_dummy (char *dummy, CORE_ADDR pc, CORE_ADDR fun, int nargs, + struct value **args, struct type *type, int gcc_p) +{ + CORE_ADDR bp_address = CALL_DUMMY_ADDRESS (); + + if (bp_address == 0) + error ("no place to put call"); + write_register (RA_REGNUM, bp_address); + write_register (T12_REGNUM, fun); +} + int alpha_use_struct_convention (int gcc_p, struct type *type) { @@ -1486,6 +1512,20 @@ alpha_use_struct_convention (int gcc_p, struct type *type) return 1; } +void +alpha_store_struct_return (CORE_ADDR addr, CORE_ADDR sp) +{ + /* Store the address of the place in which to copy the structure the + subroutine will return. Handled by alpha_push_arguments. */ +} + +CORE_ADDR +alpha_extract_struct_value_address (char *regbuf) +{ + return (extract_address (regbuf + REGISTER_BYTE (V0_REGNUM), + REGISTER_RAW_SIZE (V0_REGNUM))); +} + /* alpha_software_single_step() is called just before we want to resume the inferior, if we want to single-step it but there is no hardware or kernel single-step support (NetBSD on Alpha, for example). We find diff --git a/gdb/config/alpha/tm-alpha.h b/gdb/config/alpha/tm-alpha.h index 5c536222cc..84ba3b489f 100644 --- a/gdb/config/alpha/tm-alpha.h +++ b/gdb/config/alpha/tm-alpha.h @@ -195,14 +195,15 @@ alpha_register_convert_to_raw (struct type *, int, char *, char *); /* Return the GDB type object for the "standard" data type of data in register N. */ -#define REGISTER_VIRTUAL_TYPE(N) \ - (((N) >= FP0_REGNUM && (N) < FP0_REGNUM+31) \ - ? builtin_type_double : builtin_type_long) \ +#define REGISTER_VIRTUAL_TYPE(N) alpha_register_virtual_type ((N)) +extern struct type * alpha_register_virtual_type (int); /* Store the address of the place in which to copy the structure the subroutine will return. Handled by alpha_push_arguments. */ -#define STORE_STRUCT_RETURN(addr, sp) +#define STORE_STRUCT_RETURN(addr, sp) \ + alpha_store_struct_return ((addr), (sp)) +extern void alpha_store_struct_return (CORE_ADDR, CORE_ADDR); /**/ /* Extract from an array REGBUF containing the (raw) register state @@ -229,8 +230,8 @@ extern void alpha_store_return_value (struct type *, char *); on it. */ #define EXTRACT_STRUCT_VALUE_ADDRESS(REGBUF) \ - (extract_address (REGBUF + REGISTER_BYTE (V0_REGNUM), \ - REGISTER_RAW_SIZE (V0_REGNUM))) + alpha_extract_struct_value_address (REGBUF) +extern CORE_ADDR alpha_extract_struct_value_address (char *); /* Structures are returned by ref in extra arg0 */ #define USE_STRUCT_CONVENTION(gcc_p, type) \ @@ -346,23 +347,20 @@ extern CORE_ADDR alpha_call_dummy_address (void); We only have to set RA_REGNUM to the dummy breakpoint address and T12_REGNUM (the `procedure value register') to the function address. */ -#define FIX_CALL_DUMMY(dummyname, pc, fun, nargs, args, type, gcc_p) \ -{ \ - CORE_ADDR bp_address = CALL_DUMMY_ADDRESS (); \ - if (bp_address == 0) \ - error ("no place to put call"); \ - write_register (RA_REGNUM, bp_address); \ - write_register (T12_REGNUM, fun); \ -} +#define FIX_CALL_DUMMY(dummyname, pc, fun, nargs, args, type, gcc_p) \ + alpha_fix_call_dummy ((dummyname), (pc), (fun), (nargs), (args), \ + (type), (gcc_p)) +extern void alpha_fix_call_dummy (char *, CORE_ADDR, CORE_ADDR, int, + struct value **, struct type *, int); /* There's a mess in stack frame creation. See comments in blockframe.c near reference to INIT_FRAME_PC_FIRST. */ -#define INIT_FRAME_PC(fromleaf, prev) /* nada */ +#define INIT_FRAME_PC(fromleaf, prev) init_frame_pc_noop ((fromleaf), (prev)) #define INIT_FRAME_PC_FIRST(fromleaf, prev) \ - (prev)->pc = ((fromleaf) ? SAVED_PC_AFTER_CALL ((prev)->next) : \ - (prev)->next ? FRAME_SAVED_PC ((prev)->next) : read_pc ()); + alpha_init_frame_pc_first ((fromleaf), (prev)) +extern void alpha_init_frame_pc_first (int, struct frame_info *); /* Special symbol found in blocks associated with routines. We can hang alpha_extra_func_info_t's off of this. */ -- 2.11.0