X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=gdb%2Fgdbarch.c;h=31993f189978a0208b69df87049cacca817ab2ad;hb=66b43ecb0f97cb826fa1595098a8fb0e7dc8a7c9;hp=a32eafa3f81961aea236ba0a60ae53dc6916708b;hpb=fba45db2faf619e71856ee38ec63949c0ef6903e;p=deliverable%2Fbinutils-gdb.git diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c index a32eafa3f8..31993f1899 100644 --- a/gdb/gdbarch.c +++ b/gdb/gdbarch.c @@ -128,8 +128,6 @@ struct gdbarch */ - int bfd_vma_bit; - int ptr_bit; int short_bit; int int_bit; int long_bit; @@ -137,6 +135,8 @@ struct gdbarch int float_bit; int double_bit; int long_double_bit; + int ptr_bit; + int bfd_vma_bit; int ieee_float; gdbarch_read_pc_ftype *read_pc; gdbarch_write_pc_ftype *write_pc; @@ -161,6 +161,8 @@ struct gdbarch gdbarch_register_virtual_size_ftype *register_virtual_size; int max_register_virtual_size; gdbarch_register_virtual_type_ftype *register_virtual_type; + gdbarch_do_registers_info_ftype *do_registers_info; + gdbarch_register_sim_regno_ftype *register_sim_regno; int use_generic_dummy_frames; int call_dummy_location; gdbarch_call_dummy_address_ftype *call_dummy_address; @@ -223,6 +225,7 @@ struct gdbarch gdbarch_saved_pc_after_call_ftype *saved_pc_after_call; gdbarch_frame_num_args_ftype *frame_num_args; gdbarch_stack_align_ftype *stack_align; + int extra_stack_alignment_needed; gdbarch_reg_struct_has_addr_ftype *reg_struct_has_addr; gdbarch_save_dummy_frame_tos_ftype *save_dummy_frame_tos; const struct floatformat * float_format; @@ -246,8 +249,6 @@ struct gdbarch startup_gdbarch = /*per-architecture data-pointers and swap regions */ 0, NULL, NULL, /* Multi-arch values */ - 8 * sizeof (void*), - 8 * sizeof (void*), 8 * sizeof (short), 8 * sizeof (int), 8 * sizeof (long), @@ -255,6 +256,10 @@ struct gdbarch startup_gdbarch = 8 * sizeof (float), 8 * sizeof (double), 8 * sizeof (long double), + 8 * sizeof (void*), + 8 * sizeof (void*), + 0, + 0, 0, 0, 0, @@ -346,13 +351,14 @@ struct gdbarch startup_gdbarch = 0, 0, 0, + 0, /* startup_gdbarch() */ }; struct gdbarch *current_gdbarch = &startup_gdbarch; -/* Create a new ``struct gdbarch'' based in information provided by +/* Create a new ``struct gdbarch'' based on information provided by ``struct gdbarch_info''. */ struct gdbarch * @@ -368,6 +374,14 @@ gdbarch_alloc (const struct gdbarch_info *info, gdbarch->byte_order = info->byte_order; /* Force the explicit initialization of these. */ + gdbarch->short_bit = 2*TARGET_CHAR_BIT; + gdbarch->int_bit = 4*TARGET_CHAR_BIT; + gdbarch->long_bit = 4*TARGET_CHAR_BIT; + gdbarch->long_long_bit = 2*TARGET_LONG_BIT; + gdbarch->float_bit = 4*TARGET_CHAR_BIT; + gdbarch->double_bit = 8*TARGET_CHAR_BIT; + gdbarch->long_double_bit = 2*TARGET_DOUBLE_BIT; + gdbarch->ptr_bit = TARGET_INT_BIT; gdbarch->bfd_vma_bit = TARGET_ARCHITECTURE->bits_per_address; gdbarch->num_regs = -1; gdbarch->sp_regnum = -1; @@ -381,6 +395,8 @@ gdbarch_alloc (const struct gdbarch_info *info, gdbarch->register_bytes = -1; gdbarch->max_register_raw_size = -1; gdbarch->max_register_virtual_size = -1; + gdbarch->do_registers_info = do_registers_info; + gdbarch->register_sim_regno = default_register_sim_regno; gdbarch->use_generic_dummy_frames = -1; gdbarch->call_dummy_start_offset = -1; gdbarch->call_dummy_breakpoint_offset = -1; @@ -404,6 +420,7 @@ gdbarch_alloc (const struct gdbarch_info *info, gdbarch->remote_translate_xfer_address = generic_remote_translate_xfer_address; gdbarch->frame_args_skip = -1; gdbarch->frameless_function_invocation = generic_frameless_function_invocation_not; + gdbarch->extra_stack_alignment_needed = 1; /* gdbarch_alloc() */ return gdbarch; @@ -438,31 +455,15 @@ verify_gdbarch (struct gdbarch *gdbarch) if (gdbarch->bfd_arch_info == NULL) internal_error ("verify_gdbarch: bfd_arch_info unset"); /* Check those that need to be defined for the given multi-arch level. */ + /* Skip verify of short_bit, invalid_p == 0 */ + /* Skip verify of int_bit, invalid_p == 0 */ + /* Skip verify of long_bit, invalid_p == 0 */ + /* Skip verify of long_long_bit, invalid_p == 0 */ + /* Skip verify of float_bit, invalid_p == 0 */ + /* Skip verify of double_bit, invalid_p == 0 */ + /* Skip verify of long_double_bit, invalid_p == 0 */ + /* Skip verify of ptr_bit, invalid_p == 0 */ /* Skip verify of bfd_vma_bit, invalid_p == 0 */ - if ((GDB_MULTI_ARCH >= 1) - && (gdbarch->ptr_bit == 0)) - internal_error ("gdbarch: verify_gdbarch: ptr_bit invalid"); - if ((GDB_MULTI_ARCH >= 1) - && (gdbarch->short_bit == 0)) - internal_error ("gdbarch: verify_gdbarch: short_bit invalid"); - if ((GDB_MULTI_ARCH >= 1) - && (gdbarch->int_bit == 0)) - internal_error ("gdbarch: verify_gdbarch: int_bit invalid"); - if ((GDB_MULTI_ARCH >= 1) - && (gdbarch->long_bit == 0)) - internal_error ("gdbarch: verify_gdbarch: long_bit invalid"); - if ((GDB_MULTI_ARCH >= 1) - && (gdbarch->long_long_bit == 0)) - internal_error ("gdbarch: verify_gdbarch: long_long_bit invalid"); - if ((GDB_MULTI_ARCH >= 1) - && (gdbarch->float_bit == 0)) - internal_error ("gdbarch: verify_gdbarch: float_bit invalid"); - if ((GDB_MULTI_ARCH >= 1) - && (gdbarch->double_bit == 0)) - internal_error ("gdbarch: verify_gdbarch: double_bit invalid"); - if ((GDB_MULTI_ARCH >= 1) - && (gdbarch->long_double_bit == 0)) - internal_error ("gdbarch: verify_gdbarch: long_double_bit invalid"); /* Skip verify of ieee_float, invalid_p == 0 */ if ((GDB_MULTI_ARCH >= 1) && (gdbarch->read_pc == 0)) @@ -523,6 +524,8 @@ verify_gdbarch (struct gdbarch *gdbarch) if ((GDB_MULTI_ARCH >= 2) && (gdbarch->register_virtual_type == 0)) internal_error ("gdbarch: verify_gdbarch: register_virtual_type invalid"); + /* Skip verify of do_registers_info, invalid_p == 0 */ + /* Skip verify of register_sim_regno, invalid_p == 0 */ if ((GDB_MULTI_ARCH >= 1) && (gdbarch->use_generic_dummy_frames == -1)) internal_error ("gdbarch: verify_gdbarch: use_generic_dummy_frames invalid"); @@ -655,6 +658,7 @@ verify_gdbarch (struct gdbarch *gdbarch) && (gdbarch->frame_num_args == 0)) internal_error ("gdbarch: verify_gdbarch: frame_num_args invalid"); /* Skip verify of stack_align, has predicate */ + /* Skip verify of extra_stack_alignment_needed, invalid_p == 0 */ /* Skip verify of reg_struct_has_addr, has predicate */ /* Skip verify of save_dummy_frame_tos, has predicate */ if (gdbarch->float_format == 0) @@ -690,16 +694,6 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file) "gdbarch_dump: TARGET_BYTE_ORDER # %s\n", XSTRING (TARGET_BYTE_ORDER)); #endif -#ifdef TARGET_BFD_VMA_BIT - fprintf_unfiltered (file, - "gdbarch_dump: TARGET_BFD_VMA_BIT # %s\n", - XSTRING (TARGET_BFD_VMA_BIT)); -#endif -#ifdef TARGET_PTR_BIT - fprintf_unfiltered (file, - "gdbarch_dump: TARGET_PTR_BIT # %s\n", - XSTRING (TARGET_PTR_BIT)); -#endif #ifdef TARGET_SHORT_BIT fprintf_unfiltered (file, "gdbarch_dump: TARGET_SHORT_BIT # %s\n", @@ -735,6 +729,16 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file) "gdbarch_dump: TARGET_LONG_DOUBLE_BIT # %s\n", XSTRING (TARGET_LONG_DOUBLE_BIT)); #endif +#ifdef TARGET_PTR_BIT + fprintf_unfiltered (file, + "gdbarch_dump: TARGET_PTR_BIT # %s\n", + XSTRING (TARGET_PTR_BIT)); +#endif +#ifdef TARGET_BFD_VMA_BIT + fprintf_unfiltered (file, + "gdbarch_dump: TARGET_BFD_VMA_BIT # %s\n", + XSTRING (TARGET_BFD_VMA_BIT)); +#endif #ifdef IEEE_FLOAT fprintf_unfiltered (file, "gdbarch_dump: IEEE_FLOAT # %s\n", @@ -869,6 +873,19 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file) "REGISTER_VIRTUAL_TYPE(reg_nr)", XSTRING (REGISTER_VIRTUAL_TYPE (reg_nr))); #endif +#if defined (DO_REGISTERS_INFO) && GDB_MULTI_ARCH + /* Macro might contain `[{}]' when not multi-arch */ + fprintf_unfiltered (file, + "gdbarch_dump: %s # %s\n", + "DO_REGISTERS_INFO(reg_nr, fpregs)", + XSTRING (DO_REGISTERS_INFO (reg_nr, fpregs))); +#endif +#ifdef REGISTER_SIM_REGNO + fprintf_unfiltered (file, + "gdbarch_dump: %s # %s\n", + "REGISTER_SIM_REGNO(reg_nr)", + XSTRING (REGISTER_SIM_REGNO (reg_nr))); +#endif #ifdef USE_GENERIC_DUMMY_FRAMES fprintf_unfiltered (file, "gdbarch_dump: USE_GENERIC_DUMMY_FRAMES # %s\n", @@ -1240,6 +1257,11 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file) "STACK_ALIGN(sp)", XSTRING (STACK_ALIGN (sp))); #endif +#ifdef EXTRA_STACK_ALIGNMENT_NEEDED + fprintf_unfiltered (file, + "gdbarch_dump: EXTRA_STACK_ALIGNMENT_NEEDED # %s\n", + XSTRING (EXTRA_STACK_ALIGNMENT_NEEDED)); +#endif #ifdef REG_STRUCT_HAS_ADDR fprintf_unfiltered (file, "gdbarch_dump: %s # %s\n", @@ -1279,16 +1301,6 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file) "gdbarch_dump: TARGET_BYTE_ORDER = %ld\n", (long) TARGET_BYTE_ORDER); #endif -#ifdef TARGET_BFD_VMA_BIT - fprintf_unfiltered (file, - "gdbarch_dump: TARGET_BFD_VMA_BIT = %ld\n", - (long) TARGET_BFD_VMA_BIT); -#endif -#ifdef TARGET_PTR_BIT - fprintf_unfiltered (file, - "gdbarch_dump: TARGET_PTR_BIT = %ld\n", - (long) TARGET_PTR_BIT); -#endif #ifdef TARGET_SHORT_BIT fprintf_unfiltered (file, "gdbarch_dump: TARGET_SHORT_BIT = %ld\n", @@ -1324,6 +1336,16 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file) "gdbarch_dump: TARGET_LONG_DOUBLE_BIT = %ld\n", (long) TARGET_LONG_DOUBLE_BIT); #endif +#ifdef TARGET_PTR_BIT + fprintf_unfiltered (file, + "gdbarch_dump: TARGET_PTR_BIT = %ld\n", + (long) TARGET_PTR_BIT); +#endif +#ifdef TARGET_BFD_VMA_BIT + fprintf_unfiltered (file, + "gdbarch_dump: TARGET_BFD_VMA_BIT = %ld\n", + (long) TARGET_BFD_VMA_BIT); +#endif #ifdef IEEE_FLOAT fprintf_unfiltered (file, "gdbarch_dump: IEEE_FLOAT = %ld\n", @@ -1466,6 +1488,20 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file) (long) current_gdbarch->register_virtual_type /*REGISTER_VIRTUAL_TYPE ()*/); #endif +#ifdef DO_REGISTERS_INFO + if (GDB_MULTI_ARCH) + fprintf_unfiltered (file, + "gdbarch_dump: DO_REGISTERS_INFO = 0x%08lx\n", + (long) current_gdbarch->do_registers_info + /*DO_REGISTERS_INFO ()*/); +#endif +#ifdef REGISTER_SIM_REGNO + if (GDB_MULTI_ARCH) + fprintf_unfiltered (file, + "gdbarch_dump: REGISTER_SIM_REGNO = 0x%08lx\n", + (long) current_gdbarch->register_sim_regno + /*REGISTER_SIM_REGNO ()*/); +#endif #ifdef USE_GENERIC_DUMMY_FRAMES fprintf_unfiltered (file, "gdbarch_dump: USE_GENERIC_DUMMY_FRAMES = %ld\n", @@ -1489,9 +1525,10 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file) (long) CALL_DUMMY_START_OFFSET); #endif #ifdef CALL_DUMMY_BREAKPOINT_OFFSET - fprintf_unfiltered (file, - "gdbarch_dump: CALL_DUMMY_BREAKPOINT_OFFSET = 0x%08lx\n", - (long) CALL_DUMMY_BREAKPOINT_OFFSET); + if (CALL_DUMMY_BREAKPOINT_OFFSET_P) + fprintf_unfiltered (file, + "gdbarch_dump: CALL_DUMMY_BREAKPOINT_OFFSET = 0x%08lx\n", + (long) CALL_DUMMY_BREAKPOINT_OFFSET); #endif #ifdef CALL_DUMMY_BREAKPOINT_OFFSET_P fprintf_unfiltered (file, @@ -1870,6 +1907,11 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file) (long) current_gdbarch->stack_align /*STACK_ALIGN ()*/); #endif +#ifdef EXTRA_STACK_ALIGNMENT_NEEDED + fprintf_unfiltered (file, + "gdbarch_dump: EXTRA_STACK_ALIGNMENT_NEEDED = %ld\n", + (long) EXTRA_STACK_ALIGNMENT_NEEDED); +#endif #ifdef REG_STRUCT_HAS_ADDR if (GDB_MULTI_ARCH) fprintf_unfiltered (file, @@ -1928,44 +1970,10 @@ gdbarch_byte_order (struct gdbarch *gdbarch) return gdbarch->byte_order; } -int -gdbarch_bfd_vma_bit (struct gdbarch *gdbarch) -{ - /* Skip verify of bfd_vma_bit, invalid_p == 0 */ - if (gdbarch_debug >= 2) - fprintf_unfiltered (gdb_stdlog, "gdbarch_bfd_vma_bit called\n"); - return gdbarch->bfd_vma_bit; -} - -void -set_gdbarch_bfd_vma_bit (struct gdbarch *gdbarch, - int bfd_vma_bit) -{ - gdbarch->bfd_vma_bit = bfd_vma_bit; -} - -int -gdbarch_ptr_bit (struct gdbarch *gdbarch) -{ - if (gdbarch->ptr_bit == 0) - internal_error ("gdbarch: gdbarch_ptr_bit invalid"); - if (gdbarch_debug >= 2) - fprintf_unfiltered (gdb_stdlog, "gdbarch_ptr_bit called\n"); - return gdbarch->ptr_bit; -} - -void -set_gdbarch_ptr_bit (struct gdbarch *gdbarch, - int ptr_bit) -{ - gdbarch->ptr_bit = ptr_bit; -} - int gdbarch_short_bit (struct gdbarch *gdbarch) { - if (gdbarch->short_bit == 0) - internal_error ("gdbarch: gdbarch_short_bit invalid"); + /* Skip verify of short_bit, invalid_p == 0 */ if (gdbarch_debug >= 2) fprintf_unfiltered (gdb_stdlog, "gdbarch_short_bit called\n"); return gdbarch->short_bit; @@ -1981,8 +1989,7 @@ set_gdbarch_short_bit (struct gdbarch *gdbarch, int gdbarch_int_bit (struct gdbarch *gdbarch) { - if (gdbarch->int_bit == 0) - internal_error ("gdbarch: gdbarch_int_bit invalid"); + /* Skip verify of int_bit, invalid_p == 0 */ if (gdbarch_debug >= 2) fprintf_unfiltered (gdb_stdlog, "gdbarch_int_bit called\n"); return gdbarch->int_bit; @@ -1998,8 +2005,7 @@ set_gdbarch_int_bit (struct gdbarch *gdbarch, int gdbarch_long_bit (struct gdbarch *gdbarch) { - if (gdbarch->long_bit == 0) - internal_error ("gdbarch: gdbarch_long_bit invalid"); + /* Skip verify of long_bit, invalid_p == 0 */ if (gdbarch_debug >= 2) fprintf_unfiltered (gdb_stdlog, "gdbarch_long_bit called\n"); return gdbarch->long_bit; @@ -2015,8 +2021,7 @@ set_gdbarch_long_bit (struct gdbarch *gdbarch, int gdbarch_long_long_bit (struct gdbarch *gdbarch) { - if (gdbarch->long_long_bit == 0) - internal_error ("gdbarch: gdbarch_long_long_bit invalid"); + /* Skip verify of long_long_bit, invalid_p == 0 */ if (gdbarch_debug >= 2) fprintf_unfiltered (gdb_stdlog, "gdbarch_long_long_bit called\n"); return gdbarch->long_long_bit; @@ -2032,8 +2037,7 @@ set_gdbarch_long_long_bit (struct gdbarch *gdbarch, int gdbarch_float_bit (struct gdbarch *gdbarch) { - if (gdbarch->float_bit == 0) - internal_error ("gdbarch: gdbarch_float_bit invalid"); + /* Skip verify of float_bit, invalid_p == 0 */ if (gdbarch_debug >= 2) fprintf_unfiltered (gdb_stdlog, "gdbarch_float_bit called\n"); return gdbarch->float_bit; @@ -2049,8 +2053,7 @@ set_gdbarch_float_bit (struct gdbarch *gdbarch, int gdbarch_double_bit (struct gdbarch *gdbarch) { - if (gdbarch->double_bit == 0) - internal_error ("gdbarch: gdbarch_double_bit invalid"); + /* Skip verify of double_bit, invalid_p == 0 */ if (gdbarch_debug >= 2) fprintf_unfiltered (gdb_stdlog, "gdbarch_double_bit called\n"); return gdbarch->double_bit; @@ -2066,8 +2069,7 @@ set_gdbarch_double_bit (struct gdbarch *gdbarch, int gdbarch_long_double_bit (struct gdbarch *gdbarch) { - if (gdbarch->long_double_bit == 0) - internal_error ("gdbarch: gdbarch_long_double_bit invalid"); + /* Skip verify of long_double_bit, invalid_p == 0 */ if (gdbarch_debug >= 2) fprintf_unfiltered (gdb_stdlog, "gdbarch_long_double_bit called\n"); return gdbarch->long_double_bit; @@ -2080,6 +2082,38 @@ set_gdbarch_long_double_bit (struct gdbarch *gdbarch, gdbarch->long_double_bit = long_double_bit; } +int +gdbarch_ptr_bit (struct gdbarch *gdbarch) +{ + /* Skip verify of ptr_bit, invalid_p == 0 */ + if (gdbarch_debug >= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_ptr_bit called\n"); + return gdbarch->ptr_bit; +} + +void +set_gdbarch_ptr_bit (struct gdbarch *gdbarch, + int ptr_bit) +{ + gdbarch->ptr_bit = ptr_bit; +} + +int +gdbarch_bfd_vma_bit (struct gdbarch *gdbarch) +{ + /* Skip verify of bfd_vma_bit, invalid_p == 0 */ + if (gdbarch_debug >= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_bfd_vma_bit called\n"); + return gdbarch->bfd_vma_bit; +} + +void +set_gdbarch_bfd_vma_bit (struct gdbarch *gdbarch, + int bfd_vma_bit) +{ + gdbarch->bfd_vma_bit = bfd_vma_bit; +} + int gdbarch_ieee_float (struct gdbarch *gdbarch) { @@ -2483,6 +2517,40 @@ set_gdbarch_register_virtual_type (struct gdbarch *gdbarch, gdbarch->register_virtual_type = register_virtual_type; } +void +gdbarch_do_registers_info (struct gdbarch *gdbarch, int reg_nr, int fpregs) +{ + if (gdbarch->do_registers_info == 0) + internal_error ("gdbarch: gdbarch_do_registers_info invalid"); + if (gdbarch_debug >= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_do_registers_info called\n"); + gdbarch->do_registers_info (reg_nr, fpregs); +} + +void +set_gdbarch_do_registers_info (struct gdbarch *gdbarch, + gdbarch_do_registers_info_ftype do_registers_info) +{ + gdbarch->do_registers_info = do_registers_info; +} + +int +gdbarch_register_sim_regno (struct gdbarch *gdbarch, int reg_nr) +{ + if (gdbarch->register_sim_regno == 0) + internal_error ("gdbarch: gdbarch_register_sim_regno invalid"); + if (gdbarch_debug >= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_register_sim_regno called\n"); + return gdbarch->register_sim_regno (reg_nr); +} + +void +set_gdbarch_register_sim_regno (struct gdbarch *gdbarch, + gdbarch_register_sim_regno_ftype register_sim_regno) +{ + gdbarch->register_sim_regno = register_sim_regno; +} + int gdbarch_use_generic_dummy_frames (struct gdbarch *gdbarch) { @@ -3537,6 +3605,22 @@ set_gdbarch_stack_align (struct gdbarch *gdbarch, gdbarch->stack_align = stack_align; } +int +gdbarch_extra_stack_alignment_needed (struct gdbarch *gdbarch) +{ + /* Skip verify of extra_stack_alignment_needed, invalid_p == 0 */ + if (gdbarch_debug >= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_extra_stack_alignment_needed called\n"); + return gdbarch->extra_stack_alignment_needed; +} + +void +set_gdbarch_extra_stack_alignment_needed (struct gdbarch *gdbarch, + int extra_stack_alignment_needed) +{ + gdbarch->extra_stack_alignment_needed = extra_stack_alignment_needed; +} + int gdbarch_reg_struct_has_addr_p (struct gdbarch *gdbarch) { @@ -3921,7 +4005,7 @@ gdbarch_list_lookup_by_info (struct gdbarch_list *arches, failed. */ int -gdbarch_update (struct gdbarch_info info) +gdbarch_update_p (struct gdbarch_info info) { struct gdbarch *new_gdbarch; struct gdbarch_list **list;