Commit Graph

325 Commits

Author SHA1 Message Date
Tom Tromey a1fd1ac9de Remove ALL_SO_LIBS and so_list_head
This patch started as an attempt to replace ALL_SO_LIBS with an
ordinary C++ iterator.  However, then I tripped over the so_list_head
define again, and decided to remove it as well.

gdb/ChangeLog
2020-05-08  Tom Tromey  <tom@tromey.com>

	* mi/mi-cmd-file.c (mi_cmd_file_list_shared_libraries): Update.
	* solib-svr4.c (svr4_fetch_objfile_link_map): Update.
	(enable_break): Update.
	* solib-frv.c (frv_fdpic_find_global_pointer): Update.
	(frv_fdpic_find_canonical_descriptor): Update.
	(frv_fetch_objfile_link_map): Update.
	* progspace.c (program_space::free_all_objfiles): Update.
	(program_space::solibs): New method.
	* progspace.h (struct program_space) <solibs>: New method.
	* solist.h (master_so_list): Don't declare.
	(ALL_SO_LIBS): Remove.
	* solib.h (so_list_head): Remove.
	(update_solib_list): Update comment.
	* solib.c (master_so_list): Remove.
	(solib_used, update_solib_list, solib_add)
	(info_sharedlibrary_command, clear_solib)
	(reload_shared_libraries_1, remove_user_added_objfile): Update.
2020-05-08 14:21:22 -06:00
Simon Marchi 6c2659886f gdb: add back declarations for _initialize functions
I'd like to enable the -Wmissing-declarations warning.  However, it
warns for every _initialize function, for example:

      CXX    dcache.o
    /home/smarchi/src/binutils-gdb/gdb/dcache.c: In function ‘void _initialize_dcache()’:
    /home/smarchi/src/binutils-gdb/gdb/dcache.c:688:1: error: no previous declaration for ‘void _initialize_dcache()’ [-Werror=missing-declarations]
     _initialize_dcache (void)
     ^~~~~~~~~~~~~~~~~~

The only practical way forward I found is to add back the declarations,
which were removed by this commit:

    commit 481695ed5f
    Author: John Baldwin <jhb@FreeBSD.org>
    Date:   Sat Sep 9 11:02:37 2017 -0700

        Remove unnecessary function prototypes.

I don't think it's a big problem to have the declarations for these
functions, but if anybody has a better solution for this, I'll be happy
to use it.

gdb/ChangeLog:

	* aarch64-fbsd-nat.c (_initialize_aarch64_fbsd_nat): Add declaration.
	* aarch64-fbsd-tdep.c (_initialize_aarch64_fbsd_tdep): Add declaration.
	* aarch64-linux-nat.c (_initialize_aarch64_linux_nat): Add declaration.
	* aarch64-linux-tdep.c (_initialize_aarch64_linux_tdep): Add declaration.
	* aarch64-newlib-tdep.c (_initialize_aarch64_newlib_tdep): Add declaration.
	* aarch64-tdep.c (_initialize_aarch64_tdep): Add declaration.
	* ada-exp.y (_initialize_ada_exp): Add declaration.
	* ada-lang.c (_initialize_ada_language): Add declaration.
	* ada-tasks.c (_initialize_tasks): Add declaration.
	* agent.c (_initialize_agent): Add declaration.
	* aix-thread.c (_initialize_aix_thread): Add declaration.
	* alpha-bsd-nat.c (_initialize_alphabsd_nat): Add declaration.
	* alpha-linux-nat.c (_initialize_alpha_linux_nat): Add declaration.
	* alpha-linux-tdep.c (_initialize_alpha_linux_tdep): Add declaration.
	* alpha-nbsd-tdep.c (_initialize_alphanbsd_tdep): Add declaration.
	* alpha-obsd-tdep.c (_initialize_alphaobsd_tdep): Add declaration.
	* alpha-tdep.c (_initialize_alpha_tdep): Add declaration.
	* amd64-darwin-tdep.c (_initialize_amd64_darwin_tdep): Add declaration.
	* amd64-dicos-tdep.c (_initialize_amd64_dicos_tdep): Add declaration.
	* amd64-fbsd-nat.c (_initialize_amd64fbsd_nat): Add declaration.
	* amd64-fbsd-tdep.c (_initialize_amd64fbsd_tdep): Add declaration.
	* amd64-linux-nat.c (_initialize_amd64_linux_nat): Add declaration.
	* amd64-linux-tdep.c (_initialize_amd64_linux_tdep): Add declaration.
	* amd64-nbsd-nat.c (_initialize_amd64nbsd_nat): Add declaration.
	* amd64-nbsd-tdep.c (_initialize_amd64nbsd_tdep): Add declaration.
	* amd64-obsd-nat.c (_initialize_amd64obsd_nat): Add declaration.
	* amd64-obsd-tdep.c (_initialize_amd64obsd_tdep): Add declaration.
	* amd64-sol2-tdep.c (_initialize_amd64_sol2_tdep): Add declaration.
	* amd64-tdep.c (_initialize_amd64_tdep): Add declaration.
	* amd64-windows-nat.c (_initialize_amd64_windows_nat): Add declaration.
	* amd64-windows-tdep.c (_initialize_amd64_windows_tdep): Add declaration.
	* annotate.c (_initialize_annotate): Add declaration.
	* arc-newlib-tdep.c (_initialize_arc_newlib_tdep): Add declaration.
	* arc-tdep.c (_initialize_arc_tdep): Add declaration.
	* arch-utils.c (_initialize_gdbarch_utils): Add declaration.
	* arm-fbsd-nat.c (_initialize_arm_fbsd_nat): Add declaration.
	* arm-fbsd-tdep.c (_initialize_arm_fbsd_tdep): Add declaration.
	* arm-linux-nat.c (_initialize_arm_linux_nat): Add declaration.
	* arm-linux-tdep.c (_initialize_arm_linux_tdep): Add declaration.
	* arm-nbsd-nat.c (_initialize_arm_netbsd_nat): Add declaration.
	* arm-nbsd-tdep.c (_initialize_arm_netbsd_tdep): Add declaration.
	* arm-obsd-tdep.c (_initialize_armobsd_tdep): Add declaration.
	* arm-pikeos-tdep.c (_initialize_arm_pikeos_tdep): Add declaration.
	* arm-symbian-tdep.c (_initialize_arm_symbian_tdep): Add declaration.
	* arm-tdep.c (_initialize_arm_tdep): Add declaration.
	* arm-wince-tdep.c (_initialize_arm_wince_tdep): Add declaration.
	* auto-load.c (_initialize_auto_load): Add declaration.
	* auxv.c (_initialize_auxv): Add declaration.
	* avr-tdep.c (_initialize_avr_tdep): Add declaration.
	* ax-gdb.c (_initialize_ax_gdb): Add declaration.
	* bfin-linux-tdep.c (_initialize_bfin_linux_tdep): Add declaration.
	* bfin-tdep.c (_initialize_bfin_tdep): Add declaration.
	* break-catch-sig.c (_initialize_break_catch_sig): Add declaration.
	* break-catch-syscall.c (_initialize_break_catch_syscall): Add declaration.
	* break-catch-throw.c (_initialize_break_catch_throw): Add declaration.
	* breakpoint.c (_initialize_breakpoint): Add declaration.
	* bsd-uthread.c (_initialize_bsd_uthread): Add declaration.
	* btrace.c (_initialize_btrace): Add declaration.
	* charset.c (_initialize_charset): Add declaration.
	* cli/cli-cmds.c (_initialize_cli_cmds): Add declaration.
	* cli/cli-dump.c (_initialize_cli_dump): Add declaration.
	* cli/cli-interp.c (_initialize_cli_interp): Add declaration.
	* cli/cli-logging.c (_initialize_cli_logging): Add declaration.
	* cli/cli-script.c (_initialize_cli_script): Add declaration.
	* cli/cli-style.c (_initialize_cli_style): Add declaration.
	* coff-pe-read.c (_initialize_coff_pe_read): Add declaration.
	* coffread.c (_initialize_coffread): Add declaration.
	* compile/compile-cplus-types.c (_initialize_compile_cplus_types): Add declaration.
	* compile/compile.c (_initialize_compile): Add declaration.
	* complaints.c (_initialize_complaints): Add declaration.
	* completer.c (_initialize_completer): Add declaration.
	* copying.c (_initialize_copying): Add declaration.
	* corefile.c (_initialize_core): Add declaration.
	* corelow.c (_initialize_corelow): Add declaration.
	* cp-abi.c (_initialize_cp_abi): Add declaration.
	* cp-namespace.c (_initialize_cp_namespace): Add declaration.
	* cp-support.c (_initialize_cp_support): Add declaration.
	* cp-valprint.c (_initialize_cp_valprint): Add declaration.
	* cris-linux-tdep.c (_initialize_cris_linux_tdep): Add declaration.
	* cris-tdep.c (_initialize_cris_tdep): Add declaration.
	* csky-linux-tdep.c (_initialize_csky_linux_tdep): Add declaration.
	* csky-tdep.c (_initialize_csky_tdep): Add declaration.
	* ctfread.c (_initialize_ctfread): Add declaration.
	* d-lang.c (_initialize_d_language): Add declaration.
	* darwin-nat-info.c (_initialize_darwin_info_commands): Add declaration.
	* darwin-nat.c (_initialize_darwin_nat): Add declaration.
	* dbxread.c (_initialize_dbxread): Add declaration.
	* dcache.c (_initialize_dcache): Add declaration.
	* disasm-selftests.c (_initialize_disasm_selftests): Add declaration.
	* disasm.c (_initialize_disasm): Add declaration.
	* dtrace-probe.c (_initialize_dtrace_probe): Add declaration.
	* dummy-frame.c (_initialize_dummy_frame): Add declaration.
	* dwarf-index-cache.c (_initialize_index_cache): Add declaration.
	* dwarf-index-write.c (_initialize_dwarf_index_write): Add declaration.
	* dwarf2-frame-tailcall.c (_initialize_tailcall_frame): Add declaration.
	* dwarf2-frame.c (_initialize_dwarf2_frame): Add declaration.
	* dwarf2expr.c (_initialize_dwarf2expr): Add declaration.
	* dwarf2loc.c (_initialize_dwarf2loc): Add declaration.
	* dwarf2read.c (_initialize_dwarf2_read): Add declaration.
	* elfread.c (_initialize_elfread): Add declaration.
	* exec.c (_initialize_exec): Add declaration.
	* extension.c (_initialize_extension): Add declaration.
	* f-lang.c (_initialize_f_language): Add declaration.
	* f-valprint.c (_initialize_f_valprint): Add declaration.
	* fbsd-nat.c (_initialize_fbsd_nat): Add declaration.
	* fbsd-tdep.c (_initialize_fbsd_tdep): Add declaration.
	* filesystem.c (_initialize_filesystem): Add declaration.
	* findcmd.c (_initialize_mem_search): Add declaration.
	* findvar.c (_initialize_findvar): Add declaration.
	* fork-child.c (_initialize_fork_child): Add declaration.
	* frame-base.c (_initialize_frame_base): Add declaration.
	* frame-unwind.c (_initialize_frame_unwind): Add declaration.
	* frame.c (_initialize_frame): Add declaration.
	* frv-linux-tdep.c (_initialize_frv_linux_tdep): Add declaration.
	* frv-tdep.c (_initialize_frv_tdep): Add declaration.
	* ft32-tdep.c (_initialize_ft32_tdep): Add declaration.
	* gcore.c (_initialize_gcore): Add declaration.
	* gdb-demangle.c (_initialize_gdb_demangle): Add declaration.
	* gdb_bfd.c (_initialize_gdb_bfd): Add declaration.
	* gdbarch-selftests.c (_initialize_gdbarch_selftests): Add declaration.
	* gdbarch.c (_initialize_gdbarch): Add declaration.
	* gdbtypes.c (_initialize_gdbtypes): Add declaration.
	* gnu-nat.c (_initialize_gnu_nat): Add declaration.
	* gnu-v2-abi.c (_initialize_gnu_v2_abi): Add declaration.
	* gnu-v3-abi.c (_initialize_gnu_v3_abi): Add declaration.
	* go-lang.c (_initialize_go_language): Add declaration.
	* go32-nat.c (_initialize_go32_nat): Add declaration.
	* guile/guile.c (_initialize_guile): Add declaration.
	* h8300-tdep.c (_initialize_h8300_tdep): Add declaration.
	* hppa-linux-nat.c (_initialize_hppa_linux_nat): Add declaration.
	* hppa-linux-tdep.c (_initialize_hppa_linux_tdep): Add declaration.
	* hppa-nbsd-nat.c (_initialize_hppanbsd_nat): Add declaration.
	* hppa-nbsd-tdep.c (_initialize_hppanbsd_tdep): Add declaration.
	* hppa-obsd-nat.c (_initialize_hppaobsd_nat): Add declaration.
	* hppa-obsd-tdep.c (_initialize_hppabsd_tdep): Add declaration.
	* hppa-tdep.c (_initialize_hppa_tdep): Add declaration.
	* i386-bsd-nat.c (_initialize_i386bsd_nat): Add declaration.
	* i386-cygwin-tdep.c (_initialize_i386_cygwin_tdep): Add declaration.
	* i386-darwin-nat.c (_initialize_i386_darwin_nat): Add declaration.
	* i386-darwin-tdep.c (_initialize_i386_darwin_tdep): Add declaration.
	* i386-dicos-tdep.c (_initialize_i386_dicos_tdep): Add declaration.
	* i386-fbsd-nat.c (_initialize_i386fbsd_nat): Add declaration.
	* i386-fbsd-tdep.c (_initialize_i386fbsd_tdep): Add declaration.
	* i386-gnu-nat.c (_initialize_i386gnu_nat): Add declaration.
	* i386-gnu-tdep.c (_initialize_i386gnu_tdep): Add declaration.
	* i386-go32-tdep.c (_initialize_i386_go32_tdep): Add declaration.
	* i386-linux-nat.c (_initialize_i386_linux_nat): Add declaration.
	* i386-linux-tdep.c (_initialize_i386_linux_tdep): Add declaration.
	* i386-nbsd-nat.c (_initialize_i386nbsd_nat): Add declaration.
	* i386-nbsd-tdep.c (_initialize_i386nbsd_tdep): Add declaration.
	* i386-nto-tdep.c (_initialize_i386nto_tdep): Add declaration.
	* i386-obsd-nat.c (_initialize_i386obsd_nat): Add declaration.
	* i386-obsd-tdep.c (_initialize_i386obsd_tdep): Add declaration.
	* i386-sol2-nat.c (_initialize_amd64_sol2_nat): Add declaration.
	* i386-sol2-tdep.c (_initialize_i386_sol2_tdep): Add declaration.
	* i386-tdep.c (_initialize_i386_tdep): Add declaration.
	* i386-windows-nat.c (_initialize_i386_windows_nat): Add declaration.
	* ia64-libunwind-tdep.c (_initialize_libunwind_frame): Add declaration.
	* ia64-linux-nat.c (_initialize_ia64_linux_nat): Add declaration.
	* ia64-linux-tdep.c (_initialize_ia64_linux_tdep): Add declaration.
	* ia64-tdep.c (_initialize_ia64_tdep): Add declaration.
	* ia64-vms-tdep.c (_initialize_ia64_vms_tdep): Add declaration.
	* infcall.c (_initialize_infcall): Add declaration.
	* infcmd.c (_initialize_infcmd): Add declaration.
	* inflow.c (_initialize_inflow): Add declaration.
	* infrun.c (_initialize_infrun): Add declaration.
	* interps.c (_initialize_interpreter): Add declaration.
	* iq2000-tdep.c (_initialize_iq2000_tdep): Add declaration.
	* jit.c (_initialize_jit): Add declaration.
	* language.c (_initialize_language): Add declaration.
	* linux-fork.c (_initialize_linux_fork): Add declaration.
	* linux-nat.c (_initialize_linux_nat): Add declaration.
	* linux-tdep.c (_initialize_linux_tdep): Add declaration.
	* linux-thread-db.c (_initialize_thread_db): Add declaration.
	* lm32-tdep.c (_initialize_lm32_tdep): Add declaration.
	* m2-lang.c (_initialize_m2_language): Add declaration.
	* m32c-tdep.c (_initialize_m32c_tdep): Add declaration.
	* m32r-linux-nat.c (_initialize_m32r_linux_nat): Add declaration.
	* m32r-linux-tdep.c (_initialize_m32r_linux_tdep): Add declaration.
	* m32r-tdep.c (_initialize_m32r_tdep): Add declaration.
	* m68hc11-tdep.c (_initialize_m68hc11_tdep): Add declaration.
	* m68k-bsd-nat.c (_initialize_m68kbsd_nat): Add declaration.
	* m68k-bsd-tdep.c (_initialize_m68kbsd_tdep): Add declaration.
	* m68k-linux-nat.c (_initialize_m68k_linux_nat): Add declaration.
	* m68k-linux-tdep.c (_initialize_m68k_linux_tdep): Add declaration.
	* m68k-tdep.c (_initialize_m68k_tdep): Add declaration.
	* machoread.c (_initialize_machoread): Add declaration.
	* macrocmd.c (_initialize_macrocmd): Add declaration.
	* macroscope.c (_initialize_macroscope): Add declaration.
	* maint-test-options.c (_initialize_maint_test_options): Add declaration.
	* maint-test-settings.c (_initialize_maint_test_settings): Add declaration.
	* maint.c (_initialize_maint_cmds): Add declaration.
	* mdebugread.c (_initialize_mdebugread): Add declaration.
	* memattr.c (_initialize_mem): Add declaration.
	* mep-tdep.c (_initialize_mep_tdep): Add declaration.
	* mi/mi-cmd-env.c (_initialize_mi_cmd_env): Add declaration.
	* mi/mi-cmds.c (_initialize_mi_cmds): Add declaration.
	* mi/mi-interp.c (_initialize_mi_interp): Add declaration.
	* mi/mi-main.c (_initialize_mi_main): Add declaration.
	* microblaze-linux-tdep.c (_initialize_microblaze_linux_tdep): Add declaration.
	* microblaze-tdep.c (_initialize_microblaze_tdep): Add declaration.
	* mips-fbsd-nat.c (_initialize_mips_fbsd_nat): Add declaration.
	* mips-fbsd-tdep.c (_initialize_mips_fbsd_tdep): Add declaration.
	* mips-linux-nat.c (_initialize_mips_linux_nat): Add declaration.
	* mips-linux-tdep.c (_initialize_mips_linux_tdep): Add declaration.
	* mips-nbsd-nat.c (_initialize_mipsnbsd_nat): Add declaration.
	* mips-nbsd-tdep.c (_initialize_mipsnbsd_tdep): Add declaration.
	* mips-sde-tdep.c (_initialize_mips_sde_tdep): Add declaration.
	* mips-tdep.c (_initialize_mips_tdep): Add declaration.
	* mips64-obsd-nat.c (_initialize_mips64obsd_nat): Add declaration.
	* mips64-obsd-tdep.c (_initialize_mips64obsd_tdep): Add declaration.
	* mipsread.c (_initialize_mipsread): Add declaration.
	* mn10300-linux-tdep.c (_initialize_mn10300_linux_tdep): Add declaration.
	* mn10300-tdep.c (_initialize_mn10300_tdep): Add declaration.
	* moxie-tdep.c (_initialize_moxie_tdep): Add declaration.
	* msp430-tdep.c (_initialize_msp430_tdep): Add declaration.
	* nds32-tdep.c (_initialize_nds32_tdep): Add declaration.
	* nios2-linux-tdep.c (_initialize_nios2_linux_tdep): Add declaration.
	* nios2-tdep.c (_initialize_nios2_tdep): Add declaration.
	* nto-procfs.c (_initialize_procfs): Add declaration.
	* objc-lang.c (_initialize_objc_language): Add declaration.
	* observable.c (_initialize_observer): Add declaration.
	* opencl-lang.c (_initialize_opencl_language): Add declaration.
	* or1k-linux-tdep.c (_initialize_or1k_linux_tdep): Add declaration.
	* or1k-tdep.c (_initialize_or1k_tdep): Add declaration.
	* osabi.c (_initialize_gdb_osabi): Add declaration.
	* osdata.c (_initialize_osdata): Add declaration.
	* p-valprint.c (_initialize_pascal_valprint): Add declaration.
	* parse.c (_initialize_parse): Add declaration.
	* ppc-fbsd-nat.c (_initialize_ppcfbsd_nat): Add declaration.
	* ppc-fbsd-tdep.c (_initialize_ppcfbsd_tdep): Add declaration.
	* ppc-linux-nat.c (_initialize_ppc_linux_nat): Add declaration.
	* ppc-linux-tdep.c (_initialize_ppc_linux_tdep): Add declaration.
	* ppc-nbsd-nat.c (_initialize_ppcnbsd_nat): Add declaration.
	* ppc-nbsd-tdep.c (_initialize_ppcnbsd_tdep): Add declaration.
	* ppc-obsd-nat.c (_initialize_ppcobsd_nat): Add declaration.
	* ppc-obsd-tdep.c (_initialize_ppcobsd_tdep): Add declaration.
	* printcmd.c (_initialize_printcmd): Add declaration.
	* probe.c (_initialize_probe): Add declaration.
	* proc-api.c (_initialize_proc_api): Add declaration.
	* proc-events.c (_initialize_proc_events): Add declaration.
	* proc-service.c (_initialize_proc_service): Add declaration.
	* procfs.c (_initialize_procfs): Add declaration.
	* producer.c (_initialize_producer): Add declaration.
	* psymtab.c (_initialize_psymtab): Add declaration.
	* python/python.c (_initialize_python): Add declaration.
	* ravenscar-thread.c (_initialize_ravenscar): Add declaration.
	* record-btrace.c (_initialize_record_btrace): Add declaration.
	* record-full.c (_initialize_record_full): Add declaration.
	* record.c (_initialize_record): Add declaration.
	* regcache-dump.c (_initialize_regcache_dump): Add declaration.
	* regcache.c (_initialize_regcache): Add declaration.
	* reggroups.c (_initialize_reggroup): Add declaration.
	* remote-notif.c (_initialize_notif): Add declaration.
	* remote-sim.c (_initialize_remote_sim): Add declaration.
	* remote.c (_initialize_remote): Add declaration.
	* reverse.c (_initialize_reverse): Add declaration.
	* riscv-fbsd-nat.c (_initialize_riscv_fbsd_nat): Add declaration.
	* riscv-fbsd-tdep.c (_initialize_riscv_fbsd_tdep): Add declaration.
	* riscv-linux-nat.c (_initialize_riscv_linux_nat): Add declaration.
	* riscv-linux-tdep.c (_initialize_riscv_linux_tdep): Add declaration.
	* riscv-tdep.c (_initialize_riscv_tdep): Add declaration.
	* rl78-tdep.c (_initialize_rl78_tdep): Add declaration.
	* rs6000-aix-tdep.c (_initialize_rs6000_aix_tdep): Add declaration.
	* rs6000-lynx178-tdep.c (_initialize_rs6000_lynx178_tdep):
	Add declaration.
	* rs6000-nat.c (_initialize_rs6000_nat): Add declaration.
	* rs6000-tdep.c (_initialize_rs6000_tdep): Add declaration.
	* run-on-main-thread.c (_initialize_run_on_main_thread): Add declaration.
	* rust-exp.y (_initialize_rust_exp): Add declaration.
	* rx-tdep.c (_initialize_rx_tdep): Add declaration.
	* s12z-tdep.c (_initialize_s12z_tdep): Add declaration.
	* s390-linux-nat.c (_initialize_s390_nat): Add declaration.
	* s390-linux-tdep.c (_initialize_s390_linux_tdep): Add declaration.
	* s390-tdep.c (_initialize_s390_tdep): Add declaration.
	* score-tdep.c (_initialize_score_tdep): Add declaration.
	* ser-go32.c (_initialize_ser_dos): Add declaration.
	* ser-mingw.c (_initialize_ser_windows): Add declaration.
	* ser-pipe.c (_initialize_ser_pipe): Add declaration.
	* ser-tcp.c (_initialize_ser_tcp): Add declaration.
	* ser-uds.c (_initialize_ser_socket): Add declaration.
	* ser-unix.c (_initialize_ser_hardwire): Add declaration.
	* serial.c (_initialize_serial): Add declaration.
	* sh-linux-tdep.c (_initialize_sh_linux_tdep): Add declaration.
	* sh-nbsd-nat.c (_initialize_shnbsd_nat): Add declaration.
	* sh-nbsd-tdep.c (_initialize_shnbsd_tdep): Add declaration.
	* sh-tdep.c (_initialize_sh_tdep): Add declaration.
	* skip.c (_initialize_step_skip): Add declaration.
	* sol-thread.c (_initialize_sol_thread): Add declaration.
	* solib-aix.c (_initialize_solib_aix): Add declaration.
	* solib-darwin.c (_initialize_darwin_solib): Add declaration.
	* solib-dsbt.c (_initialize_dsbt_solib): Add declaration.
	* solib-frv.c (_initialize_frv_solib): Add declaration.
	* solib-svr4.c (_initialize_svr4_solib): Add declaration.
	* solib-target.c (_initialize_solib_target): Add declaration.
	* solib.c (_initialize_solib): Add declaration.
	* source-cache.c (_initialize_source_cache): Add declaration.
	* source.c (_initialize_source): Add declaration.
	* sparc-linux-nat.c (_initialize_sparc_linux_nat): Add declaration.
	* sparc-linux-tdep.c (_initialize_sparc_linux_tdep): Add declaration.
	* sparc-nat.c (_initialize_sparc_nat): Add declaration.
	* sparc-nbsd-nat.c (_initialize_sparcnbsd_nat): Add declaration.
	* sparc-nbsd-tdep.c (_initialize_sparcnbsd_tdep): Add declaration.
	* sparc-obsd-tdep.c (_initialize_sparc32obsd_tdep): Add declaration.
	* sparc-sol2-tdep.c (_initialize_sparc_sol2_tdep): Add declaration.
	* sparc-tdep.c (_initialize_sparc_tdep): Add declaration.
	* sparc64-fbsd-nat.c (_initialize_sparc64fbsd_nat): Add declaration.
	* sparc64-fbsd-tdep.c (_initialize_sparc64fbsd_tdep): Add declaration.
	* sparc64-linux-nat.c (_initialize_sparc64_linux_nat): Add declaration.
	* sparc64-linux-tdep.c (_initialize_sparc64_linux_tdep): Add declaration.
	* sparc64-nat.c (_initialize_sparc64_nat): Add declaration.
	* sparc64-nbsd-nat.c (_initialize_sparc64nbsd_nat): Add declaration.
	* sparc64-nbsd-tdep.c (_initialize_sparc64nbsd_tdep): Add declaration.
	* sparc64-obsd-nat.c (_initialize_sparc64obsd_nat): Add declaration.
	* sparc64-obsd-tdep.c (_initialize_sparc64obsd_tdep): Add declaration.
	* sparc64-sol2-tdep.c (_initialize_sparc64_sol2_tdep): Add declaration.
	* sparc64-tdep.c (_initialize_sparc64_adi_tdep): Add declaration.
	* stabsread.c (_initialize_stabsread): Add declaration.
	* stack.c (_initialize_stack): Add declaration.
	* stap-probe.c (_initialize_stap_probe): Add declaration.
	* std-regs.c (_initialize_frame_reg): Add declaration.
	* symfile-debug.c (_initialize_symfile_debug): Add declaration.
	* symfile-mem.c (_initialize_symfile_mem): Add declaration.
	* symfile.c (_initialize_symfile): Add declaration.
	* symmisc.c (_initialize_symmisc): Add declaration.
	* symtab.c (_initialize_symtab): Add declaration.
	* target.c (_initialize_target): Add declaration.
	* target-connection.c (_initialize_target_connection): Add
	declaration.
	* target-dcache.c (_initialize_target_dcache): Add declaration.
	* target-descriptions.c (_initialize_target_descriptions): Add declaration.
	* thread.c (_initialize_thread): Add declaration.
	* tic6x-linux-tdep.c (_initialize_tic6x_linux_tdep): Add declaration.
	* tic6x-tdep.c (_initialize_tic6x_tdep): Add declaration.
	* tilegx-linux-nat.c (_initialize_tile_linux_nat): Add declaration.
	* tilegx-linux-tdep.c (_initialize_tilegx_linux_tdep): Add declaration.
	* tilegx-tdep.c (_initialize_tilegx_tdep): Add declaration.
	* tracectf.c (_initialize_ctf): Add declaration.
	* tracefile-tfile.c (_initialize_tracefile_tfile): Add declaration.
	* tracefile.c (_initialize_tracefile): Add declaration.
	* tracepoint.c (_initialize_tracepoint): Add declaration.
	* tui/tui-hooks.c (_initialize_tui_hooks): Add declaration.
	* tui/tui-interp.c (_initialize_tui_interp): Add declaration.
	* tui/tui-layout.c (_initialize_tui_layout): Add declaration.
	* tui/tui-regs.c (_initialize_tui_regs): Add declaration.
	* tui/tui-stack.c (_initialize_tui_stack): Add declaration.
	* tui/tui-win.c (_initialize_tui_win): Add declaration.
	* tui/tui.c (_initialize_tui): Add declaration.
	* typeprint.c (_initialize_typeprint): Add declaration.
	* ui-style.c (_initialize_ui_style): Add declaration.
	* unittests/array-view-selftests.c (_initialize_array_view_selftests): Add declaration.
	* unittests/child-path-selftests.c (_initialize_child_path_selftests): Add declaration.
	* unittests/cli-utils-selftests.c (_initialize_cli_utils_selftests): Add declaration.
	* unittests/common-utils-selftests.c (_initialize_common_utils_selftests): Add declaration.
	* unittests/copy_bitwise-selftests.c (_initialize_copy_bitwise_utils_selftests): Add declaration.
	* unittests/environ-selftests.c (_initialize_environ_selftests): Add declaration.
	* unittests/filtered_iterator-selftests.c
	(_initialize_filtered_iterator_selftests): Add declaration.
	* unittests/format_pieces-selftests.c (_initialize_format_pieces_selftests): Add declaration.
	* unittests/function-view-selftests.c (_initialize_function_view_selftests): Add declaration.
	* unittests/help-doc-selftests.c (_initialize_help_doc_selftests): Add declaration.
	* unittests/lookup_name_info-selftests.c (_initialize_lookup_name_info_selftests): Add declaration.
	* unittests/main-thread-selftests.c
	(_initialize_main_thread_selftests): Add declaration.
	* unittests/memory-map-selftests.c (_initialize_memory_map_selftests): Add declaration.
	* unittests/memrange-selftests.c (_initialize_memrange_selftests): Add declaration.
	* unittests/mkdir-recursive-selftests.c (_initialize_mkdir_recursive_selftests): Add declaration.
	* unittests/observable-selftests.c (_initialize_observer_selftest): Add declaration.
	* unittests/offset-type-selftests.c (_initialize_offset_type_selftests): Add declaration.
	* unittests/optional-selftests.c (_initialize_optional_selftests): Add declaration.
	* unittests/parse-connection-spec-selftests.c (_initialize_parse_connection_spec_selftests): Add declaration.
	* unittests/rsp-low-selftests.c (_initialize_rsp_low_selftests): Add declaration.
	* unittests/scoped_fd-selftests.c (_initialize_scoped_fd_selftests): Add declaration.
	* unittests/scoped_mmap-selftests.c (_initialize_scoped_mmap_selftests): Add declaration.
	* unittests/scoped_restore-selftests.c (_initialize_scoped_restore_selftests): Add declaration.
	* unittests/string_view-selftests.c (_initialize_string_view_selftests): Add declaration.
	* unittests/style-selftests.c (_initialize_style_selftest): Add declaration.
	* unittests/tracepoint-selftests.c (_initialize_tracepoint_selftests): Add declaration.
	* unittests/tui-selftests.c (_initialize_tui_selftest): Add
	declaration.
	* unittests/unpack-selftests.c (_initialize_unpack_selftests): Add declaration.
	* unittests/utils-selftests.c (_initialize_utils_selftests): Add declaration.
	* unittests/vec-utils-selftests.c (_initialize_vec_utils_selftests): Add declaration.
	* unittests/xml-utils-selftests.c (_initialize_xml_utils): Add declaration.
	* user-regs.c (_initialize_user_regs): Add declaration.
	* utils.c (_initialize_utils): Add declaration.
	* v850-tdep.c (_initialize_v850_tdep): Add declaration.
	* valops.c (_initialize_valops): Add declaration.
	* valprint.c (_initialize_valprint): Add declaration.
	* value.c (_initialize_values): Add declaration.
	* varobj.c (_initialize_varobj): Add declaration.
	* vax-bsd-nat.c (_initialize_vaxbsd_nat): Add declaration.
	* vax-nbsd-tdep.c (_initialize_vaxnbsd_tdep): Add declaration.
	* vax-tdep.c (_initialize_vax_tdep): Add declaration.
	* windows-nat.c (_initialize_windows_nat): Add declaration.
	(_initialize_check_for_gdb_ini): Add declaration.
	(_initialize_loadable): Add declaration.
	* windows-tdep.c (_initialize_windows_tdep): Add declaration.
	* x86-bsd-nat.c (_initialize_x86_bsd_nat): Add declaration.
	* x86-linux-nat.c (_initialize_x86_linux_nat): Add declaration.
	* xcoffread.c (_initialize_xcoffread): Add declaration.
	* xml-support.c (_initialize_xml_support): Add declaration.
	* xstormy16-tdep.c (_initialize_xstormy16_tdep): Add declaration.
	* xtensa-linux-nat.c (_initialize_xtensa_linux_nat): Add declaration.
	* xtensa-linux-tdep.c (_initialize_xtensa_linux_tdep): Add declaration.
	* xtensa-tdep.c (_initialize_xtensa_tdep): Add declaration.

Change-Id: I13eec7e0ed2b3c427377a7bdb055cf46da64def9
2020-01-13 14:01:38 -05:00
Joel Brobecker b811d2c292 Update copyright year range in all GDB files.
gdb/ChangeLog:

        Update copyright year range in all GDB files.
2020-01-01 10:20:53 +04:00
Tom Tromey 268e4f0914 Make the objfile destructor private
The idea behind this is that, in the long run, some code will need to
be able to hold onto an objfile after it is unlinked from the program
space.  In particular, this is needed for some functionality to be
moved to worker threads -- otherwise the objfile can be deleted while
still in use.

So, this makes ~objfile private, replacing it with an "unlink" method,
making it more obvious which operation is intended at the calling
points.

gdb/ChangeLog
2019-12-12  Tom Tromey  <tom@tromey.com>

	* symfile.c (syms_from_objfile_1): Use objfile_up.
	(syms_from_objfile_1, remove_symbol_file_command): Call unlink
	method.
	(reread_symbols): Use objfile_up.
	* solib.c (update_solib_list, reload_shared_libraries_1): Call
	unlink method.
	* objfiles.h (struct objfile) <~objfile>: Now private.
	<unlink>: New method.
	(struct objfile_deleter): New.
	(objfile_up): New typedef.
	* objfiles.c (objfile::unlink): New method.
	(free_objfile_separate_debug, free_all_objfiles)
	(objfile_purge_solibs): Use it.
	* jit.c (jit_unregister_code): Remove.
	(jit_inferior_exit_hook, jit_event_handler): Call unlink on
	objfile.
	* compile/compile-object-run.c (do_module_cleanup): Call unlink on
	objfile.
	* compile/compile-object-load.c (compile_object_load): Use
	objfile_up.

Change-Id: I934bee70b26b8b24e1735828fb1e60fe8a05714f
2019-12-12 15:50:52 -07:00
Christian Biesinger 5b89c67adb Replace int with bool in solib.c
This does not touch "int from_tty" and a couple of other instances
that require a bigger change.

gdb/ChangeLog:

2019-11-25  Christian Biesinger  <cbiesinger@google.com>

	* solib.c (solib_find_1): Change int to bool.
	(exec_file_find): Change int to bool.
	(solib_find): Change int to bool.
	(solib_read_symbols): Change int to bool.
	(solib_used): Change int to bool.
	(solib_add): Change int to bool.
	(info_sharedlibrary_command): Change int to bool.
	(solib_contains_address_p): Change int to bool.
	(solib_keep_data_in_core): Change int to bool.
	(in_solib_dynsym_resolve_code): Change int to bool.
	(reload_shared_libraries_1): Change int to bool.
	(gdb_sysroot_changed): Change int to bool.
	* solib.h (solib_read_symbols): Change int to bool.
	(solib_contains_address_p): Change int to bool.
	(solib_keep_data_in_core): Change int to bool.
	(in_solib_dynsym_resolve_code): Change int to bool.
	(libpthread_name_p): Change int to bool.

Change-Id: Id695ed4ed0c3526af477d4d2bf585a7193c36cab
2019-11-25 14:36:11 -06:00
Tom Tromey e0eac551da Remove some includes of readline.h
I went through most of the spots that include readline.h and, when
appropriate, either removed the include or changed it to include
tilde.h.

Note that remote-sim.c and bsd-kvm.c could probably include tilde.h
instead, but I did not change these.  I think I can't build the
latter, and I didn't want to set up a sim build for the former.

Tested by rebuilding.

gdb/ChangeLog
2019-11-06  Tom Tromey  <tom@tromey.com>

	* tui/tui-interp.c: Don't include readline.h.
	* tui/tui-hooks.c: Don't include readline.h.
	* symmisc.c: Include tilde.h, not readline.h.
	* symfile.c: Include tilde.h, not readline.h.
	* source.c: Include tilde.h, not readline.h.
	* solib.c: Include tilde.h, not readline.h.
	* psymtab.c: Include tilde.h, not readline.h.
	* exec.c: Include tilde.h, not readline.h.
	* corelow.c: Include tilde.h, not readline.h.
	* cli/cli-dump.c: Include tilde.h, not readline.h.
	* cli/cli-cmds.c: Don't include readline.h.

Change-Id: I60487a190c43128b800ef77517d1ab42957571d7
2019-11-06 07:29:43 -07:00
Tom de Vries 85102364b2 [gdb] Fix more typos in comments
Fix typos in comments.  NFC.

Tested on x86_64-linux.

gdb/ChangeLog:

2019-10-18  Tom de Vries  <tdevries@suse.de>

	* aarch64-tdep.c: Fix typos in comments.
	* ada-lang.c: Same.
	* ada-tasks.c: Same.
	* alpha-tdep.c: Same.
	* alpha-tdep.h: Same.
	* amd64-nat.c: Same.
	* amd64-windows-tdep.c: Same.
	* arc-tdep.c: Same.
	* arc-tdep.h: Same.
	* arch-utils.c: Same.
	* arm-nbsd-tdep.c: Same.
	* arm-tdep.c: Same.
	* ax-gdb.c: Same.
	* blockframe.c: Same.
	* btrace.c: Same.
	* c-varobj.c: Same.
	* coff-pe-read.c: Same.
	* coffread.c: Same.
	* cris-tdep.c: Same.
	* darwin-nat.c: Same.
	* dbxread.c: Same.
	* dcache.c: Same.
	* disasm.c: Same.
	* dtrace-probe.c: Same.
	* dwarf-index-write.c: Same.
	* dwarf2-frame-tailcall.c: Same.
	* dwarf2-frame.c: Same.
	* dwarf2read.c: Same.
	* eval.c: Same.
	* exceptions.c: Same.
	* fbsd-tdep.c: Same.
	* findvar.c: Same.
	* frame.c: Same.
	* frv-tdep.c: Same.
	* gnu-v3-abi.c: Same.
	* go32-nat.c: Same.
	* h8300-tdep.c: Same.
	* hppa-tdep.c: Same.
	* i386-linux-tdep.c: Same.
	* i386-tdep.c: Same.
	* ia64-libunwind-tdep.c: Same.
	* ia64-tdep.c: Same.
	* infcmd.c: Same.
	* infrun.c: Same.
	* linespec.c: Same.
	* linux-nat.c: Same.
	* linux-thread-db.c: Same.
	* machoread.c: Same.
	* mdebugread.c: Same.
	* mep-tdep.c: Same.
	* mn10300-tdep.c: Same.
	* namespace.c: Same.
	* objfiles.c: Same.
	* opencl-lang.c: Same.
	* or1k-tdep.c: Same.
	* osabi.c: Same.
	* ppc-linux-nat.c: Same.
	* ppc-linux-tdep.c: Same.
	* ppc-sysv-tdep.c: Same.
	* printcmd.c: Same.
	* procfs.c: Same.
	* record-btrace.c: Same.
	* record-full.c: Same.
	* remote-fileio.c: Same.
	* remote.c: Same.
	* rs6000-tdep.c: Same.
	* s12z-tdep.c: Same.
	* score-tdep.c: Same.
	* ser-base.c: Same.
	* ser-go32.c: Same.
	* skip.c: Same.
	* sol-thread.c: Same.
	* solib-svr4.c: Same.
	* solib.c: Same.
	* source.c: Same.
	* sparc-nat.c: Same.
	* sparc-sol2-tdep.c: Same.
	* sparc-tdep.c: Same.
	* sparc64-tdep.c: Same.
	* stabsread.c: Same.
	* stack.c: Same.
	* symfile.c: Same.
	* symtab.c: Same.
	* target-descriptions.c: Same.
	* target-float.c: Same.
	* thread.c: Same.
	* utils.c: Same.
	* valops.c: Same.
	* valprint.c: Same.
	* value.c: Same.
	* varobj.c: Same.
	* windows-nat.c: Same.
	* xcoffread.c: Same.
	* xstormy16-tdep.c: Same.
	* xtensa-tdep.c: Same.

Change-Id: I5175f1b107bfa4e1cdd4a3361ccb4739e53c75c4
2019-10-18 02:48:08 +02:00
Tom Tromey e43b10e10e Remove the ui_out_style_kind enum
This removes the ui_out_style_kind enum, in favor of simply using
ui_file_style references.  This simplifies the code somewhat.

gdb/ChangeLog
2019-10-01  Tom Tromey  <tom@tromey.com>

	* ui-out.h (enum class ui_out_style_kind): Remove.
	(class ui_out) <field_string, field_stsream, do_field_string>:
	Change type of "style".
	* ui-out.c (ui_out::field_core_addr, ui_out::field_stream)
	(ui_out::field_string): Update.
	* tui/tui-out.h (class tui_ui_out) <do_field_string>: Change type
	of "style".
	* tui/tui-out.c (tui_ui_out::do_field_string): Update.
	* tracepoint.c (print_one_static_tracepoint_marker): Update.
	* stack.c (print_frame_arg, print_frame_info, print_frame):
	Update.
	* source.c (print_source_lines_base): Update.
	* solib.c (info_sharedlibrary_command): Update.
	* skip.c (info_skip_command): Update.
	* record-btrace.c (btrace_call_history_src_line)
	(btrace_call_history): Update.
	* python/py-framefilter.c (py_print_frame): Update.
	* mi/mi-out.h (class mi_ui_out) <do_field_string>: Change type of
	"style".
	* mi/mi-out.c (mi_ui_out::do_table_header)
	(mi_ui_out::do_field_signed, mi_ui_out::do_field_unsigned)
	(mi_ui_out::do_field_string): Update.
	* disasm.c (gdb_pretty_print_disassembler::pretty_print_insn):
	Update.
	* cli-out.h (class cli_ui_out) <do_field_string>: Change type of
	"style".
	* cli-out.c (cli_ui_out::do_table_header)
	(cli_ui_out::do_field_signed, cli_ui_out::do_field_unsigned)
	(cli_ui_out::do_field_skip, cli_ui_out::do_field_string)
	(cli_ui_out::do_field_fmt): Update.
	* breakpoint.c (print_breakpoint_location): Update.
	(update_static_tracepoint): Update.
2019-10-01 15:12:37 -06:00
Christian Biesinger 626ca2c06f Replace solib_global_lookup with gdbarch_iterate_over_objfiles_in_search_order
All implementations of either function use it for the same purpose (except
Darwin, which is a no-op): to prefer a symbol in the current objfile over
symbols with the same name in other objfiles. There does not seem to be a
reason to have both mechanisms for that purpose.

gdb/ChangeLog:

2019-09-20  Christian Biesinger  <cbiesinger@google.com>

	* solib-darwin.c (darwin_lookup_lib_symbol): Remove.
	(_initialize_darwin_solib): Don't set
	darwin_so_ops.lookup_lib_global_symbol.
	* solib-svr4.c (set_solib_svr4_fetch_link_map_offsets): Call
	set_gdbarch_iterate_over_objfiles_in_search_order.
	(elf_lookup_lib_symbol): Rename to...
	(svr4_iterate_over_objfiles_in_search_order): this, and update
	to iterate semantics.
	(_initialize_svr4_solib): Don't set lookup_lib_global_symbol.
	* solib.c (solib_global_lookup): Remove.
	* solist.h (struct target_so_ops): Remove lookup_lib_global_symbol.
	(solib_global_lookup): Remove.
	* symtab.c (lookup_global_or_static_symbol): Remove call to
	solib_global_lookup.
2019-09-20 21:09:15 -05:00
Alan Modra 00f93c4492 bfd macro conversion to inline functions
This converts some of the macros that access struct bfd fields to
inline functions.

bfd/
	* archive.c (bfd_generic_archive_p): Use bfd_set_thin_archive.
	* bfd-in.h (bfd_get_filename, bfd_get_cacheable, bfd_get_format),
	(bfd_get_target, bfd_get_flavour, bfd_family_coff, bfd_big_endian),
	(bfd_little_endian, bfd_header_big_endian, bfd_header_little_endian),
	(bfd_get_file_flags, bfd_applicable_file_flags),
	(bfd_applicable_section_flags, bfd_has_map, bfd_is_thin_archive),
	(bfd_valid_reloc_types, bfd_usrdata, bfd_get_start_address),
	(bfd_get_symcount, bfd_get_outsymbols, bfd_count_sections),
	(bfd_get_dynamic_symcount, bfd_get_symbol_leading_char): Delete.
	* bfd/bfd.c (bfd_get_filename, bfd_get_cacheable, bfd_get_format),
	(bfd_get_file_flags, bfd_get_start_address, bfd_get_symcount),
	(bfd_get_dynamic_symcount, bfd_get_outsymbols, bfd_count_sections),
	(bfd_has_map, bfd_is_thin_archive, bfd_set_thin_archive),
	(bfd_usrdata, bfd_set_usrdata): New inline functions.
	* targets.c (bfd_get_target, bfd_get_flavour),
	(bfd_applicable_file_flags, bfd_family_coff, bfd_big_endian),
	(bfd_little_endian, bfd_header_big_endian),
	(bfd_header_little_endian, bfd_applicable_section_flags),
	(bfd_get_symbol_leading_char): New inline functions.
	* bfd-in2.h: Regenerate.
binutils/
	* ar.c (write_archive): Use bfd_set_thin_archive.
gdb/
	* gdb_bfd.c (gdb_bfd_ref, gdb_bfd_unref): Use bfd_set_usrdata.
	* dwarf2read.c (dwarf2_read_gdb_index, dwarf2_read_debug_names),
	(read_indirect_string_from_dwz): Use bfd accessor.
	* dwarf2read.h (struct dwz_file <filename>): Likewise.
	* machoread.c (macho_symfile_read_all_oso): Likewise.
	* solib.c (solib_bfd_open): Likewise.
ld/
	* ldelf.c (ldelf_after_open, ldelf_place_orphan
	* ldlang.c (walk_wild_file, lang_process): Use bfd_usrdata.
	(load_symbols, ldlang_add_file): Use bfd_set_usrdata.
	* ldmain.c (add_archive_element): Use bfd_usrdata.
	* ldlang.h (bfd_input_just_syms): New inline function.
	* emultempl/aarch64elf.em (build_section_lists): Use it.
	* emultempl/mmo.em (mmo_place_orphan): Likewise.
	* emultempl/pe.em (gld_${EMULATION_NAME}_place_orphan): Likewise.
	* emultempl/pep.em (gld_${EMULATION_NAME}_place_orphan): Likewise.
	* emultempl/ppc64elf.em (build_section_lists): Likewise.
sim/
	* ppc/emul_generic.c (emul_add_tree_options): Delete old bfd code.
2019-09-20 18:04:02 +09:30
Alan Modra b16c44debc bfd_get_filename
This macro says:
/* Cast from const char * to char * so that caller can assign to
   a char * without a warning.  */

I reckon that isn't such a good idea since it can result in char*
variables where const char* is appropriate.  Not very many places
need the char* cast.

bfd/
	* aout-target.h (object_p): Formatting.
	* bfd-in.h (bfd_get_filename): Don't cast to char*.
	* corefile.c (generic_core_file_matches_executable_p): Constify
	variables and remove cast.
	* bfd-in2.h: Regenerate.
binutils/
	* nm.c (print_object_filename_bsd, print_object_filename_sysv),
	(print_object_filename_posix, print_archive_filename_bsd),
	(print_archive_filename_sysv, print_archive_filename_posix),
	(print_archive_member_bsd, print_archive_member_sysv),
	(print_archive_member_posix): Constify parameter.
	(struct output_fns <print_object_filename, print_archive_filename>),
	(<print_archive_member>): Likewise.
	* objcopy.c (copy_archive): Add cast for make_tempdir.
ld/
	* emultempl/elf32.em (gld${EMULATION_NAME}_search_needed): Constify
	variable.
	* emultempl/pe.em (gld_${EMULATION_NAME}_after_open): Likewise.
	* emultempl/pep.em (gld_${EMULATION_NAME}_after_open): Likewise.
gdb/
	* coffread.c (coff_symfile_read): Constify filename variable.
	* dbxread.c (dbx_symfile_init, coffstab_build_psymtabs),
	(elfstab_build_psymtabs, stabsect_build_psymtabs): Likewise.
	* gdb_bfd.c (gdb_bfd_close_or_warn): Likewise.
	* solib.c (reload_shared_libraries_1): Likewise.
	* symfile.c (reread_symbols): Likewise.
	* solib-aix.c (solib_aix_bfd_open): Add cast for xfree of filename.
	* solib-darwin.c (darwin_bfd_open): Likewise.
	* symfile-mem.c (symbol_file_add_from_memory): Likewise.
sim/cris/
	* sim-if.c (sim_open): Constify filename variable.
2019-09-06 12:22:59 +09:30
Tom Tromey 268a13a5a3 Rename common to gdbsupport
This is the next patch in the ongoing series to move gdbsever to the
top level.

This patch just renames the "common" directory.  The idea is to do
this move in two parts: first rename the directory (this patch), then
move the directory to the top.  This approach makes the patches a bit
more tractable.

I chose the name "gdbsupport" for the directory.  However, as this
patch was largely written by sed, we could pick a new name without too
much difficulty.

Tested by the buildbot.

gdb/ChangeLog
2019-07-09  Tom Tromey  <tom@tromey.com>

	* contrib/ari/gdb_ari.sh: Change common to gdbsupport.
	* configure: Rebuild.
	* configure.ac: Change common to gdbsupport.
	* gdbsupport: Rename from common.
	* acinclude.m4: Change common to gdbsupport.
	* Makefile.in (CONFIG_SRC_SUBDIR, COMMON_SFILES)
	(HFILES_NO_SRCDIR, stamp-version, ALLDEPFILES): Change common to
	gdbsupport.
	* aarch64-tdep.c, ada-lang.c, ada-lang.h, agent.c, alloc.c,
	amd64-darwin-tdep.c, amd64-dicos-tdep.c, amd64-fbsd-nat.c,
	amd64-fbsd-tdep.c, amd64-linux-nat.c, amd64-linux-tdep.c,
	amd64-nbsd-tdep.c, amd64-obsd-tdep.c, amd64-sol2-tdep.c,
	amd64-tdep.c, amd64-windows-tdep.c, arch-utils.c,
	arch/aarch64-insn.c, arch/aarch64.c, arch/aarch64.h, arch/amd64.c,
	arch/amd64.h, arch/arm-get-next-pcs.c, arch/arm-linux.c,
	arch/arm.c, arch/i386.c, arch/i386.h, arch/ppc-linux-common.c,
	arch/riscv.c, arch/riscv.h, arch/tic6x.c, arm-tdep.c, auto-load.c,
	auxv.c, ax-gdb.c, ax-general.c, ax.h, breakpoint.c, breakpoint.h,
	btrace.c, btrace.h, build-id.c, build-id.h, c-lang.h, charset.c,
	charset.h, cli/cli-cmds.c, cli/cli-cmds.h, cli/cli-decode.c,
	cli/cli-dump.c, cli/cli-option.h, cli/cli-script.c,
	coff-pe-read.c, command.h, compile/compile-c-support.c,
	compile/compile-c.h, compile/compile-cplus-symbols.c,
	compile/compile-cplus-types.c, compile/compile-cplus.h,
	compile/compile-loc2c.c, compile/compile.c, completer.c,
	completer.h, contrib/ari/gdb_ari.sh, corefile.c, corelow.c,
	cp-support.c, cp-support.h, cp-valprint.c, csky-tdep.c, ctf.c,
	darwin-nat.c, debug.c, defs.h, disasm-selftests.c, disasm.c,
	disasm.h, dtrace-probe.c, dwarf-index-cache.c,
	dwarf-index-cache.h, dwarf-index-write.c, dwarf2-frame.c,
	dwarf2expr.c, dwarf2loc.c, dwarf2read.c, event-loop.c,
	event-top.c, exceptions.c, exec.c, extension.h, fbsd-nat.c,
	features/aarch64-core.c, features/aarch64-fpu.c,
	features/aarch64-pauth.c, features/aarch64-sve.c,
	features/i386/32bit-avx.c, features/i386/32bit-avx512.c,
	features/i386/32bit-core.c, features/i386/32bit-linux.c,
	features/i386/32bit-mpx.c, features/i386/32bit-pkeys.c,
	features/i386/32bit-segments.c, features/i386/32bit-sse.c,
	features/i386/64bit-avx.c, features/i386/64bit-avx512.c,
	features/i386/64bit-core.c, features/i386/64bit-linux.c,
	features/i386/64bit-mpx.c, features/i386/64bit-pkeys.c,
	features/i386/64bit-segments.c, features/i386/64bit-sse.c,
	features/i386/x32-core.c, features/riscv/32bit-cpu.c,
	features/riscv/32bit-csr.c, features/riscv/32bit-fpu.c,
	features/riscv/64bit-cpu.c, features/riscv/64bit-csr.c,
	features/riscv/64bit-fpu.c, features/tic6x-c6xp.c,
	features/tic6x-core.c, features/tic6x-gp.c, filename-seen-cache.h,
	findcmd.c, findvar.c, fork-child.c, gcore.c, gdb_bfd.c, gdb_bfd.h,
	gdb_proc_service.h, gdb_regex.c, gdb_select.h, gdb_usleep.c,
	gdbarch-selftests.c, gdbthread.h, gdbtypes.h, gnu-nat.c,
	go32-nat.c, guile/guile.c, guile/scm-ports.c,
	guile/scm-safe-call.c, guile/scm-type.c, i386-fbsd-nat.c,
	i386-fbsd-tdep.c, i386-go32-tdep.c, i386-linux-nat.c,
	i386-linux-tdep.c, i386-tdep.c, i387-tdep.c,
	ia64-libunwind-tdep.c, ia64-linux-nat.c, inf-child.c,
	inf-ptrace.c, infcall.c, infcall.h, infcmd.c, inferior-iter.h,
	inferior.c, inferior.h, inflow.c, inflow.h, infrun.c, infrun.h,
	inline-frame.c, language.h, linespec.c, linux-fork.c, linux-nat.c,
	linux-tdep.c, linux-thread-db.c, location.c, machoread.c,
	macrotab.h, main.c, maint.c, maint.h, memattr.c, memrange.h,
	mi/mi-cmd-break.h, mi/mi-cmd-env.c, mi/mi-cmd-stack.c,
	mi/mi-cmd-var.c, mi/mi-interp.c, mi/mi-main.c, mi/mi-parse.h,
	minsyms.c, mips-linux-tdep.c, namespace.h,
	nat/aarch64-linux-hw-point.c, nat/aarch64-linux-hw-point.h,
	nat/aarch64-linux.c, nat/aarch64-sve-linux-ptrace.c,
	nat/amd64-linux-siginfo.c, nat/fork-inferior.c,
	nat/linux-btrace.c, nat/linux-btrace.h, nat/linux-namespaces.c,
	nat/linux-nat.h, nat/linux-osdata.c, nat/linux-personality.c,
	nat/linux-procfs.c, nat/linux-ptrace.c, nat/linux-ptrace.h,
	nat/linux-waitpid.c, nat/mips-linux-watch.c,
	nat/mips-linux-watch.h, nat/ppc-linux.c, nat/x86-dregs.c,
	nat/x86-dregs.h, nat/x86-linux-dregs.c, nat/x86-linux.c,
	nto-procfs.c, nto-tdep.c, objfile-flags.h, objfiles.c, objfiles.h,
	obsd-nat.c, observable.h, osdata.c, p-valprint.c, parse.c,
	parser-defs.h, ppc-linux-nat.c, printcmd.c, probe.c, proc-api.c,
	procfs.c, producer.c, progspace.h, psymtab.h,
	python/py-framefilter.c, python/py-inferior.c, python/py-ref.h,
	python/py-type.c, python/python.c, record-btrace.c, record-full.c,
	record.c, record.h, regcache-dump.c, regcache.c, regcache.h,
	remote-fileio.c, remote-fileio.h, remote-sim.c, remote.c,
	riscv-tdep.c, rs6000-aix-tdep.c, rust-exp.y, s12z-tdep.c,
	selftest-arch.c, ser-base.c, ser-event.c, ser-pipe.c, ser-tcp.c,
	ser-unix.c, skip.c, solib-aix.c, solib-target.c, solib.c,
	source-cache.c, source.c, source.h, sparc-nat.c, spu-linux-nat.c,
	stack.c, stap-probe.c, symfile-add-flags.h, symfile.c, symfile.h,
	symtab.c, symtab.h, target-descriptions.c, target-descriptions.h,
	target-memory.c, target.c, target.h, target/waitstatus.c,
	target/waitstatus.h, thread-iter.h, thread.c, tilegx-tdep.c,
	top.c, top.h, tracefile-tfile.c, tracefile.c, tracepoint.c,
	tracepoint.h, tui/tui-io.c, ui-file.c, ui-out.h,
	unittests/array-view-selftests.c,
	unittests/child-path-selftests.c, unittests/cli-utils-selftests.c,
	unittests/common-utils-selftests.c,
	unittests/copy_bitwise-selftests.c, unittests/environ-selftests.c,
	unittests/format_pieces-selftests.c,
	unittests/function-view-selftests.c,
	unittests/lookup_name_info-selftests.c,
	unittests/memory-map-selftests.c, unittests/memrange-selftests.c,
	unittests/mkdir-recursive-selftests.c,
	unittests/observable-selftests.c,
	unittests/offset-type-selftests.c, unittests/optional-selftests.c,
	unittests/parse-connection-spec-selftests.c,
	unittests/ptid-selftests.c, unittests/rsp-low-selftests.c,
	unittests/scoped_fd-selftests.c,
	unittests/scoped_mmap-selftests.c,
	unittests/scoped_restore-selftests.c,
	unittests/string_view-selftests.c, unittests/style-selftests.c,
	unittests/tracepoint-selftests.c, unittests/unpack-selftests.c,
	unittests/utils-selftests.c, unittests/xml-utils-selftests.c,
	utils.c, utils.h, valarith.c, valops.c, valprint.c, value.c,
	value.h, varobj.c, varobj.h, windows-nat.c, x86-linux-nat.c,
	xml-support.c, xml-support.h, xml-tdesc.h, xstormy16-tdep.c,
	xtensa-linux-nat.c, dwarf2read.h: Change common to gdbsupport.

gdb/gdbserver/ChangeLog
2019-07-09  Tom Tromey  <tom@tromey.com>

	* configure: Rebuild.
	* configure.ac: Change common to gdbsupport.
	* acinclude.m4: Change common to gdbsupport.
	* Makefile.in (SFILES, OBS, GDBREPLAY_OBS, IPA_OBJS)
	(version-generated.c, gdbsupport/%-ipa.o, gdbsupport/%.o): Change
	common to gdbsupport.
	* ax.c, event-loop.c, fork-child.c, gdb_proc_service.h,
	gdbreplay.c, gdbthread.h, hostio-errno.c, hostio.c, i387-fp.c,
	inferiors.c, inferiors.h, linux-aarch64-tdesc-selftest.c,
	linux-amd64-ipa.c, linux-i386-ipa.c, linux-low.c,
	linux-tic6x-low.c, linux-x86-low.c, linux-x86-tdesc-selftest.c,
	linux-x86-tdesc.c, lynx-i386-low.c, lynx-low.c, mem-break.h,
	nto-x86-low.c, regcache.c, regcache.h, remote-utils.c, server.c,
	server.h, spu-low.c, symbol.c, target.h, tdesc.c, tdesc.h,
	thread-db.c, tracepoint.c, win32-i386-low.c, win32-low.c: Change
	common to gdbsupport.
2019-07-09 07:45:38 -06:00
Tom Tromey e7bd7fba34 Add file name styling to "info sharedlibrary"
This changes "info sharedlibrary" to add styling to the file name.

Tested on x86-64 Fedora 29.

gdb/ChangeLog
2019-05-14  Tom Tromey  <tromey@adacore.com>

	* solib.c (info_sharedlibrary_command): Style the file name.

gdb/testsuite/ChangeLog
2019-05-14  Tom Tromey  <tromey@adacore.com>

	* gdb.base/info-shared.exp (check_info_shared): Add "info shared"
	styling test.
2019-05-14 07:43:38 -06:00
Tom Tromey 230d2906b9 Rename gdb exception types
This renames the gdb exception types.  The old types were only needed
due to the macros in common-exception.h that are now gone.

The intermediate layer of gdb_exception_RETURN_MASK_ALL did not seem
needed, so this patch removes it entirely.

gdb/ChangeLog
2019-04-08  Tom Tromey  <tom@tromey.com>

	* common/common-exceptions.h (gdb_exception_RETURN_MASK_ALL):
	Remove.
	(gdb_exception_error): Rename from
	gdb_exception_RETURN_MASK_ERROR.
	(gdb_exception_quit): Rename from gdb_exception_RETURN_MASK_QUIT.
	(gdb_quit_bad_alloc): Update.
	* aarch64-tdep.c: Update.
	* ada-lang.c: Update.
	* ada-typeprint.c: Update.
	* ada-valprint.c: Update.
	* amd64-tdep.c: Update.
	* arch-utils.c: Update.
	* break-catch-throw.c: Update.
	* breakpoint.c: Update.
	* btrace.c: Update.
	* c-varobj.c: Update.
	* cli/cli-cmds.c: Update.
	* cli/cli-interp.c: Update.
	* cli/cli-script.c: Update.
	* common/common-exceptions.c: Update.
	* common/new-op.c: Update.
	* common/selftest.c: Update.
	* compile/compile-c-symbols.c: Update.
	* compile/compile-cplus-symbols.c: Update.
	* compile/compile-object-load.c: Update.
	* compile/compile-object-run.c: Update.
	* completer.c: Update.
	* corelow.c: Update.
	* cp-abi.c: Update.
	* cp-support.c: Update.
	* cp-valprint.c: Update.
	* darwin-nat.c: Update.
	* disasm-selftests.c: Update.
	* dtrace-probe.c: Update.
	* dwarf-index-cache.c: Update.
	* dwarf-index-write.c: Update.
	* dwarf2-frame-tailcall.c: Update.
	* dwarf2-frame.c: Update.
	* dwarf2loc.c: Update.
	* dwarf2read.c: Update.
	* eval.c: Update.
	* event-loop.c: Update.
	* event-top.c: Update.
	* exec.c: Update.
	* f-valprint.c: Update.
	* fbsd-tdep.c: Update.
	* frame-unwind.c: Update.
	* frame.c: Update.
	* gdbtypes.c: Update.
	* gnu-v3-abi.c: Update.
	* guile/guile-internal.h: Update.
	* guile/scm-block.c: Update.
	* guile/scm-breakpoint.c: Update.
	* guile/scm-cmd.c: Update.
	* guile/scm-disasm.c: Update.
	* guile/scm-frame.c: Update.
	* guile/scm-lazy-string.c: Update.
	* guile/scm-math.c: Update.
	* guile/scm-param.c: Update.
	* guile/scm-ports.c: Update.
	* guile/scm-pretty-print.c: Update.
	* guile/scm-symbol.c: Update.
	* guile/scm-symtab.c: Update.
	* guile/scm-type.c: Update.
	* guile/scm-value.c: Update.
	* i386-linux-tdep.c: Update.
	* i386-tdep.c: Update.
	* inf-loop.c: Update.
	* infcall.c: Update.
	* infcmd.c: Update.
	* infrun.c: Update.
	* jit.c: Update.
	* language.c: Update.
	* linespec.c: Update.
	* linux-fork.c: Update.
	* linux-nat.c: Update.
	* linux-tdep.c: Update.
	* linux-thread-db.c: Update.
	* main.c: Update.
	* mi/mi-cmd-break.c: Update.
	* mi/mi-cmd-stack.c: Update.
	* mi/mi-interp.c: Update.
	* mi/mi-main.c: Update.
	* objc-lang.c: Update.
	* p-valprint.c: Update.
	* parse.c: Update.
	* ppc-linux-tdep.c: Update.
	* printcmd.c: Update.
	* python/py-arch.c: Update.
	* python/py-breakpoint.c: Update.
	* python/py-cmd.c: Update.
	* python/py-finishbreakpoint.c: Update.
	* python/py-frame.c: Update.
	* python/py-framefilter.c: Update.
	* python/py-gdb-readline.c: Update.
	* python/py-inferior.c: Update.
	* python/py-infthread.c: Update.
	* python/py-lazy-string.c: Update.
	* python/py-linetable.c: Update.
	* python/py-objfile.c: Update.
	* python/py-param.c: Update.
	* python/py-prettyprint.c: Update.
	* python/py-progspace.c: Update.
	* python/py-record-btrace.c: Update.
	* python/py-record.c: Update.
	* python/py-symbol.c: Update.
	* python/py-type.c: Update.
	* python/py-unwind.c: Update.
	* python/py-utils.c: Update.
	* python/py-value.c: Update.
	* python/python.c: Update.
	* record-btrace.c: Update.
	* record-full.c: Update.
	* remote-fileio.c: Update.
	* remote.c: Update.
	* riscv-tdep.c: Update.
	* rs6000-aix-tdep.c: Update.
	* rs6000-tdep.c: Update.
	* rust-exp.y: Update.
	* rust-lang.c: Update.
	* s390-tdep.c: Update.
	* selftest-arch.c: Update.
	* solib-dsbt.c: Update.
	* solib-frv.c: Update.
	* solib-spu.c: Update.
	* solib-svr4.c: Update.
	* solib.c: Update.
	* sparc64-linux-tdep.c: Update.
	* stack.c: Update.
	* symfile-mem.c: Update.
	* symmisc.c: Update.
	* target.c: Update.
	* thread.c: Update.
	* top.c: Update.
	* tracefile-tfile.c: Update.
	* tui/tui.c: Update.
	* typeprint.c: Update.
	* unittests/cli-utils-selftests.c: Update.
	* unittests/parse-connection-spec-selftests.c: Update.
	* valops.c: Update.
	* valprint.c: Update.
	* value.c: Update.
	* varobj.c: Update.
	* windows-nat.c: Update.
	* x86-linux-nat.c: Update.
	* xml-support.c: Update.

gdb/gdbserver/ChangeLog
2019-04-08  Tom Tromey  <tom@tromey.com>

	* gdbreplay.c: Update.
	* linux-low.c: Update.
	* server.c: Update.
2019-04-08 09:05:40 -06:00
Tom Tromey a70b814420 Rewrite TRY/CATCH
This rewrites gdb's TRY/CATCH to plain C++ try/catch.  The patch was
largely written by script, though one change (to a comment in
common-exceptions.h) was reverted by hand.

gdb/ChangeLog
2019-04-08  Tom Tromey  <tom@tromey.com>

	* xml-support.c: Use C++ exception handling.
	* x86-linux-nat.c: Use C++ exception handling.
	* windows-nat.c: Use C++ exception handling.
	* varobj.c: Use C++ exception handling.
	* value.c: Use C++ exception handling.
	* valprint.c: Use C++ exception handling.
	* valops.c: Use C++ exception handling.
	* unittests/parse-connection-spec-selftests.c: Use C++ exception
	handling.
	* unittests/cli-utils-selftests.c: Use C++ exception handling.
	* typeprint.c: Use C++ exception handling.
	* tui/tui.c: Use C++ exception handling.
	* tracefile-tfile.c: Use C++ exception handling.
	* top.c: Use C++ exception handling.
	* thread.c: Use C++ exception handling.
	* target.c: Use C++ exception handling.
	* symmisc.c: Use C++ exception handling.
	* symfile-mem.c: Use C++ exception handling.
	* stack.c: Use C++ exception handling.
	* sparc64-linux-tdep.c: Use C++ exception handling.
	* solib.c: Use C++ exception handling.
	* solib-svr4.c: Use C++ exception handling.
	* solib-spu.c: Use C++ exception handling.
	* solib-frv.c: Use C++ exception handling.
	* solib-dsbt.c: Use C++ exception handling.
	* selftest-arch.c: Use C++ exception handling.
	* s390-tdep.c: Use C++ exception handling.
	* rust-lang.c: Use C++ exception handling.
	* rust-exp.y: Use C++ exception handling.
	* rs6000-tdep.c: Use C++ exception handling.
	* rs6000-aix-tdep.c: Use C++ exception handling.
	* riscv-tdep.c: Use C++ exception handling.
	* remote.c: Use C++ exception handling.
	* remote-fileio.c: Use C++ exception handling.
	* record-full.c: Use C++ exception handling.
	* record-btrace.c: Use C++ exception handling.
	* python/python.c: Use C++ exception handling.
	* python/py-value.c: Use C++ exception handling.
	* python/py-utils.c: Use C++ exception handling.
	* python/py-unwind.c: Use C++ exception handling.
	* python/py-type.c: Use C++ exception handling.
	* python/py-symbol.c: Use C++ exception handling.
	* python/py-record.c: Use C++ exception handling.
	* python/py-record-btrace.c: Use C++ exception handling.
	* python/py-progspace.c: Use C++ exception handling.
	* python/py-prettyprint.c: Use C++ exception handling.
	* python/py-param.c: Use C++ exception handling.
	* python/py-objfile.c: Use C++ exception handling.
	* python/py-linetable.c: Use C++ exception handling.
	* python/py-lazy-string.c: Use C++ exception handling.
	* python/py-infthread.c: Use C++ exception handling.
	* python/py-inferior.c: Use C++ exception handling.
	* python/py-gdb-readline.c: Use C++ exception handling.
	* python/py-framefilter.c: Use C++ exception handling.
	* python/py-frame.c: Use C++ exception handling.
	* python/py-finishbreakpoint.c: Use C++ exception handling.
	* python/py-cmd.c: Use C++ exception handling.
	* python/py-breakpoint.c: Use C++ exception handling.
	* python/py-arch.c: Use C++ exception handling.
	* printcmd.c: Use C++ exception handling.
	* ppc-linux-tdep.c: Use C++ exception handling.
	* parse.c: Use C++ exception handling.
	* p-valprint.c: Use C++ exception handling.
	* objc-lang.c: Use C++ exception handling.
	* mi/mi-main.c: Use C++ exception handling.
	* mi/mi-interp.c: Use C++ exception handling.
	* mi/mi-cmd-stack.c: Use C++ exception handling.
	* mi/mi-cmd-break.c: Use C++ exception handling.
	* main.c: Use C++ exception handling.
	* linux-thread-db.c: Use C++ exception handling.
	* linux-tdep.c: Use C++ exception handling.
	* linux-nat.c: Use C++ exception handling.
	* linux-fork.c: Use C++ exception handling.
	* linespec.c: Use C++ exception handling.
	* language.c: Use C++ exception handling.
	* jit.c: Use C++ exception handling.
	* infrun.c: Use C++ exception handling.
	* infcmd.c: Use C++ exception handling.
	* infcall.c: Use C++ exception handling.
	* inf-loop.c: Use C++ exception handling.
	* i386-tdep.c: Use C++ exception handling.
	* i386-linux-tdep.c: Use C++ exception handling.
	* guile/scm-value.c: Use C++ exception handling.
	* guile/scm-type.c: Use C++ exception handling.
	* guile/scm-symtab.c: Use C++ exception handling.
	* guile/scm-symbol.c: Use C++ exception handling.
	* guile/scm-pretty-print.c: Use C++ exception handling.
	* guile/scm-ports.c: Use C++ exception handling.
	* guile/scm-param.c: Use C++ exception handling.
	* guile/scm-math.c: Use C++ exception handling.
	* guile/scm-lazy-string.c: Use C++ exception handling.
	* guile/scm-frame.c: Use C++ exception handling.
	* guile/scm-disasm.c: Use C++ exception handling.
	* guile/scm-cmd.c: Use C++ exception handling.
	* guile/scm-breakpoint.c: Use C++ exception handling.
	* guile/scm-block.c: Use C++ exception handling.
	* guile/guile-internal.h: Use C++ exception handling.
	* gnu-v3-abi.c: Use C++ exception handling.
	* gdbtypes.c: Use C++ exception handling.
	* frame.c: Use C++ exception handling.
	* frame-unwind.c: Use C++ exception handling.
	* fbsd-tdep.c: Use C++ exception handling.
	* f-valprint.c: Use C++ exception handling.
	* exec.c: Use C++ exception handling.
	* event-top.c: Use C++ exception handling.
	* event-loop.c: Use C++ exception handling.
	* eval.c: Use C++ exception handling.
	* dwarf2read.c: Use C++ exception handling.
	* dwarf2loc.c: Use C++ exception handling.
	* dwarf2-frame.c: Use C++ exception handling.
	* dwarf2-frame-tailcall.c: Use C++ exception handling.
	* dwarf-index-write.c: Use C++ exception handling.
	* dwarf-index-cache.c: Use C++ exception handling.
	* dtrace-probe.c: Use C++ exception handling.
	* disasm-selftests.c: Use C++ exception handling.
	* darwin-nat.c: Use C++ exception handling.
	* cp-valprint.c: Use C++ exception handling.
	* cp-support.c: Use C++ exception handling.
	* cp-abi.c: Use C++ exception handling.
	* corelow.c: Use C++ exception handling.
	* completer.c: Use C++ exception handling.
	* compile/compile-object-run.c: Use C++ exception handling.
	* compile/compile-object-load.c: Use C++ exception handling.
	* compile/compile-cplus-symbols.c: Use C++ exception handling.
	* compile/compile-c-symbols.c: Use C++ exception handling.
	* common/selftest.c: Use C++ exception handling.
	* common/new-op.c: Use C++ exception handling.
	* cli/cli-script.c: Use C++ exception handling.
	* cli/cli-interp.c: Use C++ exception handling.
	* cli/cli-cmds.c: Use C++ exception handling.
	* c-varobj.c: Use C++ exception handling.
	* btrace.c: Use C++ exception handling.
	* breakpoint.c: Use C++ exception handling.
	* break-catch-throw.c: Use C++ exception handling.
	* arch-utils.c: Use C++ exception handling.
	* amd64-tdep.c: Use C++ exception handling.
	* ada-valprint.c: Use C++ exception handling.
	* ada-typeprint.c: Use C++ exception handling.
	* ada-lang.c: Use C++ exception handling.
	* aarch64-tdep.c: Use C++ exception handling.

gdb/gdbserver/ChangeLog
2019-04-08  Tom Tromey  <tom@tromey.com>

	* server.c: Use C++ exception handling.
	* linux-low.c: Use C++ exception handling.
	* gdbreplay.c: Use C++ exception handling.
2019-04-08 09:05:39 -06:00
Tom Tromey 6640a367bf Remove null_block_symbol
This removes null_block_symbol.  It seemed simpler to me to change
initializations and returns to use value initialization rather than
null_block_symbol.  This also fixes up a few spots where
initialization was done piecemeal.

gdb/ChangeLog
2019-03-24  Tom Tromey  <tom@tromey.com>

	* ada-lang.c (standard_lookup): Simplify initialization.
	(ada_lookup_symbol_nonlocal): Simplify return.
	* solib-spu.c (spu_lookup_lib_symbol): Simplify return.
	* solib-darwin.c (darwin_lookup_lib_symbol): Simplify return.
	* solib-svr4.c (elf_lookup_lib_symbol): Simplify return.
	* rust-lang.c (rust_lookup_symbol_nonlocal): Simplify
	initialization.
	* solib.c (solib_global_lookup): Simplify.
	* symtab.c (null_block_symbol): Remove.
	(symbol_cache_lookup): Simplify returns.
	(lookup_language_this): Simplify returns.
	(lookup_symbol_aux): Simplify return.
	(lookup_local_symbol): Simplify returns.
	(lookup_global_symbol_from_objfile): Simplify return.
	(lookup_symbol_in_objfile_symtabs)
	(lookup_symbol_in_objfile_from_linkage_name): Simplify return.
	(lookup_symbol_via_quick_fns, lookup_symbol_in_static_block)
	(lookup_static_symbol, lookup_global_symbol): Simplify return.
	* cp-namespace.c (cp_lookup_bare_symbol)
	(cp_search_static_and_baseclasses, cp_lookup_symbol_via_imports)
	(cp_lookup_symbol_via_all_imports, cp_lookup_nested_symbol_1)
	(cp_lookup_nested_symbol): Don't use null_block_symbol.
	(cp_lookup_symbol_via_imports): Simplify initialization.
	(find_symbol_in_baseclass): Likewise.
	* symtab.h (null_block_symbol): Remove.
	* d-namespace.c (d_lookup_symbol): Don't use null_block_symbol.
	(d_lookup_nested_symbol, d_lookup_symbol_imports)
	(d_lookup_symbol_module): Likewise.
	(find_symbol_in_baseclass): Simplify initialization.
2019-03-24 23:32:09 -06:00
Tom Tromey eefba3da27 Change minimal_symbol inheritance
This changes struct minimal_symbol to inherit from general_symbol_info
and updates various macros to cope.

Because MSYMBOL_SET_LANGUAGE and MSYMBOL_SET_NAMES were only used from
a single spot, this patch removes them in favor of simply inlining
their definitions.  I consider this to be somewhat cleaner, not least
because the "phony polymorphism" provided by such macros is not useful
in practice.

gdb/ChangeLog
2019-03-15  Tom Tromey  <tom@tromey.com>

	* symtab.h (struct minimal_symbol): Derive from
	general_symbol_info.
	(MSYMBOL_VALUE, MSYMBOL_VALUE_RAW_ADDRESS)
	(MSYMBOL_VALUE_ADDRESS, MSYMBOL_VALUE_BYTES)
	(MSYMBOL_BLOCK_VALUE, MSYMBOL_VALUE_CHAIN, MSYMBOL_LANGUAGE)
	(MSYMBOL_SECTION, MSYMBOL_OBJ_SECTION, MSYMBOL_NATURAL_NAME)
	(MSYMBOL_LINKAGE_NAME, MSYMBOL_DEMANGLED_NAME)
	(MSYMBOL_SEARCH_NAME): Update.
	(MSYMBOL_SET_LANGUAGE, MSYMBOL_SET_NAMES): Remove.
	* solib.c (gdb_bfd_lookup_symbol_from_symtab): Don't use memset.
	* minsyms.c (minimal_symbol_reader::record_full): Update.
2019-03-15 16:02:10 -06:00
Tom Tromey 0747795c08 Normalize includes to use common/
This changes all includes to use the form "common/filename.h" rather
than just "filename.h".  This was written by a script.

gdb/ChangeLog
2019-01-25  Tom Tromey  <tom@tromey.com>

	* xtensa-linux-nat.c: Fix common/ includes.
	* xml-support.h: Fix common/ includes.
	* xml-support.c: Fix common/ includes.
	* x86-linux-nat.c: Fix common/ includes.
	* windows-nat.c: Fix common/ includes.
	* varobj.h: Fix common/ includes.
	* varobj.c: Fix common/ includes.
	* value.c: Fix common/ includes.
	* valops.c: Fix common/ includes.
	* utils.c: Fix common/ includes.
	* unittests/xml-utils-selftests.c: Fix common/ includes.
	* unittests/utils-selftests.c: Fix common/ includes.
	* unittests/unpack-selftests.c: Fix common/ includes.
	* unittests/tracepoint-selftests.c: Fix common/ includes.
	* unittests/style-selftests.c: Fix common/ includes.
	* unittests/string_view-selftests.c: Fix common/ includes.
	* unittests/scoped_restore-selftests.c: Fix common/ includes.
	* unittests/scoped_mmap-selftests.c: Fix common/ includes.
	* unittests/scoped_fd-selftests.c: Fix common/ includes.
	* unittests/rsp-low-selftests.c: Fix common/ includes.
	* unittests/parse-connection-spec-selftests.c: Fix common/
	includes.
	* unittests/optional-selftests.c: Fix common/ includes.
	* unittests/offset-type-selftests.c: Fix common/ includes.
	* unittests/observable-selftests.c: Fix common/ includes.
	* unittests/mkdir-recursive-selftests.c: Fix common/ includes.
	* unittests/memrange-selftests.c: Fix common/ includes.
	* unittests/memory-map-selftests.c: Fix common/ includes.
	* unittests/lookup_name_info-selftests.c: Fix common/ includes.
	* unittests/function-view-selftests.c: Fix common/ includes.
	* unittests/environ-selftests.c: Fix common/ includes.
	* unittests/copy_bitwise-selftests.c: Fix common/ includes.
	* unittests/common-utils-selftests.c: Fix common/ includes.
	* unittests/cli-utils-selftests.c: Fix common/ includes.
	* unittests/array-view-selftests.c: Fix common/ includes.
	* ui-file.c: Fix common/ includes.
	* tui/tui-io.c: Fix common/ includes.
	* tracepoint.h: Fix common/ includes.
	* tracepoint.c: Fix common/ includes.
	* tracefile-tfile.c: Fix common/ includes.
	* top.h: Fix common/ includes.
	* top.c: Fix common/ includes.
	* thread.c: Fix common/ includes.
	* target/waitstatus.h: Fix common/ includes.
	* target/waitstatus.c: Fix common/ includes.
	* target.h: Fix common/ includes.
	* target.c: Fix common/ includes.
	* target-memory.c: Fix common/ includes.
	* target-descriptions.c: Fix common/ includes.
	* symtab.h: Fix common/ includes.
	* symfile.c: Fix common/ includes.
	* stap-probe.c: Fix common/ includes.
	* spu-linux-nat.c: Fix common/ includes.
	* sparc-nat.c: Fix common/ includes.
	* source.c: Fix common/ includes.
	* solib.c: Fix common/ includes.
	* solib-target.c: Fix common/ includes.
	* ser-unix.c: Fix common/ includes.
	* ser-tcp.c: Fix common/ includes.
	* ser-pipe.c: Fix common/ includes.
	* ser-base.c: Fix common/ includes.
	* selftest-arch.c: Fix common/ includes.
	* s12z-tdep.c: Fix common/ includes.
	* rust-exp.y: Fix common/ includes.
	* rs6000-aix-tdep.c: Fix common/ includes.
	* riscv-tdep.c: Fix common/ includes.
	* remote.c: Fix common/ includes.
	* remote-notif.h: Fix common/ includes.
	* remote-fileio.h: Fix common/ includes.
	* remote-fileio.c: Fix common/ includes.
	* regcache.h: Fix common/ includes.
	* regcache.c: Fix common/ includes.
	* record-btrace.c: Fix common/ includes.
	* python/python.c: Fix common/ includes.
	* python/py-type.c: Fix common/ includes.
	* python/py-inferior.c: Fix common/ includes.
	* progspace.h: Fix common/ includes.
	* producer.c: Fix common/ includes.
	* procfs.c: Fix common/ includes.
	* proc-api.c: Fix common/ includes.
	* printcmd.c: Fix common/ includes.
	* ppc-linux-nat.c: Fix common/ includes.
	* parser-defs.h: Fix common/ includes.
	* osdata.c: Fix common/ includes.
	* obsd-nat.c: Fix common/ includes.
	* nat/x86-linux.c: Fix common/ includes.
	* nat/x86-linux-dregs.c: Fix common/ includes.
	* nat/x86-dregs.h: Fix common/ includes.
	* nat/x86-dregs.c: Fix common/ includes.
	* nat/ppc-linux.c: Fix common/ includes.
	* nat/mips-linux-watch.h: Fix common/ includes.
	* nat/mips-linux-watch.c: Fix common/ includes.
	* nat/linux-waitpid.c: Fix common/ includes.
	* nat/linux-ptrace.h: Fix common/ includes.
	* nat/linux-ptrace.c: Fix common/ includes.
	* nat/linux-procfs.c: Fix common/ includes.
	* nat/linux-personality.c: Fix common/ includes.
	* nat/linux-osdata.c: Fix common/ includes.
	* nat/linux-namespaces.c: Fix common/ includes.
	* nat/linux-btrace.h: Fix common/ includes.
	* nat/linux-btrace.c: Fix common/ includes.
	* nat/fork-inferior.c: Fix common/ includes.
	* nat/amd64-linux-siginfo.c: Fix common/ includes.
	* nat/aarch64-sve-linux-ptrace.c: Fix common/ includes.
	* nat/aarch64-linux.c: Fix common/ includes.
	* nat/aarch64-linux-hw-point.h: Fix common/ includes.
	* nat/aarch64-linux-hw-point.c: Fix common/ includes.
	* namespace.h: Fix common/ includes.
	* mips-linux-tdep.c: Fix common/ includes.
	* minsyms.c: Fix common/ includes.
	* mi/mi-parse.h: Fix common/ includes.
	* mi/mi-main.c: Fix common/ includes.
	* mi/mi-cmd-env.c: Fix common/ includes.
	* memrange.h: Fix common/ includes.
	* memattr.c: Fix common/ includes.
	* maint.h: Fix common/ includes.
	* maint.c: Fix common/ includes.
	* main.c: Fix common/ includes.
	* machoread.c: Fix common/ includes.
	* location.c: Fix common/ includes.
	* linux-thread-db.c: Fix common/ includes.
	* linux-nat.c: Fix common/ includes.
	* linux-fork.c: Fix common/ includes.
	* inline-frame.c: Fix common/ includes.
	* infrun.c: Fix common/ includes.
	* inflow.c: Fix common/ includes.
	* inferior.h: Fix common/ includes.
	* inferior.c: Fix common/ includes.
	* infcmd.c: Fix common/ includes.
	* inf-ptrace.c: Fix common/ includes.
	* inf-child.c: Fix common/ includes.
	* ia64-linux-nat.c: Fix common/ includes.
	* i387-tdep.c: Fix common/ includes.
	* i386-tdep.c: Fix common/ includes.
	* i386-linux-tdep.c: Fix common/ includes.
	* i386-linux-nat.c: Fix common/ includes.
	* i386-go32-tdep.c: Fix common/ includes.
	* i386-fbsd-tdep.c: Fix common/ includes.
	* i386-fbsd-nat.c: Fix common/ includes.
	* guile/scm-type.c: Fix common/ includes.
	* guile/guile.c: Fix common/ includes.
	* go32-nat.c: Fix common/ includes.
	* gnu-nat.c: Fix common/ includes.
	* gdbthread.h: Fix common/ includes.
	* gdbarch-selftests.c: Fix common/ includes.
	* gdb_usleep.c: Fix common/ includes.
	* gdb_select.h: Fix common/ includes.
	* gdb_bfd.c: Fix common/ includes.
	* gcore.c: Fix common/ includes.
	* fork-child.c: Fix common/ includes.
	* findvar.c: Fix common/ includes.
	* fbsd-nat.c: Fix common/ includes.
	* event-top.c: Fix common/ includes.
	* event-loop.c: Fix common/ includes.
	* dwarf2read.c: Fix common/ includes.
	* dwarf2loc.c: Fix common/ includes.
	* dwarf2-frame.c: Fix common/ includes.
	* dwarf-index-cache.c: Fix common/ includes.
	* dtrace-probe.c: Fix common/ includes.
	* disasm-selftests.c: Fix common/ includes.
	* defs.h: Fix common/ includes.
	* csky-tdep.c: Fix common/ includes.
	* cp-valprint.c: Fix common/ includes.
	* cp-support.h: Fix common/ includes.
	* cp-support.c: Fix common/ includes.
	* corelow.c: Fix common/ includes.
	* completer.h: Fix common/ includes.
	* completer.c: Fix common/ includes.
	* compile/compile.c: Fix common/ includes.
	* compile/compile-loc2c.c: Fix common/ includes.
	* compile/compile-cplus-types.c: Fix common/ includes.
	* compile/compile-cplus-symbols.c: Fix common/ includes.
	* command.h: Fix common/ includes.
	* cli/cli-dump.c: Fix common/ includes.
	* cli/cli-cmds.c: Fix common/ includes.
	* charset.c: Fix common/ includes.
	* build-id.c: Fix common/ includes.
	* btrace.h: Fix common/ includes.
	* btrace.c: Fix common/ includes.
	* breakpoint.h: Fix common/ includes.
	* breakpoint.c: Fix common/ includes.
	* ax.h:
	(enum agent_op): Fix common/ includes.
	* ax-general.c (struct aop_map): Fix common/ includes.
	* ax-gdb.c: Fix common/ includes.
	* auxv.c: Fix common/ includes.
	* auto-load.c: Fix common/ includes.
	* arm-tdep.c: Fix common/ includes.
	* arch/riscv.c: Fix common/ includes.
	* arch/ppc-linux-common.c: Fix common/ includes.
	* arch/i386.c: Fix common/ includes.
	* arch/arm.c: Fix common/ includes.
	* arch/arm-linux.c: Fix common/ includes.
	* arch/arm-get-next-pcs.c: Fix common/ includes.
	* arch/amd64.c: Fix common/ includes.
	* arch/aarch64.c: Fix common/ includes.
	* arch/aarch64-insn.c: Fix common/ includes.
	* arch-utils.c: Fix common/ includes.
	* amd64-windows-tdep.c: Fix common/ includes.
	* amd64-tdep.c: Fix common/ includes.
	* amd64-sol2-tdep.c: Fix common/ includes.
	* amd64-obsd-tdep.c: Fix common/ includes.
	* amd64-nbsd-tdep.c: Fix common/ includes.
	* amd64-linux-tdep.c: Fix common/ includes.
	* amd64-linux-nat.c: Fix common/ includes.
	* amd64-fbsd-tdep.c: Fix common/ includes.
	* amd64-fbsd-nat.c: Fix common/ includes.
	* amd64-dicos-tdep.c: Fix common/ includes.
	* amd64-darwin-tdep.c: Fix common/ includes.
	* agent.c: Fix common/ includes.
	* ada-lang.h: Fix common/ includes.
	* ada-lang.c: Fix common/ includes.
	* aarch64-tdep.c: Fix common/ includes.

gdb/gdbserver/ChangeLog
2019-01-25  Tom Tromey  <tom@tromey.com>

	* win32-low.c: Fix common/ includes.
	* win32-i386-low.c: Fix common/ includes.
	* tracepoint.c: Fix common/ includes.
	* thread-db.c: Fix common/ includes.
	* target.h: Fix common/ includes.
	* symbol.c: Fix common/ includes.
	* spu-low.c: Fix common/ includes.
	* server.h: Fix common/ includes.
	* server.c: Fix common/ includes.
	* remote-utils.c: Fix common/ includes.
	* regcache.h: Fix common/ includes.
	* regcache.c: Fix common/ includes.
	* nto-x86-low.c: Fix common/ includes.
	* notif.h: Fix common/ includes.
	* mem-break.h: Fix common/ includes.
	* lynx-low.c: Fix common/ includes.
	* lynx-i386-low.c: Fix common/ includes.
	* linux-x86-tdesc-selftest.c: Fix common/ includes.
	* linux-x86-low.c: Fix common/ includes.
	* linux-low.c: Fix common/ includes.
	* inferiors.h: Fix common/ includes.
	* i387-fp.c: Fix common/ includes.
	* hostio.c: Fix common/ includes.
	* hostio-errno.c: Fix common/ includes.
	* gdbthread.h: Fix common/ includes.
	* gdbreplay.c: Fix common/ includes.
	* fork-child.c: Fix common/ includes.
	* event-loop.c: Fix common/ includes.
	* ax.c:
	(enum gdb_agent_op): Fix common/ includes.
2019-01-25 15:28:16 -07:00
Tom Tromey 2030c07971 Change all_objfiles adapter to be a method on program_space
This changes the all_objfiles range adapter to be a method on the
program space, and fixes up all the users.

gdb/ChangeLog
2019-01-17  Tom Tromey  <tom@tromey.com>

	* progspace.h (program_space) <objfiles_range>: New typedef.
	<objfiles>: New method.
	<objfiles_head>: Rename from objfiles.
	(object_files): Update.
	* guile/scm-progspace.c (gdbscm_progspace_objfiles): Update.
	* guile/scm-pretty-print.c
	(ppscm_find_pretty_printer_from_objfiles): Update.
	* guile/scm-objfile.c (gdbscm_objfiles): Update.
	* python/py-xmethods.c (gdbpy_get_matching_xmethod_workers):
	Update.
	* python/py-progspace.c (pspy_get_objfiles): Update.
	* python/py-prettyprint.c (find_pretty_printer_from_objfiles):
	Update.
	* python/py-objfile.c (objfpy_lookup_objfile_by_name)
	(objfpy_lookup_objfile_by_build_id): Update.
	* mi/mi-cmd-file.c (mi_cmd_file_list_exec_source_files): Update.
	* windows-tdep.c (windows_iterate_over_objfiles_in_search_order):
	Update.
	* symtab.c (iterate_over_symtabs, matching_obj_sections)
	(expand_symtab_containing_pc, lookup_objfile_from_block)
	(lookup_static_symbol, basic_lookup_transparent_type)
	(find_pc_sect_compunit_symtab, find_symbol_at_address)
	(find_line_symtab, info_sources_command)
	(default_collect_symbol_completion_matches_break_on)
	(make_source_files_completion_list, find_main_name): Update.
	* symmisc.c (print_symbol_bcache_statistics)
	(print_objfile_statistics, maintenance_print_symbols)
	(maintenance_print_msymbols, maintenance_print_objfiles)
	(maintenance_info_symtabs, maintenance_check_symtabs)
	(maintenance_expand_symtabs, maintenance_info_line_tables):
	Update.
	* symfile.c (remove_symbol_file_command, overlay_invalidate_all)
	(find_pc_overlay, find_pc_mapped_section, list_overlays_command)
	(map_overlay_command, unmap_overlay_command)
	(simple_overlay_update, expand_symtabs_matching)
	(map_symbol_filenames): Update.
	* symfile-debug.c (set_debug_symfile): Update.
	* spu-tdep.c (spu_overlay_update, spu_objfile_from_frame):
	Update.
	* source.c (select_source_symtab, forget_cached_source_info):
	Update.
	* solib.c (solib_read_symbols): Update.
	* solib-spu.c (append_ocl_sos): Update.
	* psymtab.c (maintenance_print_psymbols)
	(maintenance_info_psymtabs, maintenance_check_psymtabs): Update.
	* probe.c (parse_probes_in_pspace, find_probe_by_pc): Update.
	* printcmd.c (info_symbol_command): Update.
	* ppc-linux-tdep.c (ppc_linux_spe_context_inferior_created):
	Update.
	* objfiles.h (class all_objfiles): Remove.
	* objfiles.c (have_partial_symbols, have_full_symbols)
	(have_minimal_symbols, qsort_cmp, update_section_map)
	(shared_objfile_contains_address_p)
	(default_iterate_over_objfiles_in_search_order): Update.
	* objc-lang.c (info_selectors_command, info_classes_command)
	(find_methods): Update.
	* minsyms.c (find_solib_trampoline_target): Update.
	* maint.c (maintenance_info_sections)
	(maintenance_translate_address, count_symtabs_and_blocks):
	Update.
	* main.c (captured_main_1): Update.
	* linux-thread-db.c (try_thread_db_load_from_pdir)
	(has_libpthread): Update.
	* linespec.c (iterate_over_all_matching_symtabs)
	(search_minsyms_for_name): Update.
	* jit.c (jit_find_objf_with_entry_addr): Update.
	* hppa-tdep.c (find_unwind_entry)
	(hppa_lookup_stub_minimal_symbol): Update.
	* gcore.c (gcore_create_callback, objfile_find_memory_regions):
	Update.
	* elfread.c (elf_gnu_ifunc_resolve_by_cache)
	(elf_gnu_ifunc_resolve_by_got): Update.
	* dwarf2-frame.c (dwarf2_frame_find_fde): Update.
	* dwarf-index-write.c (save_gdb_index_command): Update.
	* cp-support.c (add_symbol_overload_list_qualified): Update.
	* breakpoint.c (create_overlay_event_breakpoint)
	(create_longjmp_master_breakpoint)
	(create_std_terminate_master_breakpoint)
	(create_exception_master_breakpoint): Update.
	* blockframe.c (find_pc_partial_function): Update.
	* ada-lang.c (ada_lookup_simple_minsym, add_nonlocal_symbols)
	(ada_collect_symbol_completion_matches)
	(ada_add_global_exceptions): Update.
2019-01-17 15:34:37 -07:00
Tom Tromey 6471e7d23d Replace "the the" with "the"
This replaces "the the" with "the" in various comments.

Tested by rebuilding.  This didn't test the solib-dsbt.c change, but
it looks harmless.

gdb/ChangeLog
2019-01-17  Tom Tromey  <tromey@bapiya>

	* valprint.c: Replace "the the" with "the".
	* symtab.c: Replace "the the" with "the".
	* solib.c: Replace "the the" with "the".
	* solib-dsbt.c: Replace "the the" with "the".
	* linespec.c: Replace "the the" with "the".
	* dwarf2loc.h: Replace "the the" with "the".
	* amd64-windows-tdep.c: Replace "the the" with "the".
	* aarch64-tdep.c: Replace "the the" with "the".
2019-01-17 10:22:44 -07:00
Tom Tromey aed57c5371 Remove most uses of ALL_OBJFILES
This removes most uses of ALL_OBJFILES, replacing them with ranged for
loops.  The remaining uses are all in macros, and will be removed in
subsequent patches.

gdb/ChangeLog
2019-01-09  Tom Tromey  <tom@tromey.com>

	* symtab.c (iterate_over_symtabs, matching_obj_sections)
	(expand_symtab_containing_pc, lookup_static_symbol)
	(basic_lookup_transparent_type, find_pc_sect_compunit_symtab)
	(find_symbol_at_address, find_line_symtab, find_main_name): Use
	all_objfiles.
	* probe.c (find_probe_by_pc, collect_probes): Use all_objfiles.
	* breakpoint.c (create_overlay_event_breakpoint)
	(create_longjmp_master_breakpoint)
	(create_std_terminate_master_breakpoint)
	(create_exception_master_breakpoint): Use all_objfiles.
	* linux-thread-db.c (try_thread_db_load_from_pdir)
	(has_libpthread): Use all_objfiles.
	* ada-lang.c (add_nonlocal_symbols): Use all_objfiles.
	* linespec.c (iterate_over_all_matching_symtabs)
	(search_minsyms_for_name): Use all_objfiles.
	* maint.c (maintenance_info_sections): Use all_objfiles.
	* main.c (captured_main_1): Use all_objfiles.
	* spu-tdep.c (spu_objfile_from_frame): Use all_objfiles.
	* guile/scm-objfile.c (gdbscm_objfiles): Use all_objfiles.
	* guile/scm-pretty-print.c
	(ppscm_find_pretty_printer_from_objfiles): Use all_objfiles.
	* solib-spu.c (append_ocl_sos): Use all_objfiles.
	* symmisc.c (maintenance_print_symbols): Use all_objfiles.
	(maintenance_print_msymbols): Use all_objfiles.
	* source.c (select_source_symtab): Use all_objfiles.
	* jit.c (jit_find_objf_with_entry_addr): Use all_objfiles.
	* symfile.c (remove_symbol_file_command)
	(expand_symtabs_matching, map_symbol_filenames): Use
	all_objfiles.
	* ppc-linux-tdep.c (ppc_linux_spe_context_inferior_created): Use
	all_objfiles.
	* dwarf2-frame.c (dwarf2_frame_find_fde): Use all_objfiles.
	* objc-lang.c (find_methods): Use all_objfiles.
	* objfiles.c (have_partial_symbols, have_full_symbols)
	(have_minimal_symbols, qsort_cmp)
	(default_iterate_over_objfiles_in_search_order): Use
	all_objfiles.
	* hppa-tdep.c (find_unwind_entry): Use all_objfiles.
	* psymtab.c (maintenance_print_psymbols): Use all_objfiles.
	(maintenance_check_psymtabs): Use all_objfiles.
	(ALL_PSYMTABS): Remove.
	* compile/compile-object-run.c (do_module_cleanup): Use
	all_objfiles.
	* blockframe.c (find_pc_partial_function): Use all_objfiles.
	* cp-support.c (add_symbol_overload_list_qualified): Use
	all_objfiles.
	* windows-tdep.c (windows_iterate_over_objfiles_in_search_order):
	Use all_objfiles.
	* dwarf-index-write.c (save_gdb_index_command): Use all_objfiles.
	* python/py-xmethods.c (gdbpy_get_matching_xmethod_workers): Use
	all_objfiles.
	* python/py-objfile.c (objfpy_lookup_objfile_by_name)
	(objfpy_lookup_objfile_by_build_id): Use all_objfiles.
	* python/py-prettyprint.c (find_pretty_printer_from_objfiles):
	Uses all_objfiles.
	* solib.c (solib_read_symbols): Use all_objfiles
2019-01-09 18:28:14 -07:00
Joel Brobecker 42a4f53d2b Update copyright year range in all GDB files.
This commit applies all changes made after running the gdb/copyright.py
script.

Note that one file was flagged by the script, due to an invalid
copyright header
(gdb/unittests/basic_string_view/element_access/char/empty.cc).
As the file was copied from GCC's libstdc++-v3 testsuite, this commit
leaves this file untouched for the time being; a patch to fix the header
was sent to gcc-patches first.

gdb/ChangeLog:

	Update copyright year range in all GDB files.
2019-01-01 10:01:51 +04:00
Tom Tromey d7e15655a4 Remove ptid_equal
Remove ptid_equal in favor of using "==".

gdb/ChangeLog
2018-07-03  Tom Tromey  <tom@tromey.com>

	* common/ptid.c (ptid_equal): Remove.
	* common/ptid.h (ptid_equal): Don't declare.
	* ada-tasks.c: Update.
	* breakpoint.c: Update.
	* common/agent.c: Update.
	* corelow.c: Update.
	* darwin-nat-info.c: Update.
	* darwin-nat.c: Update.
	* dcache.c: Update.
	* dtrace-probe.c: Update.
	* dummy-frame.c: Update.
	* fbsd-nat.c: Update.
	* frame.c: Update.
	* gdbthread.h: Update.
	* gnu-nat.c: Update.
	* go32-nat.c: Update.
	* inf-loop.c: Update.
	* inf-ptrace.c: Update.
	* infcall.c: Update.
	* infcmd.c: Update.
	* inflow.c: Update.
	* infrun.c: Update.
	* linux-fork.c: Update.
	* linux-nat.c: Update.
	* linux-thread-db.c: Update.
	* mi/mi-cmd-var.c: Update.
	* mi/mi-interp.c: Update.
	* mi/mi-main.c: Update.
	* nto-procfs.c: Update.
	* ppc-linux-tdep.c: Update.
	* procfs.c: Update.
	* python/py-inferior.c: Update.
	* python/py-record-btrace.c: Update.
	* python/py-record.c: Update.
	* ravenscar-thread.c: Update.
	* regcache.c: Update.
	* remote-sim.c: Update.
	* remote.c: Update.
	* sol-thread.c: Update.
	* solib.c: Update.
	* target.c: Update.
	* tui/tui-stack.c: Update.
	* varobj.c: Update.
	* windows-nat.c: Update.
	* windows-tdep.c: Update.

gdb/gdbserver/ChangeLog
2018-07-03  Tom Tromey  <tom@tromey.com>

	* linux-low.c: Update.
	* lynx-low.c: Update.
	* mem-break.c: Update.
	* nto-low.c: Update.
	* remote-utils.c: Update.
	* server.c: Update.
	* spu-low.c: Update.
	* target.c: Update.
	* win32-low.c: Update.
2018-07-03 11:36:46 -06:00
Tom Tromey bcb430e4cd Change program_space::added_solibs to a std::vector
This changes program_space::added_solibs to a std::vector, removing a
VEC.

Tested by the buildbot.

gdb/ChangeLog
2018-05-29  Tom Tromey  <tom@tromey.com>

	* progspace.h (so_list_ptr): Remove typedef.  Don't declare VEC.
	(struct program_space) <added_solibs>: Now a std::vector.
	* breakpoint.c (print_solib_event): Update.
	(check_status_catch_solib): Update.
	* progspace.c (clear_program_space_solib_cache): Update.
	* solib.c (update_solib_list): Update.
2018-05-29 11:51:11 -06:00
Tom Tromey 29f9434081 Remove interp_ui_out
The function interp_ui_out simply calls the interp_ui_out method.
However, if it is passed a NULL interpreter, it first finds the
current interpreter.  I believe, though, that NULL is never passed
here, and I think it's simpler to just remove this function and
require callers to be more explicit.

ChangeLog
2018-05-25  Tom Tromey	<tom@tromey.com>

	* utils.c (fputs_maybe_filtered): Update.
	* linespec.c (decode_line_full): Update.
	* mi/mi-interp.c (mi_on_normal_stop_1, mi_tsv_modified)
	(mi_print_breakpoint_for_event, mi_solib_loaded)
	(mi_solib_unloaded, mi_command_param_changed, mi_memory_changed)
	(mi_user_selected_context_changed): Update.
	* mi/mi-main.c (mi_execute_command): Update.
	* cli/cli-script.c (execute_control_command): Update.
	* python/python.c (execute_gdb_command): Update.
	* solib.c (info_sharedlibrary_command): Update.
	* interps.c (interp_ui_out): Remove.
	* interps.h (interp_ui_out): Remove.
2018-05-25 12:41:01 -06:00
Tom Tromey 76727919ce Convert observers to C++
This converts observers from using a special source-generating script
to be plain C++.  This version of the patch takes advantage of C++11
by using std::function and variadic templates; incorporates Pedro's
patches; and renames the header file to "observable.h" (this change
eliminates the need for a clean rebuild).

Note that Pedro's patches used a template lambda in tui-hooks.c, but
this failed to compile on some buildbot instances (presumably due to
differing C++ versions); I replaced this with an ordinary template
function.

Regression tested on the buildbot.

gdb/ChangeLog
2018-03-19  Pedro Alves  <palves@redhat.com>
	    Tom Tromey  <tom@tromey.com>

	* unittests/observable-selftests.c: New file.
	* common/observable.h: New file.
	* observable.h: New file.
	* ada-lang.c, ada-tasks.c, agent.c, aix-thread.c, annotate.c,
	arm-tdep.c, auto-load.c, auxv.c, break-catch-syscall.c,
	breakpoint.c, bsd-uthread.c, cli/cli-interp.c, cli/cli-setshow.c,
	corefile.c, dummy-frame.c, event-loop.c, event-top.c, exec.c,
	extension.c, frame.c, gdbarch.c, guile/scm-breakpoint.c,
	infcall.c, infcmd.c, inferior.c, inflow.c, infrun.c, jit.c,
	linux-tdep.c, linux-thread-db.c, m68klinux-tdep.c,
	mi/mi-cmd-break.c, mi/mi-interp.c, mi/mi-main.c, objfiles.c,
	ppc-linux-nat.c, ppc-linux-tdep.c, printcmd.c, procfs.c,
	python/py-breakpoint.c, python/py-finishbreakpoint.c,
	python/py-inferior.c, python/py-unwind.c, ravenscar-thread.c,
	record-btrace.c, record-full.c, record.c, regcache.c, remote.c,
	riscv-tdep.c, sol-thread.c, solib-aix.c, solib-spu.c, solib.c,
	spu-multiarch.c, spu-tdep.c, stack.c, symfile-mem.c, symfile.c,
	symtab.c, thread.c, top.c, tracepoint.c, tui/tui-hooks.c,
	tui/tui-interp.c, valops.c: Update all users.
	* tui/tui-hooks.c (tui_bp_created_observer)
	(tui_bp_deleted_observer, tui_bp_modified_observer)
	(tui_inferior_exit_observer, tui_before_prompt_observer)
	(tui_normal_stop_observer, tui_register_changed_observer):
	Remove.
	(tui_observers_token): New global.
	(attach_or_detach, tui_attach_detach_observers): New functions.
	(tui_install_hooks, tui_remove_hooks): Use
	tui_attach_detach_observers.
	* record-btrace.c (record_btrace_thread_observer): Remove.
	(record_btrace_thread_observer_token): New global.
	* observer.sh: Remove.
	* observer.c: Rename to observable.c.
	* observable.c (namespace gdb_observers): Define new objects.
	(observer_debug): Move into gdb_observers namespace.
	(struct observer, struct observer_list, xalloc_observer_list_node)
	(xfree_observer_list_node, generic_observer_attach)
	(generic_observer_detach, generic_observer_notify): Remove.
	(_initialize_observer): Update.
	Don't include observer.inc.
	* Makefile.in (generated_files): Remove observer.h, observer.inc.
	(clean mostlyclean): Likewise.
	(observer.h, observer.inc): Remove targets.
	(SUBDIR_UNITTESTS_SRCS): Add observable-selftests.c.
	(COMMON_SFILES): Use observable.c, not observer.c.
	* .gitignore: Remove observer.h.

gdb/doc/ChangeLog
2018-03-19  Tom Tromey  <tom@tromey.com>

	* observer.texi: Remove.

gdb/testsuite/ChangeLog
2018-03-19  Tom Tromey  <tom@tromey.com>

	* gdb.gdb/observer.exp: Remove.
2018-03-19 09:37:49 -06:00
Tom Tromey 1cb1f3dae7 Remove some cleanups from solib.c
This removes some cleanups from solib.c, replacing them with
gdb::def_vector.

Regression tested by the buildbot.

gdb/ChangeLog
2018-03-18  Tom Tromey  <tom@tromey.com>

	* solib.c (gdb_bfd_lookup_symbol_from_symtab): Use
	gdb::def_vector.
	(bfd_lookup_symbol_from_dyn_symtab): Likewise.
2018-03-18 21:50:00 -06:00
Tom Tromey 37e136b168 Remove make_cleanup_free_section_addr_info
This removes make_cleanup_free_section_addr_info.  Instead -- per
Simon's suggestion -- this changes section_addr_info to be a
std::vector.

Regression tested by the buildbot.

gdb/ChangeLog
2018-03-16  Tom Tromey  <tom@tromey.com>

	* xcoffread.c (xcoff_symfile_offsets): Change type of "addrs".
	* utils.h (make_cleanup_free_section_addr_info): Don't declare.
	* utils.c (do_free_section_addr_info)
	(make_cleanup_free_section_addr_info): Remove.
	* symfile.h (struct other_sections): Add constructor.
	(struct section_addr_info): Remove.
	(section_addr_info): New typedef.
	(struct sym_fns) <sym_offsets>: Change type of parameter.
	(build_section_addr_info_from_objfile)
	(relative_addr_info_to_section_offsets, addr_info_make_relative)
	(default_symfile_offsets, symbol_file_add)
	(symbol_file_add_from_bfd)
	(build_section_addr_info_from_section_table): Update.
	(alloc_section_addr_info, free_section_addr_info): Don't declare.
	* symfile.c (alloc_section_addr_info): Remove.
	(build_section_addr_info_from_section_table): Change return type.
	Update.
	(build_section_addr_info_from_bfd)
	(build_section_addr_info_from_objfile): Likewise.
	(free_section_addr_info): Remove.
	(relative_addr_info_to_section_offsets): Change type of "addrs".
	(addrs_section_compar): Now a std::sort comparator.
	(addrs_section_sort): Change return type.
	(addr_info_make_relative): Change type of "addrs".  Update.
	(default_symfile_offsets, syms_from_objfile_1)
	(syms_from_objfile, symbol_file_add_with_addrs): Likewise.
	(symbol_file_add_separate): Update.
	(symbol_file_add): Change type of "addrs".  Update.
	(add_symbol_file_command): Update.  Remove cleanups.
	* symfile-mem.c (symbol_file_add_from_memory): Update.  Remove
	cleanups.
	* symfile-debug.c (debug_sym_offsets): Change type of "info".
	* solib.c (solib_read_symbols): Update.
	* objfiles.c (objfile_relocate): Update.  Remove cleanups.
	* machoread.c (macho_symfile_offsets): Update.
	* jit.c (jit_bfd_try_read_symtab): Update.
2018-03-16 14:22:13 -06:00
Simon Marchi 6fb16ce6ea Make program_space::deleted_solibs a vector of std::string
This allows removing a usage of free_char_ptr_vec.

gdb/ChangeLog:

	* progspace.h (struct program_space) <deleted_solibs>: Change
	type to std::vector<std::string>.
	* progspace.c (clear_program_space_solib_cache): Adjust.
	* breakpoint.c (print_solib_event): Adjust.
	(check_status_catch_solib): Adjust.
	* solib.c (update_solib_list): Adjust.
	* ui-out.h (class ui_out) <field_string>: New overload.
	* ui-out.c (ui_out::field_string): New overload.
2018-03-02 23:22:09 -05:00
Tom Tromey 692d6f9760 Constify target_so_ops::bfd_open
This constifies the bfd_open method of struct target_so_ops.

gdb/ChangeLog
2018-02-14  Tom Tromey  <tom@tromey.com>

	* solist.h (struct target_so_ops) <bfd_open>: Make pathname
	const.
	(solib_bfd_open): Make pathname const.
	* solib.c (solib_bfd_open): Make pathname const.
	* solib-spu.c (spu_bfd_fopen): Make name const.
	(spu_bfd_open): Make pathname const.
	* solib-darwin.c (darwin_bfd_open): Make pathname const.
	* solib-aix.c (solib_aix_bfd_open): Make pathname const.
2018-02-14 08:09:53 -07:00
Tom Tromey e0cc99a62f Change openp et al to use a unique_xmalloc_ptr
This changes openp, source_full_path_of, and find_and_open_source to
take a unique_xmalloc_ptr, rather than a char*, as an outgoing
argument type.  This simplifies the API, ownership-wise, and allows
for the removal of some cleanups.

gdb/ChangeLog
2018-02-14  Tom Tromey  <tom@tromey.com>

	* symfile.c (symfile_bfd_open): Update.
	* source.h (openp, source_full_path_of, find_and_open_source):
	Change argument type to unique_xmalloc_ptr.
	* source.c (openp): Take a unique_xmalloc_ptr.
	(source_full_path_of, find_and_open_source): Likewise.
	(open_source_file, symtab_to_fullname): Update.
	* solist.h (struct target_so_ops) <find_and_open_solib>: Take a
	unique_xmalloc_ptr.
	* solib.c (solib_find_1): Use unique_xmalloc_ptr.
	(exec_file_find): Update.
	* psymtab.c (psymtab_to_fullname): Update.
	* nto-tdep.h (nto_find_and_open_solib): Update.
	* nto-tdep.c (nto_find_and_open_solib): Change temp_path to a
	unique_xmalloc_ptr.
	* exec.c (exec_file_attach): Update.
	* dwarf2read.c (try_open_dwop_file): Use unique_xmalloc_ptr.
	* cli/cli-cmds.c (find_and_open_script): Use unique_xmalloc_ptr.
2018-02-14 08:09:53 -07:00
Tom Tromey b46a8d7c1d Move some declarations to source.h
I noticed a few declarations in defs.h that really could be put into
source.h.  I think it's generally preferable to something out of
defs.h unless it is needed by most of the files in gdb.

gdb/ChangeLog
2018-02-14  Tom Tromey  <tom@tromey.com>

	* solib.c: Include source.h.
	* nto-tdep.c: Include source.h.
	* mi/mi-cmd-env.c: Include source.h.
	* infcmd.c: Include source.h.
	* exec.c: Include source.h.
	* defs.h (enum openp_flag, openp, source_full_path_of, mod_path)
	(add_path, directory_switch, source_path, init_source_path): Move
	declarations...
	* source.h (enum openp_flag, openp, source_full_path_of, mod_path)
	(add_path, directory_switch, source_path, init_source_path):
	...here.
2018-02-14 08:09:52 -07:00
Tom Tromey 797bc1cb25 Return unique_xmalloc_ptr from some solib.c functions
This changes a couple of solib.c functions -- exec_file_find and
solib_find -- to return a unique_xmalloc_ptr, and then fixes up the
users.  This allows the removal of some cleanups.

This also changes solib_bfd_open to not take ownership of its
argument.  I think this change is somewhat cleaner.

gdb/ChangeLog
2018-02-14  Tom Tromey  <tom@tromey.com>

	* solist.h (exec_file_find, solib_find): Return
	unique_xmalloc_ptr.
	(solib_bfd_fopen): Take a const char *.
	* solib.c (solib_find_1): Return unique_xmalloc_ptr.
	(exec_file_find, solib_find): Likewise.
	(solib_bfd_fopen): Do not take ownership of "pathname".
	(solib_bfd_open): Use unique_xmalloc_ptr.
	* solib-darwin.c (darwin_bfd_open): Use unique_xmalloc_ptr.
	* solib-aix.c (solib_aix_bfd_open): Use unique_xmalloc_ptr.
	* infrun.c (follow_exec): Use unique_xmalloc_ptr.
	* exec.c (exec_file_locate_attach): Use unique_xmalloc_ptr.
2018-02-14 08:09:52 -07:00
Tom Tromey 9a897d43f0 Remove cleanups from solib.c
This removes a couple of cleanups from solib.c, replacing one with
std::string and another with unique_xmalloc_ptr.

2018-02-08  Tom Tromey  <tom@tromey.com>

	* solib.c (solib_find_1): Use std::string.
	(solib_bfd_fopen): Use unique_xmalloc_ptr.
2018-02-08 11:46:57 -07:00
Joel Brobecker e2882c8578 Update copyright year range in all GDB files
gdb/ChangeLog:

        Update copyright year range in all GDB files
2018-01-02 07:38:06 +04:00
Tom Tromey eb4c3f4aaa Constify add_setshow_*
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-07 13:59:09 -07:00
Tom Tromey 1d12d88f18 Constify add_info
This patch constifies add_info and updates all the info commands.  The
bulk of this patch was written using a script; and then I did a manual
pass to fix up the remaining compilation errors.

I could not compile every changed file; in particular nto-procfs.c,
gnu-nat.c, and darwin-nat-info.c; but I at least tried to check the
correctness by inspection.

gdb/ChangeLog
2017-11-07  Tom Tromey  <tom@tromey.com>

	* frame.h (info_locals_command, info_args_command): Constify.
	* auto-load.h (auto_load_info_scripts): Constify.
	* inferior.h (registers_info): Constify.
	* copying.c: Rebuild.
	* copying.awk: Constify generated commands.
	* auto-load.c (auto_load_info_scripts)
	(info_auto_load_gdb_scripts): Constify.
	* cli/cli-decode.c (struct cmd_list_element): Take a
	cmd_const_cfunc_ftype.
	* command.h (add_info): Take a cmd_const_cfunc_ftype.
	* tui/tui-win.c (tui_all_windows_info): Constify.
	* python/py-auto-load.c (info_auto_load_python_scripts):
	Constify.
	* cli/cli-cmds.c (show_command): Remove non-const overload.
	* tracepoint.c (info_tvariables_command, info_scope_command):
	Constify.
	(info_static_tracepoint_markers_command): Constify.
	* thread.c (info_threads_command): Constify.
	(print_thread_info_1): Constify.
	* target.c (info_target_command): Constify.
	* symtab.c (info_sources_command, info_functions_command)
	(info_types_command): Constify.
	(info_variables_command): Remove non-const overload.
	* symfile.c (info_ext_lang_command): Constify.
	* stack.c (info_frame_command, info_locals_command)
	(info_args_command): Constify.
	(backtrace_command): Remove non-const overload.
	* source.c (info_source_command, info_line_command): Constify.
	* solib.c (info_sharedlibrary_command): Constify.
	* skip.c (info_skip_command): Constify.
	* ser-go32.c (info_serial_command): Constify.
	* reverse.c (info_bookmarks_command): Constify.
	* printcmd.c (info_symbol_command, info_address_command)
	(info_display_command): Constify.
	* osdata.c (info_osdata_command): Constify.
	* objc-lang.c (info_selectors_command, info_classes_command):
	Constify.
	* nto-procfs.c (procfs_pidlist, procfs_meminfo): Constify.
	* memattr.c (info_mem_command): Constify.
	* macrocmd.c (info_macro_command, info_macros_command): Constify.
	* linux-fork.c (info_checkpoints_command): Constify.
	* infrun.c (info_signals_command): Constify.
	* inflow.c (info_terminal_command): Constify.
	* inferior.c (info_inferiors_command): Constify.
	(print_inferior): Constify.
	* infcmd.c (info_program_command, info_all_registers_command)
	(info_registers_command, info_vector_command)
	(info_float_command): Constify.
	(registers_info): Constify.
	* gnu-nat.c (info_send_rights_cmd, info_recv_rights_cmd)
	(info_port_sets_cmd, info_dead_names_cmd, info_port_rights_cmd):
	Constify.
	* f-valprint.c (info_common_command): Constify.
	* dcache.c (info_dcache_command): Constify.
	(dcache_info_1): Constify.
	* darwin-nat-info.c (info_mach_tasks_command)
	(info_mach_task_command, info_mach_ports_command)
	(info_mach_port_command, info_mach_threads_command)
	(info_mach_thread_command, info_mach_regions_command)
	(info_mach_regions_recurse_command, info_mach_region_command)
	(info_mach_exceptions_command): Constify.
	(get_task_from_args): Constify.
	* cp-support.c (info_vtbl_command): Constify.
	* breakpoint.c (info_watchpoints_command)
	(info_tracepoints_command): Constify.
	(info_breakpoints_command): Remove non-const overload.
	* avr-tdep.c (avr_io_reg_read_command): Constify.
	* auxv.c (info_auxv_command): Constify.
	* ada-tasks.c (info_tasks_command): Constify.
	(info_task): Constify.
	* ada-lang.c (info_exceptions_command): Constify.
2017-11-07 13:59:09 -07:00
Tom Tromey 0b39b52e6e Constify add_com
This changes add_com to take a cmd_const_cfunc_ftype, and then fixes
up all the command implementations.

In most cases this is trivial.

In a couple of places I had to again introduce a temporary non-const
overload.  These overloads will be removed when add_info is
constified.

gdb/ChangeLog
2017-11-07  Tom Tromey  <tom@tromey.com>

	* solib.h (no_shared_libraries): Constify.
	* frame.h (return_command): Constify.
	* cli/cli-cmds.h (quit_command): Constify.
	* top.h (quit_command, execute_command): Constify.
	* target.h (flash_erase_command): Constify.
	* inferior.h (set_inferior_args, attach_command): Constify.
	* tracepoint.h (start_tracing, stop_tracing): Constify.
	* breakpoint.h (break_command, tbreak_command)
	(hbreak_command_wrapper, thbreak_command_wrapper)
	(rbreak_command_wrapper, watch_command_wrapper)
	(awatch_command_wrapper, rwatch_command_wrapper)
	(get_tracepoint_by_number): Constify.
	* symtab.c (info_variables_command, rbreak_command)
	(symtab_symbol_info): Constify.
	(info_variables_command): Add non-const overload.
	* top.c (dont_repeat_command): Constify.
	* breakpoint.c (ignore_command, commands_command)
	(condition_command, tbreak_command, hbreak_command)
	(thbreak_command, clear_command, break_command)
	(info_breakpoints_command, watch_command, rwatch_command)
	(awatch_command, trace_command, ftrace_command, strace_command)
	(trace_pass_command, break_range_command, dprintf_command)
	(agent_printf_command, get_tracepoint_by_number)
	(watch_maybe_just_location, trace_pass_command): Constify.
	(info_breakpoints_command): Add non-const overload.
	* tracefile.c (tsave_command): Constify.
	* infcmd.c (attach_command, disconnect_command, signal_command)
	(queue_signal_command, stepi_command, nexti_command)
	(finish_command, next_command, step_command, until_command)
	(advance_command, jump_command, continue_command, run_command)
	(start_command, starti_command, interrupt_command)
	(run_command_1, set_inferior_args, step_1): Constify.
	* inferior.c (add_inferior_command, remove_inferior_command)
	(clone_inferior_command): Constify.
	* linux-fork.c (checkpoint_command, restart_command): Constify.
	* windows-nat.c (signal_event_command): Constify.
	* guile/guile.c (guile_repl_command, guile_command): Constify.
	* printcmd.c (x_command, display_command, printf_command)
	(output_command, set_command, call_command, print_command)
	(eval_command): Constify.
	(non_const_set_command): Remove.
	(_initialize_printcmd): Update.
	* source.c (forward_search_command, reverse_search_command):
	Constify.
	* jit.c (jit_reader_load_command, jit_reader_unload_command):
	Constify.
	* infrun.c (handle_command): Constify.
	* memattr.c (mem_command): Constify.
	* stack.c (return_command, up_command, up_silently_command)
	(down_command, down_silently_command, frame_command)
	(backtrace_command, func_command, backtrace_command_1): Constify.
	(backtrace_command): Add non-const overload.
	* remote-sim.c (simulator_command): Constify.
	* exec.c (set_section_command): Constify.
	* tracepoint.c (tdump_command, trace_variable_command)
	(tstatus_command, tstop_command, tstart_command)
	(end_actions_pseudocommand, while_stepping_pseudocommand)
	(collect_pseudocommand, teval_pseudocommand, actions_command)
	(start_tracing, stop_tracing): Constify.
	* value.c (init_if_undefined_command): Constify.
	* tui/tui-stack.c (tui_update_command): Constify.
	* tui/tui-win.c (tui_refresh_all_command)
	(tui_set_tab_width_command, tui_set_win_height_command)
	(tui_set_focus_command, tui_scroll_forward_command)
	(tui_scroll_backward_command, tui_scroll_left_command)
	(tui_scroll_right_command, parse_scrolling_args, tui_set_focus)
	(tui_set_win_height): Constify.
	* tui/tui-layout.c (tui_layout_command): Constify.
	* procfs.c (proc_trace_syscalls, proc_trace_sysentry_cmd)
	(proc_trace_sysexit_cmd, proc_untrace_sysentry_cmd)
	(proc_untrace_sysexit_cmd): Constify.
	* remote.c (threadlist_test_cmd, threadinfo_test_cmd)
	(threadset_test_cmd, threadlist_update_test_cmd)
	(threadalive_test): Constify.
	* objc-lang.c (print_object_command): Constify.
	* command.h (add_com): Constify.
	* cli/cli-dump.c (restore_command): Constify.
	* cli/cli-cmds.c (pwd_command, echo_command, quit_command)
	(help_command, complete_command, shell_command, edit_command)
	(list_command, disassemble_command, make_command)
	(apropos_command, alias_command): Constify.
	* cli/cli-script.c (document_command, define_command)
	(while_command, if_command, validate_comname): Constify.
	* cli/cli-decode.c (struct cmd_list_element): Change type of
	"fun".
	* target.c (do_monitor_command, flash_erase_command): Constify.
	* regcache.c (reg_flush_command): Constify.
	* reverse.c (reverse_step, reverse_next, reverse_stepi)
	(reverse_nexti, reverse_continue, reverse_finish)
	(save_bookmark_command, goto_bookmark_command)
	(exec_reverse_once): Constify.
	* python/python.c (python_interactive_command, python_command):
	Constify.
	* typeprint.c (ptype_command, whatis_command, whatis_exp):
	Constify.
	* solib.c (sharedlibrary_command, no_shared_libraries): Constify.
	* gcore.c (gcore_command): Constify.
2017-11-07 13:59:09 -07:00
Tom Tromey 9e86da0760 Change objfile to use new/delete
This changes objfiles to use new and delete rather than xmalloc and
free.  Simon noticed that it uses a non-POD and so shouldn't be
allocated with XCNEW; and I wanted to be able to use another non-POD as
a member; this patch is the result.

Regression tested by the buildbot.

2017-10-13  Tom Tromey  <tom@tromey.com>

	* compile/compile-object-run.c (do_module_cleanup): Use delete.
	* solib.c (update_solib_list, reload_shared_libraries_1): Use
	delete.
	* symfile.c (symbol_file_add_with_addrs): Use new.
	(symbol_file_add_separate): Update comment.
	(syms_from_objfile_1, remove_symbol_file_command): Use delete.
	* jit.c (jit_object_close_impl): Use new.
	(jit_unregister_code): Use delete.
	* objfiles.c (objfile::objfile): Rename from allocate_objfile.
	(~objfile): Rename from free_objfile.
	(free_objfile_separate_debug, do_free_objfile_cleanup)
	(free_all_objfiles, objfile_purge_solibs): Use delete.
	* objfiles.h (struct objfile): Add constructor and destructor.
	Use DISABLE_COPY_AND_ASSIGN.  Add initializers to data members.
	(allocate_objfile, free_objfile): Don't declare.
	(struct objstats): Add initializers.
2017-10-13 07:18:29 -06:00
Pedro Alves bf46927112 Eliminate catch_errors
If you want to use catch_errors with a function with parameters, then
currently you have to manually write a "capture" struct wrapping the
arguments and marshall/unmarshall that.

https://sourceware.org/ml/gdb-patches/2017-09/msg00834.html proposed
adjusting catch_errors to use gdb::function_view, which would allow
passing lambdas with automatic captures.  However, it seems like using
TRY/CATCH directly instead ends up producing clearer and easier to
debug code.  This is what this commit does.

Note that removing catch_errors exposes further cleanup opportunities
around no longer having to follow catch_errors callback type, and also
removes a few cleanups.

I didn't do anything to save/restore current_uiout because I think
that should be the responsibility of the code that changes
current_uiout in the first place.

(Another approach could be to make catch_errors a variadic template
like:

  template<typename Function, typename... Args>
  int catch_errors (const char *errstring, return_mask mask,
		    Function &&func, Args... args);

and then with:

  extern void function_with_args (int, int);
  extern void function_with_no_args ();

calls to the above functions would be wrapped like this:

  catch_errors ("some error happened", RETURN_MASK_ERROR,
                function_with_args, arg1, arg2);

  catch_errors ("some error happened", RETURN_MASK_ERROR,
                function_with_no_args);

but I'm thinking that that doesn't improve much if at all either.)

gdb/ChangeLog
2017-10-10  Pedro Alves  <palves@redhat.com>
	    Tom Tromey  <tom@tromey.com>

	* breakpoint.c (breakpoint_cond_eval): Change return type to bool
	and reverse logic.
	(WP_DELETED, WP_VALUE_CHANGED, WP_VALUE_NOT_CHANGED, WP_IGNORE):
	No longer macros.  Instead ...
	(enum wp_check_result): They're now values of this new
	enumeration.
	(watchpoint_check): Change return type to wp_check_result and
	parameter type to bpstat.
	(bpstat_check_watchpoint): Use TRY/CATCH instead of catch_errors.
	(bpstat_check_breakpoint_conditions): Use TRY/CATCH instead of
	catch_errors.  Reverse logic of watchpoint_check call.
	(breakpoint_re_set_one): Now returns void and takes a breakpoint
	pointer as parameter.
	(breakpoint_re_set): Use TRY/CATCH instead of catch_errors.
	* common/common-exceptions.c (throw_exception_sjlj): Update
	comments to avoid mentioning catch_errors.
	* exceptions.c (catch_errors): Delete.
	* exceptions.h: Update comments to avoid mentioning catch_errors.
	(catch_errors_ftype, catch_errors): Delete.
	* infrun.c (normal_stop): Use TRY/CATCH instead of catch_errors.
	(hook_stop_stub): Delete.
	(restore_selected_frame): Change return type to void, and
	parameter type to const frame_id &.
	(restore_infcall_control_state): Use TRY/CATCH instead of
	catch_errors.
	* main.c (captured_command_loop): Return void and remove
	parameter.  Remove references to catch_errors.
	(captured_main): Use TRY/CATCH instead of catch_errors.
	* objc-lang.c (objc_submethod_helper_data)
	(find_objc_msgcall_submethod_helper): Delete.
	(find_objc_msgcall_submethod): Use TRY/CATCH instead of
	catch_errors.
	* record-full.c (record_full_message): Return void.
	(record_full_message_args, record_full_message_wrapper): Delete.
	(record_full_message_wrapper_safe): Return bool and use TRY/CATCH
	instead of catch_errors.
	* solib-aix.c (solib_aix_open_symbol_file_object): Change
	parameter type to int.
	* solib-darwin.c (open_symbol_file_object): Ditto.
	* solib-dsbt.c (open_symbol_file_object): Ditto.
	* solib-frv.c (open_symbol_file_object): Ditto.
	* solib-svr4.c (open_symbol_file_object): Ditto.
	* solib-target.c (solib_target_open_symbol_file_object): Ditto.
	* solib.c (update_solib_list): Use TRY/CATCH instead of
	catch_errors.
	* solist.h (struct target_so_ops) <open_symbol_file_object>:
	Change type.
	* symmisc.c (struct print_symbol_args): Remove.
	(dump_symtab_1): Use TRY/CATCH instead of catch_errors.
	(print_symbol): Change type.
	* windows-nat.c (handle_load_dll, handle_unload_dll): Return void
	and remove parameters.
	(catch_errors): New.
	(get_windows_debug_event): Adjust.

gdb/testsuite/ChangeLog:
2017-10-10  Pedro Alves  <palves@redhat.com>

	* lib/selftest-support.exp (selftest_setup): Update for
	captured_command_loop's prototype change.
2017-10-10 16:45:50 +01:00
Tom Tromey 223ffa714c Remove make_cleanup_restore_target_terminal
This removes make_cleanup_restore_target_terminal and generally
C++-ifies target terminal handling.  It changes all target_terminal_*
functions to be static members of a new target_terminal class and
changes the cleanup to be a scoped_* class.
make_cleanup_override_quit_handler is also removed in favor of simply
using scoped_restore.

Note that there are some files in this patch that I could not compile.
Considering that some of the rewrites were automated, and that none of
these files involed cleanups, I feel that this is relatively safe.

Regression tested by the buildbot.

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

	* windows-nat.c (get_windows_debug_event, windows_wait)
	(do_initial_windows_stuff, windows_attach): Update.
	* utils.c (vwarning, internal_vproblem): Update.
	(ui_unregister_input_event_handler_cleanup)
	(prepare_to_handle_input): Remove.
	(class scoped_input_handler): New.
	(defaulted_query, prompt_for_continue): Update.
	* tui/tui-hooks.c (tui_refresh_frame_and_register_information):
	Update.
	* top.c (undo_terminal_modifications_before_exit): Update.
	* target/target.h (target_terminal_init, target_terminal_inferior)
	(target_terminal_ours): Don't declare.
	(class target_terminal): New.
	* target.h (target_terminal_is_inferior, target_terminal_is_ours)
	(target_terminal_ours_for_output)
	(make_cleanup_restore_target_terminal): Don't declare.
	(target_terminal_info): Remove.
	* target.c (enum terminal_state, terminal_state): Remove.
	(target_terminal::terminal_state): Define.
	(target_terminal::init): Rename from target_terminal_init.
	(target_terminal::inferior): Rename from
	target_terminal_inferior.
	(target_terminal::ours): Rename from target_terminal_ours.
	(target_terminal::ours_for_output): Rename from
	target_terminal_ours_for_output.
	(target_terminal::info): New method.
	(cleanup_restore_target_terminal)
	(make_cleanup_restore_target_terminal): Remove.
	* solib.c (handle_solib_event): Update.
	* remote.c (remote_serial_quit_handler): Update.
	(remote_terminal_inferior, remote_wait_as): Update.
	* record-full.c (record_full_wait_1): Update.
	* nto-procfs.c (procfs_create_inferior): Update.
	* nat/fork-inferior.c (startup_inferior): Update.
	* mi/mi-interp.c (mi_new_thread, mi_thread_exit)
	(mi_record_changed, mi_inferior_added, mi_inferior_appeared)
	(mi_inferior_exit, mi_inferior_removed, mi_traceframe_changed)
	(mi_tsv_created, mi_tsv_deleted, mi_tsv_modified)
	(mi_breakpoint_created, mi_breakpoint_deleted)
	(mi_breakpoint_modified, mi_on_resume, mi_solib_loaded)
	(mi_solib_unloaded, mi_command_param_changed, mi_memory_changed)
	(mi_user_selected_context_changed, report_initial_inferior):
	Update.
	* linux-nat.c (linux_nat_attach, linux_nat_terminal_ours)
	(linux_nat_terminal_inferior): Update.
	* infrun.c (follow_fork_inferior)
	(handle_vfork_child_exec_or_exit, do_target_resume)
	(check_curr_ui_sync_execution_done, handle_inferior_event_1)
	(handle_signal_stop, maybe_remove_breakpoints, normal_stop):
	Update.
	* inflow.c (child_terminal_init, info_terminal_command): Update.
	* infcmd.c (post_create_inferior, continue_1, prepare_one_step)
	(attach_command): Update.
	* infcall.c (call_thread_fsm_should_stop): Update.
	* gnu-nat.c (gnu_attach): Update.
	* extension.c (struct active_ext_lang_state)
	(restore_active_ext_lang): Update.
	* exceptions.c (print_flush): Update.
	* event-top.c (async_enable_stdin, default_quit_handler): Update.
	(struct quit_handler_cleanup_data, restore_quit_handler)
	(restore_quit_handler_dtor, make_cleanup_override_quit_handler):
	Remove.
	* cp-support.c (gdb_demangle): Update.
	* breakpoint.c (update_inserted_breakpoint_locations)
	(insert_breakpoint_locations, handle_jit_event)
	(disable_breakpoints_in_unloaded_shlib): Update.
	* annotate.c (annotate_breakpoints_invalid)
	(annotate_frames_invalid): Update.

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

	* target.c (target_terminal::terminal_state): Define.
	(target_terminal::init): Rename from target_terminal_init.
	(target_terminal::inferior): Rename from
	target_terminal_inferior.
	(target_terminal::ours): Rename from target_terminal_ours.
	(target_terminal::ours_for_output, target_terminal::info): New.
2017-09-20 16:09:50 -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
Tom Tromey ee0c32930c Use gdb::unique_xmalloc_ptr when calling tilde_expand
This patch changes most sites calling tilde_expand to use
gdb::unique_xmalloc_ptr, rather than a cleanup.  It also changes
scan_expression_with_cleanup to return a unique pointer, because the
patch was already touching code in that area.

Regression tested on the buildbot.

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

	* compile/compile-object-load.c (compile_object_load): Use
	gdb::unique_xmalloc_ptr.
	* cli/cli-dump.c (scan_filename): Rename from
	scan_filename_with_cleanup.  Change return type.
	(scan_expression): Rename from scan_expression_with_cleanup.
	Change return type.
	(dump_memory_to_file, dump_value_to_file, restore_command):
	Use gdb::unique_xmalloc_ptr.  Update.
	* cli/cli-cmds.c (find_and_open_script): Use
	gdb::unique_xmalloc_ptr.
	* tracefile-tfile.c (tfile_open): Use gdb::unique_xmalloc_ptr.
	* symmisc.c (maintenance_print_symbols)
	(maintenance_print_msymbols): Use gdb::unique_xmalloc_ptr.
	* symfile.c (symfile_bfd_open, generic_load)
	(add_symbol_file_command, remove_symbol_file_command): Use
	gdb::unique_xmalloc_ptr.
	* source.c (openp): Use gdb::unique_xmalloc_ptr.
	* psymtab.c (maintenance_print_psymbols): Use
	gdb::unique_xmalloc_ptr.
	* corelow.c (core_open): Use gdb::unique_xmalloc_ptr.
	* breakpoint.c (save_breakpoints): Use gdb::unique_xmalloc_ptr.
	* solib.c (solib_map_sections): Use gdb::unique_xmalloc_ptr.
	(reload_shared_libraries_1): Likewise.
2017-08-05 15:52:49 -06:00
Tom Tromey 4a2b031d54 Introduce and use ui_out_emit_table
This introduces ui_out_emit_table, similar to the other existing
ui_out RAII classes, and then uses it in a number of places.  This
replaces some cleanups.

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

	* tracepoint.c (tvariables_info_1): Use ui_out_emit_table.
	(info_static_tracepoint_markers_command): Likewise.
	* solib.c (info_sharedlibrary_command): Use ui_out_emit_table.
	* skip.c (skip_info): Use ui_out_emit_table.
	* progspace.c (print_program_space): Use ui_out_emit_table.
	* osdata.c (info_osdata): Use ui_out_emit_table.
	* mi/mi-cmd-info.c (mi_cmd_info_ada_exceptions): Use
	ui_out_emit_table.
	* linux-thread-db.c (info_auto_load_libthread_db): Use
	ui_out_emit_table.
	* inferior.c (print_inferior): Use ui_out_emit_table.
	* gdb_bfd.c (maintenance_info_bfds): Use ui_out_emit_table.
	* breakpoint.c (breakpoint_1): Use ui_out_emit_table.
	* auto-load.c (auto_load_info_scripts): Use ui_out_emit_table.
	* ada-tasks.c (print_ada_task_info): Use ui_out_emit_table.
	* ui-out.h (class ui_out_emit_table): New.
2017-08-03 07:58:51 -06:00
Sergio Durigan Junior 9a6c7d9c02 C++ify gdb/common/environ.c
As part of the preparation necessary for my upcoming task, I'd like to
propose that we turn gdb_environ into a class.  The approach taken
here is simple: the class gdb_environ contains everything that is
needed to manipulate the environment variables.  These variables are
stored in an std::vector<char *>, which can be converted to a 'char
**' and passed as argument to functions that need it.

The usage has not changed much.  As per Pedro's suggestion, this class
uses a static factory method initialization.  This means that when an
instance is created, it is initially empty.  When needed, it has to be
initialized using the static method 'from_host_environ'.

As mentioned before, this is a preparation for an upcoming work that I
will be posting in the next few weeks or so.  For that work, I'll
probably create another data structure that will contain all the
environment variables that were set by the user using the 'set
environment' command, because I'll need access to them.  This will be
much easier with the class-ification of gdb_environ.

As noted, this has been regression-tested with the new version of
environ.exp and no regressions were found.

gdb/ChangeLog:
2017-06-20  Sergio Durigan Junior  <sergiodj@redhat.com>

	* Makefile.in (SUBDIR_UNITTESTS_SRCS): Add
	'unittests/environ-selftests.c'.
	(SUBDIR_UNITTESTS_OBS): Add 'environ-selftests.o'.
	* charset.c (find_charset_names): Declare object 'iconv_env'.
	Update code to use 'iconv_env' object.  Remove call to
	'free_environ'.
	* common/environ.c: Include <utility>.
	(make_environ): Delete function.
	(free_environ): Delete function.
	(gdb_environ::clear): New function.
	(gdb_environ::operator=): New function.
	(gdb_environ::get): Likewise.
	(environ_vector): Delete function.
	(set_in_environ): Delete function.
	(gdb_environ::set): New function.
	(unset_in_environ): Delete function.
	(gdb_environ::unset): New function.
	(gdb_environ::envp): Likewise.
	* common/environ.h: Include <vector>.
	(struct gdb_environ): Delete; transform into...
	(class gdb_environ): ... this class.
	(free_environ): Delete prototype.
	(init_environ, get_in_environ, set_in_environ, unset_in_environ,
	environ_vector): Likewise.
	* infcmd.c (run_command_1): Update code to call
	'envp' from 'gdb_environ' class.
	(environment_info): Update code to call methods from 'gdb_environ'
	class.
	(unset_environment_command): Likewise.
	(path_info): Likewise.
	(path_command): Likewise.
	* inferior.c (inferior::~inferior): Delete call to 'free_environ'.
	(inferior::inferior): Initialize 'environment' using the host's
	information.
	* inferior.h: Remove forward declaration of 'struct gdb_environ'.
	Include "environ.h".
	(class inferior) <environment>: Change type from 'struct
	gdb_environ' to 'gdb_environ'.
	* mi/mi-cmd-env.c (mi_cmd_env_path): Update code to call
	methods from 'gdb_environ' class.
	* solib.c (solib_find_1): Likewise
	* unittests/environ-selftests.c: New file.

gdb/gdbserver/ChangeLog:
2017-06-20  Sergio Durigan Junior  <sergiodj@redhat.com>

	* linux-low.c (linux_create_inferior): Adjust code to access the
	environment information via 'gdb_environ' class.
	* lynx-low.c (lynx_create_inferior): Likewise.
	* server.c (our_environ): Make it an instance of 'gdb_environ'.
	(get_environ): Return a pointer to 'our_environ'.
	(captured_main): Initialize 'our_environ'.
	* server.h (get_environ): Adjust prototype.
	* spu-low.c (spu_create_inferior): Adjust code to access the
	environment information via 'gdb_environ' class.
2017-06-20 08:59:27 -04:00
Tom Tromey 2e78302469 Use ui_out_emit_tuple
This patch changes various places to use ui_out_emit_tuple,
eliminating a number of cleanups.  This patch only tackles "easy"
cases, which are ones where the cleanups in question were
block-structured and did not involve any changes other than the
obvious replacement.

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

	* record-btrace.c (record_btrace_insn_history)
	(record_btrace_insn_history_range, record_btrace_call_history)
	(record_btrace_call_history_range): Use ui_out_emit_tuple.
	* thread.c (do_captured_list_thread_ids, print_thread_info_1): Use
	ui_out_emit_tuple.
	* stack.c (print_frame_info): Use ui_out_emit_tuple.
	* solib.c (info_sharedlibrary_command): Use ui_out_emit_tuple.
	* skip.c (skip_info): Use ui_out_emit_tuple.
	* remote.c (show_remote_cmd): Use ui_out_emit_tuple.
	* progspace.c (print_program_space): Use ui_out_emit_tuple.
	* probe.c (info_probes_for_ops): Use ui_out_emit_tuple.
	* osdata.c (info_osdata): Use ui_out_emit_tuple.
	* mi/mi-symbol-cmds.c (mi_cmd_symbol_list_lines): Use
	ui_out_emit_tuple.
	* mi/mi-main.c (print_one_inferior, list_available_thread_groups)
	(output_register, mi_cmd_data_read_memory)
	(mi_cmd_data_read_memory_bytes, mi_load_progress)
	(mi_cmd_trace_frame_collected): Use ui_out_emit_tuple.
	* mi/mi-cmd-var.c (mi_cmd_var_list_children, varobj_update_one):
	Use ui_out_emit_tuple.
	* mi/mi-cmd-stack.c (mi_cmd_stack_list_args): Use
	ui_out_emit_tuple.
	* mi/mi-cmd-info.c (mi_cmd_info_ada_exceptions)
	(mi_cmd_info_gdb_mi_command): Use ui_out_emit_tuple.
	* linux-thread-db.c (info_auto_load_libthread_db): Use
	ui_out_emit_tuple.
	* inferior.c (print_inferior): Use ui_out_emit_tuple.
	* gdb_bfd.c (print_one_bfd): Use ui_out_emit_tuple.
	* disasm.c (do_mixed_source_and_assembly_deprecated)
	(do_mixed_source_and_assembly): Use ui_out_emit_tuple.
	* cp-abi.c (list_cp_abis): Use ui_out_emit_tuple.
	* cli/cli-setshow.c (cmd_show_list): Use ui_out_emit_tuple.
	* breakpoint.c (print_one_breakpoint_location)
	(print_one_breakpoint): Use ui_out_emit_tuple.
	* auto-load.c (print_script, info_auto_load_cmd): Use
	ui_out_emit_tuple.
	* ada-tasks.c (print_ada_task_info): Use ui_out_emit_tuple.
2017-04-22 09:46:58 -06:00
Marc-Andre Laperle 51457a0578 Add -file-list-shared-libraries MI command
This change adds the MI equivalent for the "info sharedlibrary"
command. The command was already partially documented but ignored as
it was not implemented. The new MI command works similarly to the CLI
command, taking an optional regular expression as an argument and
outputting the library information.

I included a test for the new command in mi-solib.exp.

gdb/doc/ChangeLog:

	* gdb.texinfo (gdb/mi Symbol Query Commands): Document new MI
	command file-list-shared-libraries
	(GDB/MI Async Records): Update documentation of library-loaded with new
	field.

gdb/ChangeLog:

	* NEWS: Add an entry about new '-file-list-shared-libraries' command.
	* mi/mi-cmd-file.c (mi_cmd_file_list_shared_libraries):
	New function definition.
	* mi/mi-cmds.c (mi_cmds): Add -file-list-shared-libraries command.
	* mi/mi-cmds.h (mi_cmd_file_list_shared_libraries):
	New function declaration.
	* mi/mi-interp.c (mi_output_solib_attribs): New Function.
	* mi/mi-interp.h: New file.
	* solib.c (info_sharedlibrary_command): Replace for loop with
	ALL_SO_LIBS macro
	* solib.h (update_solib_list): New function declaration.
	(so_list_head): Move macro.
	* solist.h (ALL_SO_LIBS): New macro.

gdb/testsuite/ChangeLog:

	* gdb.mi/mi-solib.exp (test_file_list_shared_libraries):
	New procedure.

Signed-off-by: Marc-Andre Laperle <marc-andre.laperle@ericsson.com>
2017-03-20 14:57:51 -04:00
Marc-Andre Laperle e696b3ad34 Remove unused parameter in solib_add and update_solib_list
The target parameter in both solib_add and update_solib_list
functions is not used anymore and as not been used for a while. This
change removes the parameter to clean up the code a little bit.

gdb/ChangeLog:

	* infcmd.c (post_create_inferior): Remove unused argument in
	call to solib_add.
	* remote.c (remote_start_remote): Likewise.
	* solib-frv.c (frv_fetch_objfile_link_map): Likewise.
	* solib-svr4.c: (svr4_fetch_objfile_link_map): Likewise.
	(enable_break): Likewise.
	* solib.c (update_solib_list): Remove unused target argument
	and its documentation.
	(solib_add): Remove unused target argument.  Remove unused
	argument in call to update_solib_list.
	(info_sharedlibrary_command): Remove unused argument in call
	to update_solib_list.
	(sharedlibrary_command): Remove unused argument in call to
	solib_add.
	(handle_solib_event): Likewise.
	(reload_shared_libraries): Likewise.
	* solib.h (solib_add): Remove unused target argument.

Signed-off-by: Marc-Andre Laperle <marc-andre.laperle@ericsson.com>
2017-03-20 14:57:32 -04:00
Tom Tromey 192b62ce0b Use class to manage BFD reference counts
This introduces a new specialization of gdb::ref_ptr that can be used
to manage BFD reference counts.  Then it changes most places in gdb to
use this new class, rather than explicit reference-counting or
cleanups.  This patch removes make_cleanup_bfd_unref.

If you look you will see a couple of spots using "release" where a use
of gdb_bfd_ref_ptr would be cleaner.  These will be fixed in the next
patch.

I think this patch fixes some latent bugs.  For example, it seems to
me that previously objfpy_add_separate_debug_file leaked a BFD.

I'm not 100% certain that the macho_symfile_read_all_oso change is
correct.  The existing code here is hard for me to follow.  One goal
of this sort of automated reference counting, though, is to make it
more difficult to make logic errors; so hopefully the code is clear
now.

2017-01-10  Tom Tromey  <tom@tromey.com>

	* windows-tdep.c (windows_xfer_shared_library): Update.
	* windows-nat.c (windows_make_so): Update.
	* utils.h (make_cleanup_bfd_unref): Remove.
	* utils.c (do_bfd_close_cleanup, make_cleanup_bfd_unref): Remove.
	* symfile.h (symfile_bfd_open)
	(find_separate_debug_file_in_section): Return gdb_bfd_ref_ptr.
	* symfile.c (read_symbols, symbol_file_add)
	(separate_debug_file_exists): Update.
	(symfile_bfd_open): Return gdb_bfd_ref_ptr.
	(generic_load, reread_symbols): Update.
	* symfile-mem.c (symbol_file_add_from_memory): Update.
	* spu-linux-nat.c (spu_bfd_open): Return gdb_bfd_ref_ptr.
	(spu_symbol_file_add_from_memory): Update.
	* solist.h (struct target_so_ops) <bfd_open>: Return
	gdb_bfd_ref_ptr.
	(solib_bfd_fopen, solib_bfd_open): Return gdb_bfd_ref_ptr.
	* solib.c (solib_bfd_fopen, solib_bfd_open): Return
	gdb_bfd_ref_ptr.
	(solib_map_sections, reload_shared_libraries_1): Update.
	* solib-svr4.c (enable_break): Update.
	* solib-spu.c (spu_bfd_fopen): Return gdb_bfd_ref_ptr.
	* solib-frv.c (enable_break2): Update.
	* solib-dsbt.c (enable_break): Update.
	* solib-darwin.c (gdb_bfd_mach_o_fat_extract): Return
	gdb_bfd_ref_ptr.
	(darwin_solib_get_all_image_info_addr_at_init): Update.
	(darwin_bfd_open): Return gdb_bfd_ref_ptr.
	* solib-aix.c (solib_aix_bfd_open): Return gdb_bfd_ref_ptr.
	* record-full.c (record_full_save): Update.
	* python/py-objfile.c (objfpy_add_separate_debug_file): Update.
	* procfs.c (insert_dbx_link_bpt_in_file): Update.
	* minidebug.c (find_separate_debug_file_in_section): Return
	gdb_bfd_ref_ptr.
	* machoread.c (macho_add_oso_symfile): Change abfd to
	gdb_bfd_ref_ptr.
	(macho_symfile_read_all_oso): Update.
	(macho_check_dsym): Return gdb_bfd_ref_ptr.
	(macho_symfile_read): Update.
	* jit.c (bfd_open_from_target_memory): Return gdb_bfd_ref_ptr.
	(jit_bfd_try_read_symtab): Update.
	* gdb_bfd.h (gdb_bfd_open, gdb_bfd_fopen, gdb_bfd_openr)
	(gdb_bfd_openw, gdb_bfd_openr_iovec)
	(gdb_bfd_openr_next_archived_file, gdb_bfd_fdopenr): Return
	gdb_bfd_ref_ptr.
	(gdb_bfd_ref_policy): New struct.
	(gdb_bfd_ref_ptr): New typedef.
	* gdb_bfd.c (gdb_bfd_open, gdb_bfd_fopen, gdb_bfd_openr)
	(gdb_bfd_openw, gdb_bfd_openr_iovec)
	(gdb_bfd_openr_next_archived_file, gdb_bfd_fdopenr): Return
	gdb_bfd_ref_ptr.
	* gcore.h (create_gcore_bfd): Return gdb_bfd_ref_ptr.
	* gcore.c (create_gcore_bfd): Return gdb_bfd_ref_ptr.
	(gcore_command): Update.
	* exec.c (exec_file_attach): Update.
	* elfread.c (elf_symfile_read): Update.
	* dwarf2read.c (dwarf2_get_dwz_file): Update.
	(try_open_dwop_file, open_dwo_file): Return gdb_bfd_ref_ptr.
	(open_and_init_dwo_file): Update.
	(open_dwp_file): Return gdb_bfd_ref_ptr.
	(open_and_init_dwp_file): Update.
	* corelow.c (core_open): Update.
	* compile/compile-object-load.c (compile_object_load): Update.
	* common/gdb_ref_ptr.h (ref_ptr::operator->): New operator.
	* coffread.c (coff_symfile_read): Update.
	* cli/cli-dump.c (bfd_openr_or_error, bfd_openw_or_error): Return
	gdb_bfd_ref_ptr.  Rename.
	(dump_bfd_file, restore_command): Update.
	* build-id.h (build_id_to_debug_bfd): Return gdb_bfd_ref_ptr.
	* build-id.c (build_id_to_debug_bfd): Return gdb_bfd_ref_ptr.
	(find_separate_debug_file_by_buildid): Update.
2017-01-10 19:14:10 -07:00
Joel Brobecker 61baf725ec update copyright year range in GDB files
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.
2017-01-01 10:52:34 +04:00