From 028c194b3fc140b50f2eb36a9b1e8c0f86a625bb Mon Sep 17 00:00:00 2001 From: Andrew Cagney Date: Sun, 10 Feb 2002 17:25:38 +0000 Subject: [PATCH] * gdbarch.sh: For for level one methods, disallow a definition when partially multi-arched. Add comments explaining rationale. * gdbarch.h: Re-generate. --- gdb/ChangeLog | 6 ++++++ gdb/gdbarch.h | 46 ++++++++++++++++++++++++++++++---------------- gdb/gdbarch.sh | 27 +++++++++++++++++++-------- 3 files changed, 55 insertions(+), 24 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 194cdc4ca6e..eb7b1569052 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,9 @@ +2002-02-10 Andrew Cagney + + * gdbarch.sh: For for level one methods, disallow a definition + when partially multi-arched. Add comments explaining rationale. + * gdbarch.h: Re-generate. + 2002-02-10 Andrew Cagney * gdbarch.sh (EXTRA_STACK_ALIGNMENT_NEEDED): Don't require when diff --git a/gdb/gdbarch.h b/gdb/gdbarch.h index 7a1fa804d44..90e9e6297cc 100644 --- a/gdb/gdbarch.h +++ b/gdb/gdbarch.h @@ -883,24 +883,32 @@ extern void set_gdbarch_cannot_store_register (struct gdbarch *gdbarch, gdbarch_ #endif #endif +/* Non multi-arch DUMMY_FRAMES are a mess (multi-arch ones are not that + much better but at least they are vaguely consistent). The headers + and body contain convoluted #if/#else sequences for determine how + things should be compiled. Instead of trying to mimic that + behaviour here (and hence entrench it further) gdbarch simply + reqires that these methods be set up from the word go. This also + avoids any potential problems with moving beyond multi-arch partial. */ + extern int gdbarch_use_generic_dummy_frames (struct gdbarch *gdbarch); extern void set_gdbarch_use_generic_dummy_frames (struct gdbarch *gdbarch, int use_generic_dummy_frames); -#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (USE_GENERIC_DUMMY_FRAMES) +#if (GDB_MULTI_ARCH >= GDB_MULTI_ARCH_PARTIAL) && defined (USE_GENERIC_DUMMY_FRAMES) #error "Non multi-arch definition of USE_GENERIC_DUMMY_FRAMES" #endif #if GDB_MULTI_ARCH -#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (USE_GENERIC_DUMMY_FRAMES) +#if (GDB_MULTI_ARCH >= GDB_MULTI_ARCH_PARTIAL) || !defined (USE_GENERIC_DUMMY_FRAMES) #define USE_GENERIC_DUMMY_FRAMES (gdbarch_use_generic_dummy_frames (current_gdbarch)) #endif #endif extern int gdbarch_call_dummy_location (struct gdbarch *gdbarch); extern void set_gdbarch_call_dummy_location (struct gdbarch *gdbarch, int call_dummy_location); -#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (CALL_DUMMY_LOCATION) +#if (GDB_MULTI_ARCH >= GDB_MULTI_ARCH_PARTIAL) && defined (CALL_DUMMY_LOCATION) #error "Non multi-arch definition of CALL_DUMMY_LOCATION" #endif #if GDB_MULTI_ARCH -#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (CALL_DUMMY_LOCATION) +#if (GDB_MULTI_ARCH >= GDB_MULTI_ARCH_PARTIAL) || !defined (CALL_DUMMY_LOCATION) #define CALL_DUMMY_LOCATION (gdbarch_call_dummy_location (current_gdbarch)) #endif #endif @@ -941,11 +949,11 @@ extern void set_gdbarch_call_dummy_breakpoint_offset (struct gdbarch *gdbarch, C extern int gdbarch_call_dummy_breakpoint_offset_p (struct gdbarch *gdbarch); extern void set_gdbarch_call_dummy_breakpoint_offset_p (struct gdbarch *gdbarch, int call_dummy_breakpoint_offset_p); -#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (CALL_DUMMY_BREAKPOINT_OFFSET_P) +#if (GDB_MULTI_ARCH >= GDB_MULTI_ARCH_PARTIAL) && defined (CALL_DUMMY_BREAKPOINT_OFFSET_P) #error "Non multi-arch definition of CALL_DUMMY_BREAKPOINT_OFFSET_P" #endif #if GDB_MULTI_ARCH -#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (CALL_DUMMY_BREAKPOINT_OFFSET_P) +#if (GDB_MULTI_ARCH >= GDB_MULTI_ARCH_PARTIAL) || !defined (CALL_DUMMY_BREAKPOINT_OFFSET_P) #define CALL_DUMMY_BREAKPOINT_OFFSET_P (gdbarch_call_dummy_breakpoint_offset_p (current_gdbarch)) #endif #endif @@ -964,22 +972,22 @@ extern void set_gdbarch_call_dummy_length (struct gdbarch *gdbarch, int call_dum typedef int (gdbarch_pc_in_call_dummy_ftype) (CORE_ADDR pc, CORE_ADDR sp, CORE_ADDR frame_address); extern int gdbarch_pc_in_call_dummy (struct gdbarch *gdbarch, CORE_ADDR pc, CORE_ADDR sp, CORE_ADDR frame_address); extern void set_gdbarch_pc_in_call_dummy (struct gdbarch *gdbarch, gdbarch_pc_in_call_dummy_ftype *pc_in_call_dummy); -#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (PC_IN_CALL_DUMMY) +#if (GDB_MULTI_ARCH >= GDB_MULTI_ARCH_PARTIAL) && defined (PC_IN_CALL_DUMMY) #error "Non multi-arch definition of PC_IN_CALL_DUMMY" #endif #if GDB_MULTI_ARCH -#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (PC_IN_CALL_DUMMY) +#if (GDB_MULTI_ARCH >= GDB_MULTI_ARCH_PARTIAL) || !defined (PC_IN_CALL_DUMMY) #define PC_IN_CALL_DUMMY(pc, sp, frame_address) (gdbarch_pc_in_call_dummy (current_gdbarch, pc, sp, frame_address)) #endif #endif extern int gdbarch_call_dummy_p (struct gdbarch *gdbarch); extern void set_gdbarch_call_dummy_p (struct gdbarch *gdbarch, int call_dummy_p); -#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (CALL_DUMMY_P) +#if (GDB_MULTI_ARCH >= GDB_MULTI_ARCH_PARTIAL) && defined (CALL_DUMMY_P) #error "Non multi-arch definition of CALL_DUMMY_P" #endif #if GDB_MULTI_ARCH -#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (CALL_DUMMY_P) +#if (GDB_MULTI_ARCH >= GDB_MULTI_ARCH_PARTIAL) || !defined (CALL_DUMMY_P) #define CALL_DUMMY_P (gdbarch_call_dummy_p (current_gdbarch)) #endif #endif @@ -1018,11 +1026,11 @@ extern void set_gdbarch_sizeof_call_dummy_words (struct gdbarch *gdbarch, int si extern int gdbarch_call_dummy_stack_adjust_p (struct gdbarch *gdbarch); extern void set_gdbarch_call_dummy_stack_adjust_p (struct gdbarch *gdbarch, int call_dummy_stack_adjust_p); -#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (CALL_DUMMY_STACK_ADJUST_P) +#if (GDB_MULTI_ARCH >= GDB_MULTI_ARCH_PARTIAL) && defined (CALL_DUMMY_STACK_ADJUST_P) #error "Non multi-arch definition of CALL_DUMMY_STACK_ADJUST_P" #endif #if GDB_MULTI_ARCH -#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (CALL_DUMMY_STACK_ADJUST_P) +#if (GDB_MULTI_ARCH >= GDB_MULTI_ARCH_PARTIAL) || !defined (CALL_DUMMY_STACK_ADJUST_P) #define CALL_DUMMY_STACK_ADJUST_P (gdbarch_call_dummy_stack_adjust_p (current_gdbarch)) #endif #endif @@ -1123,14 +1131,18 @@ extern void set_gdbarch_coerce_float_to_double (struct gdbarch *gdbarch, gdbarch #endif #endif +/* GET_SAVED_REGISTER is like DUMMY_FRAMES. It is at level one as the + old code has strange #ifdef interaction. So far no one has found + that default_get_saved_register() is the default they are after. */ + typedef void (gdbarch_get_saved_register_ftype) (char *raw_buffer, int *optimized, CORE_ADDR *addrp, struct frame_info *frame, int regnum, enum lval_type *lval); extern void gdbarch_get_saved_register (struct gdbarch *gdbarch, char *raw_buffer, int *optimized, CORE_ADDR *addrp, struct frame_info *frame, int regnum, enum lval_type *lval); extern void set_gdbarch_get_saved_register (struct gdbarch *gdbarch, gdbarch_get_saved_register_ftype *get_saved_register); -#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (GET_SAVED_REGISTER) +#if (GDB_MULTI_ARCH >= GDB_MULTI_ARCH_PARTIAL) && defined (GET_SAVED_REGISTER) #error "Non multi-arch definition of GET_SAVED_REGISTER" #endif #if GDB_MULTI_ARCH -#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (GET_SAVED_REGISTER) +#if (GDB_MULTI_ARCH >= GDB_MULTI_ARCH_PARTIAL) || !defined (GET_SAVED_REGISTER) #define GET_SAVED_REGISTER(raw_buffer, optimized, addrp, frame, regnum, lval) (gdbarch_get_saved_register (current_gdbarch, raw_buffer, optimized, addrp, frame, regnum, lval)) #endif #endif @@ -1761,14 +1773,16 @@ extern void set_gdbarch_frame_chain (struct gdbarch *gdbarch, gdbarch_frame_chai #endif #endif +/* See comments on DUMMY_FRAME for why this is required at level 1. */ + typedef int (gdbarch_frame_chain_valid_ftype) (CORE_ADDR chain, struct frame_info *thisframe); extern int gdbarch_frame_chain_valid (struct gdbarch *gdbarch, CORE_ADDR chain, struct frame_info *thisframe); extern void set_gdbarch_frame_chain_valid (struct gdbarch *gdbarch, gdbarch_frame_chain_valid_ftype *frame_chain_valid); -#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (FRAME_CHAIN_VALID) +#if (GDB_MULTI_ARCH >= GDB_MULTI_ARCH_PARTIAL) && defined (FRAME_CHAIN_VALID) #error "Non multi-arch definition of FRAME_CHAIN_VALID" #endif #if GDB_MULTI_ARCH -#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (FRAME_CHAIN_VALID) +#if (GDB_MULTI_ARCH >= GDB_MULTI_ARCH_PARTIAL) || !defined (FRAME_CHAIN_VALID) #define FRAME_CHAIN_VALID(chain, thisframe) (gdbarch_frame_chain_valid (current_gdbarch, chain, thisframe)) #endif #endif diff --git a/gdb/gdbarch.sh b/gdb/gdbarch.sh index e41d3df585c..e5948343a49 100755 --- a/gdb/gdbarch.sh +++ b/gdb/gdbarch.sh @@ -467,6 +467,13 @@ F:2:REGISTER_BYTES_OK:int:register_bytes_ok:long nr_bytes:nr_bytes::0:0 f:2:CANNOT_FETCH_REGISTER:int:cannot_fetch_register:int regnum:regnum:::cannot_register_not::0 f:2:CANNOT_STORE_REGISTER:int:cannot_store_register:int regnum:regnum:::cannot_register_not::0 # +# Non multi-arch DUMMY_FRAMES are a mess (multi-arch ones are not that +# much better but at least they are vaguely consistent). The headers +# and body contain convoluted #if/#else sequences for determine how +# things should be compiled. Instead of trying to mimic that +# behaviour here (and hence entrench it further) gdbarch simply +# reqires that these methods be set up from the word go. This also +# avoids any potential problems with moving beyond multi-arch partial. v:1:USE_GENERIC_DUMMY_FRAMES:int:use_generic_dummy_frames::::0:-1 v:1:CALL_DUMMY_LOCATION:int:call_dummy_location::::0:0 f:2:CALL_DUMMY_ADDRESS:CORE_ADDR:call_dummy_address:void:::0:0::gdbarch->call_dummy_location == AT_ENTRY_POINT && gdbarch->call_dummy_address == 0 @@ -487,6 +494,9 @@ f:2:INIT_FRAME_PC:void:init_frame_pc:int fromleaf, struct frame_info *prev:froml v:2:BELIEVE_PCC_PROMOTION:int:believe_pcc_promotion::::::: v:2:BELIEVE_PCC_PROMOTION_TYPE:int:believe_pcc_promotion_type::::::: f:2:COERCE_FLOAT_TO_DOUBLE:int:coerce_float_to_double:struct type *formal, struct type *actual:formal, actual:::default_coerce_float_to_double::0 +# GET_SAVED_REGISTER is like DUMMY_FRAMES. It is at level one as the +# old code has strange #ifdef interaction. So far no one has found +# that default_get_saved_register() is the default they are after. f:1:GET_SAVED_REGISTER:void:get_saved_register:char *raw_buffer, int *optimized, CORE_ADDR *addrp, struct frame_info *frame, int regnum, enum lval_type *lval:raw_buffer, optimized, addrp, frame, regnum, lval::generic_get_saved_register:0 # f:2:REGISTER_CONVERTIBLE:int:register_convertible:int nr:nr:::generic_register_convertible_not::0 @@ -535,6 +545,7 @@ f:2:REMOTE_TRANSLATE_XFER_ADDRESS:void:remote_translate_xfer_address:CORE_ADDR g v:2:FRAME_ARGS_SKIP:CORE_ADDR:frame_args_skip::::0:-1 f:2:FRAMELESS_FUNCTION_INVOCATION:int:frameless_function_invocation:struct frame_info *fi:fi:::generic_frameless_function_invocation_not::0 f:2:FRAME_CHAIN:CORE_ADDR:frame_chain:struct frame_info *frame:frame::0:0 +# See comments on DUMMY_FRAME for why this is required at level 1. f:1:FRAME_CHAIN_VALID:int:frame_chain_valid:CORE_ADDR chain, struct frame_info *thisframe:chain, thisframe::0:0 f:2:FRAME_SAVED_PC:CORE_ADDR:frame_saved_pc:struct frame_info *fi:fi::0:0 f:2:FRAME_ARGS_ADDRESS:CORE_ADDR:frame_args_address:struct frame_info *fi:fi::0:0 @@ -745,11 +756,11 @@ do printf "\n" printf "extern ${returntype} gdbarch_${function} (struct gdbarch *gdbarch);\n" printf "/* set_gdbarch_${function}() - not applicable - pre-initialized. */\n" - printf "#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (${macro})\n" + printf "#if (GDB_MULTI_ARCH ${gt_level}) && defined (${macro})\n" printf "#error \"Non multi-arch definition of ${macro}\"\n" printf "#endif\n" printf "#if GDB_MULTI_ARCH\n" - printf "#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (${macro})\n" + printf "#if (GDB_MULTI_ARCH ${gt_level}) || !defined (${macro})\n" printf "#define ${macro} (gdbarch_${function} (current_gdbarch))\n" printf "#endif\n" printf "#endif\n" @@ -794,10 +805,10 @@ do printf "#endif\n" printf "\n" printf "extern int gdbarch_${function}_p (struct gdbarch *gdbarch);\n" - printf "#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (${macro}_P)\n" + printf "#if (GDB_MULTI_ARCH ${gt_level}) && defined (${macro}_P)\n" printf "#error \"Non multi-arch definition of ${macro}\"\n" printf "#endif\n" - printf "#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (${macro}_P)\n" + printf "#if (GDB_MULTI_ARCH ${gt_level}) || !defined (${macro}_P)\n" printf "#define ${macro}_P() (gdbarch_${function}_p (current_gdbarch))\n" printf "#endif\n" fi @@ -816,11 +827,11 @@ do printf "\n" printf "extern ${returntype} gdbarch_${function} (struct gdbarch *gdbarch);\n" printf "extern void set_gdbarch_${function} (struct gdbarch *gdbarch, ${returntype} ${function});\n" - printf "#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (${macro})\n" + printf "#if (GDB_MULTI_ARCH ${gt_level}) && defined (${macro})\n" printf "#error \"Non multi-arch definition of ${macro}\"\n" printf "#endif\n" printf "#if GDB_MULTI_ARCH\n" - printf "#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (${macro})\n" + printf "#if (GDB_MULTI_ARCH ${gt_level}) || !defined (${macro})\n" printf "#define ${macro} (gdbarch_${function} (current_gdbarch))\n" printf "#endif\n" printf "#endif\n" @@ -862,11 +873,11 @@ do printf "extern void set_gdbarch_${function} (struct gdbarch *gdbarch, gdbarch_${function}_ftype *${function});\n" if class_is_multiarch_p ; then : else - printf "#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (${macro})\n" + printf "#if (GDB_MULTI_ARCH ${gt_level}) && defined (${macro})\n" printf "#error \"Non multi-arch definition of ${macro}\"\n" printf "#endif\n" printf "#if GDB_MULTI_ARCH\n" - printf "#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (${macro})\n" + printf "#if (GDB_MULTI_ARCH ${gt_level}) || !defined (${macro})\n" if [ "x${actual}" = "x" ] then printf "#define ${macro}() (gdbarch_${function} (current_gdbarch))\n" -- 2.30.2