* ld-scripts/defined3.d, ld-scripts/defined3.t: New test.
[deliverable/binutils-gdb.git] / gdb / gdbarch.sh
index 02a1dc7c6be0f7e7f6dd82432e81ee47a6b9a077..b537eabd7d614332e1efcec8888d869861d31985 100755 (executable)
@@ -94,9 +94,6 @@ EOF
                M ) staticdefault="0" ;;
                * ) test "${staticdefault}" || staticdefault=0 ;;
            esac
-           # NOT YET: Breaks BELIEVE_PCC_PROMOTION and confuses non-
-           # multi-arch defaults.
-           # test "${predefault}" || predefault=0
 
            # come up with a format, use a few guesses for variables
            case ":${class}:${fmt}:${print}:" in
@@ -119,13 +116,16 @@ EOF
            F | V | M )
                case "${invalid_p}" in
                "" )
-                   if test -n "${predefault}" -a "${predefault}" != "0"
+                   if test -n "${predefault}"
                    then
                        #invalid_p="gdbarch->${function} == ${predefault}"
                        predicate="gdbarch->${function} != ${predefault}"
-                   else
-                       # filled in later
-                       predicate=""
+                   elif class_is_variable_p
+                   then
+                       predicate="gdbarch->${function} != 0"
+                   elif class_is_function_p
+                   then
+                       predicate="gdbarch->${function} != NULL"
                    fi
                    ;;
                * )
@@ -435,8 +435,8 @@ F:2:TARGET_READ_SP:CORE_ADDR:read_sp:void
 # serious shakedown.
 f:2:TARGET_VIRTUAL_FRAME_POINTER:void:virtual_frame_pointer:CORE_ADDR pc, int *frame_regnum, LONGEST *frame_offset:pc, frame_regnum, frame_offset::0:legacy_virtual_frame_pointer::0
 #
-M:::void:pseudo_register_read:struct regcache *regcache, int cookednum, void *buf:regcache, cookednum, buf:
-M:::void:pseudo_register_write:struct regcache *regcache, int cookednum, const void *buf:regcache, cookednum, buf:
+M:::void:pseudo_register_read:struct regcache *regcache, int cookednum, void *buf:regcache, cookednum, buf
+M:::void:pseudo_register_write:struct regcache *regcache, int cookednum, const void *buf:regcache, cookednum, buf
 #
 v:2:NUM_REGS:int:num_regs::::0:-1
 # This macro gives the number of pseudo-registers that live in the
@@ -453,7 +453,9 @@ v:2:SP_REGNUM:int:sp_regnum::::-1:-1::0
 v:2:PC_REGNUM:int:pc_regnum::::-1:-1::0
 v:2:PS_REGNUM:int:ps_regnum::::-1:-1::0
 v:2:FP0_REGNUM:int:fp0_regnum::::0:-1::0
-v:2:NPC_REGNUM:int:npc_regnum::::0:-1::0
+# Replace DEPRECATED_NPC_REGNUM with an implementation of WRITE_PC
+# that updates PC, NPC and even NNPC.
+v:2:DEPRECATED_NPC_REGNUM:int:deprecated_npc_regnum::::0:-1::0
 # Convert stab register number (from \`r\' declaration) to a gdb REGNUM.
 f:2:STAB_REG_TO_REGNUM:int:stab_reg_to_regnum:int stab_regnr:stab_regnr:::no_op_reg_to_regnum::0
 # Provide a default mapping from a ecoff register number to a gdb REGNUM.
@@ -461,16 +463,14 @@ f:2:ECOFF_REG_TO_REGNUM:int:ecoff_reg_to_regnum:int ecoff_regnr:ecoff_regnr:::no
 # Provide a default mapping from a DWARF register number to a gdb REGNUM.
 f:2:DWARF_REG_TO_REGNUM:int:dwarf_reg_to_regnum:int dwarf_regnr:dwarf_regnr:::no_op_reg_to_regnum::0
 # Convert from an sdb register number to an internal gdb register number.
-# This should be defined in tm.h, if REGISTER_NAMES is not set up
-# to map one to one onto the sdb register numbers.
 f:2:SDB_REG_TO_REGNUM:int:sdb_reg_to_regnum:int sdb_regnr:sdb_regnr:::no_op_reg_to_regnum::0
 f:2:DWARF2_REG_TO_REGNUM:int:dwarf2_reg_to_regnum:int dwarf2_regnr:dwarf2_regnr:::no_op_reg_to_regnum::0
 f::REGISTER_NAME:const char *:register_name:int regnr:regnr
 
-# REGISTER_TYPE is a direct replacement for REGISTER_VIRTUAL_TYPE.
-M:2:REGISTER_TYPE:struct type *:register_type:int reg_nr:reg_nr::0:
-# REGISTER_TYPE is a direct replacement for REGISTER_VIRTUAL_TYPE.
-F:2:REGISTER_VIRTUAL_TYPE:struct type *:deprecated_register_virtual_type:int reg_nr:reg_nr::0:0
+# REGISTER_TYPE is a direct replacement for DEPRECATED_REGISTER_VIRTUAL_TYPE.
+M:2:REGISTER_TYPE:struct type *:register_type:int reg_nr:reg_nr
+# REGISTER_TYPE is a direct replacement for DEPRECATED_REGISTER_VIRTUAL_TYPE.
+F:2:DEPRECATED_REGISTER_VIRTUAL_TYPE:struct type *:deprecated_register_virtual_type:int reg_nr:reg_nr
 # DEPRECATED_REGISTER_BYTES can be deleted.  The value is computed
 # from REGISTER_TYPE.
 v::DEPRECATED_REGISTER_BYTES:int:deprecated_register_bytes
@@ -481,17 +481,17 @@ v::DEPRECATED_REGISTER_BYTES:int:deprecated_register_bytes
 # consequence, even when the predicate is false, the corresponding
 # function works.  This simplifies the migration process - old code,
 # calling DEPRECATED_REGISTER_BYTE, doesn't need to be modified.
-F::REGISTER_BYTE:int:deprecated_register_byte:int reg_nr:reg_nr::generic_register_byte:generic_register_byte
+F::DEPRECATED_REGISTER_BYTE:int:deprecated_register_byte:int reg_nr:reg_nr::generic_register_byte:generic_register_byte
 # If all registers have identical raw and virtual sizes and those
 # sizes agree with the value computed from REGISTER_TYPE,
 # DEPRECATED_REGISTER_RAW_SIZE can be deleted.  See: maint print
 # registers.
-F:2:REGISTER_RAW_SIZE:int:deprecated_register_raw_size:int reg_nr:reg_nr::generic_register_size:generic_register_size
+F:2:DEPRECATED_REGISTER_RAW_SIZE:int:deprecated_register_raw_size:int reg_nr:reg_nr::generic_register_size:generic_register_size
 # If all registers have identical raw and virtual sizes and those
 # sizes agree with the value computed from REGISTER_TYPE,
 # DEPRECATED_REGISTER_VIRTUAL_SIZE can be deleted.  See: maint print
 # registers.
-F:2:REGISTER_VIRTUAL_SIZE:int:deprecated_register_virtual_size:int reg_nr:reg_nr::generic_register_size:generic_register_size
+F:2:DEPRECATED_REGISTER_VIRTUAL_SIZE:int:deprecated_register_virtual_size:int reg_nr:reg_nr::generic_register_size:generic_register_size
 # DEPRECATED_MAX_REGISTER_RAW_SIZE can be deleted.  It has been
 # replaced by the constant MAX_REGISTER_SIZE.
 V:2:DEPRECATED_MAX_REGISTER_RAW_SIZE:int:deprecated_max_register_raw_size
@@ -500,7 +500,7 @@ V:2:DEPRECATED_MAX_REGISTER_RAW_SIZE:int:deprecated_max_register_raw_size
 V:2:DEPRECATED_MAX_REGISTER_VIRTUAL_SIZE:int:deprecated_max_register_virtual_size
 
 # See gdbint.texinfo, and PUSH_DUMMY_CALL.
-M::UNWIND_DUMMY_ID:struct frame_id:unwind_dummy_id:struct frame_info *info:info::0:0
+M::UNWIND_DUMMY_ID:struct frame_id:unwind_dummy_id:struct frame_info *info:info
 # Implement UNWIND_DUMMY_ID and PUSH_DUMMY_CALL, then delete
 # SAVE_DUMMY_FRAME_TOS.
 F:2:DEPRECATED_SAVE_DUMMY_FRAME_TOS:void:deprecated_save_dummy_frame_tos:CORE_ADDR sp:sp
@@ -520,13 +520,13 @@ F:2:DEPRECATED_PUSH_ARGUMENTS:CORE_ADDR:deprecated_push_arguments:int nargs, str
 v::DEPRECATED_USE_GENERIC_DUMMY_FRAMES:int:deprecated_use_generic_dummy_frames:::::1::0
 # Implement PUSH_RETURN_ADDRESS, and then merge in
 # DEPRECATED_PUSH_RETURN_ADDRESS.
-F:2:DEPRECATED_PUSH_RETURN_ADDRESS:CORE_ADDR:deprecated_push_return_address:CORE_ADDR pc, CORE_ADDR sp:pc, sp:::0
+F:2:DEPRECATED_PUSH_RETURN_ADDRESS:CORE_ADDR:deprecated_push_return_address:CORE_ADDR pc, CORE_ADDR sp:pc, sp
 # Implement PUSH_DUMMY_CALL, then merge in DEPRECATED_DUMMY_WRITE_SP.
 F:2:DEPRECATED_DUMMY_WRITE_SP:void:deprecated_dummy_write_sp:CORE_ADDR val:val
 # DEPRECATED_REGISTER_SIZE can be deleted.
 v::DEPRECATED_REGISTER_SIZE:int:deprecated_register_size
 v::CALL_DUMMY_LOCATION:int:call_dummy_location:::::AT_ENTRY_POINT::0
-f::CALL_DUMMY_ADDRESS:CORE_ADDR:call_dummy_address:void::::entry_point_address::0
+F::DEPRECATED_CALL_DUMMY_ADDRESS:CORE_ADDR:deprecated_call_dummy_address:void
 # DEPRECATED_CALL_DUMMY_START_OFFSET can be deleted.
 v::DEPRECATED_CALL_DUMMY_START_OFFSET:CORE_ADDR:deprecated_call_dummy_start_offset
 # DEPRECATED_CALL_DUMMY_BREAKPOINT_OFFSET can be deleted.
@@ -538,14 +538,14 @@ v::DEPRECATED_CALL_DUMMY_WORDS:LONGEST *:deprecated_call_dummy_words::::0:legacy
 # Implement PUSH_DUMMY_CALL, then delete DEPRECATED_SIZEOF_CALL_DUMMY_WORDS.
 v::DEPRECATED_SIZEOF_CALL_DUMMY_WORDS:int:deprecated_sizeof_call_dummy_words::::0:legacy_sizeof_call_dummy_words::0
 # Implement PUSH_DUMMY_CALL, then delete DEPRECATED_CALL_DUMMY_STACK_ADJUST.
-V:2:DEPRECATED_CALL_DUMMY_STACK_ADJUST:int:deprecated_call_dummy_stack_adjust::::0
+V:2:DEPRECATED_CALL_DUMMY_STACK_ADJUST:int:deprecated_call_dummy_stack_adjust
 # DEPRECATED_FIX_CALL_DUMMY can be deleted.  For the SPARC, implement
 # PUSH_DUMMY_CODE and set CALL_DUMMY_LOCATION to ON_STACK.
 F::DEPRECATED_FIX_CALL_DUMMY:void:deprecated_fix_call_dummy:char *dummy, CORE_ADDR pc, CORE_ADDR fun, int nargs, struct value **args, struct type *type, int gcc_p:dummy, pc, fun, nargs, args, type, gcc_p
 # This is a replacement for DEPRECATED_FIX_CALL_DUMMY et.al.
-M::PUSH_DUMMY_CODE:CORE_ADDR:push_dummy_code:CORE_ADDR sp, CORE_ADDR funaddr, int using_gcc, struct value **args, int nargs, struct type *value_type, CORE_ADDR *real_pc, CORE_ADDR *bp_addr:sp, funaddr, using_gcc, args, nargs, value_type, real_pc, bp_addr:
+M::PUSH_DUMMY_CODE:CORE_ADDR:push_dummy_code:CORE_ADDR sp, CORE_ADDR funaddr, int using_gcc, struct value **args, int nargs, struct type *value_type, CORE_ADDR *real_pc, CORE_ADDR *bp_addr:sp, funaddr, using_gcc, args, nargs, value_type, real_pc, bp_addr
 # Implement PUSH_DUMMY_CALL, then delete DEPRECATED_PUSH_DUMMY_FRAME.
-F:2:DEPRECATED_PUSH_DUMMY_FRAME:void:deprecated_push_dummy_frame:void:-:::0
+F:2:DEPRECATED_PUSH_DUMMY_FRAME:void:deprecated_push_dummy_frame:void:-
 # Implement PUSH_DUMMY_CALL, then delete
 # DEPRECATED_EXTRA_STACK_ALIGNMENT_NEEDED.
 v:2:DEPRECATED_EXTRA_STACK_ALIGNMENT_NEEDED:int:deprecated_extra_stack_alignment_needed::::0:0::0:::
@@ -557,11 +557,11 @@ M:2:PRINT_VECTOR_INFO:void:print_vector_info:struct ui_file *file, struct frame_
 # MAP a GDB RAW register number onto a simulator register number.  See
 # also include/...-sim.h.
 f:2:REGISTER_SIM_REGNO:int:register_sim_regno:int reg_nr:reg_nr:::legacy_register_sim_regno::0
-F:2:REGISTER_BYTES_OK:int:register_bytes_ok:long nr_bytes:nr_bytes::0:0
+F:2:REGISTER_BYTES_OK:int:register_bytes_ok:long nr_bytes:nr_bytes
 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
 # setjmp/longjmp support.
-F:2:GET_LONGJMP_TARGET:int:get_longjmp_target:CORE_ADDR *pc:pc::0:0
+F:2:GET_LONGJMP_TARGET:int:get_longjmp_target:CORE_ADDR *pc:pc
 # NOTE: cagney/2002-11-24: This function with predicate has a valid
 # (callable) initial value.  As a consequence, even when the predicate
 # is false, the corresponding function works.  This simplifies the
@@ -594,21 +594,21 @@ f:2:ADDRESS_TO_POINTER:void:address_to_pointer:struct type *type, void *buf, COR
 F:2:INTEGER_TO_ADDRESS:CORE_ADDR:integer_to_address:struct type *type, void *buf:type, buf
 #
 f:2:RETURN_VALUE_ON_STACK:int:return_value_on_stack:struct type *type:type:::generic_return_value_on_stack_not::0
-F:2:DEPRECATED_POP_FRAME:void:deprecated_pop_frame:void:-:::0
+F:2:DEPRECATED_POP_FRAME:void:deprecated_pop_frame:void:-
 # NOTE: cagney/2003-03-24: Replaced by PUSH_ARGUMENTS.
-F:2:DEPRECATED_STORE_STRUCT_RETURN:void:deprecated_store_struct_return:CORE_ADDR addr, CORE_ADDR sp:addr, sp:::0
+F:2:DEPRECATED_STORE_STRUCT_RETURN:void:deprecated_store_struct_return:CORE_ADDR addr, CORE_ADDR sp:addr, sp
 #
 f:2:EXTRACT_RETURN_VALUE:void:extract_return_value:struct type *type, struct regcache *regcache, void *valbuf:type, regcache, valbuf:::legacy_extract_return_value::0
 f:2:STORE_RETURN_VALUE:void:store_return_value:struct type *type, struct regcache *regcache, const void *valbuf:type, regcache, valbuf:::legacy_store_return_value::0
 f:2:DEPRECATED_EXTRACT_RETURN_VALUE:void:deprecated_extract_return_value:struct type *type, char *regbuf, char *valbuf:type, regbuf, valbuf
 f:2:DEPRECATED_STORE_RETURN_VALUE:void:deprecated_store_return_value:struct type *type, char *valbuf:type, valbuf
 #
-F:2:EXTRACT_STRUCT_VALUE_ADDRESS:CORE_ADDR:extract_struct_value_address:struct regcache *regcache:regcache:::0
-F:2:DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS:CORE_ADDR:deprecated_extract_struct_value_address:char *regbuf:regbuf:::0
+F:2:EXTRACT_STRUCT_VALUE_ADDRESS:CORE_ADDR:extract_struct_value_address:struct regcache *regcache:regcache
+F:2:DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS:CORE_ADDR:deprecated_extract_struct_value_address:char *regbuf:regbuf
 f:2:USE_STRUCT_CONVENTION:int:use_struct_convention:int gcc_p, struct type *value_type:gcc_p, value_type:::generic_use_struct_convention::0
 #
-F:2:DEPRECATED_FRAME_INIT_SAVED_REGS:void:deprecated_frame_init_saved_regs:struct frame_info *frame:frame:::0
-F:2:DEPRECATED_INIT_EXTRA_FRAME_INFO:void:deprecated_init_extra_frame_info:int fromleaf, struct frame_info *frame:fromleaf, frame:::0
+F:2:DEPRECATED_FRAME_INIT_SAVED_REGS:void:deprecated_frame_init_saved_regs:struct frame_info *frame:frame
+F:2:DEPRECATED_INIT_EXTRA_FRAME_INFO:void:deprecated_init_extra_frame_info:int fromleaf, struct frame_info *frame:fromleaf, frame
 #
 f:2:SKIP_PROLOGUE:CORE_ADDR:skip_prologue:CORE_ADDR ip:ip::0:0
 f:2:PROLOGUE_FRAMELESS_P:int:prologue_frameless_p:CORE_ADDR ip:ip::0:generic_prologue_frameless_p::0
@@ -623,14 +623,14 @@ m::REMOTE_TRANSLATE_XFER_ADDRESS:void:remote_translate_xfer_address:struct regca
 #
 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:DEPRECATED_FRAME_CHAIN:CORE_ADDR:deprecated_frame_chain:struct frame_info *frame:frame::0:0
-F:2:DEPRECATED_FRAME_CHAIN_VALID:int:deprecated_frame_chain_valid:CORE_ADDR chain, struct frame_info *thisframe:chain, thisframe::0:0
+F:2:DEPRECATED_FRAME_CHAIN:CORE_ADDR:deprecated_frame_chain:struct frame_info *frame:frame
+F:2:DEPRECATED_FRAME_CHAIN_VALID:int:deprecated_frame_chain_valid:CORE_ADDR chain, struct frame_info *thisframe:chain, thisframe
 # DEPRECATED_FRAME_SAVED_PC has been replaced by UNWIND_PC.  Please
 # note, per UNWIND_PC's doco, that while the two have similar
 # interfaces they have very different underlying implementations.
-F:2:DEPRECATED_FRAME_SAVED_PC:CORE_ADDR:deprecated_frame_saved_pc:struct frame_info *fi:fi::0:0
-M::UNWIND_PC:CORE_ADDR:unwind_pc:struct frame_info *next_frame:next_frame:
-M::UNWIND_SP:CORE_ADDR:unwind_sp:struct frame_info *next_frame:next_frame:
+F:2:DEPRECATED_FRAME_SAVED_PC:CORE_ADDR:deprecated_frame_saved_pc:struct frame_info *fi:fi
+M::UNWIND_PC:CORE_ADDR:unwind_pc:struct frame_info *next_frame:next_frame
+M::UNWIND_SP:CORE_ADDR:unwind_sp:struct frame_info *next_frame:next_frame
 # DEPRECATED_FRAME_ARGS_ADDRESS as been replaced by the per-frame
 # frame-base.  Enable frame-base before frame-unwind.
 F::DEPRECATED_FRAME_ARGS_ADDRESS:CORE_ADDR:deprecated_frame_args_address:struct frame_info *fi:fi::get_frame_base:get_frame_base
@@ -640,9 +640,17 @@ F::DEPRECATED_FRAME_LOCALS_ADDRESS:CORE_ADDR:deprecated_frame_locals_address:str
 F::DEPRECATED_SAVED_PC_AFTER_CALL:CORE_ADDR:deprecated_saved_pc_after_call:struct frame_info *frame:frame
 F:2:FRAME_NUM_ARGS:int:frame_num_args:struct frame_info *frame:frame
 #
-F:2:STACK_ALIGN:CORE_ADDR:stack_align:CORE_ADDR sp:sp::0:0
+# DEPRECATED_STACK_ALIGN has been replaced by an initial aligning call
+# to frame_align and the requirement that methods such as
+# push_dummy_call and frame_red_zone_size maintain correct stack/frame
+# alignment.
+F:2:DEPRECATED_STACK_ALIGN:CORE_ADDR:deprecated_stack_align:CORE_ADDR sp:sp
 M:::CORE_ADDR:frame_align:CORE_ADDR address:address
-F:2:REG_STRUCT_HAS_ADDR:int:reg_struct_has_addr:int gcc_p, struct type *type:gcc_p, type::0:0
+# DEPRECATED_REG_STRUCT_HAS_ADDR has been replaced by
+# stabs_argument_has_addr.
+F:2:DEPRECATED_REG_STRUCT_HAS_ADDR:int:deprecated_reg_struct_has_addr:int gcc_p, struct type *type:gcc_p, type
+m:::int:stabs_argument_has_addr:struct type *type:type:::default_stabs_argument_has_addr::0
+v::FRAME_RED_ZONE_SIZE:int:frame_red_zone_size
 v:2:PARM_BOUNDARY:int:parm_boundary
 #
 v:2:TARGET_FLOAT_FORMAT:const struct floatformat *:float_format::::::default_float_format (gdbarch)::%s:(TARGET_FLOAT_FORMAT)->name
@@ -670,8 +678,10 @@ f:2:SMASH_TEXT_ADDRESS:CORE_ADDR:smash_text_address:CORE_ADDR addr:addr:::core_a
 #
 # FIXME/cagney/2001-01-18: The logic is backwards.  It should be asking if the target can
 # single step.  If not, then implement single step using breakpoints.
-F:2:SOFTWARE_SINGLE_STEP:void:software_single_step:enum target_signal sig, int insert_breakpoints_p:sig, insert_breakpoints_p::0:0
-f:2:TARGET_PRINT_INSN:int:print_insn:bfd_vma vma, disassemble_info *info:vma, info:::legacy_print_insn::0
+F:2:SOFTWARE_SINGLE_STEP:void:software_single_step:enum target_signal sig, int insert_breakpoints_p:sig, insert_breakpoints_p
+# FIXME: cagney/2003-08-28: Need to find a better way of selecting the
+# disassembler.  Perhaphs objdump can handle it?
+f::TARGET_PRINT_INSN:int:print_insn:bfd_vma vma, struct disassemble_info *info:vma, info:::0:
 f:2:SKIP_TRAMPOLINE_CODE:CORE_ADDR:skip_trampoline_code:CORE_ADDR pc:pc:::generic_skip_trampoline_code::0
 
 
@@ -725,19 +735,18 @@ m:::int:in_function_epilogue_p:CORE_ADDR addr:addr::0:generic_in_function_epilog
 # ARGC is the number of elements in the vector.
 # ARGV is an array of strings, one per argument.
 m::CONSTRUCT_INFERIOR_ARGUMENTS:char *:construct_inferior_arguments:int argc, char **argv:argc, argv:::construct_inferior_arguments::0
-F:2:DWARF2_BUILD_FRAME_INFO:void:dwarf2_build_frame_info:struct objfile *objfile:objfile:::0
 f:2:ELF_MAKE_MSYMBOL_SPECIAL:void:elf_make_msymbol_special:asymbol *sym, struct minimal_symbol *msym:sym, msym:::default_elf_make_msymbol_special::0
 f:2:COFF_MAKE_MSYMBOL_SPECIAL:void:coff_make_msymbol_special:int val, struct minimal_symbol *msym:val, msym:::default_coff_make_msymbol_special::0
 v:2:NAME_OF_MALLOC:const char *:name_of_malloc::::"malloc":"malloc"::0:%s:NAME_OF_MALLOC
 v:2:CANNOT_STEP_BREAKPOINT:int:cannot_step_breakpoint::::0:0::0
 v:2:HAVE_NONSTEPPABLE_WATCHPOINT:int:have_nonsteppable_watchpoint::::0:0::0
 F:2:ADDRESS_CLASS_TYPE_FLAGS:int:address_class_type_flags:int byte_size, int dwarf2_addr_class:byte_size, dwarf2_addr_class
-M:2:ADDRESS_CLASS_TYPE_FLAGS_TO_NAME:const char *:address_class_type_flags_to_name:int type_flags:type_flags:
+M:2:ADDRESS_CLASS_TYPE_FLAGS_TO_NAME:const char *:address_class_type_flags_to_name:int type_flags:type_flags
 M:2:ADDRESS_CLASS_NAME_TO_TYPE_FLAGS:int:address_class_name_to_type_flags:const char *name, int *type_flags_ptr:name, type_flags_ptr
 # Is a register in a group
 m:::int:register_reggroup_p:int regnum, struct reggroup *reggroup:regnum, reggroup:::default_register_reggroup_p::0
 # Fetch the pointer to the ith function argument.  
-F::FETCH_POINTER_ARGUMENT:CORE_ADDR:fetch_pointer_argument:struct frame_info *frame, int argi, struct type *type:frame, argi, type:::::::::
+F::FETCH_POINTER_ARGUMENT:CORE_ADDR:fetch_pointer_argument:struct frame_info *frame, int argi, struct type *type:frame, argi, type
 EOF
 }
 
@@ -834,13 +843,6 @@ cat <<EOF
 #ifndef GDBARCH_H
 #define GDBARCH_H
 
-#include "dis-asm.h" /* Get defs for disassemble_info, which unfortunately is a typedef. */
-#if !GDB_MULTI_ARCH
-/* Pull in function declarations refered to, indirectly, via macros.  */
-#include "inferior.h"          /* For unsigned_address_to_pointer().  */
-#include "symfile.h"           /* For entry_point_address().  */
-#endif
-
 struct floatformat;
 struct ui_file;
 struct frame_info;
@@ -849,6 +851,7 @@ struct objfile;
 struct minimal_symbol;
 struct regcache;
 struct reggroup;
+struct disassemble_info;
 
 extern struct gdbarch *current_gdbarch;
 
@@ -913,11 +916,6 @@ do
            printf "#endif\n"
            printf "#endif\n"
            printf "\n"
-           printf "/* Default predicate for non- multi-arch targets. */\n"
-           printf "#if (!GDB_MULTI_ARCH) && !defined (${macro}_P)\n"
-           printf "#define ${macro}_P() (0)\n"
-           printf "#endif\n"
-           printf "\n"
            printf "extern int gdbarch_${function}_p (struct gdbarch *gdbarch);\n"
            printf "#if (GDB_MULTI_ARCH ${gt_level}) && defined (${macro}_P)\n"
            printf "#error \"Non multi-arch definition of ${macro}\"\n"
@@ -929,15 +927,6 @@ do
     fi
     if class_is_variable_p
     then
-       if fallback_default_p || class_is_predicate_p
-       then
-           printf "\n"
-           printf "/* Default (value) for non- multi-arch platforms. */\n"
-           printf "#if (!GDB_MULTI_ARCH) && !defined (${macro})\n"
-           echo "#define ${macro} (${fallbackdefault})" \
-               | sed -e 's/\([^a-z_]\)\(gdbarch[^a-z_]\)/\1current_\2/g'
-           printf "#endif\n"
-       fi
        printf "\n"
        printf "extern ${returntype} gdbarch_${function} (struct gdbarch *gdbarch);\n"
        printf "extern void set_gdbarch_${function} (struct gdbarch *gdbarch, ${returntype} ${function});\n"
@@ -950,27 +939,6 @@ do
     fi
     if class_is_function_p
     then
-       if class_is_multiarch_p ; then :
-       elif fallback_default_p || class_is_predicate_p
-       then
-           printf "\n"
-           printf "/* Default (function) for non- multi-arch platforms. */\n"
-           printf "#if (!GDB_MULTI_ARCH) && !defined (${macro})\n"
-           if [ "x${fallbackdefault}" = "x0" ]
-           then
-               if [ "x${actual}" = "x-" ]
-               then
-                   printf "#define ${macro} (internal_error (__FILE__, __LINE__, \"${macro}\"), 0)\n"
-               else
-                   printf "#define ${macro}(${actual}) (internal_error (__FILE__, __LINE__, \"${macro}\"), 0)\n"
-               fi
-           else
-               # FIXME: Should be passing current_gdbarch through!
-               echo "#define ${macro}(${actual}) (${fallbackdefault} (${actual}))" \
-                   | sed -e 's/\([^a-z_]\)\(gdbarch[^a-z_]\)/\1current_\2/g'
-           fi
-           printf "#endif\n"
-       fi
        printf "\n"
        if [ "x${formal}" = "xvoid" ] && class_is_multiarch_p
        then
@@ -1146,6 +1114,15 @@ extern struct gdbarch *gdbarch_alloc (const struct gdbarch_info *info, struct gd
 extern void gdbarch_free (struct gdbarch *);
 
 
+/* Helper function.  Allocate memory from the \`\`struct gdbarch''
+   obstack.  The memory is freed when the corresponding architecture
+   is also freed.  */
+
+extern void *gdbarch_obstack_zalloc (struct gdbarch *gdbarch, long size);
+#define GDBARCH_OBSTACK_CALLOC(GDBARCH, NR, TYPE) ((TYPE *) gdbarch_obstack_zalloc ((GDBARCH), (NR) * sizeof (TYPE)))
+#define GDBARCH_OBSTACK_ZALLOC(GDBARCH, TYPE) ((TYPE *) gdbarch_obstack_zalloc ((GDBARCH), sizeof (TYPE)))
+
+
 /* Helper function. Force an update of the current architecture.
 
    The actual architecture selected is determined by INFO, \`\`(gdb) set
@@ -1167,9 +1144,11 @@ extern int gdbarch_update_p (struct gdbarch_info info);
 
    The per-architecture data-pointer is either initialized explicitly
    (set_gdbarch_data()) or implicitly (by INIT() via a call to
-   gdbarch_data()).  FREE() is called to delete either an existing
-   data-pointer overridden by set_gdbarch_data() or when the
-   architecture object is being deleted.
+   gdbarch_data()).
+
+   Memory for the per-architecture data shall be allocated using
+   gdbarch_obstack_zalloc.  That memory will be deleted when the
+   corresponding architecture object is deleted.
 
    When a previously created architecture is re-selected, the
    per-architecture data-pointer for that previous architecture is
@@ -1181,10 +1160,7 @@ extern int gdbarch_update_p (struct gdbarch_info info);
 struct gdbarch_data;
 
 typedef void *(gdbarch_data_init_ftype) (struct gdbarch *gdbarch);
-typedef void (gdbarch_data_free_ftype) (struct gdbarch *gdbarch,
-                                       void *pointer);
-extern struct gdbarch_data *register_gdbarch_data (gdbarch_data_init_ftype *init,
-                                                  gdbarch_data_free_ftype *free);
+extern struct gdbarch_data *register_gdbarch_data (gdbarch_data_init_ftype *init);
 extern void set_gdbarch_data (struct gdbarch *gdbarch,
                              struct gdbarch_data *data,
                              void *pointer);
@@ -1237,14 +1213,6 @@ extern const struct bfd_arch_info *target_architecture;
 #endif
 
 
-/* The target-system-dependent disassembler is semi-dynamic */
-
-/* Use gdb_disassemble, and gdbarch_print_insn instead.  */
-extern int (*deprecated_tm_print_insn) (bfd_vma, disassemble_info*);
-
-/* Use set_gdbarch_print_insn instead.  */
-extern disassemble_info deprecated_tm_print_insn_info;
-
 /* Set the dynamic target-system-dependent parameters (architecture,
    byte-order, ...) using information found in the BFD */
 
@@ -1284,27 +1252,8 @@ cat <<EOF
 #include "defs.h"
 #include "arch-utils.h"
 
-#if GDB_MULTI_ARCH
 #include "gdbcmd.h"
 #include "inferior.h" /* enum CALL_DUMMY_LOCATION et.al. */
-#else
-/* Just include everything in sight so that the every old definition
-   of macro is visible. */
-#include "gdb_string.h"
-#include <ctype.h>
-#include "symtab.h"
-#include "frame.h"
-#include "inferior.h"
-#include "breakpoint.h"
-#include "gdb_wait.h"
-#include "gdbcore.h"
-#include "gdbcmd.h"
-#include "target.h"
-#include "gdbthread.h"
-#include "annotate.h"
-#include "symfile.h"           /* for overlay functions */
-#include "value.h"             /* For old tm.h/nm.h macros.  */
-#endif
 #include "symcat.h"
 
 #include "floatformat.h"
@@ -1315,12 +1264,12 @@ cat <<EOF
 #include "reggroups.h"
 #include "osabi.h"
 #include "symfile.h"           /* For entry_point_address.  */
+#include "gdb_obstack.h"
 
 /* Static function declarations */
 
 static void verify_gdbarch (struct gdbarch *gdbarch);
 static void alloc_gdbarch_data (struct gdbarch *);
-static void free_gdbarch_data (struct gdbarch *);
 static void init_gdbarch_swap (struct gdbarch *);
 static void clear_gdbarch_swap (struct gdbarch *);
 static void swapout_gdbarch_swap (struct gdbarch *);
@@ -1343,6 +1292,10 @@ printf "struct gdbarch\n"
 printf "{\n"
 printf "  /* Has this architecture been fully initialized?  */\n"
 printf "  int initialized_p;\n"
+printf "\n"
+printf "  /* An obstack bound to the lifetime of the architecture.  */\n"
+printf "  struct obstack *obstack;\n"
+printf "\n"
 printf "  /* basic architectural information */\n"
 function_list | while do_read
 do
@@ -1416,6 +1369,7 @@ printf "\n"
 printf "struct gdbarch startup_gdbarch =\n"
 printf "{\n"
 printf "  1, /* Always initialized.  */\n"
+printf "  NULL, /* The obstack.  */\n"
 printf "  /* basic architecture information */\n"
 function_list | while do_read
 do
@@ -1476,8 +1430,15 @@ gdbarch_alloc (const struct gdbarch_info *info,
      architecture.  This ensures that the new architectures initial
      values are not influenced by the previous architecture.  Once
      everything is parameterised with gdbarch, this will go away.  */
-  struct gdbarch *current_gdbarch = XMALLOC (struct gdbarch);
+  struct gdbarch *current_gdbarch;
+
+  /* Create an obstack for allocating all the per-architecture memory,
+     then use that to allocate the architecture vector.  */
+  struct obstack *obstack = XMALLOC (struct obstack);
+  obstack_init (obstack);
+  current_gdbarch = obstack_alloc (obstack, sizeof (*current_gdbarch));
   memset (current_gdbarch, 0, sizeof (*current_gdbarch));
+  current_gdbarch->obstack = obstack;
 
   alloc_gdbarch_data (current_gdbarch);
 
@@ -1514,6 +1475,17 @@ EOF
 printf "\n"
 printf "\n"
 cat <<EOF
+/* Allocate extra space using the per-architecture obstack.  */
+
+void *
+gdbarch_obstack_zalloc (struct gdbarch *arch, long size)
+{
+  void *data = obstack_alloc (arch->obstack, size);
+  memset (data, 0, size);
+  return data;
+}
+
+
 /* Free a gdbarch struct.  This should never happen in normal
    operation --- once you've created a gdbarch, you keep it around.
    However, if an architecture's init function encounters an error
@@ -1523,9 +1495,12 @@ cat <<EOF
 void
 gdbarch_free (struct gdbarch *arch)
 {
+  struct obstack *obstack;
   gdb_assert (arch != NULL);
-  free_gdbarch_data (arch);
-  xfree (arch);
+  gdb_assert (!arch->initialized_p);
+  obstack = arch->obstack;
+  obstack_free (obstack, 0); /* Includes the ARCH.  */
+  xfree (obstack);
 }
 EOF
 
@@ -1542,9 +1517,6 @@ verify_gdbarch (struct gdbarch *gdbarch)
   struct cleanup *cleanups;
   long dummy;
   char *buf;
-  /* Only perform sanity checks on a multi-arch target. */
-  if (!GDB_MULTI_ARCH)
-    return;
   log = mem_fileopen ();
   cleanups = make_cleanup_ui_file_delete (log);
   /* fundamental */
@@ -1627,10 +1599,9 @@ do
     then
        if class_is_multiarch_p
        then
-           printf "  if (GDB_MULTI_ARCH)\n"
-           printf "    fprintf_unfiltered (file,\n"
-           printf "                        \"gdbarch_dump: gdbarch_${function}_p() = %%d\\\\n\",\n"
-           printf "                        gdbarch_${function}_p (current_gdbarch));\n"
+           printf "  fprintf_unfiltered (file,\n"
+           printf "                      \"gdbarch_dump: gdbarch_${function}_p() = %%d\\\\n\",\n"
+           printf "                      gdbarch_${function}_p (current_gdbarch));\n"
        else
            printf "#ifdef ${macro}_P\n"
            printf "  fprintf_unfiltered (file,\n"
@@ -1646,19 +1617,13 @@ do
     # multiarch functions don't have macros.
     if class_is_multiarch_p
     then
-       printf "  if (GDB_MULTI_ARCH)\n"
-       printf "    fprintf_unfiltered (file,\n"
-       printf "                        \"gdbarch_dump: ${function} = 0x%%08lx\\\\n\",\n"
-       printf "                        (long) current_gdbarch->${function});\n"
+       printf "  fprintf_unfiltered (file,\n"
+       printf "                      \"gdbarch_dump: ${function} = 0x%%08lx\\\\n\",\n"
+       printf "                      (long) current_gdbarch->${function});\n"
        continue
     fi
     # Print the macro definition.
     printf "#ifdef ${macro}\n"
-    if [ "x${returntype}" = "xvoid" ]
-    then
-       printf "#if GDB_MULTI_ARCH\n"
-       printf "  /* Macro might contain \`[{}]' when not multi-arch */\n"
-    fi
     if class_is_function_p
     then
        printf "  fprintf_unfiltered (file,\n"
@@ -1670,11 +1635,6 @@ do
        printf "                      \"gdbarch_dump: ${macro} # %%s\\\\n\",\n"
        printf "                      XSTRING (${macro}));\n"
     fi
-    # Print the architecture vector value
-    if [ "x${returntype}" = "xvoid" ]
-    then
-       printf "#endif\n"
-    fi
     if [ "x${print_p}" = "x()" ]
     then
         printf "  gdbarch_dump_${function} (current_gdbarch);\n"
@@ -1689,11 +1649,10 @@ do
        printf "                        ${print});\n"
     elif class_is_function_p
     then
-       printf "  if (GDB_MULTI_ARCH)\n"
-       printf "    fprintf_unfiltered (file,\n"
-       printf "                        \"gdbarch_dump: ${macro} = <0x%%08lx>\\\\n\",\n"
-       printf "                        (long) current_gdbarch->${function}\n"
-       printf "                        /*${macro} ()*/);\n"
+       printf "  fprintf_unfiltered (file,\n"
+       printf "                      \"gdbarch_dump: ${macro} = <0x%%08lx>\\\\n\",\n"
+       printf "                      (long) current_gdbarch->${function}\n"
+       printf "                      /*${macro} ()*/);\n"
     else
        printf "  fprintf_unfiltered (file,\n"
        printf "                      \"gdbarch_dump: ${macro} = %s\\\\n\",\n" "${fmt}"
@@ -1729,12 +1688,7 @@ do
        printf "gdbarch_${function}_p (struct gdbarch *gdbarch)\n"
        printf "{\n"
         printf "  gdb_assert (gdbarch != NULL);\n"
-       if [ -n "${predicate}" ]
-       then
-           printf "  return ${predicate};\n"
-       else
-           printf "  return gdbarch->${function} != 0;\n"
-       fi
+       printf "  return ${predicate};\n"
        printf "}\n"
     fi
     if class_is_function_p
@@ -1749,13 +1703,11 @@ do
        fi
        printf "{\n"
         printf "  gdb_assert (gdbarch != NULL);\n"
-        printf "  if (gdbarch->${function} == 0)\n"
-        printf "    internal_error (__FILE__, __LINE__,\n"
-       printf "                    \"gdbarch: gdbarch_${function} invalid\");\n"
-       if class_is_predicate_p && test -n "${predicate}"
+       printf "  gdb_assert (gdbarch->${function} != NULL);\n"
+       if class_is_predicate_p && test -n "${predefault}"
        then
            # Allow a call to a function with a predicate.
-           printf "  /* Ignore predicate (${predicate}).  */\n"
+           printf "  /* Do not check predicate: ${predicate}, allow call.  */\n"
        fi
        printf "  if (gdbarch_debug >= 2)\n"
        printf "    fprintf_unfiltered (gdb_stdlog, \"gdbarch_${function} called\\\\n\");\n"
@@ -1801,14 +1753,12 @@ do
            printf "  /* Skip verify of ${function}, invalid_p == 0 */\n"
        elif [ -n "${invalid_p}" ]
        then
-         printf "  if (${invalid_p})\n"
-         printf "    internal_error (__FILE__, __LINE__,\n"
-         printf "                    \"gdbarch: gdbarch_${function} invalid\");\n"
+           printf "  /* Check variable is valid.  */\n"
+           printf "  gdb_assert (!(${invalid_p}));\n"
        elif [ -n "${predefault}" ]
        then
-         printf "  if (gdbarch->${function} == ${predefault})\n"
-         printf "    internal_error (__FILE__, __LINE__,\n"
-         printf "                    \"gdbarch: gdbarch_${function} invalid\");\n"
+           printf "  /* Check variable changed from pre-default.  */\n"
+           printf "  gdb_assert (gdbarch->${function} != ${predefault});\n"
        fi
        printf "  if (gdbarch_debug >= 2)\n"
        printf "    fprintf_unfiltered (gdb_stdlog, \"gdbarch_${function} called\\\\n\");\n"
@@ -1847,7 +1797,6 @@ struct gdbarch_data
   unsigned index;
   int init_p;
   gdbarch_data_init_ftype *init;
-  gdbarch_data_free_ftype *free;
 };
 
 struct gdbarch_data_registration
@@ -1868,8 +1817,7 @@ struct gdbarch_data_registry gdbarch_data_registry =
 };
 
 struct gdbarch_data *
-register_gdbarch_data (gdbarch_data_init_ftype *init,
-                       gdbarch_data_free_ftype *free)
+register_gdbarch_data (gdbarch_data_init_ftype *init)
 {
   struct gdbarch_data_registration **curr;
   /* Append the new registraration.  */
@@ -1882,7 +1830,6 @@ register_gdbarch_data (gdbarch_data_init_ftype *init,
   (*curr)->data->index = gdbarch_data_registry.nr++;
   (*curr)->data->init = init;
   (*curr)->data->init_p = 1;
-  (*curr)->data->free = free;
   return (*curr)->data;
 }
 
@@ -1894,31 +1841,9 @@ alloc_gdbarch_data (struct gdbarch *gdbarch)
 {
   gdb_assert (gdbarch->data == NULL);
   gdbarch->nr_data = gdbarch_data_registry.nr;
-  gdbarch->data = xcalloc (gdbarch->nr_data, sizeof (void*));
-}
-
-static void
-free_gdbarch_data (struct gdbarch *gdbarch)
-{
-  struct gdbarch_data_registration *rego;
-  gdb_assert (gdbarch->data != NULL);
-  for (rego = gdbarch_data_registry.registrations;
-       rego != NULL;
-       rego = rego->next)
-    {
-      struct gdbarch_data *data = rego->data;
-      gdb_assert (data->index < gdbarch->nr_data);
-      if (data->free != NULL && gdbarch->data[data->index] != NULL)
-        {
-          data->free (gdbarch, gdbarch->data[data->index]);
-          gdbarch->data[data->index] = NULL;
-        }
-    }
-  xfree (gdbarch->data);
-  gdbarch->data = NULL;
+  gdbarch->data = GDBARCH_OBSTACK_CALLOC (gdbarch, gdbarch->nr_data, void *);
 }
 
-
 /* Initialize the current value of the specified per-architecture
    data-pointer. */
 
@@ -1928,11 +1853,7 @@ set_gdbarch_data (struct gdbarch *gdbarch,
                   void *pointer)
 {
   gdb_assert (data->index < gdbarch->nr_data);
-  if (gdbarch->data[data->index] != NULL)
-    {
-      gdb_assert (data->free != NULL);
-      data->free (gdbarch, gdbarch->data[data->index]);
-    }
+  gdb_assert (gdbarch->data[data->index] == NULL);
   gdbarch->data[data->index] = pointer;
 }
 
@@ -2029,9 +1950,9 @@ init_gdbarch_swap (struct gdbarch *gdbarch)
     {
       if (rego->data != NULL)
        {
-         (*curr) = XMALLOC (struct gdbarch_swap);
+         (*curr) = GDBARCH_OBSTACK_ZALLOC (gdbarch, struct gdbarch_swap);
          (*curr)->source = rego;
-         (*curr)->swap = xmalloc (rego->sizeof_data);
+         (*curr)->swap = gdbarch_obstack_zalloc (gdbarch, rego->sizeof_data);
          (*curr)->next = NULL;
          curr = &(*curr)->next;
        }
@@ -2085,37 +2006,30 @@ append_name (const char ***buf, int *nr, const char *name)
 const char **
 gdbarch_printable_names (void)
 {
-  if (GDB_MULTI_ARCH)
+  /* Accumulate a list of names based on the registed list of
+     architectures. */
+  enum bfd_architecture a;
+  int nr_arches = 0;
+  const char **arches = NULL;
+  struct gdbarch_registration *rego;
+  for (rego = gdbarch_registry;
+       rego != NULL;
+       rego = rego->next)
     {
-      /* Accumulate a list of names based on the registed list of
-         architectures. */
-      enum bfd_architecture a;
-      int nr_arches = 0;
-      const char **arches = NULL;
-      struct gdbarch_registration *rego;
-      for (rego = gdbarch_registry;
-          rego != NULL;
-          rego = rego->next)
-       {
-         const struct bfd_arch_info *ap;
-         ap = bfd_lookup_arch (rego->bfd_architecture, 0);
-         if (ap == NULL)
-           internal_error (__FILE__, __LINE__,
-                            "gdbarch_architecture_names: multi-arch unknown");
-         do
-           {
-             append_name (&arches, &nr_arches, ap->printable_name);
-             ap = ap->next;
-           }
-         while (ap != NULL);
-       }
-      append_name (&arches, &nr_arches, NULL);
-      return arches;
+      const struct bfd_arch_info *ap;
+      ap = bfd_lookup_arch (rego->bfd_architecture, 0);
+      if (ap == NULL)
+        internal_error (__FILE__, __LINE__,
+                        "gdbarch_architecture_names: multi-arch unknown");
+      do
+        {
+          append_name (&arches, &nr_arches, ap->printable_name);
+          ap = ap->next;
+        }
+      while (ap != NULL);
     }
-  else
-    /* Just return all the architectures that BFD knows.  Assume that
-       the legacy architecture framework supports them. */
-    return bfd_arch_list ();
+  append_name (&arches, &nr_arches, NULL);
+  return arches;
 }
 
 
@@ -2156,12 +2070,6 @@ gdbarch_register (enum bfd_architecture bfd_architecture,
   (*curr)->dump_tdep = dump_tdep;
   (*curr)->arches = NULL;
   (*curr)->next = NULL;
-  /* When non- multi-arch, install whatever target dump routine we've
-     been provided - hopefully that routine has been written correctly
-     and works regardless of multi-arch. */
-  if (!GDB_MULTI_ARCH && dump_tdep != NULL
-      && startup_gdbarch.dump_tdep == NULL)
-    startup_gdbarch.dump_tdep = dump_tdep;
 }
 
 void
@@ -2393,11 +2301,6 @@ gdbarch_update_p (struct gdbarch_info info)
 }
 
 
-/* Disassembler */
-
-/* Pointer to the target-dependent disassembly function.  */
-int (*deprecated_tm_print_insn) (bfd_vma, disassemble_info *);
-
 extern void _initialize_gdbarch (void);
 
 void
This page took 0.067769 seconds and 4 git commands to generate.