summaryrefslogtreecommitdiff
path: root/gdb/rs6000-tdep.c
AgeCommit message (Collapse)Author
2018-01-02Update copyright year range in all GDB filesJoel Brobecker
gdb/ChangeLog: Update copyright year range in all GDB files
2017-12-20Remove write-only assignment in rs6000-tdep.cUros Bizjak
The result of this memory read is never used, so it can be removed. gdb/ChangeLog: * rs6000-tdep.c (ppc_deal_with_atomic_sequence): Remove write-only assignment to "insn" variable.
2017-11-21[PowerPC] Detect different long double floating-point formatsUlrich Weigand
Current versions of GCC support switching the format used for "long double" to either IBM double double or IEEE-128. The resulting binary is marked via different setting of the Tag_GNU_Power_ABI_FP GNU attribute. This patch checks this attribute to detect the format of the default "long double" type and sets GDB's notion of the format accordingly. The patch also adds support for the "__ibm128" type, which always uses IBM double double format independent of the format used for "long double". A new test case verifies that all three types, "long double", "__float128", and "__ibm128" are correctly detected in all three compiler settings, the default setting, -mabi=ieeelongdouble, and -mabi=ibmlongdouble. gdb/ChangeLog: 2017-11-21 Ulrich Weigand <uweigand@de.ibm.com> * ppc-tdep.h (enum powerpc_long_double_abi): New data type. (struct gdbarch_tdep): New member long_double_abi. * rs6000-tdep.c (rs6000_gdbarch_init): Initialize long_double_abi member of tdep struct based on Tag_GNU_Power_ABI_FP attribute. * ppc-linux-tdep.c (ppc_linux_init_abi): Install long double data format depending on long_double_abi tdep member. (ppc_floatformat_for_type): Handle __ibm128 type. gdb/testsuite/ChangeLog: 2017-11-21 Ulrich Weigand <uweigand@de.ibm.com> * gdb.arch/ppc-longdouble.exp: New file. * gdb.arch/ppc-longdouble.c: Likewise.
2017-11-07Constify add_setshow_*Tom Tromey
This constifies the add_setshow_* family of functions, and then fixes up the fallout. The bulk of this patch was written by script. gdb/ChangeLog 2017-11-07 Tom Tromey <tom@tromey.com> * ada-lang.c (catch_ada_exception_command): Constify. (catch_assert_command): Constify. * break-catch-throw.c (catch_catch_command, catch_throw_command) (catch_rethrow_command): Constify. (catch_exception_command_1): Constify. * breakpoint.h (add_catch_command): Constify. * break-catch-syscall.c (catch_syscall_command_1): Constify. (catch_syscall_split_args): Constify. * break-catch-sig.c (catch_signal_command): Constify. (catch_signal_split_args): Constify. * cli/cli-decode.h (struct cmd_list_element) <function>: Use cmd_const_sfunc_ftype. * cli/cli-decode.c (add_setshow_cmd_full): Constify. (add_setshow_enum_cmd, add_setshow_auto_boolean_cmd) (add_setshow_boolean_cmd, add_setshow_filename_cmd) (add_setshow_string_cmd, struct cmd_list_element) (add_setshow_optional_filename_cmd, add_setshow_integer_cmd) (add_setshow_uinteger_cmd, add_setshow_zinteger_cmd) (add_setshow_zuinteger_unlimited_cmd, add_setshow_zuinteger_cmd): Constify. (set_cmd_sfunc): Constify. (empty_sfunc): Constify. * command.h (add_setshow_enum_cmd, add_setshow_auto_boolean_cmd) (add_setshow_boolean_cmd, add_setshow_filename_cmd) (add_setshow_string_cmd, add_setshow_string_noescape_cmd) (add_setshow_optional_filename_cmd, add_setshow_integer_cmd) (add_setshow_uinteger_cmd, add_setshow_zinteger_cmd) (add_setshow_zuinteger_cmd, add_setshow_zuinteger_unlimited_cmd): Constify. (set_cmd_sfunc): Constify. (cmd_sfunc_ftype): Remove. * compile/compile.c (set_compile_args): Constify. * infrun.c (set_disable_randomization): Constify. * infcmd.c (set_args_command, set_cwd_command): Constify. * breakpoint.c (set_condition_evaluation_mode): Constify. (add_catch_command): Constify. (catch_fork_command_1, catch_exec_command_1) (catch_load_command_1, catch_unload_command_1): Constify. (catch_load_or_unload): Constify. * guile/scm-param.c (pascm_set_func): Constify. (add_setshow_generic): Constify. * python/py-param.c (get_set_value): Constify. * top.h (set_verbose): Constify. * tui/tui-win.c (tui_set_var_cmd): Constify. * mi/mi-main.c (set_mi_async_command): Constify. * cli/cli-logging.c (set_logging_overwrite) (set_logging_redirect): Constify. * value.c (set_max_value_size): Constify. * valprint.c (set_input_radix, set_output_radix): Constify. * utils.c (set_width_command, set_height_command): Constify. * typeprint.c (set_print_type_methods, set_print_type_typedefs): Constify. * tracepoint.c (set_disconnected_tracing) (set_circular_trace_buffer, set_trace_buffer_size) (set_trace_user, set_trace_notes, set_trace_stop_notes): Constify. * top.c (set_history_size_command, set_verbose, set_editing) (set_gdb_datadir, set_history_filename): Constify. * target.c (set_targetdebug, maint_set_target_async_command) (maint_set_target_non_stop_command, set_target_permissions) (set_write_memory_permission): Constify. (open_target): Constify. * target-descriptions.c (set_tdesc_filename_cmd): Constify. * target-dcache.c (set_stack_cache, set_code_cache): Constify. * symtab.c (set_symbol_cache_size_handler): Constify. * symfile.c (set_ext_lang_command): Constify. * symfile-debug.c (set_debug_symfile): Constify. * source.c (set_directories_command): Constify. * solib.c (reload_shared_libraries, gdb_sysroot_changed): Constify. * serial.c (set_parity): Constify. * rs6000-tdep.c (powerpc_set_soft_float, powerpc_set_vector_abi): Constify. * remote.c (set_remote_exec_file, set_remotebreak) (set_remote_protocol_Z_packet_cmd, set_range_stepping): Constify. * record.c (set_record_insn_history_size) (set_record_call_history_size): Constify. * record-full.c (set_record_full_insn_max_num): Constify. * proc-api.c (set_procfs_trace_cmd, set_procfs_file_cmd): Constify. * osabi.c (set_osabi): Constify. * mips-tdep.c (set_mips64_transfers_32bit_regs) (reinit_frame_cache_sfunc, mips_abi_update): Constify. * maint.c (maintenance_set_profile_cmd): Constify. * linux-thread-db.c (set_libthread_db_search_path): Constify. * language.c (set_language_command, set_range_command) (set_case_command): Constify. * infrun.c (set_non_stop, set_observer_mode) (set_stop_on_solib_events, set_schedlock_func) (set_exec_direction_func): Constify. * infcmd.c (set_inferior_tty_command): Constify. * disasm.c (set_disassembler_options_sfunc): Constify. * demangle.c (set_demangling_command): Constify. * dcache.c (set_dcache_size, set_dcache_line_size): Constify. * cris-tdep.c (set_cris_version, set_cris_mode) (set_cris_dwarf2_cfi): Constify. * corefile.c (set_gnutarget_command): Constify. * charset.c (set_host_charset_sfunc, set_target_charset_sfunc) (set_target_wide_charset_sfunc): Constify. * breakpoint.c (update_dprintf_commands): Constify. * auto-load.c (set_auto_load_dir, set_auto_load_safe_path): Constify. * arm-tdep.c (set_fp_model_sfunc, arm_set_abi) (set_disassembly_style_sfunc): Constify. * arch-utils.c (set_endian, set_architecture): Constify. * alpha-tdep.c (reinit_frame_cache_sfunc): Constify. * agent.c (set_can_use_agent): Constify.
2017-11-06Target FP: Remove convert_typed_floating from tdep filesUlrich Weigand
This patch mechanically replaces convert_typed_floating with the equivalent target_float_convert throughout tdep files, to prepare for the removal of doublest.{c,h}. No functional change intended. gdb/ChangeLog: 2017-11-06 Ulrich Weigand <uweigand@de.ibm.com> * i386-tdep.c: Include "target-float.h". Do not include "doublest.h". (i386_extract_return_value): Use target_float_convert. (i386_store_return_value): Likewise. * i387-tdep.c (i387_register_to_value): Use target_float_convert. (i387_value_to_register): Likewise. * ia64-tdep.c: Include "target-float.h". Do not include "doublest.h". (ia64_register_to_value): Use target_float_convert. (ia64_value_to_register): Likewise. (ia64_extract_return_value): Likewise. (ia64_store_return_value): Likewise. (ia64_push_dummy_call): Likewise. * m68k-tdep.c: Include "target-float.h". (m68k_register_to_value): Use target_float_convert. (m68k_value_to_register): Likewise. (m68k_svr4_extract_return_value): Likewise. (m68k_svr4_store_return_value): Likewise. * ppc-sysv-tdep.c: Include "target-float.h". (ppc_sysv_abi_push_dummy_call): Use target_float_convert. (do_ppc_sysv_return_value): Likewise. (ppc64_sysv_abi_push_freg): Likewise. (ppc64_sysv_abi_return_value_base): Likewise. * rs6000-aix-tdep.c: Include "target-float.h". (rs6000_push_dummy_call): Use target_float_convert. (rs6000_return_value): Likewise. * rs6000-lynx178-tdep.c: Include "target-float.h". (rs6000_lynx178_push_dummy_call): Use target_float_convert. (rs6000_lynx178_return_value): Likewise. * rs6000-tdep.c: Include "target-float.h". Do not include "doublest.h". (rs6000_register_to_value): Use target_float_convert. (rs6000_value_to_register): Likewise. * arm-tdep.c: Include "target-float.h". Do not include "doublest.h". (arm_extract_return_value): Use target_float_convert. (arm_store_return_value): Likewise. * sh-tdep.c: Include "target-float.h". Do not include "doublest.h". (sh_register_convert_to_virtual): Use target_float_convert. (sh_register_convert_to_raw): Likewise. * sh64-tdep.c: Include "target-float.h". (sh64_extract_return_value): Use target_float_convert. (sh64_register_convert_to_virtual): Likewise. (sh64_register_convert_to_raw): Likewise. Fix argument types.
2017-10-25s/get_regcache_arch (regcache)/regcache->arch ()/gYao Qi
This patches removes get_regcache_arch, and use regache->arch () instead. The motivation of this change is that I am going to move some basic stuff into a base class of regcache. I don't need to update "client" code regcache->arch (). On the other hand, this patch shortens the code a little bit. gdb: 2017-10-25 Yao Qi <yao.qi@linaro.org> * aarch32-linux-nat.c (aarch32_gp_regcache_supply): Use regcache->arch () instead get_regcache_arch. * aarch64-fbsd-nat.c (aarch64_fbsd_fetch_inferior_registers): Likewise. (aarch64_fbsd_store_inferior_registers): Likewise. * aarch64-linux-nat.c (fetch_gregs_from_thread): Likewise. (store_gregs_to_thread): Likewise. (fetch_fpregs_from_thread): Likewise. (store_fpregs_to_thread): Likewise. * aarch64-tdep.c (aarch64_extract_return_value): Likewise. (aarch64_store_return_value): Likewise. (aarch64_software_single_step): Likewise. * aix-thread.c (aix_thread_wait): Likewise. (supply_reg32): Likewise. (supply_sprs64): Likewise. (supply_sprs32): Likewise. (fill_gprs64): Likewise. (fill_gprs32): Likewise. (fill_sprs64): Likewise. (fill_sprs32): Likewise. (store_regs_user_thread): Likewise. (store_regs_kernel_thread): Likewise. * alpha-bsd-nat.c (alphabsd_fetch_inferior_registers): Likewise. (alphabsd_store_inferior_registers): Likewise. * alpha-tdep.c (alpha_extract_return_value): Likewise. (alpha_store_return_value): Likewise. (alpha_deal_with_atomic_sequence): Likewise. (alpha_next_pc): Likewise. (alpha_software_single_step): Likewise. * amd64-bsd-nat.c (amd64bsd_fetch_inferior_registers): Likewise. (amd64bsd_store_inferior_registers): Likewise. * amd64-linux-nat.c (amd64_linux_fetch_inferior_registers): Likewise. (amd64_linux_store_inferior_registers): Likewise. * amd64-nat.c (amd64_supply_native_gregset): Likewise. (amd64_collect_native_gregset): Likewise. * amd64-obsd-tdep.c (amd64obsd_supply_uthread): Likewise. (amd64obsd_collect_uthread): Likewise. * amd64-tdep.c (amd64_supply_fpregset): Likewise. (amd64_collect_fpregset): Likewise. (amd64_supply_fxsave): Likewise. (amd64_supply_xsave): Likewise. (amd64_collect_fxsave): Likewise. (amd64_collect_xsave): Likewise. * arc-tdep.c (arc_write_pc): Likewise. * arch-utils.c (default_skip_permanent_breakpoint): Likewise. * arm-fbsd-nat.c (arm_fbsd_fetch_inferior_registers): Likewise. (arm_fbsd_store_inferior_registers): Likewise. * arm-linux-nat.c (fetch_vfp_regs): Likewise. (store_vfp_regs): Likewise. (arm_linux_fetch_inferior_registers): Likewise. (arm_linux_store_inferior_registers): Likewise. * arm-linux-tdep.c (arm_linux_supply_gregset): Likewise. (arm_linux_sigreturn_next_pc): Likewise. (arm_linux_get_next_pcs_syscall_next_pc): Likewise. * arm-nbsd-nat.c (arm_supply_gregset): Likewise. (fetch_register): Likewise. (store_register): Likewise. * arm-tdep.c (arm_is_thumb): Likewise. (displaced_in_arm_mode): Likewise. (bx_write_pc): Likewise. (arm_get_next_pcs_addr_bits_remove): Likewise. (arm_software_single_step): Likewise. (arm_extract_return_value): Likewise. (arm_store_return_value): Likewise. (arm_write_pc): Likewise. * bfin-tdep.c (bfin_extract_return_value): Likewise. * bsd-uthread.c (bsd_uthread_fetch_registers): Likewise. (bsd_uthread_store_registers): Likewise. * core-regset.c (fetch_core_registers): Likewise. * corelow.c (get_core_registers): Likewise. * cris-tdep.c (cris_store_return_value): Likewise. (cris_extract_return_value): Likewise. (find_step_target): Likewise. (find_step_target): Likewise. (cris_software_single_step): Likewise. * ctf.c (ctf_fetch_registers): Likewise. * darwin-nat.c (cancel_breakpoint): Likewise. * fbsd-tdep.c (fbsd_collect_thread_registers): Likewise. * frv-tdep.c (frv_extract_return_value): Likewise. * ft32-tdep.c (ft32_store_return_value): Likewise. (ft32_extract_return_value): Likewise. * go32-nat.c (fetch_register): Likewise. (go32_fetch_registers): Likewise. (go32_store_registers): Likewise. (store_register): Likewise. * h8300-tdep.c (h8300_extract_return_value): Likewise. (h8300_store_return_value): Likewise. * hppa-linux-nat.c (fetch_register): Likewise. (store_register): Likewise. (hppa_linux_fetch_inferior_registers): Likewise. (hppa_linux_store_inferior_registers): Likewise. * i386-darwin-nat.c (i386_darwin_fetch_inferior_registers): Likewise. (i386_darwin_store_inferior_registers): Likewise. * i386-gnu-nat.c (gnu_fetch_registers): Likewise. (gnu_store_registers): Likewise. * i386-linux-nat.c (fetch_register): Likewise. (store_register): Likewise. (supply_gregset): Likewise. (fill_gregset): Likewise. (i386_linux_fetch_inferior_registers): Likewise. (i386_linux_store_inferior_registers): Likewise. (i386_linux_resume): Likewise. * i386-linux-tdep.c (i386_linux_get_syscall_number_from_regcache): Likewise. * i386-nto-tdep.c (i386nto_supply_gregset): Likewise. * i386-obsd-nat.c (i386obsd_supply_pcb): Likewise. * i386-obsd-tdep.c (i386obsd_supply_uthread): Likewise. (i386obsd_collect_uthread): Likewise. * i386-tdep.c (i386_mmx_regnum_to_fp_regnum): Likewise. (i386_supply_gregset): Likewise. (i386_collect_gregset): Likewise. (i386_supply_fpregset): Likewise. (i386_collect_fpregset): Likewise. (i386_mpx_bd_base): Likewise. * i386-v4-nat.c (supply_fpregset): Likewise. (fill_fpregset): Likewise. * i387-tdep.c (i387_supply_fsave): Likewise. (i387_collect_fsave): Likewise. (i387_supply_fxsave): Likewise. (i387_collect_fxsave): Likewise. (i387_supply_xsave): Likewise. (i387_collect_xsave): Likewise. * ia64-linux-nat.c (ia64_linux_fetch_registers): Likewise. (ia64_linux_store_registers): Likewise. * ia64-tdep.c (ia64_access_rse_reg): Likewise. (ia64_extract_return_value): Likewise. (ia64_store_return_value): Likewise. (find_func_descr): Likewise. * inf-child.c (inf_child_fetch_inferior_registers): Likewise. * inf-ptrace.c (inf_ptrace_fetch_registers): Likewise. (inf_ptrace_store_registers): Likewise. * infrun.c (use_displaced_stepping): Likewise. (displaced_step_prepare_throw): Likewise. (resume): Likewise. (proceed): Likewise. (do_target_wait): Likewise. (adjust_pc_after_break): Likewise. (handle_inferior_event_1): Likewise. (handle_signal_stop): Likewise. (save_infcall_suspend_state): Likewise. (restore_infcall_suspend_state): Likewise. * iq2000-tdep.c (iq2000_extract_return_value): Likewise. * jit.c (jit_frame_prev_register): Likewise. * linux-nat.c (save_stop_reason): Likewise. (linux_nat_wait_1): Likewise. (resume_stopped_resumed_lwps): Likewise. * linux-record.c (record_linux_sockaddr): Likewise. (record_linux_msghdr): Likewise. (record_linux_system_call): Likewise. * linux-tdep.c (linux_collect_thread_registers): Likewise. * lm32-tdep.c (lm32_extract_return_value): Likewise. (lm32_store_return_value): Likewise. * m32c-tdep.c (m32c_read_flg): Likewise. (m32c_pseudo_register_read): Likewise. (m32c_pseudo_register_write): Likewise. * m32r-linux-tdep.c (m32r_linux_supply_gregset): Likewise. (m32r_linux_collect_gregset): Likewise. * m32r-tdep.c (m32r_store_return_value): Likewise. (m32r_extract_return_value): Likewise. * m68k-bsd-nat.c (m68kbsd_supply_fpregset): Likewise. (m68kbsd_collect_fpregset): Likewise. * m68k-bsd-tdep.c (m68kbsd_supply_fpregset): Likewise. * m68k-linux-nat.c (fetch_register): Likewise. (old_fetch_inferior_registers): Likewise. (old_store_inferior_registers): Likewise. (store_regs): Likewise. * m68k-tdep.c (m68k_svr4_extract_return_value): Likewise. (m68k_svr4_store_return_value): Likewise. * m88k-tdep.c (m88k_store_arguments): Likewise. * mi/mi-main.c (mi_cmd_data_list_changed_registers): Likewise. (mi_cmd_data_write_register_values): Likewise. * mips-fbsd-nat.c (mips_fbsd_fetch_inferior_registers): Likewise. (mips_fbsd_store_inferior_registers): Likewise. * mips-fbsd-tdep.c (mips_fbsd_supply_fpregs): Likewise. (mips_fbsd_supply_gregs): Likewise. (mips_fbsd_collect_fpregs): Likewise. (mips_fbsd_collect_gregs): Likewise. (mips_fbsd_supply_fpregset): Likewise. (mips_fbsd_collect_fpregset): Likewise. (mips_fbsd_supply_gregset): Likewise. (mips_fbsd_collect_gregset): Likewise. * mips-linux-nat.c (supply_gregset): Likewise. (fill_gregset): Likewise. (supply_fpregset): Likewise. (fill_fpregset): Likewise. * mips-linux-tdep.c (mips_supply_gregset): Likewise. (mips_fill_gregset): Likewise. (mips_supply_fpregset): Likewise. (mips_fill_fpregset): Likewise. (mips64_supply_gregset): Likewise. (micromips_linux_sigframe_validate): Likewise. * mips-nbsd-nat.c (mipsnbsd_fetch_inferior_registers): Likewise. (mipsnbsd_fetch_inferior_registers): Likewise. (mipsnbsd_store_inferior_registers): Likewise. * mips-nbsd-tdep.c (mipsnbsd_supply_fpregset): Likewise. (mipsnbsd_supply_gregset): Likewise. (mipsnbsd_iterate_over_regset_sections): Likewise. (mipsnbsd_supply_reg): Likewise. (mipsnbsd_supply_fpreg): Likewise. * mips-tdep.c (mips_in_frame_stub): Likewise. (mips_dummy_id): Likewise. (is_octeon_bbit_op): Likewise. (micromips_bc1_pc): Likewise. (extended_mips16_next_pc): Likewise. (mips16_next_pc): Likewise. (deal_with_atomic_sequence): Likewise. * moxie-tdep.c (moxie_process_readu): Likewise. * nios2-tdep.c (nios2_get_next_pc): Likewise. * nto-procfs.c (procfs_store_registers): Likewise. * ppc-fbsd-nat.c (ppcfbsd_fetch_inferior_registers): Likewise. (ppcfbsd_store_inferior_registers): Likewise. * ppc-linux-nat.c (fetch_vsx_register): Likewise. (fetch_altivec_register): Likewise. (get_spe_registers): Likewise. (fetch_spe_register): Likewise. (fetch_altivec_registers): Likewise. (fetch_all_gp_regs): Likewise. (fetch_all_fp_regs): Likewise. (store_vsx_register): Likewise. (store_altivec_register): Likewise. (set_spe_registers): Likewise. (store_spe_register): Likewise. (store_altivec_registers): Likewise. (store_all_gp_regs): Likewise. (store_all_fp_regs): Likewise. * ppc-linux-tdep.c (ppc_linux_supply_gregset): Likewise. (ppc_linux_collect_gregset): Likewise. (ppc_canonicalize_syscall): Likewise. (ppc_linux_record_signal): Likewise. (ppu2spu_prev_register): Likewise. * ppc-nbsd-nat.c (ppcnbsd_supply_pcb): Likewise. * ppc-obsd-nat.c (ppcobsd_fetch_registers): Likewise. (ppcobsd_store_registers): Likewise. * ppc-ravenscar-thread.c (ppc_ravenscar_generic_fetch_registers): Likewise. (ppc_ravenscar_generic_store_registers): Likewise. * procfs.c (procfs_fetch_registers): Likewise. (procfs_store_registers): Likewise. * ravenscar-thread.c (ravenscar_fetch_registers): Likewise. (ravenscar_store_registers): Likewise. (ravenscar_prepare_to_store): Likewise. * record-btrace.c (record_btrace_fetch_registers): Likewise. * record-full.c (record_full_wait_1): Likewise. (record_full_registers_change): Likewise. (record_full_store_registers): Likewise. (record_full_core_fetch_registers): Likewise. (record_full_save): Likewise. (record_full_goto_insn): Likewise. * regcache.c (regcache_register_size): Likewise. (get_regcache_arch): Remove. (regcache_read_pc): Likewise. * regcache.h (get_regcache_arch): Remove. * remote-sim.c (gdbsim_fetch_register): Likewise. (gdbsim_store_register): Likewise. * remote.c (fetch_register_using_p): Likewise. (send_g_packet): Likewise. (remote_prepare_to_store): Likewise. (store_registers_using_G): Likewise. * reverse.c (save_bookmark_command): Likewise. (goto_bookmark_command): Likewise. * rs6000-aix-tdep.c (branch_dest): Likewise. * rs6000-nat.c (rs6000_ptrace64): Likewise. (fetch_register): Likewise. * rs6000-tdep.c (ppc_supply_reg): Likewise. (ppc_collect_reg): Likewise. (ppc_collect_gregset): Likewise. (ppc_collect_fpregset): Likewise. (ppc_collect_vsxregset): Likewise. (ppc_collect_vrregset): Likewise. (ppc_displaced_step_hw_singlestep): Likewise. (rs6000_pseudo_register_read): Likewise. (rs6000_pseudo_register_write): Likewise. * s390-linux-nat.c (supply_gregset): Likewise. (fill_gregset): Likewise. (s390_linux_fetch_inferior_registers): Likewise. * s390-linux-tdep.c (s390_write_pc): Likewise. (s390_software_single_step): Likewise. (s390_all_but_pc_registers_record): Likewise. (s390_linux_syscall_record): Likewise. * sentinel-frame.c (sentinel_frame_prev_arch): Likewise. * sh-nbsd-nat.c (shnbsd_fetch_inferior_registers): Likewise. (shnbsd_store_inferior_registers): Likewise. * sh-tdep.c (sh_extract_return_value_nofpu): Likewise. (sh_extract_return_value_fpu): Likewise. (sh_store_return_value_nofpu): Likewise. (sh_corefile_supply_regset): Likewise. (sh_corefile_collect_regset): Likewise. * sh64-tdep.c (sh64_extract_return_value): Likewise. (sh64_store_return_value): Likewise. * sparc-linux-tdep.c (sparc32_linux_collect_core_fpregset): Likewise. * sparc-nat.c (sparc_fetch_inferior_registers): Likewise. (sparc_store_inferior_registers): Likewise. * sparc-ravenscar-thread.c (register_in_thread_descriptor_p): Likewise. (sparc_ravenscar_prepare_to_store): Likewise. * sparc-tdep.c (sparc32_store_arguments): Likewise. (sparc_analyze_control_transfer): Likewise. (sparc_step_trap): Likewise. (sparc_software_single_step): Likewise. (sparc32_gdbarch_init): Likewise. (sparc_supply_rwindow): Likewise. (sparc_collect_rwindow): Likewise. * sparc64-linux-tdep.c (sparc64_linux_collect_core_fpregset): Likewise. * sparc64-nbsd-nat.c (sparc64nbsd_supply_gregset): Likewise. (sparc64nbsd_collect_gregset): Likewise. (sparc64nbsd_supply_fpregset): Likewise. (sparc64nbsd_collect_fpregset): Likewise. * sparc64-tdep.c (sparc64_store_arguments): Likewise. (sparc64_supply_gregset): Likewise. (sparc64_collect_gregset): Likewise. (sparc64_supply_fpregset): Likewise. (sparc64_collect_fpregset): Likewise. * spu-linux-nat.c (spu_fetch_inferior_registers): Likewise. * spu-tdep.c (spu_unwind_sp): Likewise. (spu2ppu_prev_register): Likewise. (spu_memory_remove_breakpoint): Likewise. * stack.c (return_command): Likewise. * tic6x-tdep.c (tic6x_extract_signed_field): Likewise. * tracefile-tfile.c (tfile_fetch_registers): Likewise. * tracefile.c (trace_save_ctf): Likewise. * windows-nat.c (do_windows_fetch_inferior_registers): Likewise. (do_windows_store_inferior_registers): Likewise. (windows_resume): Likewise. * xtensa-linux-nat.c (fill_gregset): Likewise. (supply_gregset_reg): Likewise. * xtensa-tdep.c (xtensa_register_write_masked): Likewise. (xtensa_register_read_masked): Likewise. (xtensa_supply_gregset): Likewise. (xtensa_extract_return_value): Likewise. (xtensa_store_return_value): Likewise.
2017-10-21Create a displaced_step_closure class hierarchySimon Marchi
displaced_step_closure is a type defined in multiple -tdep.c files. Trying to xfree it from the common code (infrun.c) is a problem when we try to poison xfree for non-POD types. Because there can be multiple of these types in the same build, this patch makes a hierarchy of classes with a virtual destructor. When the common code deletes the object through a displaced_step_closure pointer, it will invoke the right destructor. The amd64 used a last-member array with a variable size. That doesn't work with new, so I changed it for an std::vector. Other architectures which used a simple byte buffer as a closure now use a shared buf_displaced_step_closure, a closure type that only contains a gdb::byte_vector. Reg-tested on the buildbot. gdb/ChangeLog: * infrun.h: Include common/byte-vector.h. (struct displaced_step_closure): New struct. (struct buf_displaced_step_closure): New struct. * infrun.c (displaced_step_closure::~displaced_step_closure): Provide default implementation. (displaced_step_clear): Deallocate step closure with delete. * aarch64-tdep.c (displaced_step_closure): Rename to ... (aarch64_displaced_step_closure): ... this, extend displaced_step_closure. (aarch64_displaced_step_data) <dsc>: Change type to aarch64_displaced_step_closure. (aarch64_displaced_step_copy_insn): Adjust to type change, use unique_ptr. (aarch64_displaced_step_fixup): Add cast for displaced step closure. * amd64-tdep.c (displaced_step_closure): Rename to ... (amd64_displaced_step_closure): ... this, extend displaced_step_closure. <insn_buf>: Change type to std::vector<gdb_byte>. <max_len>: Remove. (fixup_riprel): Change type of DSC parameter, adjust to type change of insn_buf. (fixup_displaced_copy): Change type of DSC parameter. (amd64_displaced_step_copy_insn): Instantiate amd64_displaced_step_closure. (amd64_displaced_step_fixup): Add cast for closure type, adjust to type change of insn_buf. * arm-linux-tdep.c (arm_linux_cleanup_svc): Change type of parameter DSC. (arm_linux_copy_svc): Likewise. (cleanup_kernel_helper_return): Likewise. (arm_catch_kernel_helper_return): Likewise. (arm_linux_displaced_step_copy_insn): Instantiate arm_displaced_step_closure. * arm-tdep.c (arm_pc_is_thumb): Add cast for closure. (displaced_read_reg): Change type of parameter DSC. (branch_write_pc): Likewise. (load_write_pc): Likewise. (alu_write_pc): Likewise. (displaced_write_reg): Likewise. (arm_copy_unmodified): Likewise. (thumb_copy_unmodified_32bit): Likewise. (thumb_copy_unmodified_16bit): Likewise. (cleanup_preload): Likewise. (install_preload): Likewise. (arm_copy_preload): Likewise. (thumb2_copy_preload): Likewise. (install_preload_reg): Likewise. (arm_copy_preload_reg): Likewise. (cleanup_copro_load_store): Likewise. (install_copro_load_store): Likewise. (arm_copy_copro_load_store) Likewise. (thumb2_copy_copro_load_store): Likewise. (cleanup_branch): Likewise. (install_b_bl_blx): Likewise. (arm_copy_b_bl_blx): Likewise. (thumb2_copy_b_bl_blx): Likewise. (thumb_copy_b): Likewise. (install_bx_blx_reg): Likewise. (arm_copy_bx_blx_reg): Likewise. (thumb_copy_bx_blx_reg): Likewise. (cleanup_alu_imm): Likewise. (arm_copy_alu_imm): Likewise. (thumb2_copy_alu_imm): Likewise. (cleanup_alu_reg): Likewise. (install_alu_reg): Likewise. (arm_copy_alu_reg): Likewise. (thumb_copy_alu_reg): Likewise. (cleanup_alu_shifted_reg): Likewise. (install_alu_shifted_reg): Likewise. (arm_copy_alu_shifted_reg): Likewise. (cleanup_load): Likewise. (cleanup_store): Likewise. (arm_copy_extra_ld_st): Likewise. (install_load_store): Likewise. (thumb2_copy_load_literal): Likewise. (thumb2_copy_load_reg_imm): Likewise. (arm_copy_ldr_str_ldrb_strb): Likewise. (cleanup_block_load_all): Likewise. (cleanup_block_store_pc): Likewise. (cleanup_block_load_pc): Likewise. (arm_copy_block_xfer): Likewise. (thumb2_copy_block_xfer): Likewise. (cleanup_svc): Likewise. (install_svc): Likewise. (arm_copy_svc): Likewise. (thumb_copy_svc): Likewise. (arm_copy_undef): Likewise. (thumb_32bit_copy_undef): Likewise. (arm_copy_unpred): Likewise. (arm_decode_misc_memhint_neon): Likewise. (arm_decode_unconditional): Likewise. (arm_decode_miscellaneous): Likewise. (arm_decode_dp_misc): Likewise. (arm_decode_ld_st_word_ubyte): Likewise. (arm_decode_media): Likewise. (arm_decode_b_bl_ldmstm): Likewise. (arm_decode_ext_reg_ld_st): Likewise. (thumb2_decode_dp_shift_reg): Likewise. (thumb2_decode_ext_reg_ld_st): Likewise. (arm_decode_svc_copro): Likewise. (thumb2_decode_svc_copro): Likewise. (install_pc_relative): Likewise. (thumb_copy_pc_relative_16bit): Likewise. (thumb_decode_pc_relative_16bit): Likewise. (thumb_copy_pc_relative_32bit): Likewise. (thumb_copy_16bit_ldr_literal): Likewise. (thumb_copy_cbnz_cbz): Likewise. (thumb2_copy_table_branch): Likewise. (cleanup_pop_pc_16bit_all): Likewise. (thumb_copy_pop_pc_16bit): Likewise. (thumb_process_displaced_16bit_insn): Likewise. (decode_thumb_32bit_ld_mem_hints): Likewise. (thumb_process_displaced_32bit_insn): Likewise. (thumb_process_displaced_insn): Likewise. (arm_process_displaced_insn): Likewise. (arm_displaced_init_closure): Likewise. (arm_displaced_step_fixup): Add cast for closure. * arm-tdep.h: Include infrun.h. (displaced_step_closure): Rename to ... (arm_displaced_step_closure): ... this, extend displaced_step_closure. <u::svc::copy_svc_os>: Change type of parameter DSC. <cleanup>: Likewise. (arm_process_displaced_insn): Likewise. (arm_displaced_init_closure): Likewise. (displaced_read_reg): Likewise. (displaced_write_reg): Likewise. * i386-linux-tdep.c (i386_linux_displaced_step_copy_insn): Adjust. * i386-tdep.h: Include infrun.h. (i386_displaced_step_closure): New typedef. * i386-tdep.c (i386_displaced_step_copy_insn): Use i386_displaced_step_closure. (i386_displaced_step_fixup): Adjust. * rs6000-tdep.c (ppc_displaced_step_closure): New typedef. (ppc_displaced_step_copy_insn): Use ppc_displaced_step_closure and unique_ptr. (ppc_displaced_step_fixup): Adjust. * s390-linux-tdep.c (s390_displaced_step_closure): New typedef. (s390_displaced_step_copy_insn): Use s390_displaced_step_closure and unique_ptr. (s390_displaced_step_fixup): Adjust.
2017-10-12Remove simple_displaced_step_copy_insnSimon Marchi
Nothing uses this function. Remove it, and adjust comments referring to it. gdb/ChangeLog: * arch-utils.h (simple_displaced_step_copy_insn): Remove. * arch-utils.c (simple_displaced_step_copy_insn): Remove. * gdbarch.sh (displaced_step_copy_insn): Adjust comment. * gdbarch.h: Regenerate. * i386-linux-tdep.c (i386_linux_displaced_step_copy_insn): Adjust comment. * i386-tdep.c (i386_displaced_step_copy_insn): Adjust comment. (i386_displaced_step_fixup): Adjust comment. * rs6000-tdep.c (ppc_displaced_step_copy_insn): Adjust comment.
2017-10-11Constify add_prefix_cmdTom Tromey
This changes add_prefix_cmd to accept a const-taking function as an argument; then fixes up all the callers. In a couple of spots I had to add a non-const overload of a function, because the function is passed to two different command-adding "constructors". These overloads are temporary; once constification is complete they can be removed. This patch also fixes a typo I happened to notice while constifying. Note that this touches a couple of files (gnu-nat.c and go32-nat.c) that I can't build. So, while I made a best-effort there, I am not certain they will still compile. Tested by rebuilding. gdb/ChangeLog 2017-10-11 Tom Tromey <tom@tromey.com> * gdbthread.h (thread_command): Constify. * inferior.h (detach_command): Constify. * top.h (set_history, show_history): Constify. * arm-tdep.c (set_arm_command, show_arm_command): Constify. * serial.c (serial_set_cmd, serial_show_cmd): Constify. * bsd-kvm.c (bsd_kvm_cmd): Constify. * printcmd.c (set_command): Constify. (non_const_set_command): New function. * dcache.c (set_dcache_command, show_dcache_command): Constify. * breakpoint.c (enable_command, disable_command, delete_command) (catch_command, tcatch_command, set_breakpoint_cmd) (show_breakpoint_cmd): Constify. * macrocmd.c (macro_command): Constify. * infcmd.c (unset_command, kill_command, detach_command) (info_proc_cmd): Constify. * i386-tdep.c (set_mpx_cmd, show_mpx_cmd): Constify. * auto-load.c (show_auto_load_cmd, set_auto_load_cmd) (info_auto_load_cmd): Constify. * target-descriptions.c (set_tdesc_cmd, show_tdesc_cmd) (unset_tdesc_cmd): Constify. * ada-lang.c (set_ada_command, show_ada_command) (maint_set_ada_cmd, maint_show_ada_cmd): Constify. * guile/guile.c (set_guile_command, show_guile_command) (info_guile_command): Constify. * tui/tui-win.c (tui_command, set_tui_cmd, show_tui_cmd): Constify. * skip.c (skip_command): Constify. * compile/compile.c (_initialize_compile): Constify. * dwarf2read.c (set_dwarf_cmd, show_dwarf_cmd): Constify. * btrace.c (maint_btrace_cmd, maint_btrace_set_cmd) (maint_btrace_show_cmd, maint_btrace_pt_set_cmd) (maint_btrace_pt_show_cmd): Constify. * remote.c (set_remote_cmd, show_remote_cmd, remote_command): Constify. * python/python.c (user_show_python, user_set_python): Constify. * mips-tdep.c (set_mips_command, show_mips_command) (set_mipsfpu_command): Constify. * record-btrace.c (cmd_record_btrace_start) (cmd_set_record_btrace, cmd_show_record_btrace) (cmd_set_record_btrace_bts, cmd_show_record_btrace_bts) (cmd_set_record_btrace_pt, cmd_show_record_btrace_pt): Constify. * rs6000-tdep.c (set_powerpc_command, show_powerpc_command): Constify. * symfile.c (overlay_command): Constify. * spu-tdep.c (set_spu_command, show_spu_command): Constify. * cli/cli-logging.c (set_logging_command, show_logging_command): Constify. * cli/cli-dump.c (dump_command, append_command) (srec_dump_command, ihex_dump_command, verilog_dump_command) (tekhex_dump_command, binary_dump_command) (binary_append_command): Constify. * cli/cli-decode.c (struct cmd_list_element): Change type of "fun". * cli/cli-cmds.c (info_command, show_command, set_debug) (show_debug): Constify. (show_command): Add non-const overload. * top.c (set_history, show_history): Constify. * sh-tdep.c (set_sh_command, show_sh_command): Constify. * command.h (add_prefix_cmd): Accept a cmd_const_cfunc_ftype. * target.c (target_command): Constify. * sparc64-tdep.c (info_adi_command): Constify. * record-full.c (cmd_record_full_start): Constify. (set_record_full_command): Constify. Fix typo. (show_record_full_command): Constify. * thread.c (thread_command, thread_apply_command): Constify. * memattr.c (dummy_cmd): Constify. * value.c (function_command): Constify. * frame.c (set_backtrace_cmd, show_backtrace_cmd): Constify. * probe.c (info_probes_command): Constify. * ser-tcp.c (set_tcp_cmd, show_tcp_cmd): Constify. * gnu-nat.c (set_task_cmd, show_task_cmd, set_thread_cmd) (show_thread_cmd, set_thread_default_cmd) (show_thread_default_cmd): Constify. (check_empty): Constify. * tracepoint.c (tfind_command): Constify. * cp-support.c (maint_cplus_command): Constify. * windows-tdep.c (info_w32_command): Constify. * record.c (cmd_record_start, set_record_command) (show_record_command, info_record_command, cmd_record_goto): Constify. * ravenscar-thread.c (set_ravenscar_command) (show_ravenscar_command): Constify. * utils.c (set_internal_problem_cmd, show_internal_problem_cmd): Constify. (add_internal_problem_command): Remove casts. * arc-tdep.c (maintenance_print_arc_command): Constify. * valprint.c (set_print, show_print, set_print_raw) (show_print_raw): Constify. * maint.c (maintenance_command, maintenance_info_command) (maintenance_print_command, maintenance_set_cmd) (maintenance_show_cmd, set_per_command_cmd) (show_per_command_cmd, maintenance_check_command): Constify. * language.c (set_check, show_check): Constify. * typeprint.c (show_print_type, set_print_type): Constify. * go32-nat.c (go32_info_dos_command): Constify.
2017-09-09Remove unnecessary function prototypes.John Baldwin
These prototypes were required when compiling GDB as C but are not required for C++. gdb/ChangeLog: * aarch64-linux-nat.c: Remove _initialize_aarch64_linux_nat prototype. * aarch64-linux-tdep.c: Remove _initialize_aarch64_linux_tdep prototype. * aarch64-newlib-tdep.c: Remove _initialize_aarch64_newlib_tdep prototype. * aarch64-tdep.c: Remove _initialize_aarch64_tdep prototype. * ada-exp.y: Remove _initialize_ada_exp prototype. * ada-lang.c: Remove _initialize_ada_language prototype. * ada-tasks.c: Remove _initialize_tasks prototype. * addrmap.c: Remove _initialize_addrmap prototype. * agent.c: Remove _initialize_agent prototype. * aix-thread.c: Remove _initialize_aix_thread prototype. * alpha-bsd-nat.c: Remove _initialize_alphabsd_nat prototype. * alpha-linux-nat.c: Remove _initialize_alpha_linux_nat prototype. * alpha-linux-tdep.c: Remove _initialize_alpha_linux_tdep prototype. * alpha-nbsd-tdep.c: Remove _initialize_alphanbsd_tdep prototype. * alpha-obsd-tdep.c: Remove _initialize_alphaobsd_tdep prototype. * alpha-tdep.c: Remove _initialize_alpha_tdep prototype. * amd64-darwin-tdep.c: Remove _initialize_amd64_darwin_tdep prototype. * amd64-dicos-tdep.c: Remove _initialize_amd64_dicos_tdep prototype. * amd64-fbsd-nat.c: Remove _initialize_amd64fbsd_nat prototype. * amd64-fbsd-tdep.c: Remove _initialize_amd64fbsd_tdep prototype. * amd64-linux-nat.c: Remove _initialize_amd64_linux_nat prototype. * amd64-linux-tdep.c: Remove _initialize_amd64_linux_tdep prototype. * amd64-nbsd-nat.c: Remove _initialize_amd64nbsd_nat prototype. * amd64-nbsd-tdep.c: Remove _initialize_amd64nbsd_tdep prototype. * amd64-obsd-nat.c: Remove _initialize_amd64obsd_nat prototype. * amd64-obsd-tdep.c: Remove _initialize_amd64obsd_tdep prototype. * amd64-sol2-tdep.c: Remove _initialize_amd64_sol2_tdep prototype. * amd64-tdep.c: Remove _initialize_amd64_tdep prototype. * amd64-windows-nat.c: Remove _initialize_amd64_windows_nat prototype. * amd64-windows-tdep.c: Remove _initialize_amd64_windows_tdep prototype. * annotate.c: Remove _initialize_annotate prototype. * arc-newlib-tdep.c: Remove _initialize_arc_newlib_tdep prototype. * arc-tdep.c: Remove _initialize_arc_tdep prototype. * arch-utils.c: Remove _initialize_gdbarch_utils prototype. * arm-linux-nat.c: Remove _initialize_arm_linux_nat prototype. * arm-linux-tdep.c: Remove _initialize_arm_linux_tdep prototype. * arm-nbsd-tdep.c: Remove _initialize_arm_netbsd_tdep prototype. * arm-obsd-tdep.c: Remove _initialize_armobsd_tdep prototype. * arm-symbian-tdep.c: Remove _initialize_arm_symbian_tdep prototype. * arm-tdep.c: Remove _initialize_arm_tdep prototype. * arm-wince-tdep.c: Remove _initialize_arm_wince_tdep prototype. * auto-load.c: Remove _initialize_auto_load prototype. * auxv.c: Remove _initialize_auxv prototype. * avr-tdep.c: Remove _initialize_avr_tdep prototype. * ax-gdb.c: Remove _initialize_ax_gdb prototype. * bfin-linux-tdep.c: Remove _initialize_bfin_linux_tdep prototype. * bfin-tdep.c: Remove _initialize_bfin_tdep prototype. * break-catch-sig.c: Remove _initialize_break_catch_sig prototype. * break-catch-syscall.c: Remove _initialize_break_catch_syscall prototype. * break-catch-throw.c: Remove _initialize_break_catch_throw prototype. * breakpoint.c: Remove _initialize_breakpoint prototype. * bsd-uthread.c: Remove _initialize_bsd_uthread prototype. * btrace.c: Remove _initialize_btrace prototype. * charset.c: Remove _initialize_charset prototype. * cli/cli-cmds.c: Remove _initialize_cli_cmds prototype. * cli/cli-dump.c: Remove _initialize_cli_dump prototype. * cli/cli-interp.c: Remove _initialize_cli_interp prototype. * cli/cli-logging.c: Remove _initialize_cli_logging prototype. * cli/cli-script.c: Remove _initialize_cli_script prototype. * coff-pe-read.c: Remove _initialize_coff_pe_read prototype. * coffread.c: Remove _initialize_coffread prototype. * compile/compile.c: Remove _initialize_compile prototype. * complaints.c: Remove _initialize_complaints prototype. * completer.c: Remove _initialize_completer prototype. * copying.awk: Remove _initialize_copying prototype. * copying.c: Regenerate. * core-regset.c: Remove _initialize_core_regset prototype. * corefile.c: Remove _initialize_core prototype. * corelow.c: Remove _initialize_corelow prototype. * cp-abi.c: Remove _initialize_cp_abi prototype. * cp-namespace.c: Remove _initialize_cp_namespace prototype. * cp-support.c: Remove _initialize_cp_support prototype. * cp-valprint.c: Remove _initialize_cp_valprint prototype. * cris-linux-tdep.c: Remove _initialize_cris_linux_tdep prototype. * cris-tdep.c: Remove _initialize_cris_tdep prototype. * ctf.c: Remove _initialize_ctf prototype. * d-lang.c: Remove _initialize_d_language prototype. * darwin-nat-info.c: Remove _initialize_darwin_info_commands prototype. * darwin-nat.c: Remove _initialize_darwin_inferior prototype. * dbxread.c: Remove _initialize_dbxread prototype. * dcache.c: Remove _initialize_dcache prototype. * demangle.c: Remove _initialize_demangler prototype. * disasm-selftests.c: Remove _initialize_disasm_selftests prototype. * disasm.c: Remove _initialize_disasm prototype. * dtrace-probe.c: Remove _initialize_dtrace_probe prototype. * dummy-frame.c: Remove _initialize_dummy_frame prototype. * dwarf2-frame-tailcall.c: Remove _initialize_tailcall_frame prototype. * dwarf2-frame.c: Remove _initialize_dwarf2_frame prototype. * dwarf2expr.c: Remove _initialize_dwarf2expr prototype. * dwarf2loc.c: Remove _initialize_dwarf2loc prototype. * dwarf2read.c: Remove _initialize_dwarf2_read prototype. * elfread.c: Remove _initialize_elfread prototype. * exec.c: Remove _initialize_exec prototype. * extension.c: Remove _initialize_extension prototype. * f-lang.c: Remove _initialize_f_language prototype. * f-valprint.c: Remove _initialize_f_valprint prototype. * fbsd-nat.c: Remove _initialize_fbsd_nat prototype. * fbsd-tdep.c: Remove _initialize_fbsd_tdep prototype. * filesystem.c: Remove _initialize_filesystem prototype. * findcmd.c: Remove _initialize_mem_search prototype. * fork-child.c: Remove _initialize_fork_child prototype. * frame-base.c: Remove _initialize_frame_base prototype. * frame-unwind.c: Remove _initialize_frame_unwind prototype. * frame.c: Remove _initialize_frame prototype. * frv-linux-tdep.c: Remove _initialize_frv_linux_tdep prototype. * frv-tdep.c: Remove _initialize_frv_tdep prototype. * ft32-tdep.c: Remove _initialize_ft32_tdep prototype. * gcore.c: Remove _initialize_gcore prototype. * gdb_bfd.c: Remove _initialize_gdb_bfd prototype. * gdbarch.c: Regenerate. * gdbarch.sh: Remove _initialize_gdbarch prototype. * gdbtypes.c: Remove _initialize_gdbtypes prototype. * gnu-nat.c: Remove _initialize_gnu_nat prototype. * gnu-v2-abi.c: Remove _initialize_gnu_v2_abi prototype. * gnu-v3-abi.c: Remove _initialize_gnu_v3_abi prototype. * go-lang.c: Remove _initialize_go_language prototype. * go32-nat.c: Remove _initialize_go32_nat prototype. * guile/guile.c: Remove _initialize_guile prototype. * h8300-tdep.c: Remove _initialize_h8300_tdep prototype. * hppa-linux-nat.c: Remove _initialize_hppa_linux_nat prototype. * hppa-linux-tdep.c: Remove _initialize_hppa_linux_tdep prototype. * hppa-nbsd-nat.c: Remove _initialize_hppanbsd_nat prototype. * hppa-nbsd-tdep.c: Remove _initialize_hppanbsd_tdep prototype. * hppa-obsd-nat.c: Remove _initialize_hppaobsd_nat prototype. * hppa-obsd-tdep.c: Remove _initialize_hppaobsd_tdep prototype. * hppa-tdep.c: Remove _initialize_hppa_tdep prototype. * i386-bsd-nat.c: Remove _initialize_i386bsd_nat prototype. * i386-cygwin-tdep.c: Remove _initialize_i386_cygwin_tdep prototype. * i386-darwin-tdep.c: Remove _initialize_i386_darwin_tdep prototype. * i386-dicos-tdep.c: Remove _initialize_i386_dicos_tdep prototype. * i386-fbsd-nat.c: Remove _initialize_i386fbsd_nat prototype. * i386-fbsd-tdep.c: Remove _initialize_i386fbsd_tdep prototype. * i386-gnu-nat.c: Remove _initialize_i386gnu_nat prototype. * i386-gnu-tdep.c: Remove _initialize_i386gnu_tdep prototype. * i386-linux-nat.c: Remove _initialize_i386_linux_nat prototype. * i386-linux-tdep.c: Remove _initialize_i386_linux_tdep prototype. * i386-nbsd-nat.c: Remove _initialize_i386nbsd_nat prototype. * i386-nbsd-tdep.c: Remove _initialize_i386nbsd_tdep prototype. * i386-nto-tdep.c: Remove _initialize_i386nto_tdep prototype. * i386-obsd-nat.c: Remove _initialize_i386obsd_nat prototype. * i386-obsd-tdep.c: Remove _initialize_i386obsd_tdep prototype. * i386-sol2-nat.c: Remove _initialize_amd64_sol2_nat prototype. * i386-sol2-tdep.c: Remove _initialize_amd64_sol2_tdep prototype. * i386-tdep.c: Remove _initialize_i386_tdep prototype. * i386-windows-nat.c: Remove _initialize_i386_windows_nat prototype. * ia64-libunwind-tdep.c: Remove _initialize_libunwind_frame prototype. * ia64-linux-nat.c: Remove _initialize_ia64_linux_nat prototype. * ia64-linux-tdep.c: Remove _initialize_ia64_linux_tdep prototype. * ia64-tdep.c: Remove _initialize_ia64_tdep prototype. * ia64-vms-tdep.c: Remove _initialize_ia64_vms_tdep prototype. * infcall.c: Remove _initialize_infcall prototype. * infcmd.c: Remove _initialize_infcmd prototype. * inferior.c: Remove _initialize_inferiors prototype. * inflow.c: Remove _initialize_inflow prototype. * infrun.c: Remove _initialize_infrun prototype. * interps.c: Remove _initialize_interpreter prototype. * iq2000-tdep.c: Remove _initialize_iq2000_tdep prototype. * jit.c: Remove _initialize_jit prototype. * language.c: Remove _initialize_language prototype. * linux-fork.c: Remove _initialize_linux_fork prototype. * linux-nat.c: Remove _initialize_linux_nat prototype. * linux-tdep.c: Remove _initialize_linux_tdep prototype. * linux-thread-db.c: Remove _initialize_thread_db prototype. * lm32-tdep.c: Remove _initialize_lm32_tdep prototype. * m2-lang.c: Remove _initialize_m2_language prototype. * m32c-tdep.c: Remove _initialize_m32c_tdep prototype. * m32r-linux-nat.c: Remove _initialize_m32r_linux_nat prototype. * m32r-linux-tdep.c: Remove _initialize_m32r_linux_tdep prototype. * m32r-tdep.c: Remove _initialize_m32r_tdep prototype. * m68hc11-tdep.c: Remove _initialize_m68hc11_tdep prototype. * m68k-bsd-nat.c: Remove _initialize_m68kbsd_nat prototype. * m68k-bsd-tdep.c: Remove _initialize_m68kbsd_tdep prototype. * m68k-linux-nat.c: Remove _initialize_m68k_linux_tdep prototype. * m68k-linux-tdep.c: Remove _initialize_m68k_linux_tdep prototype. * m68k-tdep.c: Remove _initialize_m68k_tdep prototype. * m88k-bsd-nat.c: Remove _initialize_m68kbsd_nat prototype. * m88k-tdep.c: Remove _initialize_m68kbsd_tdep prototype. * machoread.c: Remove _initialize_machoread prototype. * macrocmd.c: Remove _initialize_macrocmd prototype. * macroscope.c: Remove _initialize_macroscope prototype. * maint.c: Remove _initialize_maint_cmds prototype. * mdebugread.c: Remove _initialize_mdebugread prototype. * memattr.c: Remove _initialize_mem prototype. * mep-tdep.c: Remove _initialize_mep_tdep prototype. * mi/mi-cmd-env.c: Remove _initialize_mi_cmd_env prototype. * mi/mi-cmds.c: Remove _initialize_mi_cmds prototype. * mi/mi-interp.c: Remove _initialize_mi_interp prototype. * mi/mi-main.c: Remove _initialize_mi_main prototype. * microblaze-linux-tdep.c: Remove _initialize_microblaze_linux_tdep prototype. * microblaze-tdep.c: Remove _initialize_microblaze_tdep prototype. * mips-fbsd-nat.c: Remove _initialize_mips_fbsd_nat prototype. * mips-fbsd-tdep.c: Remove _initialize_mips_fbsd_tdep prototype. * mips-linux-nat.c: Remove _initialize_mips_linux_nat prototype. * mips-linux-tdep.c: Remove _initialize_mips_linux_tdep prototype. * mips-nbsd-nat.c: Remove _initialize_mipsnbsd_nat prototype. * mips-nbsd-tdep.c: Remove _initialize_mipsnbsd_tdep prototype. * mips-sde-tdep.c: Remove _initialize_mips_sde_tdep prototype. * mips-tdep.c: Remove _initialize_mips_tdep prototype. * mips64-obsd-nat.c: Remove _initialize_mips64obsd_nat prototype. * mips64-obsd-tdep.c: Remove _initialize_mips64obsd_tdep prototype. * mipsread.c: Remove _initialize_mipsread prototype. * mn10300-linux-tdep.c: Remove _initialize_mn10300_linux_tdep prototype. * mn10300-tdep.c: Remove _initialize_mn10300_tdep prototype. * moxie-tdep.c: Remove _initialize_moxie_tdep prototype. * msp430-tdep.c: Remove _initialize_msp430_tdep prototype. * mt-tdep.c: Remove _initialize_mt_tdep prototype. * nds32-tdep.c: Remove _initialize_nds32_tdep prototype. * nios2-linux-tdep.c: Remove _initialize_nios2_linux_tdep prototype. * nios2-tdep.c: Remove _initialize_nios2_tdep prototype. * nto-procfs.c: Remove _initialize_procfs prototype. * nto-tdep.c: Remove _initialize_nto_tdep prototype. * objc-lang.c: Remove _initialize_objc_language prototype. * objfiles.c: Remove _initialize_objfiles prototype. * observer.c: Remove observer_test_first_notification_function, observer_test_second_notification_function, observer_test_third_notification_function, and _initialize_observer prototypes. * opencl-lang.c: Remove _initialize_opencl_language prototypes. * osabi.c: Remove _initialize_gdb_osabi prototype. * osdata.c: Remove _initialize_osdata prototype. * p-valprint.c: Remove _initialize_pascal_valprint prototype. * parse.c: Remove _initialize_parse prototype. * ppc-fbsd-nat.c: Remove _initialize_ppcfbsd_nat prototype. * ppc-fbsd-tdep.c: Remove _initialize_ppcfbsd_tdep prototype. * ppc-linux-nat.c: Remove _initialize_ppc_linux_nat prototype. * ppc-linux-tdep.c: Remove _initialize_ppc_linux_tdep prototype. * ppc-nbsd-nat.c: Remove _initialize_ppcnbsd_nat prototype. * ppc-nbsd-tdep.c: Remove _initialize_ppcnbsd_tdep prototype. * ppc-obsd-nat.c: Remove _initialize_ppcobsd_nat prototype. * ppc-obsd-tdep.c: Remove _initialize_ppcobsd_tdep prototype. * printcmd.c: Remove _initialize_printcmd prototype. * probe.c: Remove _initialize_probe prototype. * proc-api.c: Remove _initialize_proc_api prototype. * proc-events.c: Remove _initialize_proc_events prototype. * proc-service.c: Remove _initialize_proc_service prototype. * procfs.c: Remove _initialize_procfs prototype. * psymtab.c: Remove _initialize_psymtab prototype. * python/python.c: Remove _initialize_python prototype. * ravenscar-thread.c: Remove _initialize_ravenscar prototype. * record-btrace.c: Remove _initialize_record_btrace prototype. * record-full.c: Remove _initialize_record_full prototype. * record.c: Remove _initialize_record prototype. * regcache.c: Remove _initialize_regcache prototype. * reggroups.c: Remove _initialize_reggroup prototype. * remote-notif.c: Remove _initialize_notif prototype. * remote-sim.c: Remove _initialize_remote_sim prototype. * remote.c: Remove _initialize_remote prototype. * reverse.c: Remove _initialize_reverse prototype. * rl78-tdep.c: Remove _initialize_rl78_tdep prototype. * rs6000-aix-tdep.c: Remove _initialize_rs6000_aix_tdep prototype. * rs6000-lynx178-tdep.c: Remove _initialize_rs6000_lynx178_tdep prototype. * rs6000-nat.c: Remove _initialize_rs6000_nat prototype. * rs6000-tdep.c: Remove _initialize_rs6000_tdep prototype. * rust-exp.y: Remove _initialize_rust_exp prototype. * rx-tdep.c: Remove _initialize_rx_tdep prototype. * s390-linux-nat.c: Remove _initialize_s390_nat prototype. * s390-linux-tdep.c: Remove _initialize_s390_tdep prototype. * score-tdep.c: Remove _initialize_score_tdep prototype. * selftest-arch.c: Remove _initialize_selftests_foreach_arch prototype. * ser-go32.c: Remove _initialize_ser_dos prototype. * ser-mingw.c: Remove _initialize_ser_windows prototype. * ser-pipe.c: Remove _initialize_ser_pipe prototype. * ser-tcp.c: Remove _initialize_ser_tcp prototype. * ser-unix.c: Remove _initialize_ser_hardwire prototype. * serial.c: Remove _initialize_serial prototype. * sh-linux-tdep.c: Remove _initialize_sh_linux_tdep prototype. * sh-nbsd-nat.c: Remove _initialize_shnbsd_nat prototype. * sh-nbsd-tdep.c: Remove _initialize_shnbsd_tdep prototype. * sh-tdep.c: Remove _initialize_sh_tdep prototype. * skip.c: Remove _initialize_step_skip prototype. * sol-thread.c: Remove _initialize_sol_thread prototype. * solib-aix.c: Remove _initialize_solib_aix prototype. * solib-darwin.c: Remove _initialize_darwin_solib prototype. * solib-dsbt.c: Remove _initialize_dsbt_solib prototype. * solib-frv.c: Remove _initialize_frv_solib prototype. * solib-spu.c: Remove _initialize_spu_solib prototype. * solib-svr4.c: Remove _initialize_svr4_solib prototype. * solib-target.c: Remove _initialize_solib_target prototype. * solib.c: Remove _initialize_solib prototype. * source.c: Remove _initialize_source prototype. * sparc-linux-nat.c: Remove _initialize_sparc_linux_nat prototype. * sparc-linux-tdep.c: Remove _initialize_sparc_linux_tdep prototype. * sparc-nat.c: Remove _initialize_sparc_nat prototype. * sparc-nbsd-nat.c: Remove _initialize_sparcnbsd_nat prototype. * sparc-nbsd-tdep.c: Remove _initialize_sparcnbsd_tdep prototype. * sparc-obsd-tdep.c: Remove _initialize_sparc32obsd_tdep prototype. * sparc-sol2-nat.c: Remove _initialize_sparc_sol2_nat prototype. * sparc-sol2-tdep.c: Remove _initialize_sparc_sol2_tdep prototype. * sparc-tdep.c: Remove _initialize_sparc_tdep prototype. * sparc64-fbsd-nat.c: Remove _initialize_sparc64fbsd_nat prototype. * sparc64-fbsd-tdep.c: Remove _initialize_sparc64fbsd_tdep prototype. * sparc64-linux-nat.c: Remove _initialize_sparc64_linux_nat prototype. * sparc64-linux-tdep.c: Remove _initialize_sparc64_linux_tdep prototype. * sparc64-nat.c: Remove _initialize_sparc64_nat prototype. * sparc64-nbsd-nat.c: Remove _initialize_sparc64nbsd_nat prototype. * sparc64-nbsd-tdep.c: Remove _initialize_sparc64nbsd_tdep prototype. * sparc64-obsd-nat.c: Remove _initialize_sparc64obsd_nat prototype. * sparc64-obsd-tdep.c: Remove _initialize_sparc64obsd_tdep prototype. * sparc64-sol2-tdep.c: Remove _initialize_sparc64_sol2_tdep prototype. * spu-linux-nat.c: Remove _initialize_spu_nat prototype. * spu-multiarch.c: Remove _initialize_spu_multiarch prototype. * spu-tdep.c: Remove _initialize_spu_tdep prototype. * stabsread.c: Remove _initialize_stabsread prototype. * stack.c: Remove _initialize_stack prototype. * stap-probe.c: Remove _initialize_stap_probe prototype. * std-regs.c: Remove _initialize_frame_reg prototype. * symfile-debug.c: Remove _initialize_symfile_debug prototype. * symfile-mem.c: Remove _initialize_symfile_mem prototype. * symfile.c: Remove _initialize_symfile prototype. * symmisc.c: Remove _initialize_symmisc prototype. * symtab.c: Remove _initialize_symtab prototype. * target-dcache.c: Remove _initialize_target_dcache prototype. * target-descriptions.c: Remove _initialize_target_descriptions prototype. * thread.c: Remove _initialize_thread prototype. * tic6x-linux-tdep.c: Remove _initialize_tic6x_linux_tdep prototype. * tic6x-tdep.c: Remove _initialize_tic6x_tdep prototype. * tilegx-linux-nat.c: Remove _initialize_tile_linux_nat prototype. * tilegx-linux-tdep.c: Remove _initialize_tilegx_linux_tdep prototype. * tilegx-tdep.c: Remove _initialize_tilegx_tdep prototype. * tracefile-tfile.c: Remove _initialize_tracefile_tfile prototype. * tracefile.c: Remove _initialize_tracefile prototype. * tracepoint.c: Remove _initialize_tracepoint prototype. * tui/tui-hooks.c: Remove _initialize_tui_hooks prototype. * tui/tui-interp.c: Remove _initialize_tui_interp prototype. * tui/tui-layout.c: Remove _initialize_tui_layout prototype. * tui/tui-regs.c: Remove _initialize_tui_regs prototype. * tui/tui-stack.c: Remove _initialize_tui_stack prototype. * tui/tui-win.c: Remove _initialize_tui_win prototype. * tui/tui.c: Remove _initialize_tui prototype. * typeprint.c: Remove _initialize_typeprint prototype. * user-regs.c: Remove _initialize_user_regs prototype. * utils.c: Remove _initialize_utils prototype. * v850-tdep.c: Remove _initialize_v850_tdep prototype. * valarith.c: Remove _initialize_valarith prototype. * valops.c: Remove _initialize_valops prototype. * valprint.c: Remove _initialize_valprint prototype. * value.c: Remove _initialize_values prototype. * varobj.c: Remove _initialize_varobj prototype. * vax-bsd-nat.c: Remove _initialize_vaxbsd_nat prototype. * vax-nbsd-tdep.c: Remove _initialize_vaxnbsd_tdep prototype. * vax-tdep.c: Remove _initialize_vax_tdep prototype. * windows-nat.c: Remove _initialize_windows_nat, _initialize_check_for_gdb_ini, and _initialize_loadable prototypes. * windows-tdep.c: Remove _initialize_windows_tdep prototype. * xcoffread.c: Remove _initialize_xcoffread prototype. * xml-support.c: Remove _initialize_xml_support prototype. * xstormy16-tdep.c: Remove _initialize_xstormy16_tdep prototype. * xtensa-linux-nat.c: Remove _initialize_xtensa_linux_nat prototype. * xtensa-linux-tdep.c: Remove _initialize_xtensa_linux_tdep prototype. * xtensa-tdep.c: Remove _initialize_xtensa_tdep prototype.
2017-08-07gdbarch: Use an anonymous union for target data in `gdbarch_info'Maciej W. Rozycki
As an update to commit ede5f15146ae ("gdbarch.h: Change gdbarch_info::tdep_info's type to void *") replace the definition of the `tdep_info' member in `struct gdbarch_info' with an anonymous union, comprising the original member, with its type reverted to `struct gdbarch_tdep_info *', a `tdesc_data' member of a `struct tdesc_arch_data *' type and an `id' member of an `int *' type. Remove now unnecessary casts throughout use places then, making code easier to read an less prone to errors, which may happen with casting. gdb/ * gdbarch.sh (gdbarch_info): Replace the `tdep_info' member with a union of `tdep_info', `tdesc_data' and `id'. * aarch64-tdep.c (aarch64_gdbarch_init): Use `info.tdesc_data' rather than `info.tdep_info'. * amd64-linux-tdep.c (amd64_linux_init_abi): Likewise. * i386-linux-tdep.c (i386_linux_init_abi): Likewise. * i386-tdep.c (i386_gdbarch_init): Likewise. * mips-linux-tdep.c (mips_linux_init_abi): Likewise. * mips-tdep.c (mips_gdbarch_init): Likewise. * nds32-tdep.c (nds32_gdbarch_init): Likewise. * rs6000-tdep.c (rs6000_gdbarch_init): Likewise. * ppc-linux-tdep.c (ppu2spu_sniffer): Use `info.id' rather than `info.tdep_info'. (ppc_linux_init_abi): Use `info.tdesc_data' rather than `info.tdep_info'. * sparc-tdep.c (sparc32_gdbarch_init): Likewise. * spu-multiarch.c (spu_gdbarch): Use `info.id' rather than `info.tdep_info'. * spu-tdep.c (spu_gdbarch_init): Likewise. * gdbarch.h: Regenerate.
2017-06-10gdbarch: Remove displaced_step_free_closureSimon Marchi
The displaced_step_free_closure gdbarch hook allows architectures to free data they might have allocated to complete a displaced step. However, all architectures using that hook use the simple_displaced_step_free_closure provided in arch-utils.{c,h}, which does a simple xfree. We can remove it and do an xfree directly instead of calling the hook. gdb/ChangeLog: * gdbarch.sh (displaced_step_free_closure): Remove. * gdbarch.h, gdbarch.c: Re-generate. * aarch64-linux-tdep.c (aarch64_linux_init_abi): Don't set displaced_step_free_closure. * amd64-linux-tdep.c (amd64_linux_init_abi_common): Likewise. * arm-linux-tdep.c (arm_linux_init_abi): Likewise. * i386-linux-tdep.c (i386_linux_init_abi): Likewise. * rs6000-aix-tdep.c (rs6000_aix_init_osabi): Likewise. * rs6000-tdep.c (rs6000_gdbarch_init): Likewise. * s390-linux-tdep.c (s390_gdbarch_init): Likewise. * arch-utils.h (simple_displaced_step_free_closure): Remove. * arch-utils.c (simple_displaced_step_free_closure): Remove. * infrun.c (displaced_step_clear): Call xfree instead of gdbarch_displaced_step_free_closure.
2017-05-24Use disassemble.c:disassembler select rs6000 disassemblerYao Qi
Nowadays, rs6000 disassembler is selected in different ways in opcodes and gdb, opcodes: case bfd_arch_rs6000: if (mach == bfd_mach_ppc_620) disassemble = print_insn_big_powerpc; else disassemble = print_insn_rs6000; break; gdb: if (arch == bfd_arch_rs6000) set_gdbarch_print_insn (gdbarch, print_insn_rs6000); else set_gdbarch_print_insn (gdbarch, gdb_print_insn_powerpc); I am not sure which one is the right one. However, such selection should be done in one place instead of two. gdb: 2017-05-24 Yao Qi <yao.qi@linaro.org> * rs6000-tdep.c (gdb_print_insn_powerpc): Remove. (rs6000_gdbarch_init): Don't call set_gdbarch_print_insn.
2017-05-22Add PPC_MAX_REGISTER_SIZEAlan Hayward
gdb/ * ppc-linux-nat.c (fetch_register): Use PPC_MAX_REGISTER_SIZE. (store_register): Likewise. * ppc-sysv-tdep.c (ppc_sysv_abi_push_dummy_call): Likewise. (get_decimal_float_return_value): Likewise. (do_ppc_sysv_return_value): Likewise. (ppc64_sysv_abi_push_integer): Likewise. (ppc64_sysv_abi_push_freg): Likewise. (ppc64_sysv_abi_return_value_base): Likewise. (ppc64_sysv_abi_return_value): Likewise. * rs6000-aix-tdep.c (rs6000_push_dummy_call): Likewise. * rs6000-lynx178-tdep.c (rs6000_lynx178_push_dummy_call): Likewise. * rs6000-nat.c: Likewise. * rs6000-tdep.c (rs6000_register_to_value): Likewise. (rs6000_value_to_register): Likewise. * ppc-tdep.h (PPC_MAX_REGISTER_SIZE): Add.
2017-05-02Change return type of gdbarch_software_single_step to vector<CORE_ADDR>Simon Marchi
This is a relatively straightforward patch that changes gdbarch_software_single_step so it returns an std::vector<CORE_ADDR> instead of a VEC (CORE_ADDR). gdb/ChangeLog: * gdbarch.sh (software_single_step): Change return type to std::vector<CORE_ADDR>. * gdbarch.c, gdbarch.h: Re-generate. * arch/arm-get-next-pcs.c (thumb_deal_with_atomic_sequence_raw): Adjust. (arm_deal_with_atomic_sequence_raw): Adjust. (thumb_get_next_pcs_raw): Adjust. (arm_get_next_pcs_raw): Adjust. (arm_get_next_pcs): Adjust. * arch/arm-get-next-pcs.h (arm_get_next_pcs): Adjust. * aarch64-tdep.c (aarch64_software_single_step): Adjust. * alpha-tdep.c (alpha_deal_with_atomic_sequence): Adjust. (alpha_software_single_step): Adjust. * alpha-tdep.h (alpha_software_single_step): Adjust. * arm-linux-tdep.c (arm_linux_software_single_step): Adjust. * arm-tdep.c (arm_software_single_step): Adjust. (arm_breakpoint_kind_from_current_state): Adjust. * arm-tdep.h (arm_software_single_step): Adjust. * breakpoint.c (insert_single_step_breakpoint): Adjust. * cris-tdep.c (cris_software_single_step): Adjust. * mips-tdep.c (mips_deal_with_atomic_sequence): Adjust. (micromips_deal_with_atomic_sequence): Adjust. (deal_with_atomic_sequence): Adjust. (mips_software_single_step): Adjust. * mips-tdep.h (mips_software_single_step): Adjust. * moxie-tdep.c (moxie_software_single_step): Adjust. * nios2-tdep.c (nios2_software_single_step): Adjust. * ppc-tdep.h (ppc_deal_with_atomic_sequence): Adjust. * rs6000-aix-tdep.c (rs6000_software_single_step): Adjust. * rs6000-tdep.c (ppc_deal_with_atomic_sequence): Adjust. * s390-linux-tdep.c (s390_software_single_step): Adjust. * sparc-tdep.c (sparc_software_single_step): Adjust. * spu-tdep.c (spu_software_single_step): Adjust. * tic6x-tdep.c (tic6x_software_single_step): Adjust. gdb/gdbserver/ChangeLog: * linux-arm-low.c (arm_gdbserver_get_next_pcs): Adjust to software_single_step change of return type to std::vector<CORE_ADDR>. * linux-low.c (install_software_single_step_breakpoints): Likewise. * linux-low.h (install_software_single_step_breakpoints): Likewise.
2017-04-05-Wwrite-strings: The RestPedro Alves
This is the remainder boring constification that all looks more of less borderline obvious IMO. gdb/ChangeLog: 2017-04-05 Pedro Alves <palves@redhat.com> * ada-exp.y (yyerror): Constify. * ada-lang.c (bound_name, get_selections) (ada_variant_discrim_type) (ada_variant_discrim_name, ada_value_struct_elt) (ada_lookup_struct_elt_type, is_unchecked_variant) (ada_which_variant_applies, standard_exc, ada_get_next_arg) (catch_ada_exception_command_split) (catch_ada_assert_command_split, catch_assert_command) (ada_op_name): Constify. * ada-lang.h (ada_yyerror, get_selections) (ada_variant_discrim_name, ada_value_struct_elt): Constify. * arc-tdep.c (arc_print_frame_cache): Constify. * arm-tdep.c (arm_skip_stub): Constify. * ax-gdb.c (gen_binop, gen_struct_ref_recursive, gen_struct_ref) (gen_aggregate_elt_ref): Constify. * bcache.c (print_bcache_statistics): Constify. * bcache.h (print_bcache_statistics): Constify. * break-catch-throw.c (catch_exception_command_1): * breakpoint.c (struct ep_type_description::description): Constify. (add_solib_catchpoint): Constify. (catch_fork_command_1): Add cast. (add_catch_command): Constify. * breakpoint.h (add_catch_command, add_solib_catchpoint): Constify. * bsd-uthread.c (bsd_uthread_state): Constify. * buildsym.c (patch_subfile_names): Constify. * buildsym.h (next_symbol_text_func, patch_subfile_names): Constify. * c-exp.y (yyerror): Constify. (token::oper): Constify. * c-lang.h (c_yyerror, cp_print_class_member): Constify. * c-varobj.c (cplus_describe_child): Constify. * charset.c (find_charset_names): Add cast. (find_charset_names): Constify array and add const_cast. * cli/cli-cmds.c (complete_command, cd_command): Constify. (edit_command): Constify. * cli/cli-decode.c (lookup_cmd): Constify. * cli/cli-dump.c (dump_memory_command, dump_value_command): Constify. (struct dump_context): Constify. (add_dump_command, restore_command): Constify. * cli/cli-script.c (get_command_line): Constify. * cli/cli-script.h (get_command_line): Constify. * cli/cli-utils.c (check_for_argument): Constify. * cli/cli-utils.h (check_for_argument): Constify. * coff-pe-read.c (struct read_pe_section_data): Constify. * command.h (lookup_cmd): Constify. * common/print-utils.c (decimal2str): Constify. * completer.c (gdb_print_filename): Constify. * corefile.c (set_gnutarget): Constify. * cp-name-parser.y (yyerror): Constify. * cp-valprint.c (cp_print_class_member): Constify. * cris-tdep.c (cris_register_name, crisv32_register_name): Constify. * d-exp.y (yyerror): Constify. (struct token::oper): Constify. * d-lang.h (d_yyerror): Constify. * dbxread.c (struct header_file_location::name): Constify. (add_old_header_file, add_new_header_file, last_function_name) (dbx_next_symbol_text, add_bincl_to_list) (find_corresponding_bincl_psymtab, set_namestring) (find_stab_function_addr, read_dbx_symtab, start_psymtab) (dbx_end_psymtab, read_ofile_symtab, process_one_symbol): * defs.h (command_line_input, print_address_symbolic) (deprecated_readline_begin_hook): Constify. * dwarf2read.c (anonymous_struct_prefix, dwarf_bool_name): Constify. * event-top.c (handle_line_of_input): Constify and add cast. * exceptions.c (catch_errors): Constify. * exceptions.h (catch_errors): Constify. * expprint.c (print_subexp_standard, op_string, op_name) (op_name_standard, dump_raw_expression, dump_raw_expression): * expression.h (op_name, op_string, dump_raw_expression): Constify. * f-exp.y (yyerror): Constify. (struct token::oper): Constify. (struct f77_boolean_val::name): Constify. * f-lang.c (f_word_break_characters): Constify. * f-lang.h (f_yyerror): Constify. * fork-child.c (fork_inferior): Add cast. * frv-tdep.c (struct gdbarch_tdep::register_names): Constify. (new_variant): Constify. * gdbarch.sh (pstring_ptr, pstring_list): Constify. * gdbarch.c: Regenerate. * gdbcore.h (set_gnutarget): Constify. * go-exp.y (yyerror): Constify. (token::oper): Constify. * go-lang.h (go_yyerror): Constify. * go32-nat.c (go32_sysinfo): Constify. * guile/scm-breakpoint.c (gdbscm_breakpoint_expression): Constify. * guile/scm-cmd.c (cmdscm_function): Constify. * guile/scm-param.c (pascm_param_value): Constify. * h8300-tdep.c (h8300_register_name, h8300s_register_name) (h8300sx_register_name): Constify. * hppa-tdep.c (hppa32_register_name, hppa64_register_name): Constify. * ia64-tdep.c (ia64_register_names): Constify. * infcmd.c (construct_inferior_arguments): Constify. (path_command, attach_post_wait): Constify. * language.c (show_range_command, show_case_command) (unk_lang_error): Constify. * language.h (language_defn::la_error) (language_defn::la_name_of_this): Constify. * linespec.c (decode_line_2): Constify. * linux-thread-db.c (thread_db_err_str): Constify. * lm32-tdep.c (lm32_register_name): Constify. * m2-exp.y (yyerror): Constify. * m2-lang.h (m2_yyerror): Constify. * m32r-tdep.c (m32r_register_names): Constify and make static. * m68hc11-tdep.c (m68hc11_register_names): Constify. * m88k-tdep.c (m88k_register_name): Constify. * macroexp.c (appendmem): Constify. * mdebugread.c (fdr_name, add_data_symbol, parse_type) (upgrade_type, parse_external, parse_partial_symbols) (mdebug_next_symbol_text, cross_ref, mylookup_symbol, new_psymtab) (new_symbol): Constify. * memattr.c (mem_info_command): Constify. * mep-tdep.c (register_name_from_keyword): Constify. * mi/mi-cmd-env.c (mi_cmd_env_path, _initialize_mi_cmd_env): Constify. * mi/mi-cmd-stack.c (list_args_or_locals): Constify. * mi/mi-cmd-var.c (mi_cmd_var_show_attributes): Constify. * mi/mi-main.c (captured_mi_execute_command): Constify and add cast. (mi_execute_async_cli_command): Constify. * mips-tdep.c (mips_register_name): Constify. * mn10300-tdep.c (register_name, mn10300_generic_register_name) (am33_register_name, am33_2_register_name) * moxie-tdep.c (moxie_register_names): Constify. * nat/linux-osdata.c (osdata_type): Constify fields. * nto-tdep.c (nto_parse_redirection): Constify. * objc-lang.c (lookup_struct_typedef, lookup_objc_class) (lookup_child_selector): Constify. (objc_methcall::name): Constify. * objc-lang.h (lookup_objc_class, lookup_child_selector) (lookup_struct_typedef): Constify. * objfiles.c (pc_in_section): Constify. * objfiles.h (pc_in_section): Constify. * p-exp.y (struct token::oper): Constify. (yyerror): Constify. * p-lang.h (pascal_yyerror): Constify. * parser-defs.h (op_name_standard): Constify. (op_print::string): Constify. (exp_descriptor::op_name): Constify. * printcmd.c (print_address_symbolic): Constify. * psymtab.c (print_partial_symbols): Constify. * python/py-breakpoint.c (stop_func): Constify. (bppy_get_expression): Constify. * python/py-cmd.c (cmdpy_completer::name): Constify. (cmdpy_function): Constify. * python/py-event.c (evpy_add_attribute) (gdbpy_initialize_event_generic): Constify. * python/py-event.h (evpy_add_attribute) (gdbpy_initialize_event_generic): Constify. * python/py-evts.c (add_new_registry): Constify. * python/py-finishbreakpoint.c (outofscope_func): Constify. * python/py-framefilter.c (get_py_iter_from_func): Constify. * python/py-inferior.c (get_buffer): Add cast. * python/py-param.c (parm_constant::name): Constify. * python/py-unwind.c (fprint_frame_id): Constify. * python/python.c (gdbpy_parameter_value): Constify. * remote-fileio.c (remote_fio_func_map): Make 'name' const. * remote.c (memory_packet_config::name): Constify. (show_packet_config_cmd, remote_write_bytes) (remote_buffer_add_string): * reverse.c (exec_reverse_once): Constify. * rs6000-tdep.c (variant::name, variant::description): Constify. * rust-exp.y (rustyyerror): Constify. * rust-lang.c (rust_op_name): Constify. * rust-lang.h (rustyyerror): Constify. * serial.h (serial_ops::name): Constify. * sh-tdep.c (sh_sh_register_name, sh_sh3_register_name) (sh_sh3e_register_name, sh_sh2e_register_name) (sh_sh2a_register_name, sh_sh2a_nofpu_register_name) (sh_sh_dsp_register_name, sh_sh3_dsp_register_name) (sh_sh4_register_name, sh_sh4_nofpu_register_name) (sh_sh4al_dsp_register_name): Constify. * sh64-tdep.c (sh64_register_name): Constify. * solib-darwin.c (lookup_symbol_from_bfd): Constify. * spu-tdep.c (spu_register_name, info_spu_dma_cmdlist): Constify. * stabsread.c (patch_block_stabs, read_type_number) (ref_map::stabs, ref_add, process_reference) (symbol_reference_defined, define_symbol, define_symbol) (error_type, read_type, read_member_functions, read_cpp_abbrev) (read_one_struct_field, read_struct_fields, read_baseclasses) (read_tilde_fields, read_struct_type, read_array_type) (read_enum_type, read_sun_builtin_type, read_sun_floating_type) (read_huge_number, read_range_type, read_args, common_block_start) (find_name_end): Constify. * stabsread.h (common_block_start, define_symbol) (process_one_symbol, symbol_reference_defined, ref_add): * symfile.c (get_section_index, add_symbol_file_command): * symfile.h (get_section_index): Constify. * target-descriptions.c (tdesc_type::name): Constify. (tdesc_free_type): Add cast. * target.c (find_default_run_target): (add_deprecated_target_alias, find_default_run_target) (target_announce_detach): Constify. (do_option): Constify. * target.h (add_deprecated_target_alias): Constify. * thread.c (print_thread_info_1): Constify. * top.c (deprecated_readline_begin_hook, command_line_input): Constify. (init_main): Add casts. * top.h (handle_line_of_input): Constify. * tracefile-tfile.c (tfile_write_uploaded_tsv): Constify. * tracepoint.c (tvariables_info_1, trace_status_mi): Constify. (tfind_command): Rename to ... (tfind_command_1): ... this and constify. (tfind_command): New function. (tfind_end_command, tfind_start_command): Adjust. (encode_source_string): Constify. * tracepoint.h (encode_source_string): Constify. * tui/tui-data.c (tui_partial_win_by_name): Constify. * tui/tui-data.h (tui_partial_win_by_name): Constify. * tui/tui-source.c (tui_set_source_content_nil): Constify. * tui/tui-source.h (tui_set_source_content_nil): Constify. * tui/tui-win.c (parse_scrolling_args): Constify. * tui/tui-windata.c (tui_erase_data_content): Constify. * tui/tui-windata.h (tui_erase_data_content): Constify. * tui/tui-winsource.c (tui_erase_source_content): Constify. * tui/tui.c (tui_enable): Add cast. * utils.c (defaulted_query): Constify. (init_page_info): Add cast. (puts_debug, subset_compare): Constify. * utils.h (subset_compare): Constify. * varobj.c (varobj_format_string): Constify. * varobj.h (varobj_format_string): Constify. * vax-tdep.c (vax_register_name): Constify. * windows-nat.c (windows_detach): Constify. * xcoffread.c (process_linenos, xcoff_next_symbol_text): Constify. * xml-support.c (gdb_xml_end_element): Constify. * xml-tdesc.c (tdesc_start_reg): Constify. * xstormy16-tdep.c (xstormy16_register_name): Constify. * xtensa-tdep.c (xtensa_find_register_by_name): Constify. * xtensa-tdep.h (xtensa_register_t::name): Constify. gdb/gdbserver/ChangeLog: 2017-04-05 Pedro Alves <palves@redhat.com> * gdbreplay.c (sync_error): Constify. * linux-x86-low.c (push_opcode): Constify.
2017-02-28GDB: Add support for the new set/show disassembler-options commands.Peter Bergner
This commit adds support to GDB so that it can modify the disassembler-options value that is passed to the disassembler, similar to objdump's -M option. Currently, the only supported targets are ARM, PowerPC and S/390, but adding support for a new target(s) is not difficult. include/ * dis-asm.h (disasm_options_t): New typedef. (parse_arm_disassembler_option): Remove prototype. (set_arm_regname_option): Likewise. (get_arm_regnames): Likewise. (get_arm_regname_num_options): Likewise. (disassemble_init_s390): New prototype. (disassembler_options_powerpc): Likewise. (disassembler_options_arm): Likewise. (disassembler_options_s390): Likewise. (remove_whitespace_and_extra_commas): Likewise. (disassembler_options_cmp): Likewise. (next_disassembler_option): New inline function. (FOR_EACH_DISASSEMBLER_OPTION): New macro. opcodes/ * disassemble.c Include "safe-ctype.h". (disassemble_init_for_target): Handle s390 init. (remove_whitespace_and_extra_commas): New function. (disassembler_options_cmp): Likewise. * arm-dis.c: Include "libiberty.h". (NUM_ELEM): Delete. (regnames): Use long disassembler style names. Add force-thumb and no-force-thumb options. (NUM_ARM_REGNAMES): Rename from this... (NUM_ARM_OPTIONS): ...to this. Use ARRAY_SIZE. (get_arm_regname_num_options): Delete. (set_arm_regname_option): Likewise. (get_arm_regnames): Likewise. (parse_disassembler_options): Likewise. (parse_arm_disassembler_option): Rename from this... (parse_arm_disassembler_options): ...to this. Make static. Use new FOR_EACH_DISASSEMBLER_OPTION macro to scan over options. (print_insn): Use parse_arm_disassembler_options. (disassembler_options_arm): New function. (print_arm_disassembler_options): Handle updated regnames. * ppc-dis.c: Include "libiberty.h". (ppc_opts): Add "32" and "64" entries. (ppc_parse_cpu): Use ARRAY_SIZE and disassembler_options_cmp. (powerpc_init_dialect): Add break to switch statement. Use new FOR_EACH_DISASSEMBLER_OPTION macro. (disassembler_options_powerpc): New function. (print_ppc_disassembler_options): Use ARRAY_SIZE. Remove printing of "32" and "64". * s390-dis.c: Include "libiberty.h". (init_flag): Remove unneeded variable. (struct s390_options_t): New structure type. (options): New structure. (init_disasm): Rename from this... (disassemble_init_s390): ...to this. Add initializations for current_arch_mask and option_use_insn_len_bits_p. Remove init_flag. (print_insn_s390): Delete call to init_disasm. (disassembler_options_s390): New function. (print_s390_disassembler_options): Print using information from struct 'options'. * po/opcodes.pot: Regenerate. binutils/ * objdump.c (main): Use remove_whitespace_and_extra_commas. gdb/ * NEWS: Mention new set/show disassembler-options commands. * doc/gdb.texinfo: Document new set/show disassembler-options commands. * disasm.c: Include "arch-utils.h", "gdbcmd.h" and "safe-ctype.h". (prospective_options): New static variable. (gdb_disassembler::gdb_disassembler): Initialize m_di.disassembler_options. (gdb_buffered_insn_length_init_dis): Initilize di->disassembler_options. (get_disassembler_options): New function. (set_disassembler_options): Likewise. (set_disassembler_options_sfunc): Likewise. (show_disassembler_options_sfunc): Likewise. (disassembler_options_completer): Likewise. (_initialize_disasm): Likewise. * disasm.h (get_disassembler_options): New prototype. (set_disassembler_options): Likewise. * gdbarch.sh (gdbarch_disassembler_options): New variable. (gdbarch_verify_disassembler_options): Likewise. * gdbarch.c: Regenerate. * gdbarch.h: Likewise. * arm-tdep.c (num_disassembly_options): Delete. (set_disassembly_style): Likewise. (arm_disassembler_options): New static variable. (set_disassembly_style_sfunc): Convert short style name into long option name. Call set_disassembler_options. (show_disassembly_style_sfunc): New function. (arm_gdbarch_init): Call set_gdbarch_disassembler_options and set_gdbarch_verify_disassembler_options. (_initialize_arm_tdep): Delete regnames variable and update callers. (arm_disassembler_options): Initialize. (disasm_options): New variable. (num_disassembly_options): Rename from this... (num_disassembly_styles): ...to this. Compute by scanning through disasm_options. (valid_disassembly_styles): Initialize using disasm_options. Remove calls to parse_arm_disassembler_option, get_arm_regnames and set_arm_regname_option. Pass show_disassembly_style_sfunc to the "disassembler" setshow command. * rs6000-tdep.c (powerpc_disassembler_options): New static variable. (rs6000_gdbarch_init): Call set_gdbarch_disassembler_options and set_gdbarch_verify_disassembler_options. * s390-tdep.c (s390_disassembler_options): New static variable. (s390_gdbarch_init):all set_gdbarch_disassembler_options and set_gdbarch_verify_disassembler_options. gdb/testsuite/ * gdb.arch/powerpc-power.exp: Delete test. * gdb.arch/powerpc-power.s: Likewise. * gdb.disasm/disassembler-options.exp: New test. * gdb.arch/powerpc-altivec.exp: Likewise. * gdb.arch/powerpc-altivec.s: Likewise. * gdb.arch/powerpc-altivec2.exp: Likewise. * gdb.arch/powerpc-altivec2.s: Likewise. * gdb.arch/powerpc-altivec3.exp: Likewise. * gdb.arch/powerpc-altivec3.s: Likewise. * gdb.arch/powerpc-power7.exp: Likewise. * gdb.arch/powerpc-power7.s: Likewise. * gdb.arch/powerpc-power8.exp: Likewise. * gdb.arch/powerpc-power8.s: Likewise. * gdb.arch/powerpc-power9.exp: Likewise. * gdb.arch/powerpc-power9.s: Likewise. * gdb.arch/powerpc-vsx.exp: Likewise. * gdb.arch/powerpc-vsx.s: Likewise. * gdb.arch/powerpc-vsx2.exp: Likewise. * gdb.arch/powerpc-vsx2.s: Likewise. * gdb.arch/powerpc-vsx3.exp: Likewise. * gdb.arch/powerpc-vsx3.s: Likewise. * gdb.arch/arm-disassembler-options.exp: Likewise. * gdb.arch/powerpc-disassembler-options.exp: Likewise. * gdb.arch/s390-disassembler-options.exp: Likewise.
2017-02-21[ppc64] Add POWER8/ISA 2.07 atomic sequences single-stepping supportEdjunior Barbosa Machado
gdb/ 2017-02-21 Edjunior Barbosa Machado <emachado@linux.vnet.ibm.com> * rs6000-tdep.c (LOAD_AND_RESERVE_MASK): Rename from LWARX_MASK. (STORE_CONDITIONAL_MASK): Rename from STWCX_MASK. (LBARX_INSTRUCTION, LHARX_INSTRUCTION, LQARX_INSTRUCTION, STBCX_INSTRUCTION, STHCX_INSTRUCTION, STQCX_INSTRUCTION): New defines. (IS_LOAD_AND_RESERVE_INSN, IS_STORE_CONDITIONAL_INSN): New macros. (ppc_displaced_step_copy_insn): Use IS_LOAD_AND_RESERVE_INSN. (ppc_deal_with_atomic_sequence): Use IS_LOAD_AND_RESERVE_INSN and IS_STORE_CONDITIONAL_INSN. gdb/testsuite/ 2017-02-21 Edjunior Barbosa Machado <emachado@linux.vnet.ibm.com> * gdb.arch/ppc64-isa207-atomic-inst.exp: New testcase based on gdb.arch/ppc64-atomic-inst.exp. Add tests for lbarx/stbcx, lharx/sthcx and lqarx/stqcx. * gdb.arch/ppc64-isa207-atomic-inst.S: New file. * gdb.arch/ppc64-isa207-atomic-inst.c: Likewise.
2017-01-01update copyright year range in GDB filesJoel Brobecker
This applies the second part of GDB's End of Year Procedure, which updates the copyright year range in all of GDB's files. gdb/ChangeLog: Update copyright year range in all GDB files.
2016-12-09gdb: Remove support for obsolete OSABIs and a.outPedro Alves
gdb/ChangeLog: 2016-12-09 Pedro Alves <palves@redhat.com> * Makefile.in (ALL_TARGET_OBS): Remove vax-obsd-tdep.o. * alpha-fbsd-tdep.c (_initialize_alphafbsd_tdep): Adjust. * alpha-nbsd-tdep.c: Move comment to _initialize_alphanbsd_tdep. (alphanbsd_core_osabi_sniffer): Delete. (_initialize_alphanbsd_tdep): No longer handle a.out. * alpha-obsd-tdep.c (_initialize_alphaobsd_tdep): Adjust. * amd64-fbsd-tdep.c (_initialize_amd64fbsd_tdep): Adjust. * amd64-nbsd-tdep.c (_initialize_amd64nbsd_tdep): Adjust. * amd64-obsd-tdep.c (amd64obsd_supply_regset) (amd64obsd_combined_regset) (amd64obsd_iterate_over_regset_sections, amd64obsd_core_init_abi): Delete. (_initialize_amd64obsd_tdep): Don't handle a.out. * arm-nbsd-nat.c (struct md_core, fetch_core_registers) (arm_netbsd_core_fns): Delete. (_initialize_arm_netbsd_nat): Don't register arm_netbsd_core_fns. * arm-nbsd-tdep.c (arm_netbsd_aout_init_abi) (arm_netbsd_aout_osabi_sniffer): Delete. (_initialize_arm_netbsd_tdep): Don't handle a.out. * arm-obsd-tdep.c (armobsd_core_osabi_sniffer): Delete. (_initialize_armobsd_tdep): Don't handle a.out. * arm-tdep.c (arm_gdbarch_init): Remove bfd_target_aout_flavour case. * breakpoint.c (disable_breakpoints_in_unloaded_shlib): Remove SunOS a.out handling. * configure.tgt (vax-*-netbsd* | vax-*-knetbsd*-gnu): Remove vax-obsd-tdep.o from gdb_target_objs. (vax-*-openbsd*): Likewise. (*-*-freebsd*): Adjust default gdb_osabi. (*-*-openbsd*): Likewise. * dbxread.c (block_address_function_relative): Delete. (dbx_symfile_read): Remove reference to block_address_function_relative. (dbx_symfile_read): Don't call read_dbx_dynamic_symtab. (read_dbx_dynamic_symtab): Delete. (process_one_symbol): Remove references to block_address_function_relative. * defs.h (GDB_OSABI_FREEBSD_AOUT, GDB_OSABI_NETBSD_AOUT): Remove. (GDB_OSABI_FREEBSD_ELF): Rename to ... (GDB_OSABI_FREEBSD): ... this. (GDB_OSABI_NETBSD_ELF): Rename to ... (GDB_OSABI_NETBSD): ... this. (GDB_OSABI_OPENBSD_ELF): Rename to ... (GDB_OSABI_OPENBSD): ... this. (GDB_OSABI_HPUX_ELF, GDB_OSABI_HPUX_SOM): Remove. * fbsd-tdep.c: Adjust comment. * hppa-nbsd-tdep.c (_initialize_hppanbsd_tdep): Adjust. * hppa-obsd-tdep.c (GDB_OSABI_NETBSD_CORE): Delete. (hppaobsd_core_osabi_sniffer): Delete. (_initialize_hppabsd_tdep): Don't handle a.out. * hppa-tdep.c (hppa_stub_frame_unwind_cache): Don't handle GDB_OSABI_HPUX_SOM. (hppa_gdbarch_init): Likewise. * i386-bsd-tdep.c (i386bsd_aout_osabi_sniffer) (i386bsd_core_osabi_sniffer, _initialize_i386bsd_tdep): Delete. * i386-fbsd-tdep.c (i386fbsdaout_init_abi): Delete. Merge bits with ... (i386fbsd_init_abi): ... this. (_initialize_i386fbsd_tdep): Don't handle a.out. * i386-nbsd-tdep.c (_initialize_i386nbsd_tdep): Adjust. * i386-obsd-tdep.c (i386obsd_aout_supply_regset) (i386obsd_aout_gregset) (i386obsd_aout_iterate_over_regset_sections): Delete. (i386obsd_init_abi): Merge with i386obsd_elf_init_abi. (i386obsd_aout_init_abi): Delete. (_initialize_i386obsd_tdep): Don't handle a.out. * m68k-bsd-tdep.c (m68kobsd_sigtramp_cache_init) (m68kobsd_sigtramp): Delete. (m68kbsd_init_abi): Merge with ... (m68kbsd_elf_init_abi): ... this, and delete it. (m68kbsd_aout_init_abi): Delete. (m68kbsd_aout_osabi_sniffer, m68kbsd_core_osabi_sniffer): Delete. (_initialize_m68kbsd_tdep): Don't handle a.out. * mips-nbsd-tdep.c (_initialize_mipsnbsd_tdep): Adjust. * mips64-obsd-tdep.c (_initialize_mips64obsd_tdep): Adjust. * osabi.c (gdb_osabi_names): Remove "a.out" entries. Drop "ELF" suffixes. Remove "HP-UX" entries. (generic_elf_osabi_sniff_abi_tag_sections): Adjust. (generic_elf_osabi_sniffer): No longer handle GDB_OSABI_HPUX_ELF. Adjust. (_initialize_ppcfbsd_tdep): Adjust. * ppc-nbsd-tdep.c (_initialize_ppcnbsd_tdep): Adjust. * ppc-obsd-tdep.c (GDB_OSABI_NETBSD_CORE) (ppcobsd_core_osabi_sniffer): Delete. (_initialize_ppcobsd_tdep): Don't handle a.out. * rs6000-tdep.c (rs6000_gdbarch_init): Adjust. * sh-nbsd-tdep.c (GDB_OSABI_NETBSD_CORE) (shnbsd_core_osabi_sniffer): Delete. (_initialize_shnbsd_tdep): Don't handle a.out. * solib.c (clear_solib): Don't handle SunOS/a.out. * sparc-nbsd-tdep.c (sparc32nbsd_init_abi): Make extern. (sparc32nbsd_aout_init_abi): Delete. (sparc32nbsd_elf_init_abi): Merged into sparc32nbsd_init_abi. (sparcnbsd_aout_osabi_sniffer): Delete. (GDB_OSABI_NETBSD_CORE, sparcnbsd_core_osabi_sniffer): Delete. (_initialize_sparcnbsd_tdep): No longer handle a.out. * sparc-obsd-tdep.c (sparc32obsd_init_abi) (_initialize_sparc32obsd_tdep): Adjust. * sparc-tdep.h (sparc32nbsd_elf_init_abi): Rename to ... (sparc32nbsd_init_abi): ... this. * sparc64-fbsd-tdep.c (_initialize_sparc64fbsd_tdep): Adjust. * sparc64-nbsd-tdep.c (_initialize_sparc64nbsd_tdep): Adjust. * sparc64-obsd-tdep.c (_initialize_sparc64obsd_tdep): Adjust. * stabsread.c: Update comment. * symmisc.c (print_objfile_statistics): Don't mention "a.out" in output. * vax-nbsd-tdep.c (_initialize_vaxnbsd_tdep): Adjust. * vax-obsd-tdep.c: Delete file.
2016-11-22Change gdbarch software_single_step frame_info to regcacheYao Qi
This patch changes gdbarch method software_single_step's parameter from "struct frame_info *" to "struct regcache *, IOW, software_single_step starts to use current regcache rather than current frame for software single. gdb: 2016-11-22 Yao Qi <yao.qi@linaro.org> * gdbarch.sh (software_single_step): Change parameter from frame_info to regcache. * gdbarch.c, gdbarch.h: Regenerated. * aarch64-tdep.c (aarch64_software_single_step): Change parameter from frame_info to regcache. Don't call get_current_regcache. * alpha-tdep.c (alpha_deal_with_atomic_sequence): Likewise. (alpha_software_single_step): Likewise. * alpha-tdep.h (alpha_software_single_step): Update declaration. * arm-linux-tdep.c (arm_linux_software_single_step): Likewise. * arm-tdep.c (arm_software_single_step): Likewise. * arm-tdep.h (arm_software_single_step): Likewise. * breakpoint.c (insert_single_step_breakpoint): Pass regcache to gdbarch_software_single_step. * cris-tdep.c (cris_software_single_step): Change parameter from frame_info to regcache. Don't call get_current_regcache. * mips-tdep.c (mips_software_single_step): Likewise. * mips-tdep.h (mips_software_single_step): Update declaration. * moxie-tdep.c (moxie_software_single_step): Likewise. * nios2-tdep.c (nios2_software_single_step): Likewise. * ppc-tdep.h (ppc_deal_with_atomic_sequence): Update declaration. * rs6000-aix-tdep.c (rs6000_software_single_step): Likewise. * rs6000-tdep.c (ppc_deal_with_atomic_sequence): Likewise. * s390-linux-tdep.c (s390_software_single_step): Likewise. * sparc-tdep.c (sparc_software_single_step): Likewise. * spu-tdep.c (spu_software_single_step): Likewise. * tic6x-tdep.c (tic6x_software_single_step): Likewise.
2016-11-22gdbarch software_single_step frame_info to regcache: rs6000Yao Qi
gdb: 2016-11-22 Yao Qi <yao.qi@linaro.org> * rs6000-aix-tdep.c (branch_dest): Replace parameter frame with regcache. Call get_regcache_arch instead of get_frame_arch. Call regcache_raw_get_unsigned instead of get_frame_register_unsigned. (rs6000_software_single_step): Likewise. * rs6000-tdep.c (ppc_deal_with_atomic_sequence): Call get_regcache_arch instead of get_frame_arch. Call regcache_read_pc instead of get_frame_pc.
2016-11-08gdbarch software_single_step returns VEC (CORE_ADDR) *Yao Qi
This patch changes gdbarch method software_single_step to return a vector of addresses on which GDB should insert breakpoints, and don't insert breakpoints. Instead, the caller of gdbarch_software_single_step inserts breakpoints if the returned vector is not NULL. gdb: 2016-11-08 Yao Qi <yao.qi@linaro.org> * aarch64-tdep.c (aarch64_software_single_step): Return VEC (CORE_ADDR) *. Return NULL instead of 0. Don't call insert_single_step_breakpoint. * alpha-tdep.c (alpha_deal_with_atomic_sequence): Likewise. (alpha_software_single_step): Likewise. * alpha-tdep.h (alpha_software_single_step): Update declaration. * arm-linux-tdep.c (arm_linux_software_single_step): Return VEC (CORE_ADDR) *. Return NULL instead of 0. * arm-tdep.c (arm_software_single_step): Return NULL instead of 0. * arm-tdep.h (arm_software_single_step): Update declaration. * breakpoint.c (insert_single_step_breakpoints): New function. * breakpoint.h (insert_single_step_breakpoints): Declare. * cris-tdep.c (cris_software_single_step): Return VEC (CORE_ADDR) *. Don't call insert_single_step_breakpoint. * gdbarch.sh (software_single_step): Change it to return VEC (CORE_ADDR) *. * gdbarch.c, gdbarch.h: Regenerated. * infrun.c (maybe_software_singlestep): Adjust. * mips-tdep.c (mips_deal_with_atomic_sequence): Return VEC (CORE_ADDR) *. Don't call insert_single_step_breakpoint. (micromips_deal_with_atomic_sequence): Likewise. (deal_with_atomic_sequence): Likewise. (mips_software_single_step): Likewise. * mips-tdep.h (mips_software_single_step): Update declaration. * moxie-tdep.c (moxie_software_single_step): Likewise. * nios2-tdep.c (nios2_software_single_step): Likewise. * ppc-tdep.h (ppc_deal_with_atomic_sequence): Update declaration. * record-full.c (record_full_resume): Adjust. (record_full_wait_1): Likewise. * rs6000-aix-tdep.c (rs6000_software_single_step): Return VEC (CORE_ADDR) *. Don't call insert_single_step_breakpoint. * rs6000-tdep.c (ppc_deal_with_atomic_sequence): Return VEC (CORE_ADDR) *. Don't call insert_single_step_breakpoint. * s390-linux-tdep.c (s390_software_single_step): Likewise. * sparc-tdep.c (sparc_software_single_step): Likewise. * spu-tdep.c (spu_software_single_step): Likewise. * tic6x-tdep.c (tic6x_software_single_step): Likewise.
2016-11-03Remove GDBARCH_BREAKPOINT_MANIPULATION and SET_GDBARCH_BREAKPOINT_MANIPULATIONYao Qi
Both of them are used in conversion. We can remove them since the conversion is done. There are many architectures only have one breakpoint instruction, so their gdbarch methods breakpoint_kind_from_pc and sw_breakpoint_from_kind look very similar. Instead of macro, we use template "template <size_t, const gdb_byte *> struct bp_manipulation" for these architectures. In order to use template, I also change breakpoint instruction of type "static const gdb_byte[]" to "constexpr gdb_byte[]", and rename them to ARCH_break_insn. gdb: 2016-11-03 Yao Qi <yao.qi@linaro.org> Pedro Alves <palves@redhat.com> * aarch64-tdep.c (aarch64_default_breakpoint): Change it to constexpr. Don't use GDBARCH_BREAKPOINT_MANIPULATION. (aarch64_gdbarch_init): Don't use SET_GDBARCH_BREAKPOINT_MANIPULATION. * alpha-tdep.c (break_insn): Rename to alpha_break_insn. Don't use GDBARCH_BREAKPOINT_MANIPULATION. (alpha_gdbarch_init): Don't use SET_GDBARCH_BREAKPOINT_MANIPULATION. * arc-tdep.c (arc_gdbarch_init): Don't use SET_GDBARCH_BREAKPOINT_MANIPULATION. * arch-utils.h (GDBARCH_BREAKPOINT_MANIPULATION): Remove. (struct bp_manipulation): New. (SET_GDBARCH_BREAKPOINT_MANIPULATION): Remove. (struct bp_manipulation_endian): New. (BP_MANIPULATION): New. (BP_MANIPULATION_ENDIAN): New. * arm-tdep.c (arm_gdbarch_init): Don't use SET_GDBARCH_BREAKPOINT_MANIPULATION. * avr-tdep.c (avr_break_insn): Change it constexpr. (avr_gdbarch_init): Don't use SET_GDBARCH_BREAKPOINT_MANIPULATION. * bfin-tdep.c (bfin_gdbarch_init): Likewise. * cris-tdep.c (cris_gdbarch_init): Likewise. * frv-tdep.c (breakpoint): Rename it to frv_break_insn, and change its type to constexpr. Don't use GDBARCH_BREAKPOINT_MANIPULATION. (frv_gdbarch_init): Don't use SET_GDBARCH_BREAKPOINT_MANIPULATION. * ft32-tdep.c (breakpoint): Rename it to ft32_break_insn and change its type to constexpr. Don't use GDBARCH_BREAKPOINT_MANIPULATION. (ft32_gdbarch_init): Don't use SET_GDBARCH_BREAKPOINT_MANIPULATION. * h8300-tdep.c (breakpoint): Rename it to h8300_break_insn. Don't use GDBARCH_BREAKPOINT_MANIPULATION. (h8300_gdbarch_init): Don't use SET_GDBARCH_BREAKPOINT_MANIPULATION. * hppa-tdep.c (breakpoint): Rename it to h8300_break_insn. Don't use GDBARCH_BREAKPOINT_MANIPULATION. (hppa_gdbarch_init): Don't use SET_GDBARCH_BREAKPOINT_MANIPULATION. * i386-tdep.c (break_insn): Rename it to i386_break_insn. Don't use GDBARCH_BREAKPOINT_MANIPULATION. (i386_gdbarch_init): Don't use SET_GDBARCH_BREAKPOINT_MANIPULATION. * iq2000-tdep.c (iq2000_gdbarch_init): Don't use SET_GDBARCH_BREAKPOINT_MANIPULATION. * lm32-tdep.c (breakpoint): Rename it to lm32_break_insn and change its type to constexpr. Don't use GDBARCH_BREAKPOINT_MANIPULATION. (lm32_gdbarch_init): Don't use SET_GDBARCH_BREAKPOINT_MANIPULATION. * m32c-tdep.c (break_insn): Rename it to m32c_break_insn and change its type to constexpr. Don't use GDBARCH_BREAKPOINT_MANIPULATION. (m32c_gdbarch_init): Don't use SET_GDBARCH_BREAKPOINT_MANIPULATION. * m32r-tdep.c (m32r_gdbarch_init): Likewise. * m68hc11-tdep.c (breakpoint): Rename it to m68hc11_break_insn and change its type to constexpr. Don't use GDBARCH_BREAKPOINT_MANIPULATION. (m68hc11_gdbarch_init): Don't use SET_GDBARCH_BREAKPOINT_MANIPULATION. * m68k-tdep.c (break_insn): Rename it to m68k_break_insn and change its type to constexpr. Don't use GDBARCH_BREAKPOINT_MANIPULATION. (m68k_gdbarch_init): Don't use SET_GDBARCH_BREAKPOINT_MANIPULATION. * m88k-tdep.c (break_insn): Rename it to m88k_break_insn and change its type to constexpr. Don't use GDBARCH_BREAKPOINT_MANIPULATION. (m88k_gdbarch_init): Don't use SET_GDBARCH_BREAKPOINT_MANIPULATION. * mep-tdep.c (breakpoint): Rename it to mep_break_insn and change its type to constexpr. Don't use GDBARCH_BREAKPOINT_MANIPULATION. (mep_gdbarch_init): Don't use SET_GDBARCH_BREAKPOINT_MANIPULATION. * microblaze-tdep.c (break_insn): Rename it to microblaze_break_insn and change its type to constexpr. Don't use GDBARCH_BREAKPOINT_MANIPULATION. (microblaze_gdbarch_init): Don't use SET_GDBARCH_BREAKPOINT_MANIPULATION. * mips-tdep.c (mips_gdbarch_init): Likewise. * mn10300-tdep.c (breakpoint): Rename it to mn10300_break_insn and change its type to constexpr. Don't use GDBARCH_BREAKPOINT_MANIPULATION. (mn10300_gdbarch_init): Don't use SET_GDBARCH_BREAKPOINT_MANIPULATION. * moxie-tdep.c (breakpoint): Rename it to moxie_break_insn and change its type to constexpr. Don't use GDBARCH_BREAKPOINT_MANIPULATION. (moxie_gdbarch_init): Don't use SET_GDBARCH_BREAKPOINT_MANIPULATION. * msp430-tdep.c (breakpoint): Rename it to msp430_break_insn and change its type to constexpr. Don't use GDBARCH_BREAKPOINT_MANIPULATION. (msp430_gdbarch_init): Don't use SET_GDBARCH_BREAKPOINT_MANIPULATION. * mt-tdep.c (mt_gdbarch_init): Likewise. * nds32-tdep.c (break_insn): Rename it to nds32_break_insn and change its type to constexpr. Don't use GDBARCH_BREAKPOINT_MANIPULATION. (nds32_gdbarch_init): Don't use SET_GDBARCH_BREAKPOINT_MANIPULATION. * nios2-tdep.c (nios2_gdbarch_init): Likewise. * rl78-tdep.c (breakpoint): Rename it to rl78_break_ins and change its type to rl78_break_insn. Don't use GDBARCH_BREAKPOINT_MANIPULATION. (rl78_gdbarch_init): Don't use SET_GDBARCH_BREAKPOINT_MANIPULATION. * rs6000-tdep.c (big_breakpoint): Change its type to constexpr. (little_breakpoint): Likewise. Don't use GDBARCH_BREAKPOINT_MANIPULATION_ENDIAN. (rs6000_gdbarch_init): Don't use SET_GDBARCH_BREAKPOINT_MANIPULATION. * rx-tdep.c (breakpoint): Rename it to rx_break_insn and change its type to constexpr. Don't use GDBARCH_BREAKPOINT_MANIPULATION. (rx_gdbarch_init): Don't use SET_GDBARCH_BREAKPOINT_MANIPULATION. * s390-linux-tdep.c (breakpoint): Rename it to s390_break_insn and change its type to constexpr. Don't use GDBARCH_BREAKPOINT_MANIPULATION (s390_gdbarch_init): Don't use SET_GDBARCH_BREAKPOINT_MANIPULATION. * score-tdep.c (score_gdbarch_init): Likewise. * sh-tdep.c (sh_gdbarch_init): Likewise. * sh64-tdep.c (sh64_gdbarch_init): Likewise. * sparc-tdep.c (break_insn): Rename it to sparc_break_insn and change its type to constexpr. Don't use GDBARCH_BREAKPOINT_MANIPULATION. (sparc32_gdbarch_init): Don't use SET_GDBARCH_BREAKPOINT_MANIPULATION. * spu-tdep.c (breakpoint): Rename it to spu_break_insn and change its type to constexpr. Don't use GDBARCH_BREAKPOINT_MANIPULATION. (spu_gdbarch_init): Don't use SET_GDBARCH_BREAKPOINT_MANIPULATION. * tic6x-tdep.c (tic6x_gdbarch_init): Likewise. * tilegx-tdep.c (breakpoint): Rename it to tilegx_break_insn and change its type to constexpr. Don't use GDBARCH_BREAKPOINT_MANIPULATION. (tilegx_gdbarch_init): Don't use SET_GDBARCH_BREAKPOINT_MANIPULATION. * v850-tdep.c (v850_gdbarch_init): Likewise. * vax-tdep.c (break_insn): Rename it to vax_break_insn and change its type to constexpr. Don't use GDBARCH_BREAKPOINT_MANIPULATION. (vax_gdbarch_init): Don't use SET_GDBARCH_BREAKPOINT_MANIPULATION. * xstormy16-tdep.c (breakpoint): Rename it to xstormy16_break_insn and change its type to constexpr. Don't use GDBARCH_BREAKPOINT_MANIPULATION. (xstormy16_gdbarch_init): Don't use SET_GDBARCH_BREAKPOINT_MANIPULATION. * xtensa-tdep.c (xtensa_gdbarch_init): Likewise.
2016-11-03Split breakpoint_from_pc to breakpoint_kind_from_pc and sw_breakpoint_from_kindYao Qi
We convert each ARCH_breakpoint_from_pc to ARCH_breakpoint_kind_from_pc and ARCH_sw_breakpoint_from_kind. Note that gdbarch doesn't have methods breakpoint_kind_from_pc and sw_breakpoint_from_kind so far. gdb: 2016-11-03 Yao Qi <yao.qi@linaro.org> * arch-utils.h (GDBARCH_BREAKPOINT_FROM_PC): New macro. (GDBARCH_BREAKPOINT_MANIPULATION_ENDIAN): New macro. * arm-tdep.c (arm_breakpoint_from_pc): Remove. (arm_breakpoint_kind_from_pc): New function. (arm_sw_breakpoint_from_kind): New function. (arm_breakpoint_from_pc): Call arm_breakpoint_kind_from_pc and arm_sw_breakpoint_from_kind. Use GDBARCH_BREAKPOINT_FROM_PC. (arm_remote_breakpoint_from_pc): Call arm_breakpoint_kind_from_pc. (arm_gdbarch_init): Replace set_gdbarch_breakpoint_from_pc with SET_GDBARCH_BREAKPOINT_MANIPULATION. * arc-tdep.c: Likewise. * bfin-tdep.c: Likewise. * cris-tdep.c: Likewise. * iq2000-tdep.c: Likewise. * m32r-tdep.c: Likewise. * mips-tdep.c: Likewise. * mt-tdep.c: Likewise. * nios2-tdep.c: Likewise. * rs6000-tdep.c: Likewise. * score-tdep.c: Likewise. * sh-tdep.c: Likewise. * sh64-tdep.c: Likewise. * tic6x-tdep.c: Likewise. * v850-tdep.c: Likewise. * xtensa-tdep.c: Likewise.
2016-09-22Fix build breakage from commit 6ec2b2Edjunior Barbosa Machado
I was notified by buildbot that my patch (commit 6ec2b2) has broken the build on x86_64: ../../binutils-gdb/gdb/rs6000-tdep.c: In function int ppc_process_record_op31(gdbarch*, regcache*, CORE_ADDR, uint32_t): ../../binutils-gdb/gdb/rs6000-tdep.c:4705:50: error: cannot convert CORE_ADDR* {aka long unsigned int*} to ULONGEST* {aka long long unsigned int*} for argument 3 to register_status regcache_raw_read_unsigned(regcache*, int, ULONGEST*) tdep->ppc_gp0_regnum + PPC_RA (insn), &ea); ^ ../../binutils-gdb/gdb/rs6000-tdep.c:4718:50: error: cannot convert CORE_ADDR* {aka long unsigned int*} to ULONGEST* {aka long long unsigned int*} for argument 3 to register_status regcache_raw_read_unsigned(regcache*, int, ULONGEST*) tdep->ppc_gp0_regnum + PPC_RA (insn), &ea); ^ The patch below should fix it. gdb/ChangeLog: 2016-09-22 Edjunior Barbosa Machado <emachado@linux.vnet.ibm.com> * rs6000-tdep.c (ppc_process_record_op31): Fix regcache_raw_read_unsigned call using the correct parameter type.
2016-09-21ppc: Fix return of instruction handlers in ppc_process_record_op63Edjunior Barbosa Machado
some instruction handlers in ppc_process_record_op63() seem to be missing return or incorrectly using break. This patch aims to fix that. gdb/ChangeLog: 2016-09-21 Edjunior Barbosa Machado <emachado@linux.vnet.ibm.com> * rs6000-tdep.c (ppc_process_record_op63): Fix return of instruction handlers.
2016-09-21ppc: Add Power ISA 3.0/POWER9 instructions record supportEdjunior Barbosa Machado
gdb/ChangeLog: 2016-09-21 Edjunior Barbosa Machado <emachado@linux.vnet.ibm.com> * rs6000-tdep.c (PPC_DQ): New macro. (ppc_process_record_op4): Add Power ISA 3.0 instructions. (ppc_process_record_op19): Likewise. (ppc_process_record_op31): Likewise. (ppc_process_record_op59): Likewise. (ppc_process_record_op60): Likewise. (ppc_process_record_op63): Likewise. (ppc_process_record): Likewise. (ppc_process_record_op61): New function.
2016-09-20ppc: Fix record support of Store String Word instructionsEdjunior Barbosa Machado
gdb/ChangeLog 2016-09-20 Edjunior Barbosa Machado <emachado@linux.vnet.ibm.com> * rs6000-tdep.c (ppc_process_record_op31): Fix record of Store String Word instructions.
2016-09-16gdb: Use std::min and std::max throughoutPedro Alves
Otherwise including <string> or some other C++ header is broken. E.g.: In file included from /opt/gcc/include/c++/7.0.0/bits/char_traits.h:39:0, from /opt/gcc/include/c++/7.0.0/string:40, from /home/pedro/gdb/mygit/cxx-convertion/src/gdb/infrun.c:68: /opt/gcc/include/c++/7.0.0/bits/stl_algobase.h:243:56: error: macro "min" passed 3 arguments, but takes just 2 min(const _Tp& __a, const _Tp& __b, _Compare __comp) ^ /opt/gcc/include/c++/7.0.0/bits/stl_algobase.h:265:56: error: macro "max" passed 3 arguments, but takes just 2 max(const _Tp& __a, const _Tp& __b, _Compare __comp) ^ In file included from .../src/gdb/infrun.c:21:0: To the best of my grepping abilities, I believe I adjusted all min/max calls. gdb/ChangeLog: 2016-09-16 Pedro Alves <palves@redhat.com> * defs.h (min, max): Delete. * aarch64-tdep.c: Include <algorithm> and use std::min and std::max throughout. * aarch64-tdep.c: Likewise. * alpha-tdep.c: Likewise. * amd64-tdep.c: Likewise. * amd64-windows-tdep.c: Likewise. * arm-tdep.c: Likewise. * avr-tdep.c: Likewise. * breakpoint.c: Likewise. * btrace.c: Likewise. * ctf.c: Likewise. * disasm.c: Likewise. * doublest.c: Likewise. * dwarf2loc.c: Likewise. * dwarf2read.c: Likewise. * environ.c: Likewise. * exec.c: Likewise. * f-exp.y: Likewise. * findcmd.c: Likewise. * ft32-tdep.c: Likewise. * gcore.c: Likewise. * hppa-tdep.c: Likewise. * i386-darwin-tdep.c: Likewise. * i386-tdep.c: Likewise. * linux-thread-db.c: Likewise. * lm32-tdep.c: Likewise. * m32r-tdep.c: Likewise. * m88k-tdep.c: Likewise. * memrange.c: Likewise. * minidebug.c: Likewise. * mips-tdep.c: Likewise. * moxie-tdep.c: Likewise. * nds32-tdep.c: Likewise. * nios2-tdep.c: Likewise. * nto-procfs.c: Likewise. * parse.c: Likewise. * ppc-sysv-tdep.c: Likewise. * probe.c: Likewise. * record-btrace.c: Likewise. * remote.c: Likewise. * rs6000-tdep.c: Likewise. * rx-tdep.c: Likewise. * s390-linux-nat.c: Likewise. * s390-linux-tdep.c: Likewise. * ser-tcp.c: Likewise. * sh-tdep.c: Likewise. * sh64-tdep.c: Likewise. * source.c: Likewise. * sparc-tdep.c: Likewise. * symfile.c: Likewise. * target-memory.c: Likewise. * target.c: Likewise. * tic6x-tdep.c: Likewise. * tilegx-tdep.c: Likewise. * tracefile-tfile.c: Likewise. * tracepoint.c: Likewise. * valprint.c: Likewise. * value.c: Likewise. * xtensa-tdep.c: Likewise. * cli/cli-cmds.c: Likewise. * compile/compile-object-load.c: Likewise.
2016-08-24Fix for gdb.base/pc-fp.exp.Carl E. Love
It is my understanding that GDB used to require each architecture to define a Frame Pointer (fp). However, this functionality was deprecated some time ago so the call to setup the fp_reg was changed to deprecated (set_gdbarch_deprecated_fp_regnum). It should have been removed from the Power code. That said, the code "set_gdbarch_deprecated_fp_regnum (gdbarch, PPC_R0_REGNUM + 1);" sets up register r1 as the frame pointer. Register r1 is no longer used to hold the frame pointer on Power. By removing the fp definition for Power in GDB, it causes GDB to fall back to the call get_frame_base_address (frame) which returns the correct value depending on the specific senario but most of the time is the DWARF canonical frame address. gdb/ChangeLog 2016-08-24 Carl Love <cel@us.ibm.com> * rs6000-tdep.c (rs6000_gdbarch_init): Remove call set_gdbarch_deprecated_fp_regnum() from initialization function.
2016-08-18ppc: Fix record of HTM instructionsEdjunior Barbosa Machado
The patch fixes the record support of Hardware Transactional Memory instructions on Power. It also solves a large number of unexpected failures from gdb.reverse testcases sigall-precsave.exp and sigall-reverse.exp that occur on distros which glibc uses HTM instructions. gdb/ChangeLog 2016-08-18 Edjunior Barbosa Machado <emachado@linux.vnet.ibm.com> * rs6000-tdep.c (ppc_process_record_op31): Handle HTM instructions.
2016-07-27Wean gdb and sim off private libbfd.h headerAlan Modra
The major reason this header was needed, bfd_default_set_arch_mach, has now moved to bfd.h. gdb/ * amd64-darwin-tdep.c: Don't include libbfd.h. * i386-darwin-tdep.c: Likewise. * rs6000-nat.c: Likewise. * rs6000-tdep.c: Likewise. sim/aarch64/ * memory.c: Don't include libbfd.h. sim/rl78/ * load.c: Don't include libbfd.h. (rl78_load): Don't use private iovec seek or read. sim/rx/ * load.c: Don't include libbfd.h. (rx_load): Don't use private iovec seek or read.
2016-06-14Initialize 'ra' to zero to avoid uninitialized use.John Baldwin
If the instruction in this case does not include an RA field, then 'ra' is used uninitialized. Use the same idiom used elsewhere in this file of initializing ra to zero before check for an RA field. gdb/ChangeLog: * rs6000-tdep.c (ppc_process_record_op31): Initialize ra.
2016-05-07remove trivialy unused variablesTrevor Saunders
gdb/ChangeLog: 2016-05-07 Trevor Saunders <tbsaunde+binutils@tbsaunde.org> * aarch64-linux-tdep.c (aarch64_linux_sigframe_init): Remove unused variables. * aarch64-tdep.c (aarch64_skip_prologue): Likewise. (aarch64_scan_prologue): Likewise. (aarch64_prologue_prev_register): Likewise. (aarch64_dwarf2_prev_register): Likewise. (pass_in_v): Likewise. (aarch64_push_dummy_call): Likewise. (aarch64_breakpoint_from_pc): Likewise. (aarch64_return_in_memory): Likewise. (aarch64_return_value): Likewise. (aarch64_displaced_step_b_cond): Likewise. (aarch64_displaced_step_cb): Likewise. (aarch64_displaced_step_tb): Likewise. (aarch64_gdbarch_init): Likewise. (aarch64_process_record): Likewise. * alpha-mdebug-tdep.c (alpha_mdebug_init_abi): Likewise. * alpha-tdep.c (_initialize_alpha_tdep): Likewise. * amd64-dicos-tdep.c (amd64_dicos_init_abi): Likewise. * amd64-linux-tdep.c (amd64_dtrace_parse_probe_argument): Likewise. * amd64-tdep.c (fixup_riprel): Likewise. * amd64-windows-tdep.c (amd64_windows_frame_decode_epilogue): Likewise. (amd64_windows_frame_decode_insns): Likewise. (amd64_windows_frame_cache): Likewise. (amd64_windows_frame_prev_register): Likewise. (amd64_windows_frame_this_id): Likewise. (amd64_windows_init_abi): Likewise. * arm-linux-tdep.c (arm_linux_get_syscall_number): Likewise. (arm_linux_get_next_pcs_syscall_next_pc): Likewise. * arm-symbian-tdep.c (arm_symbian_init_abi): Likewise. * arm-tdep.c (arm_make_epilogue_frame_cache): Likewise. (arm_epilogue_frame_prev_register): Likewise. (arm_record_vdata_transfer_insn): Likewise. (arm_record_exreg_ld_st_insn): Likewise. * auto-load.c (execute_script_contents): Likewise. (print_scripts): Likewise. * avr-tdep.c (avr_frame_prev_register): Likewise. (avr_push_dummy_call): Likewise. * bfin-linux-tdep.c (bfin_linux_sigframe_init): Likewise. * bfin-tdep.c (bfin_gdbarch_init): Likewise. * blockframe.c (find_pc_partial_function_gnu_ifunc): Likewise. * break-catch-throw.c (fetch_probe_arguments): Likewise. * breakpoint.c (breakpoint_xfer_memory): Likewise. (breakpoint_init_inferior): Likewise. (breakpoint_inserted_here_p): Likewise. (software_breakpoint_inserted_here_p): Likewise. (hardware_breakpoint_inserted_here_p): Likewise. (bpstat_what): Likewise. (break_range_command): Likewise. (save_breakpoints): Likewise. * coffread.c (coff_symfile_read): Likewise. * cris-tdep.c (cris_push_dummy_call): Likewise. (cris_scan_prologue): Likewise. (cris_register_size): Likewise. (_initialize_cris_tdep): Likewise. * d-exp.y: Likewise. * dbxread.c (dbx_read_symtab): Likewise. (process_one_symbol): Likewise. (coffstab_build_psymtabs): Likewise. (elfstab_build_psymtabs): Likewise. * dicos-tdep.c (dicos_init_abi): Likewise. * disasm.c (do_mixed_source_and_assembly): Likewise. (gdb_disassembly): Likewise. * dtrace-probe.c (dtrace_process_dof): Likewise. * dwarf2read.c (error_check_comp_unit_head): Likewise. (build_type_psymtabs_1): Likewise. (skip_one_die): Likewise. (process_imported_unit_die): Likewise. (dwarf2_physname): Likewise. (read_file_scope): Likewise. (setup_type_unit_groups): Likewise. (create_dwo_cu_reader): Likewise. (create_dwo_cu): Likewise. (create_dwo_unit_in_dwp_v1): Likewise. (create_dwo_unit_in_dwp_v2): Likewise. (lookup_dwo_unit_in_dwp): Likewise. (free_dwo_file): Likewise. (check_producer): Likewise. (dwarf2_add_typedef): Likewise. (dwarf2_add_member_fn): Likewise. (read_unsigned_leb128): Likewise. (read_signed_leb128): Likewise. (dwarf2_const_value): Likewise. (follow_die_sig_1): Likewise. (dwarf_decode_macro_bytes): Likewise. * extension.c (restore_active_ext_lang): Likewise. * frv-linux-tdep.c (frv_linux_sigtramp_frame_cache): Likewise. * ft32-tdep.c (ft32_analyze_prologue): Likewise. * gdbtypes.c (lookup_typename): Likewise. (resolve_dynamic_range): Likewise. (check_typedef): Likewise. * h8300-tdep.c (h8300_is_argument_spill): Likewise. (h8300_gdbarch_init): Likewise. * hppa-tdep.c (hppa32_push_dummy_call): Likewise. (hppa_frame_this_id): Likewise. (_initialize_hppa_tdep): Likewise. * hppanbsd-tdep.c (hppanbsd_sigtramp_cache_init): Likewise. * hppaobsd-tdep.c (hppaobsd_supply_fpregset): Likewise. * i386-dicos-tdep.c (i386_dicos_init_abi): Likewise. * i386-tdep.c (i386_bnd_type): Likewise. (i386_gdbarch_init): Likewise. (i386_mpx_bd_base): Likewise. * i386nbsd-tdep.c (i386nbsd_sigtramp_cache_init): Likewise. * i386obsd-tdep.c (i386obsd_elf_init_abi): Likewise. * ia64-tdep.c (examine_prologue): Likewise. (ia64_frame_cache): Likewise. (ia64_push_dummy_call): Likewise. * infcmd.c (finish_command_fsm_async_reply_reason): Likewise. (default_print_one_register_info): Likewise. * infrun.c (infrun_thread_ptid_changed): Likewise. (thread_still_needs_step_over): Likewise. (stop_all_threads): Likewise. (restart_threads): Likewise. (keep_going_stepped_thread): Likewise. * iq2000-tdep.c (iq2000_scan_prologue): Likewise. * language.c (language_init_primitive_type_symbols): Likewise. * linespec.c (add_sal_to_sals): Likewise. * linux-nat.c (status_callback): Likewise. (kill_unfollowed_fork_children): Likewise. (linux_nat_kill): Likewise. * linux-tdep.c (linux_fill_prpsinfo): Likewise. * linux-thread-db.c (thread_db_notice_clone): Likewise. (record_thread): Likewise. * location.c (string_to_event_location_basic): Likewise. * m32c-tdep.c (m32c_prev_register): Likewise. * m32r-linux-tdep.c (m32r_linux_init_abi): Likewise. * m32r-tdep.c (decode_prologue): Likewise. * m68klinux-tdep.c (m68k_linux_sigtramp_frame_cache): Likewise. * machoread.c (macho_symtab_read): Likewise. (macho_symfile_read): Likewise. (macho_symfile_offsets): Likewise. * maint.c (set_per_command_cmd): Likewise. * mi/mi-cmd-stack.c (mi_cmd_stack_list_locals): Likewise. (mi_cmd_stack_list_variables): Likewise. * mi/mi-main.c (mi_cmd_exec_run): Likewise. (output_register): Likewise. (mi_cmd_execute): Likewise. (mi_cmd_trace_define_variable): Likewise. (print_variable_or_computed): Likewise. * minsyms.c (prim_record_minimal_symbol_full): Likewise. * mn10300-tdep.c (mn10300_frame_prev_register): Likewise. * msp430-tdep.c (msp430_pseudo_register_write): Likewise. * mt-tdep.c (mt_registers_info): Likewise. * nios2-tdep.c (nios2_analyze_prologue): Likewise. (nios2_push_dummy_call): Likewise. (nios2_frame_unwind_cache): Likewise. (nios2_stub_frame_cache): Likewise. (nios2_stub_frame_sniffer): Likewise. (nios2_gdbarch_init): Likewise. * ppc-ravenscar-thread.c: Likewise. * ppcfbsd-tdep.c (ppcfbsd_sigtramp_frame_cache): Likewise. * python/py-evts.c (add_new_registry): Likewise. * python/py-finishbreakpoint.c (bpfinishpy_init): Likewise. (bpfinishpy_detect_out_scope_cb): Likewise. * python/py-framefilter.c (py_print_value): Likewise. * python/py-inferior.c (infpy_write_memory): Likewise. * python/py-infevents.c (create_inferior_call_event_object): Likewise. * python/py-infthread.c (thpy_get_ptid): Likewise. * python/py-linetable.c (ltpy_get_pcs_for_line): Likewise. (ltpy_get_all_source_lines): Likewise. (ltpy_is_valid): Likewise. (ltpy_iternext): Likewise. * python/py-symtab.c (symtab_and_line_to_sal_object): Likewise. * python/py-unwind.c (pyuw_object_attribute_to_pointer): Likewise. (unwind_infopy_str): Likewise. * python/py-varobj.c (py_varobj_get_iterator): Likewise. * ravenscar-thread.c (ravenscar_inferior_created): Likewise. * rs6000-aix-tdep.c (rs6000_push_dummy_call): Likewise. * rs6000-lynx178-tdep.c (rs6000_lynx178_push_dummy_call): Likewise. * rs6000-tdep.c (ppc_deal_with_atomic_sequence): Likewise. * s390-linux-tdep.c (s390_supply_tdb_regset): Likewise. (s390_frame_prev_register): Likewise. (s390_dwarf2_frame_init_reg): Likewise. (s390_record_vr): Likewise. (s390_process_record): Likewise. * score-tdep.c (score_push_dummy_call): Likewise. (score3_analyze_prologue): Likewise. * sh-tdep.c (sh_extract_return_value_nofpu): Likewise. * sh64-tdep.c (sh64_analyze_prologue): Likewise. (sh64_push_dummy_call): Likewise. (sh64_extract_return_value): Likewise. (sh64_do_fp_register): Likewise. * solib-aix.c (solib_aix_get_section_offsets): Likewise. * solib-darwin.c (darwin_read_exec_load_addr_from_dyld): Likewise. (darwin_solib_read_all_image_info_addr): Likewise. * solib-dsbt.c (enable_break): Likewise. * solib-frv.c (enable_break2): Likewise. (frv_fdpic_find_canonical_descriptor): Likewise. * solib-svr4.c (svr4_handle_solib_event): Likewise. * sparc-tdep.c (sparc_skip_stack_check): Likewise. * sparc64-linux-tdep.c (sparc64_linux_get_longjmp_target): Likewise. * sparcobsd-tdep.c (sparc32obsd_init_abi): Likewise. * spu-tdep.c (info_spu_dma_cmdlist): Likewise. * stack.c (read_frame_local): Likewise. * symfile.c (symbol_file_add_separate): Likewise. (remove_symbol_file_command): Likewise. * symmisc.c (maintenance_print_one_line_table): Likewise. * symtab.c (symbol_cache_flush): Likewise. (basic_lookup_transparent_type): Likewise. (sort_search_symbols_remove_dups): Likewise. * target.c (target_memory_map): Likewise. (target_detach): Likewise. (target_resume): Likewise. (acquire_fileio_fd): Likewise. (target_store_registers): Likewise. * thread.c (print_thread_info_1): Likewise. * tic6x-tdep.c (tic6x_analyze_prologue): Likewise. * tilegx-linux-tdep.c (tilegx_linux_sigframe_init): Likewise. * tilegx-tdep.c (tilegx_push_dummy_call): Likewise. (tilegx_analyze_prologue): Likewise. (tilegx_stack_frame_destroyed_p): Likewise. (tilegx_frame_cache): Likewise. * tracefile.c (trace_save): Likewise. * tracepoint.c (encode_actions_and_make_cleanup): Likewise. (start_tracing): Likewise. (print_one_static_tracepoint_marker): Likewise. * tui/tui.c (tui_enable): Likewise. * valops.c (value_struct_elt_bitpos): Likewise. (find_overload_match): Likewise. (find_oload_champ): Likewise. * value.c (value_contents_copy_raw): Likewise. * windows-tdep.c (windows_get_tlb_type): Likewise. * x86-linux-nat.c (x86_linux_enable_btrace): Likewise. * xcoffread.c (record_minimal_symbol): Likewise. (scan_xcoff_symtab): Likewise. * xtensa-tdep.c (execute_code): Likewise. (xtensa_gdbarch_init): Likewise. (_initialize_xtensa_tdep): Likewise.
2016-03-09gdb/rs6000: Read backchain as unsigned.Marcin Kościelnicki
Previously, backchain was read as a signed quantity, resulting in addresses like 0xfffffffffffeded0 instead of 0xfffeded0 returned by unwinder on 32-bit powerpc. While normally such addresses are masked off, this causes problems for tracepoints, since 0xfffffffffffeded0 is considered unavailable. Fixes a test failure in gdb.trace/entry-values.exp. gdb/ChangeLog: * corefile.c (safe_read_memory_unsigned_integer): New function. * gdbcore.h (safe_read_memory_unsigned_integer): New prototype. * rs6000-tdep.c (rs6000_frame_cache): Read backchain as unsigned.
2016-03-09gdb: Add gen_return_address for powerpc.Marcin Kościelnicki
gdb/ChangeLog: * rs6000-tdep.c: Add "ax.h" and "ax-gdb.h" includes. (rs6000_gen_return_address): New function. (rs6000_gdbarch_init): Wire in the above.
2016-03-09gdb: Add ax_pseudo_register_collect for powerpc.Marcin Kościelnicki
gdb/ChangeLog: * rs6000-tdep.c (rs6000_ax_pseudo_register_collect): New function. (rs6000_gdbarch_init): Wire in the above.
2016-02-26Fix CXX invalid cast from void *.Keith Seitz
This is an obvious patch to fix the following build error seen with --enable-build-with-cxx: ../../src/gdb/rs6000-tdep.c: In function ‘rs6000_frame_cache* rs6000_frame_cache(frame_info*, void**)’: ../../src/gdb/rs6000-tdep.c:3242:15: error: invalid conversion from ‘void*’ to ‘rs6000_frame_cache*’ [-fpermissive] return (*this_cache); ~^~~~~~~~~~~~ gdb/ChangeLog * rs6000-tdep.c (rs6000_frame_cache): Explicitly cast return result to avoid invalid conversion from void *.
2016-02-24[OBV] gdb/rs6000: Fix maybe-uninitialized warning.Marcin Kościelnicki
Introduced by 657f9cde9d531c9929bef9e02a8064101d568f50. gdb/ChangeLog: * rs6000-tdep.c (rs6000_frame_cache): Initialize frame and pc to 0 to avoid spurious warnings.
2016-02-24Build unavailable-stack frames for tracepoint.Wei-cheng Wang
gdb/ChangeLog: 2016-02-24 Wei-cheng Wang <cole945@gmail.com> * rs6000-tdep.c (rs6000_frame_cache, rs6000_frame_this_id): Handle unavailable PC/SP to build unavailable frame.
2016-01-05Fix PR sim/13418: building with --enable-targets=all failsPedro Alves
Multitarget builds currently fail when: (1) simulator support is enabled (the main --target supports target sim) (2) powerpc is included in the --enable-targets list (3) powerpc is not the main/default target (--target) This is because the powerpc sim provides a non-standard API function sim_spr_register_name which gdb/rs6000-tdep.c utilizes. Since the sim does not yet support multitarget, only the sim (if one exists) for the main target is built. When that target isn't powerpc, this function is not available leading to linking errors: rs6000-tdep.c:(.text+0x1e34d): undefined reference to `sim_spr_register_name' Fix this by only using that API if the sim linked in is the powerpc sim. gdb/ChangeLog: 2016-01-05 Pedro Alves <palves@redhat.com> PR sim/13418 * configure.ac: Define WITH_PPC_SIM when linking in the sim and the target is powerpc*. * configure: Regenerate. * config.in: Regenerate.
2016-01-01GDB copyright headers update after running GDB's copyright.py script.Joel Brobecker
gdb/ChangeLog: Update year range in copyright notice of all files.
2015-10-22rs6000: Add cast for int to enum conversionSimon Marchi
Fixes this error: /home/pedro/gdb/mygit/src/gdb/rs6000-tdep.c:3091:1: error: invalid conversion from ‘int’ to ‘bfd_architecture’ [-fpermissive] }; ^ /home/pedro/gdb/mygit/src/gdb/rs6000-tdep.c: In function ‘void powerpc_set_vector_abi(char*, int, cmd_list_element*)’: /home/pedro/gdb/mygit/src/gdb/rs6000-tdep.c:6063:28: error: invalid conversion from ‘int’ to ‘powerpc_vector_abi’ [-fpermissive] powerpc_vector_abi_global = vector_abi; ^ gdb/ChangeLog: * rs6000-tdep.c (variants): Add (enum bfd_architecture) cast.
2015-09-30gdbarch.h: Change gdbarch_info::tdep_info's type to void *Simon Marchi
As reported by Ulrich here: https://sourceware.org/ml/gdb-patches/2015-09/msg00604.html The system compiler (gcc 4.1) in Centos 5 doesn't like that we cast to a pointer to a type that doesn't exist. I see no real value in using this kind iof construct over just using void *. So this patch changes the tdep_info field to void * and removes the casts. Even in C++, we should not need an explicit cast when assigning to a void *. gdb/ChangeLog: * gdbarch.sh (struct gdbarch_info): Change tdep_info's type to void *. * gdbarch.h: Regenerate. * i386-tdep.c (i386_gdbarch_init): Remove cast to struct gdbarch_tdep_info *. * mips-tdep.c (mips_gdbarch_init): Likewise. * ppc-linux-tdep (ppu2spu_sniffer): Likewise. * rs6000-tdep.c (rs6000_gdbarch_init): Likewise. * spu-multiarch.c (spu_gdbarch): Likewise.
2015-09-25Add some more casts (2/2)Simon Marchi
See previous patch's description. gdb/ChangeLog: * macrocmd.c (print_macro_callback): Add cast(s). * macrotab.c (macro_bcache_str): Likewise. (new_macro_definition): Likewise. * main.c (captured_main): Likewise. * maint.c (print_bfd_section_info): Likewise. * mdebugread.c (mdebug_build_psymtabs): Likewise. (basic_type): Likewise. * memattr.c (mem_region_cmp): Likewise. * memory-map.c (memory_map_start_memory): Likewise. (memory_map_end_memory): Likewise. (memory_map_start_property): Likewise. (memory_map_end_property): Likewise. (clear_result): Likewise. * memrange.c (compare_mem_ranges): Likewise. * mep-tdep.c (mep_analyze_frame_prologue): Likewise. * mi/mi-cmd-var.c (mi_cmd_var_update_iter): Likewise. * mi/mi-console.c (mi_console_file_delete): Likewise. (mi_console_file_fputs): Likewise. (mi_console_raw_packet): Likewise. (mi_console_file_flush): Likewise. (mi_console_set_raw): Likewise. * mi/mi-interp.c (mi_interpreter_resume): Likewise. (mi_new_thread): Likewise. (mi_thread_exit): Likewise. (mi_record_changed): Likewise. (mi_inferior_added): Likewise. (mi_inferior_appeared): Likewise. (mi_inferior_exit): Likewise. (mi_inferior_removed): Likewise. (mi_interp_data): Likewise. (mi_on_normal_stop): Likewise. (mi_traceframe_changed): Likewise. (mi_tsv_created): Likewise. (mi_tsv_deleted): Likewise. (mi_tsv_modified): Likewise. (mi_breakpoint_created): Likewise. (mi_breakpoint_deleted): Likewise. (mi_breakpoint_modified): Likewise. (mi_output_running_pid): Likewise. (mi_inferior_count): Likewise. (mi_solib_loaded): Likewise. (mi_solib_unloaded): Likewise. (mi_command_param_changed): Likewise. (mi_memory_changed): Likewise. (report_initial_inferior): Likewise. (mi_ui_out): Likewise. (mi_set_logging): Likewise. * mi/mi-main.c (collect_cores): Likewise. (print_one_inferior): Likewise. (free_vector_of_ints): Likewise. (free_splay_tree): Likewise. (mi_execute_command): Likewise. * mi/mi-out.c (mi_table_body): Likewise. (mi_table_end): Likewise. (mi_table_header): Likewise. (mi_begin): Likewise. (mi_end): Likewise. (mi_field_int): Likewise. (mi_field_string): Likewise. (mi_field_fmt): Likewise. (mi_flush): Likewise. (mi_redirect): Likewise. (field_separator): Likewise. (mi_open): Likewise. (mi_close): Likewise. (mi_out_buffered): Likewise. (mi_out_rewind): Likewise. (mi_out_put): Likewise. (mi_version): Likewise. (mi_out_data_dtor): Likewise. * mi/mi-parse.c (mi_parse_cleanup): Likewise. * microblaze-tdep.c (microblaze_frame_cache): Likewise. * minidebug.c (lzma_open): Likewise. (lzma_pread): Likewise. (lzma_close): Likewise. (lzma_stat): Likewise. * mips-linux-tdep.c (mips_linux_init_abi): Likewise. * mips-sde-tdep.c (mips_sde_frame_cache): Likewise. (mips_sde_elf_osabi_sniff_abi_tag_sections): Likewise. * mips-tdep.c (mips_insn16_frame_cache): Likewise. (mips_micro_frame_cache): Likewise. (mips_insn32_frame_cache): Likewise. (mips_stub_frame_cache): Likewise. (gdb_print_insn_mips): Likewise. (value_of_mips_user_reg): Likewise. (mips_gdbarch_init): Likewise. * mips64obsd-tdep.c (mips64obsd_supply_gregset): Likewise. * mipsnbsd-tdep.c (mipsnbsd_supply_fpregset): Likewise. (mipsnbsd_supply_gregset): Likewise. * mn10300-linux-tdep.c (am33_supply_fpregset_method): Likewise. (am33_collect_gregset_method): Likewise. (am33_collect_fpregset_method): Likewise. * mn10300-tdep.c (mn10300_analyze_frame_prologue): Likewise. * moxie-tdep.c (moxie_frame_cache): Likewise. * msp430-tdep.c (msp430_get_opcode_byte): Likewise. (msp430_analyze_frame_prologue): Likewise. * mt-tdep.c (mt_frame_unwind_cache): Likewise. * nios2-linux-tdep.c (nios2_supply_gregset): Likewise. (nios2_collect_gregset): Likewise. * nios2-tdep.c (nios2_frame_unwind_cache): Likewise. (nios2_stub_frame_cache): Likewise. * objc-lang.c (find_methods): Likewise. * objfiles.c (objfiles_pspace_data_cleanup): Likewise. (get_objfile_pspace_data): Likewise. (get_objfile_bfd_data): Likewise. (objfile_bfd_data_free): Likewise. (add_to_objfile_sections): Likewise. (do_free_objfile_cleanup): Likewise. (resume_section_map_updates_cleanup): Likewise. * opencl-lang.c (builtin_opencl_type): Likewise. * osabi.c (generic_elf_osabi_sniff_abi_tag_sections): Likewise. * osdata.c (osdata_start_osdata): Likewise. (osdata_start_item): Likewise. (osdata_start_column): Likewise. (osdata_end_column): Likewise. (clear_parsing_data): Likewise. (osdata_free_cleanup): Likewise. * parse.c (type_stack_cleanup): Likewise. (exp_uses_objfile_iter): Likewise. * ppc-linux-tdep.c (ppc_linux_supply_gregset): Likewise. (ppc_linux_collect_gregset): Likewise. (ppu2spu_prev_arch): Likewise. (ppu2spu_this_id): Likewise. (ppu2spu_prev_register): Likewise. (ppu2spu_unwind_register): Likewise. (ppu2spu_sniffer): Likewise. (ppu2spu_dealloc_cache): Likewise. (ppc_linux_init_abi): Likewise. * ppcfbsd-tdep.c (ppcfbsd_sigtramp_frame_cache): Likewise. * ppcobsd-tdep.c (ppcobsd_sigtramp_frame_cache): Likewise. * progspace.c (restore_program_space): Likewise. * psymtab.c (find_pc_sect_psymtab): Likewise. (compare_psymbols): Likewise. (psymbol_bcache_full): Likewise. (allocate_psymtab): Likewise. (discard_psymtabs_upto): Likewise. * python/py-block.c (set_block): Likewise. (del_objfile_blocks): Likewise. * python/py-breakpoint.c (build_bp_list): Likewise. * python/py-inferior.c (inferior_to_inferior_object): Likewise. (build_inferior_list): Likewise. (py_free_inferior): Likewise. * python/py-objfile.c (py_free_objfile): Likewise. (objfile_to_objfile_object): Likewise. * python/py-prettyprint.c (py_restore_tstate): Likewise. * python/py-progspace.c (py_free_pspace): Likewise. (pspace_to_pspace_object): Likewise. * python/py-symbol.c (set_symbol): Likewise. (del_objfile_symbols): Likewise. * python/py-symtab.c (set_sal): Likewise. (set_symtab): Likewise. (del_objfile_symtab): Likewise. (del_objfile_sal): Likewise. * python/py-type.c (save_objfile_types): Likewise. (set_type): Likewise. * python/py-unwind.c (pyuw_prev_register): Likewise. (pyuw_on_new_gdbarch): Likewise. * python/py-utils.c (py_decref): Likewise. (py_xdecref): Likewise. (gdb_py_generic_dict): Likewise. * python/py-xmethods.c (gdbpy_free_xmethod_worker_data): Likewise. (gdbpy_clone_xmethod_worker_data): Likewise. (gdbpy_get_xmethod_arg_types): Likewise. (gdbpy_get_xmethod_result_type): Likewise. (gdbpy_invoke_xmethod): Likewise. * python/python.c (gdbpy_apply_type_printers): Likewise. (gdbpy_free_type_printers): Likewise. * record-btrace.c (record_btrace_disable_callback): Likewise. (bfcache_hash): Likewise. (bfcache_eq): Likewise. (btrace_get_frame_function): Likewise. (record_btrace_frame_unwind_stop_reason): Likewise. (record_btrace_frame_this_id): Likewise. (record_btrace_frame_prev_register): Likewise. (record_btrace_frame_dealloc_cache): Likewise. * record-full.c (record_full_message_wrapper): Likewise. (record_full_save_cleanups): Likewise. * regcache.c (regcache_descr): Likewise. (do_regcache_xfree): Likewise. (do_regcache_invalidate): Likewise. (do_cooked_read): Likewise. (regcache_transfer_regset): Likewise. * reggroups.c (reggroup_add): Likewise. (reggroup_next): Likewise. (reggroup_prev): Likewise. * remote-fileio.c (do_remote_fileio_request): Likewise. * remote-notif.c (remote_async_get_pending_events_handler): Likewise. (do_notif_event_xfree): Likewise. * remote.c (get_remote_arch_state): Likewise. (remote_pspace_data_cleanup): Likewise. (get_remote_exec_file): Likewise. (set_pspace_remote_exec_file): Likewise. (compare_pnums): Likewise. (clear_threads_listing_context): Likewise. (remote_newthread_step): Likewise. (start_thread): Likewise. (end_thread): Likewise. (remove_child_of_pending_fork): Likewise. (remove_stop_reply_for_inferior): Likewise. (remove_stop_reply_of_remote_state): Likewise. (remote_notif_remove_once_on_match): Likewise. (stop_reply_match_ptid_and_ws): Likewise. (kill_child_of_pending_fork): Likewise. (register_remote_g_packet_guess): Likewise. (remote_read_description_p): Likewise. (remote_read_description): Likewise. (free_actions_list_cleanup_wrapper): Likewise. (remote_async_serial_handler): Likewise. * rl78-tdep.c (rl78_get_opcode_byte): Likewise. (rl78_analyze_frame_prologue): Likewise. * rs6000-tdep.c (ppc_supply_gregset): Likewise. (ppc_supply_fpregset): Likewise. (ppc_supply_vsxregset): Likewise. (ppc_supply_vrregset): Likewise. (ppc_collect_gregset): Likewise. (ppc_collect_fpregset): Likewise. (ppc_collect_vsxregset): Likewise. (ppc_collect_vrregset): Likewise. (e500_move_ev_register): Likewise. (do_regcache_raw_write): Likewise. (rs6000_frame_cache): Likewise. (rs6000_epilogue_frame_cache): Likewise. (rs6000_gdbarch_init): Likewise. * rx-tdep.c (rx_get_opcode_byte): Likewise. (rx_analyze_frame_prologue): Likewise. (rx_frame_type): Likewise. (rx_frame_sniffer_common): Likewise. * s390-linux-tdep.c (s390_check_for_saved): Likewise. (s390_frame_unwind_cache): Likewise. (s390_stub_frame_unwind_cache): Likewise. (s390_sigtramp_frame_unwind_cache): Likewise. * score-tdep.c (score_make_prologue_cache): Likewise. * sentinel-frame.c (sentinel_frame_prev_register): Likewise. (sentinel_frame_prev_arch): Likewise. * ser-base.c (fd_event): Likewise. (push_event): Likewise. (ser_base_write): Likewise. * ser-pipe.c (pipe_close): Likewise. * serial.c (serial_write): Likewise. * sh-tdep.c (sh_frame_cache): Likewise. (sh_stub_this_id): Likewise. * sh64-tdep.c (sh64_frame_cache): Likewise. * solib-aix.c (get_solib_aix_inferior_data): Likewise. (library_list_start_library): Likewise. (library_list_start_list): Likewise. (solib_aix_free_library_list): Likewise. * solib-darwin.c (get_darwin_info): Likewise. * solib-dsbt.c (get_dsbt_info): Likewise. * solib-spu.c (append_ocl_sos): Likewise. * solib-svr4.c (svr4_pspace_data_cleanup): Likewise. (get_svr4_info): Likewise. (library_list_start_library): Likewise. (svr4_library_list_start_list): Likewise. (hash_probe_and_action): Likewise. (equal_probe_and_action): Likewise. (svr4_update_solib_event_breakpoint): Likewise. (set_solib_svr4_fetch_link_map_offsets): Likewise. (svr4_fetch_link_map_offsets): Likewise. (svr4_have_link_map_offsets): Likewise. * solib-target.c (library_list_start_segment): Likewise. (library_list_start_section): Likewise. (library_list_start_library): Likewise. (library_list_end_library): Likewise. (library_list_start_list): Likewise. (solib_target_free_library_list): Likewise. * solib.c (solib_ops): Likewise. (set_solib_ops): Likewise. * sparc-sol2-tdep.c (sparc32_sol2_sigtramp_frame_cache): Likewise. * sparc-tdep.c (sparc_frame_cache): Likewise. (sparc32_frame_cache): Likewise. (sparc32_supply_gregset): Likewise. (sparc32_collect_gregset): Likewise. (sparc32_supply_fpregset): Likewise. (sparc32_collect_fpregset): Likewise. * sparc64-sol2-tdep.c (sparc64_sol2_sigtramp_frame_cache): Likewise. * sparc64-tdep.c (sparc64_supply_gregset): Likewise. (sparc64_collect_gregset): Likewise. (sparc64_supply_fpregset): Likewise. (sparc64_collect_fpregset): Likewise. * sparc64fbsd-tdep.c (sparc64fbsd_sigtramp_frame_cache): Likewise. * sparc64nbsd-tdep.c (sparc64nbsd_sigcontext_frame_cache): Likewise. * sparc64obsd-tdep.c (sparc64obsd_frame_cache): Likewise. (sparc64obsd_trapframe_cache): Likewise. * sparcnbsd-tdep.c (sparc32nbsd_sigcontext_frame_cache): Likewise. * sparcobsd-tdep.c (sparc32obsd_sigtramp_frame_cache): Likewise. * spu-multiarch.c (spu_gdbarch): Likewise. * spu-tdep.c (spu_frame_unwind_cache): Likewise. (spu2ppu_prev_arch): Likewise. (spu2ppu_this_id): Likewise. (spu2ppu_prev_register): Likewise. (spu2ppu_dealloc_cache): Likewise. (spu_dis_asm_print_address): Likewise. (gdb_print_insn_spu): Likewise. (spu_get_overlay_table): Likewise. * stabsread.c (rs6000_builtin_type): Likewise. * stack.c (do_print_variable_and_value): Likewise. * stap-probe.c (get_stap_base_address_1): Likewise. * symfile-debug.c (debug_qf_has_symbols): Likewise. (debug_qf_find_last_source_symtab): Likewise. (debug_qf_forget_cached_source_info): Likewise. (debug_qf_map_symtabs_matching_filename): Likewise. (debug_qf_lookup_symbol): Likewise. (debug_qf_print_stats): Likewise. (debug_qf_dump): Likewise. (debug_qf_relocate): Likewise. (debug_qf_expand_symtabs_for_function): Likewise. (debug_qf_expand_all_symtabs): Likewise. (debug_qf_expand_symtabs_with_fullname): Likewise. (debug_qf_map_matching_symbols): Likewise. (debug_qf_expand_symtabs_matching): Likewise. (debug_qf_find_pc_sect_compunit_symtab): Likewise. (debug_qf_map_symbol_filenames): Likewise. (debug_sym_get_probes): Likewise. (debug_sym_new_init): Likewise. (debug_sym_init): Likewise. (debug_sym_read): Likewise. (debug_sym_read_psymbols): Likewise. (debug_sym_finish): Likewise. (debug_sym_offsets): Likewise. (debug_sym_read_linetable): Likewise. (debug_sym_relocate): Likewise. (uninstall_symfile_debug_logging): Likewise. * symfile-mem.c (symbol_file_add_from_memory_wrapper): Likewise. * symfile.c (place_section): Likewise. (add_section_size_callback): Likewise. (load_progress): Likewise. (load_section_callback): Likewise. (clear_memory_write_data): Likewise. (allocate_symtab): Likewise. * symmisc.c (maintenance_expand_file_matcher): Likewise. * symtab.c (lookup_symtab_callback): Likewise. (hash_demangled_name_entry): Likewise. (eq_demangled_name_entry): Likewise. (get_symbol_cache): Likewise. (symbol_cache_cleanup): Likewise. (set_symbol_cache_size): Likewise. (symbol_cache_flush): Likewise. (maintenance_print_symbol_cache): Likewise. (maintenance_print_symbol_cache_statistics): Likewise. (delete_filename_seen_cache): Likewise. (output_partial_symbol_filename): Likewise. (search_symbols_file_matches): Likewise. (search_symbols_name_matches): Likewise. (do_free_completion_list): Likewise. (maybe_add_partial_symtab_filename): Likewise. (get_main_info): Likewise. (main_info_cleanup): Likewise. * target-dcache.c (target_dcache_cleanup): Likewise. (target_dcache_init_p): Likewise. (target_dcache_invalidate): Likewise. (target_dcache_get): Likewise. (target_dcache_get_or_init): Likewise. * target-descriptions.c (target_find_description): Likewise. (tdesc_find_type): Likewise. (tdesc_data_cleanup): Likewise. (tdesc_find_arch_register): Likewise. (tdesc_register_name): Likewise. (tdesc_register_type): Likewise. (tdesc_register_reggroup_p): Likewise. (set_tdesc_pseudo_register_name): Likewise. (set_tdesc_pseudo_register_type): Likewise. (set_tdesc_pseudo_register_reggroup_p): Likewise. (tdesc_use_registers): Likewise. (free_target_description): Likewise. * target-memory.c (compare_block_starting_address): Likewise. (cleanup_request_data): Likewise. (cleanup_write_requests_vector): Likewise. * target.c (open_target): Likewise. (cleanup_restore_target_terminal): Likewise. (free_memory_read_result_vector): Likewise. * thread.c (disable_thread_stack_temporaries): Likewise. (finish_thread_state_cleanup): Likewise. (do_restore_current_thread_cleanup): Likewise. (restore_current_thread_cleanup_dtor): Likewise. (set_thread_refcount): Likewise. (tp_array_compar): Likewise. (do_captured_thread_select): Likewise. * tic6x-tdep.c (tic6x_frame_unwind_cache): Likewise. (tic6x_stub_this_id): Likewise. * tilegx-tdep.c (tilegx_frame_cache): Likewise. * top.c (do_restore_instream_cleanup): Likewise. (gdb_readline_wrapper_cleanup): Likewise. (kill_or_detach): Likewise. (print_inferior_quit_action): Likewise. * tracefile-tfile.c (match_blocktype): Likewise. (build_traceframe_info): Likewise. * tracefile.c (trace_file_writer_xfree): Likewise. * tracepoint.c (memrange_cmp): Likewise. (do_collect_symbol): Likewise. (do_clear_collection_list): Likewise. (do_restore_current_traceframe_cleanup): Likewise. (restore_current_traceframe_cleanup_dtor): Likewise. (free_current_marker): Likewise. (traceframe_info_start_memory): Likewise. (traceframe_info_start_tvar): Likewise. (free_result): Likewise. * tramp-frame.c (tramp_frame_cache): Likewise. * tui/tui-file.c (tui_file_delete): Likewise. (tui_fileopen): Likewise. (tui_sfileopen): Likewise. (tui_file_isatty): Likewise. (tui_file_rewind): Likewise. (tui_file_put): Likewise. (tui_file_fputs): Likewise. (tui_file_get_strbuf): Likewise. (tui_file_adjust_strbuf): Likewise. (tui_file_flush): Likewise. * tui/tui-layout.c (make_command_window): Likewise. (make_data_window): Likewise. (show_source_disasm_command): Likewise. (show_data): Likewise. (make_source_or_disasm_window): Likewise. (show_source_or_disasm_and_command): Likewise. * tui/tui-out.c (tui_field_int): Likewise. (tui_field_string): Likewise. (tui_field_fmt): Likewise. (tui_text): Likewise. * typeprint.c (hash_typedef_field): Likewise. (eq_typedef_field): Likewise. (do_free_typedef_hash): Likewise. (copy_typedef_hash_element): Likewise. (do_free_global_table): Likewise. (find_global_typedef): Likewise. (find_typedef_in_hash): Likewise. * ui-file.c (ui_file_write_for_put): Likewise. (do_ui_file_xstrdup): Likewise. (mem_file_delete): Likewise. (mem_file_rewind): Likewise. (mem_file_put): Likewise. (mem_file_write): Likewise. (stdio_file_delete): Likewise. (stdio_file_flush): Likewise. (stdio_file_read): Likewise. (stdio_file_write): Likewise. (stdio_file_write_async_safe): Likewise. (stdio_file_fputs): Likewise. (stdio_file_isatty): Likewise. (stdio_file_fseek): Likewise. (tee_file_delete): Likewise. (tee_file_flush): Likewise. (tee_file_write): Likewise. (tee_file_fputs): Likewise. (tee_file_isatty): Likewise. * ui-out.c (do_cleanup_table_end): Likewise. (do_cleanup_end): Likewise. * user-regs.c (user_reg_add): Likewise. (user_reg_map_name_to_regnum): Likewise. (usernum_to_user_reg): Likewise. (maintenance_print_user_registers): Likewise. * utils.c (do_bfd_close_cleanup): Likewise. (do_fclose_cleanup): Likewise. (do_obstack_free): Likewise. (do_ui_file_delete): Likewise. (do_ui_out_redirect_pop): Likewise. (do_free_section_addr_info): Likewise. (restore_integer): Likewise. (do_unpush_target): Likewise. (do_htab_delete_cleanup): Likewise. (do_restore_ui_file): Likewise. (do_value_free): Likewise. (do_free_so): Likewise. (free_current_contents): Likewise. (do_regfree_cleanup): Likewise. (core_addr_hash): Likewise. (core_addr_eq): Likewise. (do_free_char_ptr_vec): Likewise. * v850-tdep.c (v850_frame_cache): Likewise. * varobj.c (do_free_variable_cleanup): Likewise. * vax-tdep.c (vax_supply_gregset): Likewise. (vax_frame_cache): Likewise. * vaxobsd-tdep.c (vaxobsd_sigtramp_frame_cache): Likewise. * xml-support.c (gdb_xml_body_text): Likewise. (gdb_xml_values_cleanup): Likewise. (gdb_xml_start_element): Likewise. (gdb_xml_start_element_wrapper): Likewise. (gdb_xml_end_element): Likewise. (gdb_xml_end_element_wrapper): Likewise. (gdb_xml_cleanup): Likewise. (gdb_xml_fetch_external_entity): Likewise. (gdb_xml_parse_attr_enum): Likewise. (xinclude_start_include): Likewise. (xinclude_end_include): Likewise. (xml_xinclude_default): Likewise. (xml_xinclude_start_doctype): Likewise. (xml_xinclude_end_doctype): Likewise. (xml_xinclude_cleanup): Likewise. (xml_fetch_content_from_file): Likewise. * xml-syscall.c (free_syscalls_info): Likewise. (syscall_start_syscall): Likewise. * xml-tdesc.c (tdesc_end_arch): Likewise. (tdesc_end_osabi): Likewise. (tdesc_end_compatible): Likewise. (tdesc_start_target): Likewise. (tdesc_start_feature): Likewise. (tdesc_start_reg): Likewise. (tdesc_start_union): Likewise. (tdesc_start_struct): Likewise. (tdesc_start_flags): Likewise. (tdesc_start_field): Likewise. (tdesc_start_vector): Likewise. (fetch_available_features_from_target): Likewise. * xstormy16-tdep.c (xstormy16_frame_cache): Likewise. * xtensa-tdep.c (xtensa_supply_gregset): Likewise. (xtensa_frame_cache): Likewise. (xtensa_frame_prev_register): Likewise. (xtensa_extract_return_value): Likewise.
2015-09-25Add casts to memory allocation related callsSimon Marchi
Most allocation functions (if not all) return a void* pointing to the allocated memory. In C++, we need to add an explicit cast when assigning the result to a pointer to another type (which is the case more often than not). The content of this patch is taken from Pedro's branch, from commit "(mostly) auto-generated patch to insert casts needed for C++". I validated that the changes make sense and manually reflowed the code to make it respect the coding style. I also found multiple places where I could use XNEW/XNEWVEC/XRESIZEVEC/etc. Thanks a lot to whoever did that automated script to insert casts, doing it completely by hand would have taken a ridiculous amount of time. Only files built on x86 with --enable-targets=all are modified. This means that all other -nat.c files are untouched and will have to be dealt with later by using appropiate compilers. Or maybe we can try to build them with a regular g++ just to know where to add casts, I don't know. I built-tested this with --enable-targets=all and reg-tested. Here's the changelog entry, which was not too bad to make despite the size, thanks to David Malcom's script. I fixed some bits by hand, but there might be some wrong parts left (hopefully not). gdb/ChangeLog: * aarch64-linux-tdep.c (aarch64_stap_parse_special_token): Add cast to allocation result assignment. * ada-exp.y (write_object_renaming): Likewise. (write_ambiguous_var): Likewise. (ada_nget_field_index): Likewise. (write_var_or_type): Likewise. * ada-lang.c (ada_decode_symbol): Likewise. (ada_value_assign): Likewise. (value_pointer): Likewise. (cache_symbol): Likewise. (add_nonlocal_symbols): Likewise. (ada_name_for_lookup): Likewise. (symbol_completion_add): Likewise. (ada_to_fixed_type_1): Likewise. (ada_get_next_arg): Likewise. (defns_collected): Likewise. * ada-lex.l (processId): Likewise. (processString): Likewise. * ada-tasks.c (read_known_tasks_array): Likewise. (read_known_tasks_list): Likewise. * ada-typeprint.c (decoded_type_name): Likewise. * addrmap.c (addrmap_mutable_create_fixed): Likewise. * amd64-tdep.c (amd64_push_arguments): Likewise. (amd64_displaced_step_copy_insn): Likewise. (amd64_classify_insn_at): Likewise. (amd64_relocate_instruction): Likewise. * amd64obsd-tdep.c (amd64obsd_sigtramp_p): Likewise. * arch-utils.c (simple_displaced_step_copy_insn): Likewise. (initialize_current_architecture): Likewise. * arm-linux-tdep.c (arm_stap_parse_special_token): Likewise. * arm-symbian-tdep.c (arm_symbian_osabi_sniffer): Likewise. * arm-tdep.c (arm_exidx_new_objfile): Likewise. (arm_push_dummy_call): Likewise. (extend_buffer_earlier): Likewise. (arm_adjust_breakpoint_address): Likewise. (arm_skip_stub): Likewise. * auto-load.c (filename_is_in_pattern): Likewise. (maybe_add_script_file): Likewise. (maybe_add_script_text): Likewise. (auto_load_objfile_script_1): Likewise. * auxv.c (ld_so_xfer_auxv): Likewise. * ax-general.c (new_agent_expr): Likewise. (grow_expr): Likewise. (ax_reg_mask): Likewise. * bcache.c (bcache_full): Likewise. * breakpoint.c (program_breakpoint_here_p): Likewise. * btrace.c (parse_xml_raw): Likewise. * build-id.c (build_id_to_debug_bfd): Likewise. * buildsym.c (end_symtab_with_blockvector): Likewise. * c-exp.y (string_exp): Likewise. (qualified_name): Likewise. (write_destructor_name): Likewise. (operator_stoken): Likewise. (parse_number): Likewise. (scan_macro_expansion): Likewise. (yylex): Likewise. (c_print_token): Likewise. * c-lang.c (c_get_string): Likewise. (emit_numeric_character): Likewise. * charset.c (wchar_iterate): Likewise. * cli/cli-cmds.c (complete_command): Likewise. (make_command): Likewise. * cli/cli-dump.c (restore_section_callback): Likewise. (restore_binary_file): Likewise. * cli/cli-interp.c (cli_interpreter_exec): Likewise. * cli/cli-script.c (execute_control_command): Likewise. * cli/cli-setshow.c (do_set_command): Likewise. * coff-pe-read.c (add_pe_forwarded_sym): Likewise. (read_pe_exported_syms): Likewise. * coffread.c (coff_read_struct_type): Likewise. (coff_read_enum_type): Likewise. * common/btrace-common.c (btrace_data_append): Likewise. * common/buffer.c (buffer_grow): Likewise. * common/filestuff.c (gdb_fopen_cloexec): Likewise. * common/format.c (parse_format_string): Likewise. * common/gdb_vecs.c (delim_string_to_char_ptr_vec_append): Likewise. * common/xml-utils.c (xml_escape_text): Likewise. * compile/compile-object-load.c (copy_sections): Likewise. (compile_object_load): Likewise. * compile/compile-object-run.c (compile_object_run): Likewise. * completer.c (filename_completer): Likewise. * corefile.c (read_memory_typed_address): Likewise. (write_memory_unsigned_integer): Likewise. (write_memory_signed_integer): Likewise. (complete_set_gnutarget): Likewise. * corelow.c (get_core_register_section): Likewise. * cp-name-parser.y (d_grab): Likewise. (allocate_info): Likewise. (cp_new_demangle_parse_info): Likewise. * cp-namespace.c (cp_scan_for_anonymous_namespaces): Likewise. (cp_lookup_symbol_in_namespace): Likewise. (lookup_namespace_scope): Likewise. (find_symbol_in_baseclass): Likewise. (cp_lookup_nested_symbol): Likewise. (cp_lookup_transparent_type_loop): Likewise. * cp-support.c (copy_string_to_obstack): Likewise. (make_symbol_overload_list): Likewise. (make_symbol_overload_list_namespace): Likewise. (make_symbol_overload_list_adl_namespace): Likewise. (first_component_command): Likewise. * cp-valprint.c (cp_print_value): Likewise. * ctf.c (ctf_xfer_partial): Likewise. * d-exp.y (StringExp): Likewise. * d-namespace.c (d_lookup_symbol_in_module): Likewise. (lookup_module_scope): Likewise. (find_symbol_in_baseclass): Likewise. (d_lookup_nested_symbol): Likewise. * dbxread.c (find_stab_function_addr): Likewise. (read_dbx_symtab): Likewise. (dbx_end_psymtab): Likewise. (cp_set_block_scope): Likewise. * dcache.c (dcache_alloc): Likewise. * demangle.c (_initialize_demangler): Likewise. * dicos-tdep.c (dicos_load_module_p): Likewise. * dictionary.c (dict_create_hashed_expandable): Likewise. (dict_create_linear_expandable): Likewise. (expand_hashtable): Likewise. (add_symbol_linear_expandable): Likewise. * dwarf2-frame.c (add_cie): Likewise. (add_fde): Likewise. (dwarf2_build_frame_info): Likewise. * dwarf2expr.c (dwarf_expr_grow_stack): Likewise. (dwarf_expr_fetch_address): Likewise. (add_piece): Likewise. (execute_stack_op): Likewise. * dwarf2loc.c (chain_candidate): Likewise. (dwarf_entry_parameter_to_value): Likewise. (read_pieced_value): Likewise. (write_pieced_value): Likewise. * dwarf2read.c (dwarf2_read_section): Likewise. (add_type_unit): Likewise. (read_comp_units_from_section): Likewise. (fixup_go_packaging): Likewise. (dwarf2_compute_name): Likewise. (dwarf2_physname): Likewise. (create_dwo_unit_in_dwp_v1): Likewise. (create_dwo_unit_in_dwp_v2): Likewise. (read_func_scope): Likewise. (read_call_site_scope): Likewise. (dwarf2_attach_fields_to_type): Likewise. (process_structure_scope): Likewise. (mark_common_block_symbol_computed): Likewise. (read_common_block): Likewise. (abbrev_table_read_table): Likewise. (guess_partial_die_structure_name): Likewise. (fixup_partial_die): Likewise. (add_file_name): Likewise. (dwarf2_const_value_data): Likewise. (dwarf2_const_value_attr): Likewise. (build_error_marker_type): Likewise. (guess_full_die_structure_name): Likewise. (anonymous_struct_prefix): Likewise. (typename_concat): Likewise. (dwarf2_canonicalize_name): Likewise. (dwarf2_name): Likewise. (write_constant_as_bytes): Likewise. (dwarf2_fetch_constant_bytes): Likewise. (copy_string): Likewise. (parse_macro_definition): Likewise. * elfread.c (elf_symfile_segments): Likewise. (elf_rel_plt_read): Likewise. (elf_gnu_ifunc_resolve_by_cache): Likewise. (elf_gnu_ifunc_resolve_by_got): Likewise. (elf_read_minimal_symbols): Likewise. (elf_gnu_ifunc_record_cache): Likewise. * event-top.c (top_level_prompt): Likewise. (command_line_handler): Likewise. * exec.c (resize_section_table): Likewise. * expprint.c (print_subexp_standard): Likewise. * fbsd-tdep.c (fbsd_collect_regset_section_cb): Likewise. * findcmd.c (parse_find_args): Likewise. * findvar.c (address_from_register): Likewise. * frame.c (get_prev_frame_always): Likewise. * gdb_bfd.c (gdb_bfd_ref): Likewise. (get_section_descriptor): Likewise. * gdb_obstack.c (obconcat): Likewise. (obstack_strdup): Likewise. * gdbtypes.c (lookup_function_type_with_arguments): Likewise. (create_set_type): Likewise. (lookup_unsigned_typename): Likewise. (lookup_signed_typename): Likewise. (resolve_dynamic_union): Likewise. (resolve_dynamic_struct): Likewise. (add_dyn_prop): Likewise. (copy_dynamic_prop_list): Likewise. (arch_flags_type): Likewise. (append_composite_type_field_raw): Likewise. * gdbtypes.h (INIT_FUNC_SPECIFIC): Likewise. * gnu-v3-abi.c (gnuv3_rtti_type): Likewise. * go-exp.y (string_exp): Likewise. * go-lang.c (go_demangle): Likewise. * guile/guile.c (compute_scheme_string): Likewise. * guile/scm-cmd.c (gdbscm_parse_command_name): Likewise. (gdbscm_canonicalize_command_name): Likewise. * guile/scm-ports.c (ioscm_init_stdio_buffers): Likewise. (ioscm_init_memory_port): Likewise. (ioscm_reinit_memory_port): Likewise. * guile/scm-utils.c (gdbscm_gc_xstrdup): Likewise. (gdbscm_gc_dup_argv): Likewise. * h8300-tdep.c (h8300_push_dummy_call): Likewise. * hppa-tdep.c (internalize_unwinds): Likewise. (read_unwind_info): Likewise. * i386-cygwin-tdep.c (core_process_module_section): Likewise. (windows_core_xfer_shared_libraries): Likewise. * i386-tdep.c (i386_displaced_step_copy_insn): Likewise. (i386_stap_parse_special_token_triplet): Likewise. (i386_stap_parse_special_token_three_arg_disp): Likewise. * i386obsd-tdep.c (i386obsd_sigtramp_p): Likewise. * inf-child.c (inf_child_fileio_readlink): Likewise. * inf-ptrace.c (inf_ptrace_fetch_register): Likewise. (inf_ptrace_store_register): Likewise. * infrun.c (follow_exec): Likewise. (displaced_step_prepare_throw): Likewise. (save_stop_context): Likewise. (save_infcall_suspend_state): Likewise. * jit.c (jit_read_descriptor): Likewise. (jit_read_code_entry): Likewise. (jit_symtab_line_mapping_add_impl): Likewise. (finalize_symtab): Likewise. (jit_unwind_reg_get_impl): Likewise. * jv-exp.y (QualifiedName): Likewise. * jv-lang.c (get_java_utf8_name): Likewise. (type_from_class): Likewise. (java_demangle_type_signature): Likewise. (java_class_name_from_physname): Likewise. * jv-typeprint.c (java_type_print_base): Likewise. * jv-valprint.c (java_value_print): Likewise. * language.c (add_language): Likewise. * linespec.c (add_sal_to_sals_basic): Likewise. (add_sal_to_sals): Likewise. (decode_objc): Likewise. (find_linespec_symbols): Likewise. * linux-fork.c (fork_save_infrun_state): Likewise. * linux-nat.c (linux_nat_detach): Likewise. (linux_nat_fileio_readlink): Likewise. * linux-record.c (record_linux_sockaddr): Likewise. (record_linux_msghdr): Likewise. (Do): Likewise. * linux-tdep.c (linux_core_info_proc_mappings): Likewise. (linux_collect_regset_section_cb): Likewise. (linux_get_siginfo_data): Likewise. * linux-thread-db.c (try_thread_db_load_from_pdir_1): Likewise. (try_thread_db_load_from_dir): Likewise. (thread_db_load_search): Likewise. (info_auto_load_libthread_db): Likewise. * m32c-tdep.c (m32c_m16c_address_to_pointer): Likewise. (m32c_m16c_pointer_to_address): Likewise. * m68hc11-tdep.c (m68hc11_pseudo_register_write): Likewise. * m68k-tdep.c (m68k_get_longjmp_target): Likewise. * machoread.c (macho_check_dsym): Likewise. * macroexp.c (resize_buffer): Likewise. (gather_arguments): Likewise. (maybe_expand): Likewise. * macrotab.c (new_macro_key): Likewise. (new_source_file): Likewise. (new_macro_definition): Likewise. * mdebugread.c (parse_symbol): Likewise. (parse_type): Likewise. (parse_partial_symbols): Likewise. (psymtab_to_symtab_1): Likewise. * mem-break.c (default_memory_insert_breakpoint): Likewise. * mi/mi-cmd-break.c (mi_argv_to_format): Likewise. * mi/mi-main.c (mi_cmd_data_read_memory): Likewise. (mi_cmd_data_read_memory_bytes): Likewise. (mi_cmd_data_write_memory_bytes): Likewise. (mi_cmd_trace_frame_collected): Likewise. * mi/mi-parse.c (mi_parse_argv): Likewise. (mi_parse): Likewise. * minidebug.c (lzma_open): Likewise. (lzma_pread): Likewise. * mips-tdep.c (mips_read_fp_register_single): Likewise. (mips_print_fp_register): Likewise. * mipsnbsd-tdep.c (mipsnbsd_get_longjmp_target): Likewise. * mipsread.c (read_alphacoff_dynamic_symtab): Likewise. * mt-tdep.c (mt_register_name): Likewise. (mt_registers_info): Likewise. (mt_push_dummy_call): Likewise. * namespace.c (add_using_directive): Likewise. * nat/linux-btrace.c (perf_event_read): Likewise. (linux_enable_bts): Likewise. * nat/linux-osdata.c (linux_common_core_of_thread): Likewise. * nat/linux-ptrace.c (linux_ptrace_test_ret_to_nx): Likewise. * nto-tdep.c (nto_find_and_open_solib): Likewise. (nto_parse_redirection): Likewise. * objc-lang.c (objc_demangle): Likewise. (find_methods): Likewise. * objfiles.c (get_objfile_bfd_data): Likewise. (set_objfile_main_name): Likewise. (allocate_objfile): Likewise. (objfile_relocate): Likewise. (update_section_map): Likewise. * osabi.c (generic_elf_osabi_sniff_abi_tag_sections): Likewise. * p-exp.y (exp): Likewise. (yylex): Likewise. * p-valprint.c (pascal_object_print_value): Likewise. * parse.c (initialize_expout): Likewise. (mark_completion_tag): Likewise. (copy_name): Likewise. (parse_float): Likewise. (type_stack_reserve): Likewise. * ppc-linux-tdep.c (ppc_stap_parse_special_token): Likewise. (ppu2spu_prev_register): Likewise. * ppc-ravenscar-thread.c (supply_register_at_address): Likewise. * printcmd.c (printf_wide_c_string): Likewise. (printf_pointer): Likewise. * probe.c (parse_probes): Likewise. * python/py-cmd.c (gdbpy_parse_command_name): Likewise. (cmdpy_init): Likewise. * python/py-gdb-readline.c (gdbpy_readline_wrapper): Likewise. * python/py-symtab.c (set_sal): Likewise. * python/py-unwind.c (pyuw_sniffer): Likewise. * python/python.c (python_interactive_command): Likewise. (compute_python_string): Likewise. * ravenscar-thread.c (get_running_thread_id): Likewise. * record-full.c (record_full_exec_insn): Likewise. (record_full_core_open_1): Likewise. * regcache.c (regcache_raw_read_signed): Likewise. (regcache_raw_read_unsigned): Likewise. (regcache_cooked_read_signed): Likewise. (regcache_cooked_read_unsigned): Likewise. * remote-fileio.c (remote_fileio_func_open): Likewise. (remote_fileio_func_rename): Likewise. (remote_fileio_func_unlink): Likewise. (remote_fileio_func_stat): Likewise. (remote_fileio_func_system): Likewise. * remote-mips.c (mips_xfer_memory): Likewise. (mips_load_srec): Likewise. (pmon_end_download): Likewise. * remote.c (new_remote_state): Likewise. (map_regcache_remote_table): Likewise. (remote_register_number_and_offset): Likewise. (init_remote_state): Likewise. (get_memory_packet_size): Likewise. (remote_pass_signals): Likewise. (remote_program_signals): Likewise. (remote_start_remote): Likewise. (remote_check_symbols): Likewise. (remote_query_supported): Likewise. (extended_remote_attach): Likewise. (process_g_packet): Likewise. (store_registers_using_G): Likewise. (putpkt_binary): Likewise. (read_frame): Likewise. (compare_sections_command): Likewise. (remote_hostio_pread): Likewise. (remote_hostio_readlink): Likewise. (remote_file_put): Likewise. (remote_file_get): Likewise. (remote_pid_to_exec_file): Likewise. (_initialize_remote): Likewise. * rs6000-aix-tdep.c (rs6000_aix_ld_info_to_xml): Likewise. (rs6000_aix_core_xfer_shared_libraries_aix): Likewise. * rs6000-tdep.c (ppc_displaced_step_copy_insn): Likewise. (bfd_uses_spe_extensions): Likewise. * s390-linux-tdep.c (s390_displaced_step_copy_insn): Likewise. * score-tdep.c (score7_malloc_and_get_memblock): Likewise. * solib-dsbt.c (decode_loadmap): Likewise. (fetch_loadmap): Likewise. (scan_dyntag): Likewise. (enable_break): Likewise. (dsbt_relocate_main_executable): Likewise. * solib-frv.c (fetch_loadmap): Likewise. (enable_break2): Likewise. (frv_relocate_main_executable): Likewise. * solib-spu.c (spu_relocate_main_executable): Likewise. (spu_bfd_open): Likewise. * solib-svr4.c (lm_info_read): Likewise. (read_program_header): Likewise. (find_program_interpreter): Likewise. (scan_dyntag): Likewise. (elf_locate_base): Likewise. (open_symbol_file_object): Likewise. (read_program_headers_from_bfd): Likewise. (svr4_relocate_main_executable): Likewise. * solib-target.c (solib_target_relocate_section_addresses): Likewise. * solib.c (solib_find_1): Likewise. (exec_file_find): Likewise. (solib_find): Likewise. * source.c (openp): Likewise. (print_source_lines_base): Likewise. (forward_search_command): Likewise. * sparc-ravenscar-thread.c (supply_register_at_address): Likewise. * spu-tdep.c (spu2ppu_prev_register): Likewise. (spu_get_overlay_table): Likewise. * stabsread.c (patch_block_stabs): Likewise. (define_symbol): Likewise. (again:): Likewise. (read_member_functions): Likewise. (read_one_struct_field): Likewise. (read_enum_type): Likewise. (common_block_start): Likewise. * stack.c (read_frame_arg): Likewise. (backtrace_command): Likewise. * stap-probe.c (stap_parse_register_operand): Likewise. * symfile.c (syms_from_objfile_1): Likewise. (find_separate_debug_file): Likewise. (load_command): Likewise. (load_progress): Likewise. (load_section_callback): Likewise. (reread_symbols): Likewise. (add_filename_language): Likewise. (allocate_compunit_symtab): Likewise. (read_target_long_array): Likewise. (simple_read_overlay_table): Likewise. * symtab.c (symbol_set_names): Likewise. (resize_symbol_cache): Likewise. (rbreak_command): Likewise. (completion_list_add_name): Likewise. (completion_list_objc_symbol): Likewise. (add_filename_to_list): Likewise. * target-descriptions.c (maint_print_c_tdesc_cmd): Likewise. * target-memory.c (target_write_memory_blocks): Likewise. * target.c (target_read_string): Likewise. (read_whatever_is_readable): Likewise. (target_read_alloc_1): Likewise. (simple_search_memory): Likewise. (target_fileio_read_alloc_1): Likewise. * tilegx-tdep.c (tilegx_push_dummy_call): Likewise. * top.c (command_line_input): Likewise. * tracefile-tfile.c (tfile_fetch_registers): Likewise. * tracefile.c (tracefile_fetch_registers): Likewise. * tracepoint.c (add_memrange): Likewise. (init_collection_list): Likewise. (add_aexpr): Likewise. (trace_dump_actions): Likewise. (parse_trace_status): Likewise. (parse_tracepoint_definition): Likewise. (parse_tsv_definition): Likewise. (parse_static_tracepoint_marker_definition): Likewise. * tui/tui-file.c (tui_sfileopen): Likewise. (tui_file_adjust_strbuf): Likewise. * tui/tui-io.c (tui_expand_tabs): Likewise. * tui/tui-source.c (tui_set_source_content): Likewise. * typeprint.c (find_global_typedef): Likewise. * ui-file.c (do_ui_file_xstrdup): Likewise. (ui_file_obsavestring): Likewise. (mem_file_write): Likewise. * utils.c (make_hex_string): Likewise. (get_regcomp_error): Likewise. (puts_filtered_tabular): Likewise. (gdb_realpath_keepfile): Likewise. (ldirname): Likewise. (gdb_bfd_errmsg): Likewise. (substitute_path_component): Likewise. * valops.c (search_struct_method): Likewise. (find_oload_champ_namespace_loop): Likewise. * valprint.c (print_decimal_chars): Likewise. (read_string): Likewise. (generic_emit_char): Likewise. * varobj.c (varobj_delete): Likewise. (varobj_value_get_print_value): Likewise. * vaxobsd-tdep.c (vaxobsd_sigtramp_sniffer): Likewise. * windows-tdep.c (display_one_tib): Likewise. * xcoffread.c (read_xcoff_symtab): Likewise. (process_xcoff_symbol): Likewise. (swap_sym): Likewise. (scan_xcoff_symtab): Likewise. (xcoff_initial_scan): Likewise. * xml-support.c (gdb_xml_end_element): Likewise. (xml_process_xincludes): Likewise. (xml_fetch_content_from_file): Likewise. * xml-syscall.c (xml_list_of_syscalls): Likewise. * xstormy16-tdep.c (xstormy16_push_dummy_call): Likewise. gdb/gdbserver/ChangeLog: * ax.c (gdb_parse_agent_expr): Add cast to allocation result assignment. (gdb_unparse_agent_expr): Likewise. * hostio.c (require_data): Likewise. (handle_pread): Likewise. * linux-low.c (disable_regset): Likewise. (fetch_register): Likewise. (store_register): Likewise. (get_dynamic): Likewise. (linux_qxfer_libraries_svr4): Likewise. * mem-break.c (delete_fast_tracepoint_jump): Likewise. (set_fast_tracepoint_jump): Likewise. (uninsert_fast_tracepoint_jumps_at): Likewise. (reinsert_fast_tracepoint_jumps_at): Likewise. (validate_inserted_breakpoint): Likewise. (clone_agent_expr): Likewise. * regcache.c (init_register_cache): Likewise. * remote-utils.c (putpkt_binary_1): Likewise. (decode_M_packet): Likewise. (decode_X_packet): Likewise. (look_up_one_symbol): Likewise. (relocate_instruction): Likewise. (monitor_output): Likewise. * server.c (handle_search_memory): Likewise. (handle_qxfer_exec_file): Likewise. (handle_qxfer_libraries): Likewise. (handle_qxfer): Likewise. (handle_query): Likewise. (handle_v_cont): Likewise. (handle_v_run): Likewise. (captured_main): Likewise. * target.c (write_inferior_memory): Likewise. * thread-db.c (try_thread_db_load_from_dir): Likewise. * tracepoint.c (init_trace_buffer): Likewise. (add_tracepoint_action): Likewise. (add_traceframe): Likewise. (add_traceframe_block): Likewise. (cmd_qtdpsrc): Likewise. (cmd_qtdv): Likewise. (cmd_qtstatus): Likewise. (response_source): Likewise. (response_tsv): Likewise. (cmd_qtnotes): Likewise. (gdb_collect): Likewise. (initialize_tracepoint): Likewise.
2015-08-07PPC64: Fix gdb.arch/ppc64-atomic-inst.exp with displaced steppingPedro Alves
The ppc64 displaced step code can't handle atomic sequences. Fallback to stepping over the breakpoint in-line if we detect one. gdb/ChangeLog: 2015-08-07 Pedro Alves <palves@redhat.com> * infrun.c (displaced_step_prepare_throw): Return -1 if gdbarch_displaced_step_copy_insn returns NULL. Update intro comment. * rs6000-tdep.c (LWARX_MASK, LWARX_INSTRUCTION, LDARX_INSTRUCTION) (STWCX_MASK, STWCX_INSTRUCTION, STDCX_INSTRUCTION): Move higher up in file. (ppc_displaced_step_copy_insn): New function. (ppc_displaced_step_fixup): Update comment. (rs6000_gdbarch_init): Install ppc_displaced_step_copy_insn as gdbarch_displaced_step_copy_insn hook. * gdbarch.sh (displaced_step_copy_insn): Document what happens on NULL return. * gdbarch.h: Regenerate. gdb/testsuite/ChangeLog: 2015-08-07 Pedro Alves <palves@redhat.com> * gdb.arch/ppc64-atomic-inst.exp (do_test): New procedure, move tests here. (top level): Run do_test with and without displaced stepping.
2015-08-06Add casts for legitimate integer to enum conversionsSimon Marchi
This patch is mostly extracted from Pedro's C++ branch. It adds explicit casts from integer to enum types, where it is really the intention to do so. This could be because we are ... * iterating on enum values (we need to iterate on an equivalent integer) * converting from a value read from bytes (dwarf attribute, agent expression opcode) to the equivalent enum * reading the equivalent integer value from another language (Python/Guile) An exception to that is the casts in regcache.c. It seems to me like struct regcache's register_status field could be a pointer to an array of enum register_status. Doing so would waste a bit of memory (4 bytes used by the enum vs 1 byte used by the current signed char, for each register). If we switch to C++11 one day, we can define the underlying type of an enum type, so we could have the best of both worlds. gdb/ChangeLog: * arm-tdep.c (set_fp_model_sfunc): Add cast from integer to enum. (arm_set_abi): Likewise. * ax-general.c (ax_print): Likewise. * c-exp.y (exp : string_exp): Likewise. * compile/compile-loc2c.c (compute_stack_depth_worker): Likewise. (do_compile_dwarf_expr_to_c): Likewise. * cp-name-parser.y (demangler_special : DEMANGLER_SPECIAL start): Likewise. * dwarf2expr.c (execute_stack_op): Likewise. * dwarf2loc.c (dwarf2_compile_expr_to_ax): Likewise. (disassemble_dwarf_expression): Likewise. * dwarf2read.c (dwarf2_add_member_fn): Likewise. (read_array_order): Likewise. (abbrev_table_read_table): Likewise. (read_attribute_value): Likewise. (skip_unknown_opcode): Likewise. (dwarf_decode_macro_bytes): Likewise. (dwarf_decode_macros): Likewise. * eval.c (value_f90_subarray): Likewise. * guile/scm-param.c (gdbscm_make_parameter): Likewise. * i386-linux-tdep.c (i386_canonicalize_syscall): Likewise. * infrun.c (handle_command): Likewise. * memory-map.c (memory_map_start_memory): Likewise. * osabi.c (set_osabi): Likewise. * parse.c (operator_length_standard): Likewise. * ppc-linux-tdep.c (ppc_canonicalize_syscall): Likewise, and use single return point. * python/py-frame.c (gdbpy_frame_stop_reason_string): Likewise. * python/py-symbol.c (gdbpy_lookup_symbol): Likewise. (gdbpy_lookup_global_symbol): Likewise. * record-full.c (record_full_restore): Likewise. * regcache.c (regcache_register_status): Likewise. (regcache_raw_read): Likewise. (regcache_cooked_read): Likewise. * rs6000-tdep.c (powerpc_set_vector_abi): Likewise. * symtab.c (initialize_ordinary_address_classes): Likewise. * target-debug.h (target_debug_print_signals): Likewise. * utils.c (do_restore_current_language): Likewise.
2015-05-26Rename in_function_epilogue_p to stack_frame_destroyed_pMartin Galvan
We concluded that gdbarch_in_function_epilogue_p is misnamed, since it returns true if the given PC is one instruction after the one that destroyed the stack (which isn't necessarily inside an epilogue), therefore it should be renamed to stack_frame_destroyed_p. I also took the liberty of renaming the arch-specific implementations to *_stack_frame_destroyed_p as well for consistency. gdb: 2015-05-26 Martin Galvan <martin.galvan@tallertechnologies.com> * amd64-tdep.c: Replace in_function_epilogue_p with stack_frame_destroyed_p throughout. * arch-utils.c: Ditto. * arch-utils.h: Ditto. * arm-tdep.c: Ditto. * breakpoint.c: Ditto. * gdbarch.sh: Ditto. * hppa-tdep.c: Ditto. * i386-tdep.c: Ditto. * mips-tdep.c: Ditto. * nios2-tdep.c: Ditto. * rs6000-tdep.c: Ditto. * s390-linux-tdep.c: Ditto. * score-tdep.c: Ditto. * sh-tdep.c: Ditto. * sparc-tdep.c: Ditto. * sparc-tdep.h: Ditto. * sparc64-tdep.c: Ditto. * spu-tdep.c: Ditto. * tic6x-tdep.c: Ditto. * tilegx-tdep.c: Ditto. * xstormy16-tdep.c: Ditto. * gdbarch.c, gdbarch.h: Re-generated.