From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2126) id 752EB3857BA6; Thu, 4 Aug 2022 19:33:44 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 752EB3857BA6 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Tom Tromey To: gdb-cvs@sourceware.org Subject: [binutils-gdb] Use new and delete for gdbarch X-Act-Checkin: binutils-gdb X-Git-Author: Tom Tromey X-Git-Refname: refs/heads/master X-Git-Oldrev: 0655397b573d93fe543d6ec4bd0e00e8b3ff5d81 X-Git-Newrev: b987c79ac133c303adefad5caff19c530f86b7a4 Message-Id: <20220804193344.752EB3857BA6@sourceware.org> Date: Thu, 4 Aug 2022 19:33:44 +0000 (GMT) X-BeenThere: gdb-cvs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 Aug 2022 19:33:44 -0000 https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3Db987c79ac133= c303adefad5caff19c530f86b7a4 commit b987c79ac133c303adefad5caff19c530f86b7a4 Author: Tom Tromey Date: Wed Jun 1 13:13:28 2022 -0600 Use new and delete for gdbarch =20 This changes gdbarch to use new and delete. Diff: --- gdb/arch-utils.c | 12 +- gdb/gdbarch.c | 424 +++++++++++++++++++++++++++------------------------= ---- gdb/gdbarch.py | 26 ++-- 3 files changed, 222 insertions(+), 240 deletions(-) diff --git a/gdb/arch-utils.c b/gdb/arch-utils.c index e92004f1c93..295dfc2aaf7 100644 --- a/gdb/arch-utils.c +++ b/gdb/arch-utils.c @@ -1168,7 +1168,7 @@ pstring_list (const char *const *list) =20 obstack *gdbarch_obstack (gdbarch *arch) { - return arch->obstack; + return &arch->obstack; } =20 /* See gdbarch.h. */ @@ -1176,7 +1176,7 @@ obstack *gdbarch_obstack (gdbarch *arch) char * gdbarch_obstack_strdup (struct gdbarch *arch, const char *string) { - return obstack_strdup (arch->obstack, string); + return obstack_strdup (&arch->obstack, string); } =20 =20 @@ -1189,13 +1189,9 @@ gdbarch_obstack_strdup (struct gdbarch *arch, const = char *string) void gdbarch_free (struct gdbarch *arch) { - struct obstack *obstack; - gdb_assert (arch !=3D NULL); gdb_assert (!arch->initialized_p); - obstack =3D arch->obstack; - obstack_free (obstack, 0); /* Includes the ARCH. */ - xfree (obstack); + delete arch; } =20 /* See gdbarch.h. */ @@ -1294,7 +1290,7 @@ gdbarch_data (struct gdbarch *gdbarch, struct gdbarch= _data *data) the entire architecture, as that way it isn't possible for pre-init code to refer to undefined architecture fields. */ - gdbarch->data[data->index] =3D data->pre_init (gdbarch->obstack); + gdbarch->data[data->index] =3D data->pre_init (&gdbarch->obstack); else if (gdbarch->initialized_p && data->post_init !=3D NULL) /* Post architecture creation: pass the entire architecture diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c index 800d9196ea7..15897172f10 100644 --- a/gdb/gdbarch.c +++ b/gdb/gdbarch.c @@ -30,10 +30,10 @@ struct gdbarch { /* Has this architecture been fully initialized? */ - bool initialized_p; + bool initialized_p =3D false; =20 /* An obstack bound to the lifetime of the architecture. */ - struct obstack *obstack; + auto_obstack obstack; =20 /* basic architectural information. */ const struct bfd_arch_info * bfd_arch_info; @@ -43,214 +43,214 @@ struct gdbarch const struct target_desc * target_desc; =20 /* target specific vector. */ - struct gdbarch_tdep_base *tdep; - gdbarch_dump_tdep_ftype *dump_tdep; + struct gdbarch_tdep_base *tdep =3D nullptr; + gdbarch_dump_tdep_ftype *dump_tdep =3D nullptr; =20 /* per-architecture data-pointers. */ - unsigned nr_data; - void **data; - - int short_bit; - int int_bit; - int long_bit; - int long_long_bit; - int bfloat16_bit; - const struct floatformat ** bfloat16_format; - int half_bit; - const struct floatformat ** half_format; - int float_bit; - const struct floatformat ** float_format; - int double_bit; - const struct floatformat ** double_format; - int long_double_bit; - const struct floatformat ** long_double_format; - int wchar_bit; - int wchar_signed; - gdbarch_floatformat_for_type_ftype *floatformat_for_type; - int ptr_bit; - int addr_bit; - int dwarf2_addr_size; - int char_signed; - gdbarch_read_pc_ftype *read_pc; - gdbarch_write_pc_ftype *write_pc; - gdbarch_virtual_frame_pointer_ftype *virtual_frame_pointer; - gdbarch_pseudo_register_read_ftype *pseudo_register_read; - gdbarch_pseudo_register_read_value_ftype *pseudo_register_read_value; - gdbarch_pseudo_register_write_ftype *pseudo_register_write; - int num_regs; - int num_pseudo_regs; - gdbarch_ax_pseudo_register_collect_ftype *ax_pseudo_register_collect; - gdbarch_ax_pseudo_register_push_stack_ftype *ax_pseudo_register_push_sta= ck; - gdbarch_report_signal_info_ftype *report_signal_info; - int sp_regnum; - int pc_regnum; - int ps_regnum; - int fp0_regnum; - gdbarch_stab_reg_to_regnum_ftype *stab_reg_to_regnum; - gdbarch_ecoff_reg_to_regnum_ftype *ecoff_reg_to_regnum; - gdbarch_sdb_reg_to_regnum_ftype *sdb_reg_to_regnum; - gdbarch_dwarf2_reg_to_regnum_ftype *dwarf2_reg_to_regnum; - gdbarch_register_name_ftype *register_name; - gdbarch_register_type_ftype *register_type; - gdbarch_dummy_id_ftype *dummy_id; - int deprecated_fp_regnum; - gdbarch_push_dummy_call_ftype *push_dummy_call; - int call_dummy_location; - gdbarch_push_dummy_code_ftype *push_dummy_code; - gdbarch_code_of_frame_writable_ftype *code_of_frame_writable; - gdbarch_print_registers_info_ftype *print_registers_info; - gdbarch_print_float_info_ftype *print_float_info; - gdbarch_print_vector_info_ftype *print_vector_info; - gdbarch_register_sim_regno_ftype *register_sim_regno; - gdbarch_cannot_fetch_register_ftype *cannot_fetch_register; - gdbarch_cannot_store_register_ftype *cannot_store_register; - gdbarch_get_longjmp_target_ftype *get_longjmp_target; - int believe_pcc_promotion; - gdbarch_convert_register_p_ftype *convert_register_p; - gdbarch_register_to_value_ftype *register_to_value; - gdbarch_value_to_register_ftype *value_to_register; - gdbarch_value_from_register_ftype *value_from_register; - gdbarch_pointer_to_address_ftype *pointer_to_address; - gdbarch_address_to_pointer_ftype *address_to_pointer; - gdbarch_integer_to_address_ftype *integer_to_address; - gdbarch_return_value_ftype *return_value; - gdbarch_return_in_first_hidden_param_p_ftype *return_in_first_hidden_par= am_p; - gdbarch_skip_prologue_ftype *skip_prologue; - gdbarch_skip_main_prologue_ftype *skip_main_prologue; - gdbarch_skip_entrypoint_ftype *skip_entrypoint; - gdbarch_inner_than_ftype *inner_than; - gdbarch_breakpoint_from_pc_ftype *breakpoint_from_pc; - gdbarch_breakpoint_kind_from_pc_ftype *breakpoint_kind_from_pc; - gdbarch_sw_breakpoint_from_kind_ftype *sw_breakpoint_from_kind; - gdbarch_breakpoint_kind_from_current_state_ftype *breakpoint_kind_from_c= urrent_state; - gdbarch_adjust_breakpoint_address_ftype *adjust_breakpoint_address; - gdbarch_memory_insert_breakpoint_ftype *memory_insert_breakpoint; - gdbarch_memory_remove_breakpoint_ftype *memory_remove_breakpoint; - CORE_ADDR decr_pc_after_break; - CORE_ADDR deprecated_function_start_offset; - gdbarch_remote_register_number_ftype *remote_register_number; - gdbarch_fetch_tls_load_module_address_ftype *fetch_tls_load_module_addre= ss; - gdbarch_get_thread_local_address_ftype *get_thread_local_address; - CORE_ADDR frame_args_skip; - gdbarch_unwind_pc_ftype *unwind_pc; - gdbarch_unwind_sp_ftype *unwind_sp; - gdbarch_frame_num_args_ftype *frame_num_args; - gdbarch_frame_align_ftype *frame_align; - gdbarch_stabs_argument_has_addr_ftype *stabs_argument_has_addr; - int frame_red_zone_size; - gdbarch_convert_from_func_ptr_addr_ftype *convert_from_func_ptr_addr; - gdbarch_addr_bits_remove_ftype *addr_bits_remove; - int significant_addr_bit; - gdbarch_memtag_to_string_ftype *memtag_to_string; - gdbarch_tagged_address_p_ftype *tagged_address_p; - gdbarch_memtag_matches_p_ftype *memtag_matches_p; - gdbarch_set_memtags_ftype *set_memtags; - gdbarch_get_memtag_ftype *get_memtag; - CORE_ADDR memtag_granule_size; - gdbarch_software_single_step_ftype *software_single_step; - gdbarch_single_step_through_delay_ftype *single_step_through_delay; - gdbarch_print_insn_ftype *print_insn; - gdbarch_skip_trampoline_code_ftype *skip_trampoline_code; - gdbarch_skip_solib_resolver_ftype *skip_solib_resolver; - gdbarch_in_solib_return_trampoline_ftype *in_solib_return_trampoline; - gdbarch_in_indirect_branch_thunk_ftype *in_indirect_branch_thunk; - gdbarch_stack_frame_destroyed_p_ftype *stack_frame_destroyed_p; - gdbarch_elf_make_msymbol_special_ftype *elf_make_msymbol_special; - gdbarch_coff_make_msymbol_special_ftype *coff_make_msymbol_special; - gdbarch_make_symbol_special_ftype *make_symbol_special; - gdbarch_adjust_dwarf2_addr_ftype *adjust_dwarf2_addr; - gdbarch_adjust_dwarf2_line_ftype *adjust_dwarf2_line; - int cannot_step_breakpoint; - int have_nonsteppable_watchpoint; - gdbarch_address_class_type_flags_ftype *address_class_type_flags; - gdbarch_address_class_type_flags_to_name_ftype *address_class_type_flags= _to_name; - gdbarch_execute_dwarf_cfa_vendor_op_ftype *execute_dwarf_cfa_vendor_op; - gdbarch_address_class_name_to_type_flags_ftype *address_class_name_to_ty= pe_flags; - gdbarch_register_reggroup_p_ftype *register_reggroup_p; - gdbarch_fetch_pointer_argument_ftype *fetch_pointer_argument; - gdbarch_iterate_over_regset_sections_ftype *iterate_over_regset_sections; - gdbarch_make_corefile_notes_ftype *make_corefile_notes; - gdbarch_find_memory_regions_ftype *find_memory_regions; - gdbarch_create_memtag_section_ftype *create_memtag_section; - gdbarch_fill_memtag_section_ftype *fill_memtag_section; - gdbarch_decode_memtag_section_ftype *decode_memtag_section; - gdbarch_core_xfer_shared_libraries_ftype *core_xfer_shared_libraries; - gdbarch_core_xfer_shared_libraries_aix_ftype *core_xfer_shared_libraries= _aix; - gdbarch_core_pid_to_str_ftype *core_pid_to_str; - gdbarch_core_thread_name_ftype *core_thread_name; - gdbarch_core_xfer_siginfo_ftype *core_xfer_siginfo; - const char * gcore_bfd_target; - int vtable_function_descriptors; - int vbit_in_delta; - gdbarch_skip_permanent_breakpoint_ftype *skip_permanent_breakpoint; - ULONGEST max_insn_length; - gdbarch_displaced_step_copy_insn_ftype *displaced_step_copy_insn; - gdbarch_displaced_step_hw_singlestep_ftype *displaced_step_hw_singlestep; - gdbarch_displaced_step_fixup_ftype *displaced_step_fixup; - gdbarch_displaced_step_prepare_ftype *displaced_step_prepare; - gdbarch_displaced_step_finish_ftype *displaced_step_finish; - gdbarch_displaced_step_copy_insn_closure_by_addr_ftype *displaced_step_c= opy_insn_closure_by_addr; - gdbarch_displaced_step_restore_all_in_ptid_ftype *displaced_step_restore= _all_in_ptid; - gdbarch_relocate_instruction_ftype *relocate_instruction; - gdbarch_overlay_update_ftype *overlay_update; - gdbarch_core_read_description_ftype *core_read_description; - int sofun_address_maybe_missing; - gdbarch_process_record_ftype *process_record; - gdbarch_process_record_signal_ftype *process_record_signal; - gdbarch_gdb_signal_from_target_ftype *gdb_signal_from_target; - gdbarch_gdb_signal_to_target_ftype *gdb_signal_to_target; - gdbarch_get_siginfo_type_ftype *get_siginfo_type; - gdbarch_record_special_symbol_ftype *record_special_symbol; - gdbarch_get_syscall_number_ftype *get_syscall_number; - const char * xml_syscall_file; - struct syscalls_info * syscalls_info; - const char *const * stap_integer_prefixes; - const char *const * stap_integer_suffixes; - const char *const * stap_register_prefixes; - const char *const * stap_register_suffixes; - const char *const * stap_register_indirection_prefixes; - const char *const * stap_register_indirection_suffixes; - const char * stap_gdb_register_prefix; - const char * stap_gdb_register_suffix; - gdbarch_stap_is_single_operand_ftype *stap_is_single_operand; - gdbarch_stap_parse_special_token_ftype *stap_parse_special_token; - gdbarch_stap_adjust_register_ftype *stap_adjust_register; - gdbarch_dtrace_parse_probe_argument_ftype *dtrace_parse_probe_argument; - gdbarch_dtrace_probe_is_enabled_ftype *dtrace_probe_is_enabled; - gdbarch_dtrace_enable_probe_ftype *dtrace_enable_probe; - gdbarch_dtrace_disable_probe_ftype *dtrace_disable_probe; - int has_global_solist; - int has_global_breakpoints; - gdbarch_has_shared_address_space_ftype *has_shared_address_space; - gdbarch_fast_tracepoint_valid_at_ftype *fast_tracepoint_valid_at; - gdbarch_guess_tracepoint_registers_ftype *guess_tracepoint_registers; - gdbarch_auto_charset_ftype *auto_charset; - gdbarch_auto_wide_charset_ftype *auto_wide_charset; - const char * solib_symbols_extension; - int has_dos_based_file_system; - gdbarch_gen_return_address_ftype *gen_return_address; - gdbarch_info_proc_ftype *info_proc; - gdbarch_core_info_proc_ftype *core_info_proc; - gdbarch_iterate_over_objfiles_in_search_order_ftype *iterate_over_objfil= es_in_search_order; - struct ravenscar_arch_ops * ravenscar_ops; - gdbarch_insn_is_call_ftype *insn_is_call; - gdbarch_insn_is_ret_ftype *insn_is_ret; - gdbarch_insn_is_jump_ftype *insn_is_jump; - gdbarch_program_breakpoint_here_p_ftype *program_breakpoint_here_p; - gdbarch_auxv_parse_ftype *auxv_parse; - gdbarch_print_auxv_entry_ftype *print_auxv_entry; - gdbarch_vsyscall_range_ftype *vsyscall_range; - gdbarch_infcall_mmap_ftype *infcall_mmap; - gdbarch_infcall_munmap_ftype *infcall_munmap; - gdbarch_gcc_target_options_ftype *gcc_target_options; - gdbarch_gnu_triplet_regexp_ftype *gnu_triplet_regexp; - gdbarch_addressable_memory_unit_size_ftype *addressable_memory_unit_size; - const char * disassembler_options_implicit; - char ** disassembler_options; - const disasm_options_and_args_t * valid_disassembler_options; - gdbarch_type_align_ftype *type_align; - gdbarch_get_pc_address_flags_ftype *get_pc_address_flags; - gdbarch_read_core_file_mappings_ftype *read_core_file_mappings; + unsigned nr_data =3D 0; + void **data =3D nullptr; + + int short_bit =3D 0; + int int_bit =3D 0; + int long_bit =3D 0; + int long_long_bit =3D 0; + int bfloat16_bit =3D 0; + const struct floatformat ** bfloat16_format =3D 0; + int half_bit =3D 0; + const struct floatformat ** half_format =3D 0; + int float_bit =3D 0; + const struct floatformat ** float_format =3D 0; + int double_bit =3D 0; + const struct floatformat ** double_format =3D 0; + int long_double_bit =3D 0; + const struct floatformat ** long_double_format =3D 0; + int wchar_bit =3D 0; + int wchar_signed =3D 0; + gdbarch_floatformat_for_type_ftype *floatformat_for_type =3D nullptr; + int ptr_bit =3D 0; + int addr_bit =3D 0; + int dwarf2_addr_size =3D 0; + int char_signed =3D 0; + gdbarch_read_pc_ftype *read_pc =3D nullptr; + gdbarch_write_pc_ftype *write_pc =3D nullptr; + gdbarch_virtual_frame_pointer_ftype *virtual_frame_pointer =3D nullptr; + gdbarch_pseudo_register_read_ftype *pseudo_register_read =3D nullptr; + gdbarch_pseudo_register_read_value_ftype *pseudo_register_read_value =3D= nullptr; + gdbarch_pseudo_register_write_ftype *pseudo_register_write =3D nullptr; + int num_regs =3D 0; + int num_pseudo_regs =3D 0; + gdbarch_ax_pseudo_register_collect_ftype *ax_pseudo_register_collect =3D= nullptr; + gdbarch_ax_pseudo_register_push_stack_ftype *ax_pseudo_register_push_sta= ck =3D nullptr; + gdbarch_report_signal_info_ftype *report_signal_info =3D nullptr; + int sp_regnum =3D 0; + int pc_regnum =3D 0; + int ps_regnum =3D 0; + int fp0_regnum =3D 0; + gdbarch_stab_reg_to_regnum_ftype *stab_reg_to_regnum =3D nullptr; + gdbarch_ecoff_reg_to_regnum_ftype *ecoff_reg_to_regnum =3D nullptr; + gdbarch_sdb_reg_to_regnum_ftype *sdb_reg_to_regnum =3D nullptr; + gdbarch_dwarf2_reg_to_regnum_ftype *dwarf2_reg_to_regnum =3D nullptr; + gdbarch_register_name_ftype *register_name =3D nullptr; + gdbarch_register_type_ftype *register_type =3D nullptr; + gdbarch_dummy_id_ftype *dummy_id =3D nullptr; + int deprecated_fp_regnum =3D 0; + gdbarch_push_dummy_call_ftype *push_dummy_call =3D nullptr; + int call_dummy_location =3D 0; + gdbarch_push_dummy_code_ftype *push_dummy_code =3D nullptr; + gdbarch_code_of_frame_writable_ftype *code_of_frame_writable =3D nullptr; + gdbarch_print_registers_info_ftype *print_registers_info =3D nullptr; + gdbarch_print_float_info_ftype *print_float_info =3D nullptr; + gdbarch_print_vector_info_ftype *print_vector_info =3D nullptr; + gdbarch_register_sim_regno_ftype *register_sim_regno =3D nullptr; + gdbarch_cannot_fetch_register_ftype *cannot_fetch_register =3D nullptr; + gdbarch_cannot_store_register_ftype *cannot_store_register =3D nullptr; + gdbarch_get_longjmp_target_ftype *get_longjmp_target =3D nullptr; + int believe_pcc_promotion =3D 0; + gdbarch_convert_register_p_ftype *convert_register_p =3D nullptr; + gdbarch_register_to_value_ftype *register_to_value =3D nullptr; + gdbarch_value_to_register_ftype *value_to_register =3D nullptr; + gdbarch_value_from_register_ftype *value_from_register =3D nullptr; + gdbarch_pointer_to_address_ftype *pointer_to_address =3D nullptr; + gdbarch_address_to_pointer_ftype *address_to_pointer =3D nullptr; + gdbarch_integer_to_address_ftype *integer_to_address =3D nullptr; + gdbarch_return_value_ftype *return_value =3D nullptr; + gdbarch_return_in_first_hidden_param_p_ftype *return_in_first_hidden_par= am_p =3D nullptr; + gdbarch_skip_prologue_ftype *skip_prologue =3D nullptr; + gdbarch_skip_main_prologue_ftype *skip_main_prologue =3D nullptr; + gdbarch_skip_entrypoint_ftype *skip_entrypoint =3D nullptr; + gdbarch_inner_than_ftype *inner_than =3D nullptr; + gdbarch_breakpoint_from_pc_ftype *breakpoint_from_pc =3D nullptr; + gdbarch_breakpoint_kind_from_pc_ftype *breakpoint_kind_from_pc =3D nullp= tr; + gdbarch_sw_breakpoint_from_kind_ftype *sw_breakpoint_from_kind =3D nullp= tr; + gdbarch_breakpoint_kind_from_current_state_ftype *breakpoint_kind_from_c= urrent_state =3D nullptr; + gdbarch_adjust_breakpoint_address_ftype *adjust_breakpoint_address =3D n= ullptr; + gdbarch_memory_insert_breakpoint_ftype *memory_insert_breakpoint =3D nul= lptr; + gdbarch_memory_remove_breakpoint_ftype *memory_remove_breakpoint =3D nul= lptr; + CORE_ADDR decr_pc_after_break =3D 0; + CORE_ADDR deprecated_function_start_offset =3D 0; + gdbarch_remote_register_number_ftype *remote_register_number =3D nullptr; + gdbarch_fetch_tls_load_module_address_ftype *fetch_tls_load_module_addre= ss =3D nullptr; + gdbarch_get_thread_local_address_ftype *get_thread_local_address =3D nul= lptr; + CORE_ADDR frame_args_skip =3D 0; + gdbarch_unwind_pc_ftype *unwind_pc =3D nullptr; + gdbarch_unwind_sp_ftype *unwind_sp =3D nullptr; + gdbarch_frame_num_args_ftype *frame_num_args =3D nullptr; + gdbarch_frame_align_ftype *frame_align =3D nullptr; + gdbarch_stabs_argument_has_addr_ftype *stabs_argument_has_addr =3D nullp= tr; + int frame_red_zone_size =3D 0; + gdbarch_convert_from_func_ptr_addr_ftype *convert_from_func_ptr_addr =3D= nullptr; + gdbarch_addr_bits_remove_ftype *addr_bits_remove =3D nullptr; + int significant_addr_bit =3D 0; + gdbarch_memtag_to_string_ftype *memtag_to_string =3D nullptr; + gdbarch_tagged_address_p_ftype *tagged_address_p =3D nullptr; + gdbarch_memtag_matches_p_ftype *memtag_matches_p =3D nullptr; + gdbarch_set_memtags_ftype *set_memtags =3D nullptr; + gdbarch_get_memtag_ftype *get_memtag =3D nullptr; + CORE_ADDR memtag_granule_size =3D 0; + gdbarch_software_single_step_ftype *software_single_step =3D nullptr; + gdbarch_single_step_through_delay_ftype *single_step_through_delay =3D n= ullptr; + gdbarch_print_insn_ftype *print_insn =3D nullptr; + gdbarch_skip_trampoline_code_ftype *skip_trampoline_code =3D nullptr; + gdbarch_skip_solib_resolver_ftype *skip_solib_resolver =3D nullptr; + gdbarch_in_solib_return_trampoline_ftype *in_solib_return_trampoline =3D= nullptr; + gdbarch_in_indirect_branch_thunk_ftype *in_indirect_branch_thunk =3D nul= lptr; + gdbarch_stack_frame_destroyed_p_ftype *stack_frame_destroyed_p =3D nullp= tr; + gdbarch_elf_make_msymbol_special_ftype *elf_make_msymbol_special =3D nul= lptr; + gdbarch_coff_make_msymbol_special_ftype *coff_make_msymbol_special =3D n= ullptr; + gdbarch_make_symbol_special_ftype *make_symbol_special =3D nullptr; + gdbarch_adjust_dwarf2_addr_ftype *adjust_dwarf2_addr =3D nullptr; + gdbarch_adjust_dwarf2_line_ftype *adjust_dwarf2_line =3D nullptr; + int cannot_step_breakpoint =3D 0; + int have_nonsteppable_watchpoint =3D 0; + gdbarch_address_class_type_flags_ftype *address_class_type_flags =3D nul= lptr; + gdbarch_address_class_type_flags_to_name_ftype *address_class_type_flags= _to_name =3D nullptr; + gdbarch_execute_dwarf_cfa_vendor_op_ftype *execute_dwarf_cfa_vendor_op = =3D nullptr; + gdbarch_address_class_name_to_type_flags_ftype *address_class_name_to_ty= pe_flags =3D nullptr; + gdbarch_register_reggroup_p_ftype *register_reggroup_p =3D nullptr; + gdbarch_fetch_pointer_argument_ftype *fetch_pointer_argument =3D nullptr; + gdbarch_iterate_over_regset_sections_ftype *iterate_over_regset_sections= =3D nullptr; + gdbarch_make_corefile_notes_ftype *make_corefile_notes =3D nullptr; + gdbarch_find_memory_regions_ftype *find_memory_regions =3D nullptr; + gdbarch_create_memtag_section_ftype *create_memtag_section =3D nullptr; + gdbarch_fill_memtag_section_ftype *fill_memtag_section =3D nullptr; + gdbarch_decode_memtag_section_ftype *decode_memtag_section =3D nullptr; + gdbarch_core_xfer_shared_libraries_ftype *core_xfer_shared_libraries =3D= nullptr; + gdbarch_core_xfer_shared_libraries_aix_ftype *core_xfer_shared_libraries= _aix =3D nullptr; + gdbarch_core_pid_to_str_ftype *core_pid_to_str =3D nullptr; + gdbarch_core_thread_name_ftype *core_thread_name =3D nullptr; + gdbarch_core_xfer_siginfo_ftype *core_xfer_siginfo =3D nullptr; + const char * gcore_bfd_target =3D 0; + int vtable_function_descriptors =3D 0; + int vbit_in_delta =3D 0; + gdbarch_skip_permanent_breakpoint_ftype *skip_permanent_breakpoint =3D n= ullptr; + ULONGEST max_insn_length =3D 0; + gdbarch_displaced_step_copy_insn_ftype *displaced_step_copy_insn =3D nul= lptr; + gdbarch_displaced_step_hw_singlestep_ftype *displaced_step_hw_singlestep= =3D nullptr; + gdbarch_displaced_step_fixup_ftype *displaced_step_fixup =3D nullptr; + gdbarch_displaced_step_prepare_ftype *displaced_step_prepare =3D nullptr; + gdbarch_displaced_step_finish_ftype *displaced_step_finish =3D nullptr; + gdbarch_displaced_step_copy_insn_closure_by_addr_ftype *displaced_step_c= opy_insn_closure_by_addr =3D nullptr; + gdbarch_displaced_step_restore_all_in_ptid_ftype *displaced_step_restore= _all_in_ptid =3D nullptr; + gdbarch_relocate_instruction_ftype *relocate_instruction =3D nullptr; + gdbarch_overlay_update_ftype *overlay_update =3D nullptr; + gdbarch_core_read_description_ftype *core_read_description =3D nullptr; + int sofun_address_maybe_missing =3D 0; + gdbarch_process_record_ftype *process_record =3D nullptr; + gdbarch_process_record_signal_ftype *process_record_signal =3D nullptr; + gdbarch_gdb_signal_from_target_ftype *gdb_signal_from_target =3D nullptr; + gdbarch_gdb_signal_to_target_ftype *gdb_signal_to_target =3D nullptr; + gdbarch_get_siginfo_type_ftype *get_siginfo_type =3D nullptr; + gdbarch_record_special_symbol_ftype *record_special_symbol =3D nullptr; + gdbarch_get_syscall_number_ftype *get_syscall_number =3D nullptr; + const char * xml_syscall_file =3D 0; + struct syscalls_info * syscalls_info =3D 0; + const char *const * stap_integer_prefixes =3D 0; + const char *const * stap_integer_suffixes =3D 0; + const char *const * stap_register_prefixes =3D 0; + const char *const * stap_register_suffixes =3D 0; + const char *const * stap_register_indirection_prefixes =3D 0; + const char *const * stap_register_indirection_suffixes =3D 0; + const char * stap_gdb_register_prefix =3D 0; + const char * stap_gdb_register_suffix =3D 0; + gdbarch_stap_is_single_operand_ftype *stap_is_single_operand =3D nullptr; + gdbarch_stap_parse_special_token_ftype *stap_parse_special_token =3D nul= lptr; + gdbarch_stap_adjust_register_ftype *stap_adjust_register =3D nullptr; + gdbarch_dtrace_parse_probe_argument_ftype *dtrace_parse_probe_argument = =3D nullptr; + gdbarch_dtrace_probe_is_enabled_ftype *dtrace_probe_is_enabled =3D nullp= tr; + gdbarch_dtrace_enable_probe_ftype *dtrace_enable_probe =3D nullptr; + gdbarch_dtrace_disable_probe_ftype *dtrace_disable_probe =3D nullptr; + int has_global_solist =3D 0; + int has_global_breakpoints =3D 0; + gdbarch_has_shared_address_space_ftype *has_shared_address_space =3D nul= lptr; + gdbarch_fast_tracepoint_valid_at_ftype *fast_tracepoint_valid_at =3D nul= lptr; + gdbarch_guess_tracepoint_registers_ftype *guess_tracepoint_registers =3D= nullptr; + gdbarch_auto_charset_ftype *auto_charset =3D nullptr; + gdbarch_auto_wide_charset_ftype *auto_wide_charset =3D nullptr; + const char * solib_symbols_extension =3D 0; + int has_dos_based_file_system =3D 0; + gdbarch_gen_return_address_ftype *gen_return_address =3D nullptr; + gdbarch_info_proc_ftype *info_proc =3D nullptr; + gdbarch_core_info_proc_ftype *core_info_proc =3D nullptr; + gdbarch_iterate_over_objfiles_in_search_order_ftype *iterate_over_objfil= es_in_search_order =3D nullptr; + struct ravenscar_arch_ops * ravenscar_ops =3D 0; + gdbarch_insn_is_call_ftype *insn_is_call =3D nullptr; + gdbarch_insn_is_ret_ftype *insn_is_ret =3D nullptr; + gdbarch_insn_is_jump_ftype *insn_is_jump =3D nullptr; + gdbarch_program_breakpoint_here_p_ftype *program_breakpoint_here_p =3D n= ullptr; + gdbarch_auxv_parse_ftype *auxv_parse =3D nullptr; + gdbarch_print_auxv_entry_ftype *print_auxv_entry =3D nullptr; + gdbarch_vsyscall_range_ftype *vsyscall_range =3D nullptr; + gdbarch_infcall_mmap_ftype *infcall_mmap =3D nullptr; + gdbarch_infcall_munmap_ftype *infcall_munmap =3D nullptr; + gdbarch_gcc_target_options_ftype *gcc_target_options =3D nullptr; + gdbarch_gnu_triplet_regexp_ftype *gnu_triplet_regexp =3D nullptr; + gdbarch_addressable_memory_unit_size_ftype *addressable_memory_unit_size= =3D nullptr; + const char * disassembler_options_implicit =3D 0; + char ** disassembler_options =3D 0; + const disasm_options_and_args_t * valid_disassembler_options =3D 0; + gdbarch_type_align_ftype *type_align =3D nullptr; + gdbarch_get_pc_address_flags_ftype *get_pc_address_flags =3D nullptr; + gdbarch_read_core_file_mappings_ftype *read_core_file_mappings =3D nullp= tr; }; =20 /* Create a new ``struct gdbarch'' based on information provided by @@ -262,13 +262,7 @@ gdbarch_alloc (const struct gdbarch_info *info, { struct gdbarch *gdbarch; =20 - /* Create an obstack for allocating all the per-architecture memory, - then use that to allocate the architecture vector. */ - struct obstack *obstack =3D XNEW (struct obstack); - obstack_init (obstack); - gdbarch =3D XOBNEW (obstack, struct gdbarch); - memset (gdbarch, 0, sizeof (*gdbarch)); - gdbarch->obstack =3D obstack; + gdbarch =3D new struct gdbarch; =20 alloc_gdbarch_data (gdbarch); =20 diff --git a/gdb/gdbarch.py b/gdb/gdbarch.py index 4a0c5220744..5a261ba572b 100755 --- a/gdb/gdbarch.py +++ b/gdb/gdbarch.py @@ -257,29 +257,29 @@ with open("gdbarch.c", "w") as f: print("struct gdbarch", file=3Df) print("{", file=3Df) print(" /* Has this architecture been fully initialized? */", file= =3Df) - print(" bool initialized_p;", file=3Df) + print(" bool initialized_p =3D false;", file=3Df) print(file=3Df) print(" /* An obstack bound to the lifetime of the architecture. */"= , file=3Df) - print(" struct obstack *obstack;", file=3Df) + print(" auto_obstack obstack;", file=3Df) print(file=3Df) print(" /* basic architectural information. */", file=3Df) for c in filter(info, components): print(f" {c.type} {c.name};", file=3Df) print(file=3Df) print(" /* target specific vector. */", file=3Df) - print(" struct gdbarch_tdep_base *tdep;", file=3Df) - print(" gdbarch_dump_tdep_ftype *dump_tdep;", file=3Df) + print(" struct gdbarch_tdep_base *tdep =3D nullptr;", file=3Df) + print(" gdbarch_dump_tdep_ftype *dump_tdep =3D nullptr;", file=3Df) print(file=3Df) print(" /* per-architecture data-pointers. */", file=3Df) - print(" unsigned nr_data;", file=3Df) - print(" void **data;", file=3Df) + print(" unsigned nr_data =3D 0;", file=3Df) + print(" void **data =3D nullptr;", file=3Df) print(file=3Df) for c in filter(not_info, components): if isinstance(c, Value): - print(f" {c.type} {c.name};", file=3Df) + print(f" {c.type} {c.name} =3D 0;", file=3Df) else: assert isinstance(c, Function) - print(f" gdbarch_{c.name}_ftype *{c.name};", file=3Df) + print(f" gdbarch_{c.name}_ftype *{c.name} =3D nullptr;", file= =3Df) print("};", file=3Df) print(file=3Df) # @@ -294,15 +294,7 @@ with open("gdbarch.c", "w") as f: print("{", file=3Df) print(" struct gdbarch *gdbarch;", file=3Df) print("", file=3Df) - print( - " /* Create an obstack for allocating all the per-architecture me= mory,", file=3Df - ) - print(" then use that to allocate the architecture vector. */", f= ile=3Df) - print(" struct obstack *obstack =3D XNEW (struct obstack);", file=3Df) - print(" obstack_init (obstack);", file=3Df) - print(" gdbarch =3D XOBNEW (obstack, struct gdbarch);", file=3Df) - print(" memset (gdbarch, 0, sizeof (*gdbarch));", file=3Df) - print(" gdbarch->obstack =3D obstack;", file=3Df) + print(" gdbarch =3D new struct gdbarch;", file=3Df) print(file=3Df) print(" alloc_gdbarch_data (gdbarch);", file=3Df) print(file=3Df)