Commit Graph

39580 Commits

Author SHA1 Message Date
Tom Tromey dc9fe180a4 Remove make_cleanup_ui_out_table_begin_end
This changes the few remaining uses of
make_cleanup_ui_out_table_begin_end to use ui_out_emit_table instead,
and then removes the cleanup.

ChangeLog
2017-09-09  Tom Tromey  <tom@tromey.com>

	* ui-out.h (make_cleanup_ui_out_table_begin_end): Remove.
	(class ui_out_emit_table): Update comment.
	* ui-out.c (do_cleanup_table_end)
	(make_cleanup_ui_out_table_begin_end): Remove.
	* spu-tdep.c (info_spu_mailbox_list): Use ui_out_emit_table.
	(info_spu_dma_cmdlist): Likewise.
	* probe.c (info_probes_for_ops): Use ui_out_emit_table.
	* darwin-nat-info.c (darwin_debug_regions_recurse): Use
	ui_out_emit_table.
2017-09-09 13:46:04 -06:00
Tom Tromey f8cc3da6e4 Use ui_out_emit_table and ui_out_emit_list in print_thread_info_1
This changes print_thread_info_1 to use ui_out_emit_table and
ui_out_emit_list.  Which one is used depends on whether the ui-out is
mi-like; so the emitters are wrapped in gdb::optional.

ChangeLog
2017-09-09  Tom Tromey  <tom@tromey.com>

	* thread.c (print_thread_info_1): Use ui_out_emit_table,
	ui_out_emit_list, gdb::optional.
2017-09-09 13:46:04 -06:00
John Baldwin 481695ed5f Remove unnecessary function prototypes.
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-09-09 11:02:37 -07:00
Keith Seitz a611b5cb00 Remove unused field field_info.fnfields
Since at least 7.3 the "fnfields" field in struct field_info has been
unused.  This patch simply removes it.

gdb/ChangeLog:

	* dwarf2read.c (struct field_info) <fnfields>: Remove unused
	field.
2017-09-08 16:47:13 -07:00
Christoph Weinmann 469412dd9c Remove C/C++ relevant code in Fortran specific file.
Remove code relevant for printing C/C++ Integer values in a
Fortran specific file to unify printing of Fortran values.
This does not change the output.
2017-09-08 15:11:47 +02:00
Bernhard Heckel e0f86435f8 fortran: Testsuite, fix typos in vla-value. 2017-09-08 15:11:47 +02:00
Bernhard Heckel 9e9af4be9f Fortran: Testsuite, fix differences in type naming. 2017-09-08 15:11:47 +02:00
Frank Penczek a5ad232b3e Fix indentation for printing Fortran types with pointers
Printing the prefix "PTR TO -> (" resp. "REF TO ->(" ignored the active
indentation level.  This caused inconsistent appearance of user-defined
Fortran types containing pointers.  Fix by using "fprintfi_filtered" with the
current indentation level for outputting the prefix string.  Add test case
ptr-indentation.

Example using 'ptype' on object of type:
  type TypeWithPointer
    integer i
    integer, pointer:: p
  end type TypeWithPointer

Before:
  type = Type typewithpointer
      integer(kind=4) :: i
  PTR TO -> ( integer(kind=4) :: p)
  End Type typewithpointer

After:
  type = Type typewithpointer
      integer(kind=4) :: i
      PTR TO -> ( integer(kind=4) :: p)
  End Type typewithpointer
2017-09-08 15:11:47 +02:00
Joel Brobecker e50142270b Document the GDB 8.0.1 release in gdb/ChangeLog
gdb/ChangeLog:

	GDB 8.0.1 released.
2017-09-07 07:53:34 -07:00
Joel Brobecker 63c99141de remove QStartupWithShell entry from NEWS::Changes in GDB 7.11
This entry was added twice within the same commit, back in Dec 2017
by the following change:

    commit aefd8b33d9
    Date:   Thu Dec 22 22:14:02 2016 -0500
    Subject: Implement proper "startup-with-shell" support on gdbserver

I think the second entry is just a rebase/merge oversight, and it wasn't
meant to be added there, particularly since the 7.11 branch was no longer
active at that time anymore.

This patch just removes the entry.

gdb/ChangeLog:

	* NEWS (Changes in GDB 7.11): Remove entry for QStartupWithShell.
2017-09-07 07:24:33 -07:00
Tom Tromey 69c1e056df Change funcall_chain to be a std::vector
This simplifies the handling of funcall_chain, by changing it to be a
std::vector<int> and then fixing the users.  This allows the removal
of a cleanup.

It would be even cleaner to replace this with better logic in the
parsers; but a baby step seemed ok.

gdb/ChangeLog
2017-09-05  Tom Tromey  <tom@tromey.com>

	* parse.c (funcall_chain): Now a std::vector.
	(start_arglist, end_arglist): Simplify.
	(free_funcalls): Remove.
	(parse_exp_in_context_1): Remove cleanup.
2017-09-06 15:49:32 -06:00
Tom Tromey fef704bfec Remove last cleanups from go-exp.y
This removes the last remaining cleanups from go-exp.y.

2017-09-05  Tom Tromey  <tom@tromey.com>

	* go-exp.y (go_parse): Don't create a cleanup.
2017-09-06 15:49:31 -06:00
Tom Tromey 5613c5857a Remove last cleanups from d-exp.y
This removes the last remaining cleanups from d-exp.y.

2017-09-05  Tom Tromey  <tom@tromey.com>

	* d-exp.y (PrimaryExpression): Use std::string.
	(d_parse): Don't create a cleanup.
2017-09-06 15:49:31 -06:00
Tom Tromey eae49211e1 Remove make_cleanup_clear_parser_state
This removes make_cleanup_clear_parser_state in favor of
scoped_restore.

2017-09-05  Tom Tromey  <tom@tromey.com>

	* utils.c (do_clear_parser_state): Remove.
	(make_cleanup_clear_parser_state): Remove.
	* p-exp.y (pascal_parse): Use scoped_restore.
	* m2-exp.y (m2_parse): Use scoped_restore.
	* f-exp.y (f_parse): Use scoped_restore.
	* d-exp.y (d_parse): Use scoped_restore.
	* c-exp.y (c_parse): Use scoped_restore.
	* ada-exp.y (ada_parse): Use scoped_restore.
	* utils.h (make_cleanup_clear_parser_state): Remove.
2017-09-06 15:49:30 -06:00
Keith Seitz 73b9be8b53 Introduce dw2_linkage_name and dw2_linkage_name_attr.
The DWARF reader is littered with the following idiom to read a linkage name
from the debug info:

  mangled = dwarf2_string_attr (die, DW_AT_linkage_name, cu);
  if (mangled == NULL)
    mangled = dwarf2_string_attr (die, DW_AT_MIPS_linkage_name, cu);

This patch introduces functions to simplify this to:

  mangled = dw2_linkage_name (die, cu);

or

  attr = dw2_linkage_name_attr (die, cu);

gdb/ChangeLog:

	* dwarf2read.c (dw2_linkage_name_attr): New function.
	(dw2_linkage_name): New function.
	(dwarf2_compute_name, dwarf2_physname, read_call_site_scope)
	(guess_full_die_structure_name, dwarf2_name): Use dw2_linkage_name.
	(anonymous_struct_prefix, dwarf2_name): Use dw2_linkage_name_attr.
2017-09-06 12:50:52 -07:00
Tom Tromey 5aec60eb2f Cast char constant to int in sizeof.exp
PR gdb/22010 concerns a regression I introduced with the scalar
printing changes.  The bug is that this code in sizeof.exp:

    set signof_byte [get_integer_valueof "'\\377'" -1]

can incorrectly compute sizeof_byte.  One underlying problem here is
that gdb's C parser doesn't treat a char constant as an int (this is
PR 19973).

However, it seems good to have an immediate fix for the regression.
The simplest is to cast to an int here.

testsuite/ChangeLog
2017-09-05  Tom Tromey  <tom@tromey.com>

	PR gdb/22010:
	* gdb.base/sizeof.exp (check_valueof): Cast char constant to int.
2017-09-06 11:11:03 -06:00
Kamil Rytarowski a102602bc5 Correct shell compatibility issue detected with pkgsrc.
String comparison of in a POSIX bourne shell must be done
with '=', not '=='. For example the NetBSD sh(1) does not
support it.

gdb/ChangeLog
2017-09-06  Kamil Rytarowski  <n54@gmx.com>

	* config/djgpp/djconfig.sh: Correct shell portability issue.
2017-09-06 18:52:08 +02:00
Thomas Preud'homme 8f8f815255 Fix calls in gdb.arch/thumb2-it.exp
Tests in gdb.arch/thumb2-it.exp call functions defined in assembly
without type debugging information. Since
7022349d5c ("Stop assuming no-debug-info
functions return int") this triggers an error which leads to many tests
to FAIL. This patch cast the call to indicate the return type of the
functions when calling them.

2017-09-06  Thomas Preud'homme  <thomas.preudhomme@arm.com>

gdb/testsuite/
	* gdb.arch/thumb2-it.exp: Cast call to assembly defined function.
2017-09-06 17:54:26 +01:00
Kamil Rytarowski 28ad437d7a Define HAVE_NATIVE_GCORE_HOST on NetBSD
NetBSD ships with gcore(1) againg since the version 2.0.
This tool is functional and actively maintained.

gdb/ChangeLog
2017-09-06  Kamil Rytarowski  <n54@gmx.com>

	* configure.nat: Define HAVE_NATIVE_GCORE_HOST on NetBSD.
2017-09-06 18:40:29 +02:00
John Baldwin 351787dd4c Add native target for FreeBSD/aarch64.
gdb/ChangeLog:

	* Makefile.in (ALLDEPFILES): Add mips-fbsd-nat.c.
	* NEWS: Mention new FreeBSD/mips native configuration.
	* configure.host: Add aarch64*-*-freebsd*.
	* configure.nat: Likewise.
	* aarch64-fbsd-nat.c: New file.
2017-09-06 09:42:08 -07:00
John Baldwin c0f84956d0 Add FreeBSD/aarch64 architecture.
Support for collecting and supplying general purpose and floating point
register sets is provided along with signal frame unwinding.

gdb/ChangeLog:

	* Makefile.in (ALL_64_TARGET_OBS): Add aarch64-fbsd-tdep.o.
	(ALLDEPFILES): Add aarch64-fbsd-tdep.c.
	* NEWS: Mention new FreeBSD/aarch64 target.
	* configure.tgt: Add aarch64*-*-freebsd*.
	* aarch64-fbsd-tdep.c: New file.
	* aarch64-fbsd-tdep.h: New file.
2017-09-06 09:40:47 -07:00
Kamil Rytarowski 7610297ab5 Add myself as a write-after-approval GDB maintainer.
gdb/ChangeLog:
2017-09-06  Kamil Rytarowski  <n54@gmx.com>

	* MAINTAINERS (Write After Approval): Add Kamil Rytarowski.
2017-09-06 18:01:18 +02:00
Jan Kratochvil fbd1b77155 Fix accessing TLS variables with no debug info
Since 2273f0ac95 ("change minsyms not to be relocated at
read-time"), printing TLS symbols of objfiles with a non-zero base
address, without debug info, fails.

E.g., with:

 $ mv /usr/lib/debug /usr/lib/debug-x

to get debug info out of the way, we get:

 $ echo 'int main(){}' | gcc -pthread -x c -
 $ ./gdb -q -ex start -ex 'p (int) errno' ./a.out
 Cannot access memory at address 0xffffef7c0698

instead of the expected:

 $1 = 0

The regression is not visible with glibc debuginfo installed.

The problem is that we compute the address of TLS minsyms incorrectly.

To trigger the problem, it is important that the variable is in an
objfile with a non-zero base address.  While glibc is a shared library
for 'errno', it's easier for the testcase to use PIE instead of a
shlib.  For TLS variables in PT_EXEC the regression obviously does not
happen.

gdb/ChangeLog
2017-09-06  Jan Kratochvil  <jan.kratochvil@redhat.com>

	* parse.c (find_minsym_type_and_address): Don't relocate addresses
	of TLS symbols.

gdb/testsuite/ChangeLog
2017-09-06  Jan Kratochvil  <jan.kratochvil@redhat.com>

	* gdb.threads/tls-nodebug-pie.c: New file.
	* gdb.threads/tls-nodebug-pie.exp: New file.
2017-09-06 12:32:46 +01:00
Philippe Waroquiers 5ca79eae06 Fix leak of auto_obstack objfile_per_bfd_storage->storage_obstack;
commit 23732b1e32
  Author: Pedro Alves <palves@redhat.com>
  Date:   Tue Jun 27 16:22:08 2017 +0100
changed objfile_per_bfd_storage->storage_obstack
from  'struct obstack storage_obstack;'
to    'auto_obstack storage_obstack;'
So the obstack is auto allocated when the  objfile_per_bfd_storage ctor is
manually called by get_objfile_bfd_data).
However, the ctor call was still followed by a manual call to
      obstack_init (&storage->storage_obstack);

This results in a bunch of leaks detected by valgrind, such as:
==24665== 4,064 bytes in 1 blocks are definitely lost in loss record 11,469 of 11,590
==24665==    at 0x4C27BF5: malloc (vg_replace_malloc.c:299)
==24665==    by 0x5437B7: xmalloc (common-utils.c:44)
==24665==    by 0x77CAA7: _obstack_begin_worker (obstack.c:141)
==24665==    by 0x60168F: auto_obstack (gdb_obstack.h:70)
==24665==    by 0x60168F: get_objfile_bfd_data(objfile*, bfd*) (objfiles.h:188)
==24665==    by 0x601DB6: allocate_objfile(bfd*, char const*, enum_flags<objfile_flag>) (objfiles.c:423)
==24665==    by 0x647753: symbol_file_add_with_addrs(bfd*, char const*, enum_flags<symfile_add_flag>, section_addr_info*, enum_flags<objfile_flag>, objfile*) (symfile.c:1158)
==24665==    by 0x647C7B: symbol_file_add_separate(bfd*, char const*, enum_flags<symfile_add_flag>, objfile*) (symfile.c:1252)
==24665==    by 0x4C7D79: elf_symfile_read(objfile*, enum_flags<symfile_add_flag>) (elfread.c:1270)
==24665==    by 0x647CB4: read_symbols(objfile*, enum_flags<symfile_add_flag>) (symfile.c:861)
==24665==    by 0x647809: syms_from_objfile_1 (symfile.c:1062)

-> remove the manual call to obstack_init.
Reg-tested on Debian 8/amd64, tests results are the same before/after the patch.
valgrind still show some leaks, but less.

gdb/ChangeLog
2017-09-05  Philippe Waroquiers  <philippe.waroquiers@skynet.be>

	* objfiles.c (get_objfile_bfd_data): Remove useless obstack_init
	call.
2017-09-05 20:51:23 +02:00
Tom Tromey 5eb5f85062 Don't use -fdiagnostics-color=never for rustc
I noticed that the gdb.rust tests fail because the test suite passes
-fdiagnostics-color=never to rustc.  This is not a recognized rustc
option, and the test suite already handles passing the appropriate
option to the Rust compiler.

This patch fixes the problem.

testsuite/ChangeLog
2017-09-05  Tom Tromey  <tom@tromey.com>

	* lib/gdb.exp (gdb_compile): Don't use universal_compile_options
	for rust.
2017-09-05 12:08:03 -06:00
Simon Marchi ae780a21f2 Test different follow-exec-mode settings in gdb.multi/multi-arch-exec.exp
Using follow-exec-mode "new" takes a different code path than "same", so
it's interesting to test this path in combination with a change in
architecture of the inferior.  This test fails if you remove the
previous patch.

gdb/testsuite/ChangeLog:

	* gdb.multi/multi-arch-exec.exp: Test with different
	"follow-exec-mode" settings.
	(do_test): New procedure.
2017-09-05 17:42:04 +02:00
Simon Marchi bf93d7ba99 Add thread after updating gdbarch when exec'ing
As mentioned in the previous patch, we should avoid doing register reads
after a process does an exec and before we've updated that inferior's
gdbarch.  Otherwise, we may interpret the registers using the wrong
architecture.  When a process does an exec with "follow-exec-mode new",
a new inferior is added by follow_exec.  The gdbarch of that new
inferior is at first set to some default value, probably specific to the
gdb build (I get "i386" here), which may not be the right one.  It is
updated later by the call to target_find_description.  Before that
point, if we try to read the inferior's registers, we may not interpret
them correctly.  This has been exposed by a failure in
gdb.base/foll-exec-mode.exp after the previous patch, with:

  Remote 'g' packet reply is too long (expected 312 bytes, got 816 bytes)

The call to "add_thread" done just after adding the inferior is
problematic, because it ends up reading the registers (because the ptid
is re-used, we end up doing a switch_to_thread to it, which tries to
update stop_pc).  The registers returned by gdbserver are the x86-64
ones, while we try to interpret them using the "i386" gdbarch.

Postponing the call to add_thread to until the target
description/gdbarch has been updated seems to fix the issue.

As to why this issue was uncovered by the previous patch: what I think
happened before that patch is that since we were updating stop_pc before
switching to the new inferior, we were filling the regcache associated
to the ptid (this worked fine as long as the architectures of the
previous and new process images were the same).  The call to
switch_to_thread then worked, because the register read hit the
regcache.  Now, it triggers a register read, while the gdbarch is not
set correctly, leading to the "reply is too long" error.  If this is
right, it sounds wrong that we delete and re-add a thread with the same
ptid, and are able to access the registers from the deleted thread.
When we delete a thread, should we clear the regcache associated to that
ptid, so that the new thread starts with a fresh/empty regcache?

gdb/ChangeLog:

	* infrun.c (follow_exec): Call add_thread after
	target_find_description.
2017-09-05 17:41:03 +02:00
Simon Marchi 1bb7c05977 Read stop_pc after updating the gdbarch when exec'ing
When an inferior execs and changes architecture (e.g. 64 bits to 32
bits), the gdbarch associated to the inferior is updated by the
follow_exec call in handle_inferior_event_1.  We should avoid doing any
register read before that point, because the registers sent by the
remote side will be those of the new architecture, but we would
interpret them using the old architecture.  We do just that by setting
stop_pc during this window, which obviously requires reading the
registers.  This results in gdb.multi/multi-arch-exec.exp failing, GDB
outputting the following error:

  Truncated register 50 in remote 'g' packet

This patch fixes that by postponing the setting of stop_pc to after
we've updated the inferior gdbarch.

This bug was hiding another problem, and as such introduces some
failures in gdb.base/foll-exec-mode.exp.  The following patch takes care
of that.

gdb/ChangeLog:

	* infrun.c (handle_inferior_event_1): When exec'ing, read
	stop_pc after follow_exec.
2017-09-05 17:41:03 +02:00
Simon Marchi fc80982757 Improve "'g' reply is is to long" error message
... by adding the expected size, and the received size.  I found this
useful when debugging gdbarch/remote issues, since it gives a hint of
what gdb expects and what the remote sent.

gdb/ChangeLog:

	* remote.c (process_g_packet): Update error message.
2017-09-05 17:41:03 +02:00
Yao Qi d2fcdd8546 Add i386.o to gdb_target_obs for x86_64-* targets
This patch fixes the build failure caused by 22916b0
(Convert the rest x86 target descriptions).

gdb:

2017-09-05  Yao Qi  <yao.qi@linaro.org>

	* configure.tgt (gdb_target_obs): Add i386.o for x86_64-*
	targets.
2017-09-05 14:46:47 +01:00
Pedro Alves e69570ee18 eval.c:evaluate_subexp_standard: Factor out function call handling
While working on the no-debug-info debugging improvements, I found
evaluate_subexp_standard's function call code unnecessarily long and
hard to navigate and debug.  The use of goto doesn't help either.

This commit tries to improve things by factoring out the
function-call-related code to separate helper functions.

gdb/ChangeLog:
2017-09-05  Pedro Alves  <palves@redhat.com>

	* eval.c (eval_call, evaluate_funcall): New functions, factored
	out from ...
	(evaluate_subexp_standard): ... this.
2017-09-05 12:13:57 +01:00
Yao Qi 22916b0786 Convert the rest x86 target descriptions
This patch changes the rest of x86 target descriptions in GDB and
GDBserver.

gdb:

2017-09-05  Yao Qi  <yao.qi@linaro.org>

	* amd64-tdep.c (amd64_target_description): Create target
	descriptions.
	(_initialize_amd64_tdep): Don't call functions
	initialize_tdesc_amd64_*.  Add self tests.
	* arch/amd64.c (amd64_create_target_description): Add parameter
	is_linux.  Call set_tdesc_osabi if is_linux is true.
	* arch/amd64.h (amd64_create_target_description): Update the
	declaration.
	* arch/i386.c (i386_create_target_description): Add parameter
	is_linux.  Call set_tdesc_osabi if is_linux is true.
	* arch/i386.h (i386_create_target_description): Update
	declaration.
	* configure.tgt: Add i386.o to gdb_target_obs.
	* features/Makefile (XMLTOC): Remove i386/*.xml.
	* features/i386/amd64-avx-avx512.c: Remove.
	* features/i386/amd64-avx-mpx-avx512-pku.c: Remove.
	* features/i386/amd64-avx-mpx.c: Remove.
	* features/i386/amd64-avx.c: Remove.
	* features/i386/amd64-mpx.c: Remove.
	* features/i386/amd64.c: Remove.
	* features/i386/i386-avx-avx512.c: Remove.
	* features/i386/i386-avx-mpx-avx512-pku.c: Remove.
	* features/i386/i386-avx-mpx.c: Remove.
	* features/i386/i386-avx.c: Remove.
	* features/i386/i386-mmx.c: Remove.
	* features/i386/i386-mpx.c: Remove.
	* features/i386/i386.c: Remove.
	* i386-tdep.c: Don't include features/i386/i386*.c., include
	target-descriptions.h and arch/i386.h.
	(i386_target_description): Create target descriptions.
	(i386_gdbarch_init): Don't call initialize_tdesc_i386_*
	functions.  Do self tests.

gdb/gdbserver:

2017-09-05  Yao Qi  <yao.qi@linaro.org>

	* configure.srv (srv_i386_regobj): Remove.
	(srv_amd64_regobj): Remove.
	(srv_regobj): Set it to "" for x86 non-linux targets.
	* linux-x86-tdesc.c (i386_linux_read_description):
	* lynx-i386-low.c: Include x86-xstate.h and arch/i386.h.
	(init_registers_i386): Remove the declaration.
	(tdesc_i386): Remove the declaration.
	(lynx_i386_arch_setup): Call i386_create_target_description.
	* nto-x86-low.c: Likewise.
	* win32-i386-low.c [__x86_64__]: include arch/amd64.h.
	[!__x86_64__]: include arch/i386.h.
	(i386_arch_setup) [__x86_64__]: Call amd64_create_target_description.
2017-09-05 09:54:54 +01:00
Yao Qi 0854b7b187 Remove features/i386/amd64-*linux.c and features/i386/x32-*linux.c
gdb:

2017-09-05  Yao Qi  <yao.qi@linaro.org>

	* features/Makefile (XMLTOC): Remove i386/amd64XXX-linux.xml.
	* features/i386/amd64-avx-avx512-linux.c: Removed.
	* features/i386/amd64-avx-linux.c: Removed.
	* features/i386/amd64-avx-mpx-avx512-pku-linux.c: Removed.
	* features/i386/amd64-avx-mpx-linux.c: Removed.
	* features/i386/amd64-linux.c: Removed.
	* features/i386/amd64-mpx-linux.c: Removed.
	* features/i386/x32-avx-avx512-linux.c: Removed.
	* features/i386/x32-avx-linux.c: Removed.
	* features/i386/x32-linux.c: Removed.
2017-09-05 09:54:54 +01:00
Yao Qi 38602d55e0 [GDBserver] Shorten srv_amd64_linux_xmlfiles
GDBserver now is able to generate target descriptions from features, so
don't need to remember these target description files.

Note that it should be i386/amd64-avx-avx512-linux.xml instead of
i386/amd64-avx-avx512.xml in $srv_amd64_linux_xmlfiles.  This patch
removes it anyway.

gdb/gdbserver:

2017-09-05  Yao Qi  <yao.qi@linaro.org>

	* configure.srv (srv_amd64_linux_xmlfiles): Remove
	i386/amd64-XXX-linux from it.
2017-09-05 09:54:54 +01:00
Yao Qi 44b886ff15 [GDBserver] Use pre-generated amd64-linux tdesc as test
Now, all these amd64-linux pre-generated tdesc can be used as test, so
don't need to build them if $development is false.

gdb/gdbserver:

2017-09-05  Yao Qi  <yao.qi@linaro.org>

	* configure.srv: Empty srv_amd64_linux_regobj if $development is
	false.
	(ipa_amd64_linux_regobj): Remove.
	(ipa_x32_linux_regobj): Remove.
2017-09-05 09:54:54 +01:00
Yao Qi b4570e4b30 Convert amd64-linux target descriptions
This patch changes amd64-linux target descriptions so that they can be
dynamically generated in both GDB and GDBserver.

gdb/gdbserver:

2017-09-05  Yao Qi  <yao.qi@linaro.org>

	* Makefile.in (arch-amd64.o): New rule.
	* configure.srv: Append arch-amd64.o.
	* linux-amd64-ipa.c: Include common/x86-xstate.h.
	(get_ipa_tdesc): Call amd64_linux_read_description.
	(initialize_low_tracepoint): Don't call init_registers_x32_XXX
	and init_registers_amd64_XXX.
	* linux-x86-low.c (x86_linux_read_description): Call
	amd64_linux_read_description.
	(x86_get_ipa_tdesc_idx): Call amd64_get_ipa_tdesc_idx.
	(initialize_low_arch): Don't call init_registers_x32_XXX and
	init_registers_amd64_XXX.
	* linux-x86-tdesc-selftest.c: Declare init_registers_amd64_XXX
	and tdesc_amd64_XXX.
	[__x86_64__] (amd64_tdesc_test): New function.
	(initialize_low_tdesc) [__x86_64__]: Call init_registers_x32_XXX
	and init_registers_amd64_XXX.
	* linux-x86-tdesc.c: Include arch/amd64.h.
	(xcr0_to_tdesc_idx): New function.
	(i386_linux_read_description): New function.
	(amd64_get_ipa_tdesc_idx): New function.
	* linux-x86-tdesc.h (amd64_get_ipa_tdesc_idx): Declare.
	(amd64_get_ipa_tdesc): Declare.

gdb:

2017-09-05  Yao Qi  <yao.qi@linaro.org>

	* amd64-linux-tdep.c: Include arch/amd64.h.  Don't include
	features/i386/*.c.
	(amd64_linux_read_description): Call
	amd64_create_target_description.
	* arch/amd64.c: New file.
	* arch/amd64.h: New file.
	* configure.tgt (x86_64-*-linux*): Append amd64.o.
	* Makefile.in (ALL_64_TARGET_OBS): Append amd64.o.
2017-09-05 09:54:54 +01:00
Yao Qi 6c73f67f9c Lazily and dynamically create amd64-linux target descriptions
This patch starts to use the generate c feature files to dynamically
create amd64-linux target descriptions.

gdb:

2017-09-05  Yao Qi  <yao.qi@linaro.org>

	* amd64-linux-tdep.c: Don't include amd64-XXX-linux and
	x32-XXX-linux.c.  Include 64bit-XX.c and x32-XX.c.
	(amd64_linux_read_description): Create target descriptions.
	(_initialize_amd64_linux_tdep): Don't call initialize_tdesc_XXX
	functions.  Add unit tests.
	* features/Makefile (FEATURE_XMLFILES): Append 64bit-XXX.xml and
	x32-core.xml.
	* features/i386/64bit-avx.c: Generated.
	* features/i386/64bit-avx512.c: Generated.
	* features/i386/64bit-core.c: Generated.
	* features/i386/64bit-linux.c: Generated.
	* features/i386/64bit-mpx.c: Generated.
	* features/i386/64bit-pkeys.c: Generated.
	* features/i386/64bit-segments.c: Generated.
	* features/i386/64bit-sse.c: Generated.
	* features/i386/x32-core.c: Generated.
	* target-descriptions.c (maint_print_c_tdesc_cmd): Print feature
	c files for amd64-linux and x32-linux.
2017-09-05 09:54:54 +01:00
Yao Qi 9d3d478be5 Centralize amd64-linux target descriptions
This patch adds a new function amd64_linux_read_description, which
creates amd64-linux target descriptions according to its two
arguments, xcr0 and is_x32.

gdb:

2017-09-05  Yao Qi  <yao.qi@linaro.org>

	* amd64-linux-tdep.c (amd64_linux_read_description): New
	function.
	(amd64_linux_core_read_description): Call
	amd64_linux_read_description.
	(amd64_linux_init_abi): Likewise.
	(amd64_x32_linux_init_abi): Likewise.
	* amd64-linux-tdep.h (amd64_linux_read_description): Declare.
	* x86-linux-nat.c (x86_linux_read_description): Call
	amd64_linux_read_description.
2017-09-05 09:54:53 +01:00
Yao Qi b9f1d50ffc Update comments in amd64_linux_core_read_description
gdb:

2017-09-05  Yao Qi  <yao.qi@linaro.org>

	* amd64-linux-tdep.c (amd64_linux_core_read_description): Update
	comments.
2017-09-05 09:54:53 +01:00
Yao Qi d1f28ea24a [GDBserver] Shorten srv_i386_linux_xmlfiles
GDBserver now is able to generate target descriptions from features, so
don't need to remember these target description files.

gdb/gdbserver:

2017-09-05  Yao Qi  <yao.qi@linaro.org>

	* configure.srv (srv_i386_linux_xmlfiles): Remove
	i386/i386-XXX-linux.xml from it.
2017-09-05 09:54:53 +01:00
Yao Qi 25a93583f3 [GDBserver] Use pre-generated tdesc as test
Now, these *-generate.c files are only used in GDBserver for unit test.
If $development is false (in release), these *-generate.c files won't be
used at all.

gdb/gdbserver:

2017-09-05  Yao Qi  <yao.qi@linaro.org>

	* configure.srv: Set srv_i386_linux_regobj empty if $development
	is false.
	* linux-i386-ipa.c (initialize_low_tracepoint): Don't call
	initialize_low_tdesc.
	* linux-x86-low.c (initialize_low_arch): Wrap initialize_low_tdesc
	with #if initialize_low_tdesc.
	* linux-x86-tdesc-selftest.c: New file.
	* linux-x86-tdesc.c: Move code to linux-x86-tdesc-selftest.c.
2017-09-05 09:54:53 +01:00
Yao Qi 188c9e6dcb Remove features/i386/i386-*linux.c
Now, features/i386/i386-XXX-linux.c are not used, remove them.

gdb:

2017-09-05  Yao Qi  <yao.qi@linaro.org>

	* features/Makefile (XMLTOC): Remove i386/i386-XX-linux.xml.
	* features/i386/i386-avx-avx512-linux.c: Remove.
	* features/i386/i386-avx-linux.c: Remove.
	* features/i386/i386-avx-mpx-avx512-pku-linux.c: Remove.
	* features/i386/i386-avx-mpx-linux.c: Remove.
	* features/i386/i386-linux.c: Remove.
	* features/i386/i386-mmx-linux.c: Remove.
	* features/i386/i386-mpx-linux.c: Remove.
2017-09-05 09:54:53 +01:00
Yao Qi 5f035c0716 Share i386-linux target description between GDB and GDBserver
The code on creating i386-linux target descriptions are quite similar
between GDB and GDBserver, so this patch moves them into a shared file
arch/i386.c.  I didn't name it as i386-linux.c, because I want to reuse it
to create other i386 non-linux target descriptions later.

gdb:

2017-09-05  Yao Qi  <yao.qi@linaro.org>

	* Makefile.in (ALL_TARGET_OBS): Add i386.o.
	(SFILES): Add arch/i386.c.
	(HFILES_NO_SRCDIR): Add arch/i386.h.
	* arch/i386.c: New file.
	* arch/i386.h: New file.
	* arch/tdesc.h (allocate_target_description): Declare.
	(set_tdesc_architecture): Declare.
	(set_tdesc_osabi): Declare.
	* configure.tgt (i[34567]86-*-linux*): Add i386.o.
	* i386-linux-tdep.c: Don't include ../features/i386/32bit-XXX.c.
	include arch/i386.h.
	(i386_linux_read_description): Remove code and call
	i386_create_target_description.
	(set_tdesc_architecture): New function.
	(set_tdesc_osabi): New function.
	* target-descriptions.h (allocate_target_description): Remove.

gdb/gdbserver:

2017-09-05  Yao Qi  <yao.qi@linaro.org>

	* Makefile.in (arch-i386.o): New rule.
	* configure.srv (i[34567]86-*-linux*): Add arch-i386.o.
	(x86_64-*-linux*): Likewise.
	* linux-x86-tdesc.c: Don't include ../features/i386/32bit-XXX.c,
	include arch/i386.h.
	(i386_linux_read_description): Remove code and call
	i386_create_target_description.
	* tdesc.c (allocate_target_description): New function.
	* tdesc.h (set_tdesc_architecture): Remove declaration.
	(set_tdesc_osabi): Likewise.
2017-09-05 09:54:53 +01:00
Yao Qi 0abe8a8992 Dynamically composite xml in reply to GDB
GDBserver still uses pre-generated target descriptions in order to
reply to GDB's query on target description (see xml-builtin-generated.c
in GDBserver build directory).  This patch teaches GDBserver to
create XML contents according to the target descriptions rather than
using pre-generated ones.

First, change target feature c files to pass the feature xml file
name to tdesc_create_feature, so that target description in GDBserver
can record them, and create XML contents from these features in
buffer, like

  ...
  <xi:include href="$FEATURE1_XML_NAME"/>
  <xi:include href="$FEATURE2_XML_NAME"/>
  ...

and send this buffer back to GDB.

Note that this patch reuses target_desc.xmltarget a little bit, which is
to hold the XML contents dynamically generated in tdesc_get_features_xml.
However, it is not xfree'ed in ~target_desc, because we can't tell it is
from xstrdup or a literal string.  Since we don't delete target_desc,
there is no memory leak yet.  After we change all target descriptions to
the new style, target_desc.xmltarget is from xstrdup, then, we can safely
xfree it in ~target_desc.

gdb:

2017-09-05  Yao Qi  <yao.qi@linaro.org>

	* arch/tdesc.h (tdesc_create_feature): Add an argument xml.
	* target-descriptions.c (tdesc_create_feature): Likewise, and
	adjust code.
	* features/i386/32bit-avx.c: Re-generated.
	* features/i386/32bit-avx512.c: Re-generated.
	* features/i386/32bit-core.c: Re-generated.
	* features/i386/32bit-linux.c: Re-generated.
	* features/i386/32bit-mpx.c: Re-generated.
	* features/i386/32bit-pkeys.c: Re-generated.
	* features/i386/32bit-sse.c: Re-generated.

gdb/gdbserver:

2017-09-05  Yao Qi  <yao.qi@linaro.org>

	* linux-x86-tdesc.c: Don't include <inttypes.h>.
	(i386_linux_read_description) [!IN_PROCESS_AGENT]: Call
	set_tdesc_architecture and set_tdesc_osabi.  Remove code setting
	.xmltarget.
	* server.c (get_features_xml): Call tdesc_get_features_xml.
	* tdesc.c (set_tdesc_architecture): New function.
	(set_tdesc_osabi): New function.
	(tdesc_get_features_xml): New function.
	(tdesc_create_feature): Add an argument.
	* tdesc.h (struct target_desc) <features>: New field.
	<arch, osabi>: New field.
	(~target_desc): xfree features, arch, and osabi.
	(target_desc::oerator==): Don't compare .xmltarget.
	[!IN_PROCESS_AGENT] (set_tdesc_architecture): Declare.
	(set_tdesc_osabi): Likewise.
	(tdesc_get_features_xml): Likewise.
2017-09-05 09:54:53 +01:00
Yao Qi 0a188386c0 [GDBserver] unit test to i386_tdesc
This patch adds a unit test in GDBserver to test dynamically created
target descriptions equal these pre-generated ones.

gdb/gdbserver:

2017-09-05  Yao Qi  <yao.qi@linaro.org>

	* linux-x86-tdesc.c: Include selftest.h.
	(i386_tdesc_test): New function.
	(initialize_low_tdesc): Call selftests::register_test.
	* tdesc.h: Include regdef.h.
	(target_desc): Override operator == and !=.

gdb:

2017-09-05  Yao Qi  <yao.qi@linaro.org>

	* regformats/regdef.h (struct reg): Override operator == and !=.
2017-09-05 09:54:53 +01:00
Yao Qi f49ff00066 [GDBserver] Centralize tdesc for i386-linux
tdesc_i386_XXX_linux is used in many places in linux-x86-low.c and this
patch adds a new function i386_linux_read_description to return the right
tdesc according to xcr0.  i386_linux_read_description is quite similar to
the counterpart in GDB, and the following patch will share the duplicated
code, so this patch adds arch/tdesc.h includes the declarations of various
tdesc apis which are used by the shared code.  The generated c feature
files can include arch/tdesc.h only.

gdb/gdbserver:

2017-09-05  Yao Qi  <yao.qi@linaro.org>

	* configure.srv (srv_tgtobj): Append linux-x86-tdesc.o.
	(ipa_obj): Likewise.
	* linux-i386-ipa.c: Include common/x86-xstate.h
	(get_ipa_tdesc): Call i386_linux_read_description.
	(initialize_low_tracepoint): Don't call  init_registers_XXX
	functions, call initialize_low_tdesc instead.
	* linux-x86-low.c (x86_linux_read_description): Call
	i386_linux_read_description.
	(initialize_low_arch): Don't call init_registers_i386_XXX
	functions, call initialize_low_tdesc.
	* linux-x86-tdesc.c: New file.
	* linux-x86-tdesc.h (x86_linux_tdesc): New X86_TDESC_LAST.
	(i386_get_ipa_tdesc_idx): Declare.
	(i386_get_ipa_tdesc): Declare.
	(initialize_low_tdesc): Declare.

gdb:

2017-09-05  Yao Qi  <yao.qi@linaro.org>

	* arch/tdesc.h: New file.
	* regformats/regdat.sh: Generate code using tdesc_create_reg.
	* target-descriptions.c: Update comments.
	* target-descriptions.h: Include "arch/tdesc.h".  Remove the
	declarations.
	* features/i386/32bit-avx.c: Re-generated.
	* features/i386/32bit-avx512.c: Re-generated.
	* features/i386/32bit-core.c: Re-generated.
	* features/i386/32bit-linux.c: Re-generated.
	* features/i386/32bit-mpx.c: Re-generated.
	* features/i386/32bit-pkeys.c: Re-generated.
	* features/i386/32bit-sse.c: Re-generated.
2017-09-05 09:54:53 +01:00
Yao Qi 2b68ef2f11 Return X86_TDESC_MMX in x86_get_ipa_tdesc_idx
gdb/gdbserver:

2017-09-05  Yao Qi  <yao.qi@linaro.org>

	* linux-x86-low.c (x86_get_ipa_tdesc_idx): Use X86_TDESC_MMX
	instead of 0.
2017-09-05 09:54:52 +01:00
Yao Qi f7000548a2 Use VEC for target_desc.reg_defs
Nowadays, target_desc.reg_defs is a pointer points to a pre-generated
array, which is not flexible.  This patch changes it from an array
to a VEC so that GDBserver can create target descriptions dynamically
later.  Instead of using pre-generated array, the -generated.c calls
VEC_safe_push to add each register to vector.

Since target_desc.reg_defs is used in IPA, we need to build common/vec.c
for IPA too.

gdb/gdbserver:

2017-09-05  Yao Qi  <yao.qi@linaro.org>

	* Makefile.in (IPA_OBJS): Add vec-ipa.o
	* regcache.c (get_thread_regcache): Use VEC_length.
	(init_register_cache): Likewise.
	(regcache_cpy): Likewise.
	(registers_to_string): Iterate reg_defs via VEC_iterate.
	(find_regno): Likewise.
	(find_register_by_number): Use VEC_index.
	(register_size): Call find_register_by_number.
	(register_data): Call find_register_by_number.
	(supply_regblock): Use VEC_length.
	(regcache_raw_read_unsigned): Likewise.
	* tdesc.c (init_target_desc): Iterate reg_defs via
	VEC_iterate.
	(default_description): Update initializer.
	(copy_target_description): Don't update field num_registers.
	* tdesc.h (struct target_desc) <reg_defs>: Change it to VEC.
	<num_registers>: Remove.

gdb:

2017-09-05  Yao Qi  <yao.qi@linaro.org>

	* regformats/regdat.sh: Update generated code.
2017-09-05 09:54:52 +01:00
Yao Qi c9a5e2a5b2 Adjust code generated by regformats/regdat.sh
regformats/regdat.sh generate some *-generated.c files when GDBserver
is built.  Each .c file has some static variables, which are only used
within function init_registers_XXX, like this,

static struct reg regs_i386_linux[] = {
  { "eax", 0, 32 },
  { "ecx", 32, 32 },
  ...
};

static const char *expedite_regs_i386_linux[] = { "ebp", "esp", "eip", 0 };
static const char *xmltarget_i386_linux = "i386-linux.xml";

void
init_registers_i386_linux (void)
{
  ...
}

This patch moves these static variables' definitions to function
init_registers_XXX, so the generated files look like this,

void
init_registers_i386_linux (void)
{
  static struct target_desc tdesc_i386_linux_s;
  struct target_desc *result = &tdesc_i386_linux_s;
static struct reg regs_i386_linux[] = {
  ...
};

static const char *expedite_regs_i386_linux[] = { "ebp", "esp", "eip", 0 };
static const char *xmltarget_i386_linux = "i386-linux.xml";

  ...
}

We want GDBserver create target descriptions dynamically in each
init_registers_XXXX functions, so this patch moves all the related code
into function init_registers_XXXX, so that the following patch can easily
change function init_registers_XXXX to create target description
dynamically, rather than using current pre-generated array.

gdb:

2017-09-05  Yao Qi  <yao.qi@linaro.org>

	* regformats/regdat.sh: Adjust code order.
2017-09-05 09:54:52 +01:00
Simon Marchi d6b687ac7a expprint: Fix format string warning
My compiler (gcc 5.4.0, clang 3.8) gives this warning:

/home/emaisin/src/binutils-gdb/gdb/expprint.c: In lambda function:
/home/emaisin/src/binutils-gdb/gdb/expprint.c:1055:35: error: format not a string literal and no format arguments [-Werror=format-security]
      fprintf_filtered (stream, mod);
                                   ^

Fix it by not using the passed string as the format string.

gdb/ChangeLog:

	* expprint.c (dump_subexp_body_standard): Use constant format
	string in fprintf_filtered call.
2017-09-05 09:01:13 +02:00