Commit Graph

134 Commits

Author SHA1 Message Date
Tom Tromey 0743fc83c0 Replace most calls to help_list and cmd_show_list
Currently there are many prefix commands that do nothing but call
either help_list or cmd_show_list.  I happened to notice that one such
call, for "set print type", used the wrong command list parameter,
causing incorrect output.

Rather than fix this bug in isolation, I decided to eliminate this
possibility by adding two new ways to add prefix commands, which
simply route the call to help_list or cmd_show_list, as appropriate.
This makes it impossible for a mismatch to occur.

In some cases, a bit of output was removed; however, I don't think
this output in general was very useful.  It seemed redundant with
what's already printed by help_list.  A representative example is this
hunk, removed from ada-lang.c:

-  printf_unfiltered (_(\
-"\"set ada\" must be followed by the name of a setting.\n"));

This simplified the CLI style set/show commands quite a bit, and
allowed the deletion of a macro.

This also cleans up some unusual code in windows-tdep.c.

Tested on x86-64 Fedora 30.  Note that I have no way to build the
go32-nat.c change.

gdb/ChangeLog
2020-04-17  Tom Tromey  <tromey@adacore.com>

	* auto-load.c (show_auto_load_cmd): Remove.
	(auto_load_show_cmdlist_get): Use add_show_prefix_cmd.
	* arc-tdep.c (_initialize_arc_tdep): Use add_show_prefix_cmd.
	(maintenance_print_arc_command): Remove.
	* tui/tui-win.c (tui_command): Remove.
	(tui_get_cmd_list): Use add_basic_prefix_cmd.
	* tui/tui-layout.c (tui_layout_command): Remove.
	(_initialize_tui_layout): Use add_basic_prefix_cmd.
	* python/python.c (user_set_python, user_show_python): Remove.
	(_initialize_python): Use add_basic_prefix_cmd,
	add_show_prefix_cmd.
	* guile/guile.c (set_guile_command, show_guile_command): Remove.
	(install_gdb_commands): Use add_basic_prefix_cmd,
	add_show_prefix_cmd.
	(info_guile_command): Remove.
	* dwarf2/read.c (set_dwarf_cmd, show_dwarf_cmd): Remove.
	(_initialize_dwarf2_read): Use add_basic_prefix_cmd,
	add_show_prefix_cmd.
	* cli/cli-style.h (class cli_style_option) <add_setshow_commands>:
	Remove do_set and do_show parameters.
	* cli/cli-style.c (set_style, show_style): Remove.
	(_initialize_cli_style): Use add_basic_prefix_cmd,
	add_show_prefix_cmd.
	(cli_style_option::add_setshow_commands): Remove do_set and
	do_show parameters.
	(cli_style_option::add_setshow_commands): Use
	add_basic_prefix_cmd, add_show_prefix_cmd.
	(STYLE_ADD_SETSHOW_COMMANDS): Remove macro.
	(set_style_name): Remove.
	* cli/cli-dump.c (dump_command, append_command): Remove.
	(srec_dump_command, ihex_dump_command, verilog_dump_command)
	(tekhex_dump_command, binary_dump_command)
	(binary_append_command): Remove.
	(_initialize_cli_dump): Use add_basic_prefix_cmd.
	* windows-tdep.c (w32_prefix_command_valid): Remove global.
	(init_w32_command_list): Remove; move into ...
	(_initialize_windows_tdep): ... here.  Use add_basic_prefix_cmd.
	* valprint.c (set_print, show_print, set_print_raw)
	(show_print_raw): Remove.
	(_initialize_valprint): Use add_basic_prefix_cmd,
	add_show_prefix_cmd.
	* typeprint.c (set_print_type, show_print_type): Remove.
	(_initialize_typeprint): Use add_basic_prefix_cmd,
	add_show_prefix_cmd.
	* record.c (set_record_command, show_record_command): Remove.
	(_initialize_record): Use add_basic_prefix_cmd,
	add_show_prefix_cmd.
	* cli/cli-cmds.c (_initialize_cli_cmds): Use add_basic_prefix_cmd,
	add_show_prefix_cmd.
	(info_command, show_command, set_debug, show_debug): Remove.
	* top.h (set_history, show_history): Don't declare.
	* top.c (set_history, show_history): Remove.
	* target-descriptions.c (set_tdesc_cmd, show_tdesc_cmd)
	(unset_tdesc_cmd): Remove.
	(_initialize_target_descriptions): Use add_basic_prefix_cmd,
	add_show_prefix_cmd.
	* symtab.c (info_module_command): Remove.
	(_initialize_symtab): Use add_basic_prefix_cmd.
	* symfile.c (overlay_command): Remove.
	(_initialize_symfile): Use add_basic_prefix_cmd.
	* sparc64-tdep.c (info_adi_command): Remove.
	(_initialize_sparc64_adi_tdep): Use add_basic_prefix_cmd.
	* sh-tdep.c (show_sh_command, set_sh_command): Remove.
	(_initialize_sh_tdep): Use add_basic_prefix_cmd,
	add_show_prefix_cmd.
	* serial.c (serial_set_cmd, serial_show_cmd): Remove.
	(_initialize_serial): Use add_basic_prefix_cmd,
	add_show_prefix_cmd.
	* ser-tcp.c (set_tcp_cmd, show_tcp_cmd): Remove.
	(_initialize_ser_tcp): Use add_basic_prefix_cmd,
	add_show_prefix_cmd.
	* rs6000-tdep.c (set_powerpc_command, show_powerpc_command)
	(_initialize_rs6000_tdep): Use add_basic_prefix_cmd,
	add_show_prefix_cmd.
	* riscv-tdep.c (show_riscv_command, set_riscv_command)
	(show_debug_riscv_command, set_debug_riscv_command): Remove.
	(_initialize_riscv_tdep): Use add_basic_prefix_cmd,
	add_show_prefix_cmd.
	* remote.c (remote_command, set_remote_cmd): Remove.
	(_initialize_remote): Use add_basic_prefix_cmd.
	* record-full.c (set_record_full_command)
	(show_record_full_command): Remove.
	(_initialize_record_full): Use add_basic_prefix_cmd,
	add_show_prefix_cmd.
	* record-btrace.c (cmd_set_record_btrace)
	(cmd_show_record_btrace, cmd_set_record_btrace_bts)
	(cmd_show_record_btrace_bts, cmd_set_record_btrace_pt)
	(cmd_show_record_btrace_pt): Remove.
	(_initialize_record_btrace): Use add_basic_prefix_cmd,
	add_show_prefix_cmd.
	* ravenscar-thread.c (set_ravenscar_command)
	(show_ravenscar_command): Remove.
	(_initialize_ravenscar): Use add_basic_prefix_cmd,
	add_show_prefix_cmd.
	* mips-tdep.c (show_mips_command, set_mips_command)
	(_initialize_mips_tdep): Use add_basic_prefix_cmd,
	add_show_prefix_cmd.
	* maint.c (maintenance_command, maintenance_info_command)
	(maintenance_check_command, maintenance_print_command)
	(maintenance_set_cmd, maintenance_show_cmd): Remove.
	(_initialize_maint_cmds): Use add_basic_prefix_cmd,
	add_show_prefix_cmd.
	(show_per_command_cmd): Remove.
	* maint-test-settings.c (maintenance_set_test_settings_cmd):
	Remove.
	(maintenance_show_test_settings_cmd): Remove.
	(_initialize_maint_test_settings): Use add_basic_prefix_cmd,
	add_show_prefix_cmd.
	* maint-test-options.c (maintenance_test_options_command):
	Remove.
	(_initialize_maint_test_options): Use add_basic_prefix_cmd.
	* macrocmd.c (macro_command): Remove
	(_initialize_macrocmd): Use add_basic_prefix_cmd.
	* language.c (set_check, show_check): Remove.
	(_initialize_language): Use add_basic_prefix_cmd,
	add_show_prefix_cmd.
	* infcmd.c (unset_command): Remove.
	(_initialize_infcmd): Use add_basic_prefix_cmd.
	* i386-tdep.c (set_mpx_cmd, show_mpx_cmd): Remove.
	(_initialize_i386_tdep): Use add_basic_prefix_cmd,
	add_show_prefix_cmd.
	* go32-nat.c (go32_info_dos_command): Remove.
	(_initialize_go32_nat): Use add_basic_prefix_cmd.
	* cli/cli-decode.c (do_prefix_cmd, add_basic_prefix_cmd)
	(do_show_prefix_cmd, add_show_prefix_cmd): New functions.
	* frame.c (set_backtrace_cmd, show_backtrace_cmd): Remove.
	(_initialize_frame): Use add_basic_prefix_cmd,
	add_show_prefix_cmd.
	* dcache.c (set_dcache_command, show_dcache_command): Remove.
	(_initialize_dcache): Use add_basic_prefix_cmd,
	add_show_prefix_cmd.
	* cp-support.c (maint_cplus_command): Remove.
	(_initialize_cp_support): Use add_basic_prefix_cmd.
	* btrace.c (maint_btrace_cmd, maint_btrace_set_cmd)
	(maint_btrace_show_cmd, maint_btrace_pt_set_cmd)
	(maint_btrace_pt_show_cmd, _initialize_btrace): Use
	add_basic_prefix_cmd, add_show_prefix_cmd.
	* breakpoint.c (save_command): Remove.
	(_initialize_breakpoint): Use add_basic_prefix_cmd.
	* arm-tdep.c (set_arm_command, show_arm_command): Remove.
	(_initialize_arm_tdep): Use add_basic_prefix_cmd,
	add_show_prefix_cmd.
	* ada-lang.c (maint_set_ada_cmd, maint_show_ada_cmd)
	(set_ada_command, show_ada_command): Remove.
	(_initialize_ada_language): Use add_basic_prefix_cmd,
	add_show_prefix_cmd.
	* command.h (add_basic_prefix_cmd, add_show_prefix_cmd): Declare.

gdb/testsuite/ChangeLog
2020-04-17  Tom Tromey  <tromey@adacore.com>

	* gdb.cp/maint.exp (test_help): Simplify multiple_help_body.
	Update tests.
	* gdb.btrace/cpu.exp: Update tests.
	* gdb.base/maint.exp: Update tests.
	* gdb.base/default.exp: Update tests.
	* gdb.base/completion.exp: Update tests.
2020-04-17 15:13:41 -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
Pedro Alves 4f83758119 Revert 'Remove unused struct serial::name field'
This commit reverts:

 commit 5f5219fc34
 Author:     Pedro Alves <palves@redhat.com>
 AuthorDate: Tue Apr 12 16:49:30 2016 +0100

     Remove unused struct serial::name field

The following patches will add uses for the field.

gdb/ChangeLog:
2020-01-10  Pedro Alves  <palves@redhat.com>

	Revert:
	2016-04-12  Pedro Alves  <palves@redhat.com>
	* serial.c (serial_open, serial_fdopen_ops, do_serial_close):
	Remove references to name.
	* serial.h (struct serial) <name>: Delete.
2020-01-10 20:06:11 +00: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
Philippe Waroquiers 590042fc45 Make first and last lines of 'command help documentation' consistent.
With this patch, the help docs now respect 2 invariants:
  * The first line of a command help is terminated by a '.' character.
  * The last character of a command help is not a newline character.

Note that the changes for the last invariant were done by Tom, as part of :
 [PATCH] Remove trailing newlines from help text
 https://sourceware.org/ml/gdb-patches/2019-06/msg00050.html
but some occurrences have been re-introduced since then.

Some help docs had to be rephrased/restructured to respect the above
invariants.

Before this patch, print_doc_line was printing the first line
of a command help documentation, but stopping at the first '.'
or ',' character.

This was giving inconsistent results :
  * The first line of command helps was sometimes '.' terminated,
    sometimes not.
  * The first line of command helps was not always designed to be
    readable/understandable/unambiguous when stopping at the first
    '.' or ',' character.

This e.g. created the following inconsistencies/problems:
< catch exception -- Catch Ada exceptions
< catch handlers -- Catch Ada exceptions
< catch syscall -- Catch system calls by their names
< down-silently -- Same as the `down' command
while the new help is:
> catch exception -- Catch Ada exceptions, when raised.
> catch handlers -- Catch Ada exceptions, when handled.
> catch syscall -- Catch system calls by their names, groups and/or numbers.
> down-silently -- Same as the `down' command, but does not print anything.

Also, the command help doc should not be terminated by a newline
character, but this was not respected by all commands.
The cli-option -OPT framework re-introduced some occurences.
So, the -OPT build help framework was changed to not output newlines at the
end of %OPTIONS% replacement.

This patch changes the help documentations to ensure the 2 invariants
given above.

It implied to slightly rephrase or restructure some help docs.

Based on the above invariants, print_doc_line (called by
'apropos' and 'help' commands to print the first line of a command
help) now outputs the full first line of a command help.

This all results in a lot of small changes in the produced help docs.
There are less code changes than changes in the help docs, as a lot
of docs are produced by some code (e.g. the remote packet usage settings).

gdb/ChangeLog
2019-08-07  Philippe Waroquiers  <philippe.waroquiers@skynet.be>

	* cli/cli-decode.h (print_doc_line): Add for_value_prefix argument.
	* cli/cli-decode.c (print_doc_line): Likewise.  It now prints
	the full first line, except when FOR_VALUE_PREFIX.  In this case,
	the trailing '.' is not output, and the first character is uppercased.
	(print_help_for_command): Update call to print_doc_line.
	(print_doc_of_command): Likewise.
	* cli/cli-setshow.c (deprecated_show_value_hack): Likewise.
	* cli/cli-option.c (append_indented_doc): Do not append newline.
	(build_help_option): Append newline after first appended_indented_doc
	only if a second call is done.
	(build_help): Append 2 new lines before each option, except the first
	one.
	* compile/compile.c (_initialize_compile): Add new lines after
	%OPTIONS%, when not at the end of the help.
	Change help doc or code
	producing the help doc to respect the invariants.
	* maint-test-options.c (_initialize_maint_test_options): Likewise.
	Also removed the new line after 'Options:', as all other commands
	do not put an empty line between 'Options:' and the first option.
	* printcmd.c (_initialize_printcmd): Likewise.
	* stack.c (_initialize_stack): Likewise.
	* interps.c (interpreter_exec_cmd): Fix "Usage:" line that was
	incorrectly telling COMMAND is optional.
	* ada-lang.c (_initialize_ada_language): Change help doc or code
	producing the help doc to respect the invariants.
	* ada-tasks.c (_initialize_ada_tasks): Likewise.
	* breakpoint.c (_initialize_breakpoint): Likewise.
	* cli/cli-cmds.c (_initialize_cli_cmds): Likewise.
	* cli/cli-logging.c (_initialize_cli_logging): Likewise.
	* cli/cli-setshow.c (_initialize_cli_setshow): Likewise.
	* cli/cli-style.c (cli_style_option::add_setshow_commands,
	_initialize_cli_style): Likewise.
	* corelow.c (core_target_info): Likewise.
	* dwarf-index-cache.c (_initialize_index_cache): Likewise.
	* dwarf2read.c (_initialize_dwarf2_read): Likewise.
	* filesystem.c (_initialize_filesystem): Likewise.
	* frame.c (_initialize_frame): Likewise.
	* gnu-nat.c (add_task_commands): Likewise.
	* infcall.c (_initialize_infcall): Likewise.
	* infcmd.c (_initialize_infcmd): Likewise.
	* interps.c (_initialize_interpreter): Likewise.
	* language.c (_initialize_language): Likewise.
	* linux-fork.c (_initialize_linux_fork): Likewise.
	* maint-test-settings.c (_initialize_maint_test_settings): Likewise.
	* maint.c (_initialize_maint_cmds): Likewise.
	* memattr.c (_initialize_mem): Likewise.
	* printcmd.c (_initialize_printcmd): Likewise.
	* python/lib/gdb/function/strfns.py (_MemEq, _StrLen, _StrEq,
	_RegEx): Likewise.
	* ravenscar-thread.c (_initialize_ravenscar): Likewise.
	* record-btrace.c (_initialize_record_btrace): Likewise.
	* record-full.c (_initialize_record_full): Likewise.
	* record.c (_initialize_record): Likewise.
	* regcache-dump.c (_initialize_regcache_dump): Likewise.
	* regcache.c (_initialize_regcache): Likewise.
	* remote.c (add_packet_config_cmd, init_remote_threadtests,
	_initialize_remote): Likewise.
	* ser-tcp.c (_initialize_ser_tcp): Likewise.
	* serial.c (_initialize_serial): Likewise.
	* skip.c (_initialize_step_skip): Likewise.
	* source.c (_initialize_source): Likewise.
	* stack.c (_initialize_stack): Likewise.
	* symfile.c (_initialize_symfile): Likewise.
	* symtab.c (_initialize_symtab): Likewise.
	* target-descriptions.c (_initialize_target_descriptions): Likewise.
	* top.c (init_main): Likewise.
	* tracefile-tfile.c (tfile_target_info): Likewise.
	* tracepoint.c (_initialize_tracepoint): Likewise.
	* tui/tui-win.c (_initialize_tui_win): Likewise.
	* utils.c (add_internal_problem_command): Likewise.
	* valprint.c (value_print_option_defs): Likewise.

gdb/testsuite/ChangeLog
2019-08-07  Philippe Waroquiers  <philippe.waroquiers@skynet.be>

	* gdb.base/style.exp: Update tests for help doc new invariants.
	* gdb.base/help.exp: Likewise.
2019-08-07 00:04:33 +02: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
Simon Marchi 431f22cc09 Revert "GDB: Remote target can now accept the form unix::/path/to/socket."
This reverts commit 88f5cc8cf8.
2018-10-29 13:22:47 -04:00
John Darrington 88f5cc8cf8 GDB: Remote target can now accept the form unix::/path/to/socket.
Allow target remote to use the unix::/path/to/socket syntax as well as just
plain /path/to/socket

gdb/

  * ser-uds.c (uds_open): Use parse_connection_spec to deal with the
    comm form unix::/path/to/socket.

  * serial.c (serial_open): Consider the "unix:" prefix when deciding which
    interface to use.
2018-10-23 16:09:34 +02:00
John Darrington c1168a2f66 Allow remote debugging over a Unix local domain socket.
Extend the "target remote" and "target extended-remote" commands
such that if the filename provided is a Unix local domain (AF_UNIX)
socket, then it'll be treated as such, instead of trying to open
it as if it were a character device.

gdb/ChangeLog:
	* NEWS: Mention changed commands.
	* ser-uds.c: New file.
	* configure.ac (SER_HARDWIRE): Add ser-uds.o.
	* configure: Regenerate.
	* Makefile.in: Add new file.
	* serial.c (serial_open): Check if filename is a socket
	  and lookup the appropriate interface accordingly.

gdb/doc/ChangeLog:
	* gdb.texinfo (Remote Connection Commands): Describe
	  the changes to target remote and target extended-remote
	  relating to Unix domain sockets.
2018-10-02 16:10:57 +02:00
Simon Marchi 467dc1e2ea Replace xstrvprintf usages with string_vprintf
Most usages of xstrvprintf in GDB can be replaced with string_vprintf,
removing some manual memory management.

gdb/ChangeLog:

	* guile/scm-string.c (gdbscm_scm_from_printf): Use
	string_vprintf.
	* guile/scm-utils.c (gdbscm_printf): Likewise.
	* serial.c (serial_printf): Likewise.
	* xml-support.c (gdb_xml_parser::vdebug): Likewise.
2018-08-22 10:55:28 -04:00
Simon Marchi 71b7376497 Remove more "struct" keywords in range-based for loops
GCC 6.3.0 produces this kind of errors:

  CXX    dwarf2read.o
/home/simark/src/binutils-gdb/gdb/dwarf2read.c: In function 'void process_cu_includes(dwarf2_per_objfile*)':
/home/simark/src/binutils-gdb/gdb/dwarf2read.c:10220:8: error: types may not be defined in a for-range-declaration [-Werror]
   for (struct dwarf2_per_cu_data *iter : dwarf2_per_objfile->just_read_cus)
        ^~~~~~

Removing the struct keyword makes it happy.

gdb/ChangeLog:

	* dwarf2read.c (process_cu_includes): Remove struct keyword.
	* serial.c (serial_interface_lookup): Remove struct keyword.
2018-06-10 22:34:08 -04:00
Tom Tromey 191cca6383 Remove a VEC from serial.c
This replaces a VEC in serial.c with a std::vector.

Tested by the buildbot.

gdb/ChangeLog
2018-06-09  Tom Tromey  <tom@tromey.com>

	* serial.c (serial_ops_p): Remove typedef.  Don't declare VEC.
	(serial_ops_list): Now static, std::vector.
	(serial_interface_lookup, serial_add_interface): Update.
2018-06-09 16:07:57 -06: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
Simon Marchi 798a7429f9 Remove some unused variables
This patch removes some unused variables, found with -Wunused.  I have
not removed everything reported by -Wunused, because some expressions
such as

  struct type *arg_type = check_typedef (value_type);

in bfin-tdep.c could have an unexpected but important side-effect.  I
removed others that I considered more low-risk, such as:

  struct gdbarch *gdbarch = get_objfile_arch (objfile);

I tested building with Python 2/Python 3/no Python, with/without expat,
with/without libipt and with/without babeltrace.

gdb/ChangeLog:

	* ada-lang.c (ada_collect_symbol_completion_matches): Remove
	unused variables.
	(ada_is_redundant_range_encoding): Likewise.
	* ada-varobj.c (ada_varobj_get_value_of_array_variable):
	Likewise.
	* alpha-tdep.c (alpha_software_single_step): Likewise.
	* arm-tdep.c (_initialize_arm_tdep): Likewise.
	* auto-load.c (info_auto_load_cmd): Likewise.
	* break-catch-syscall.c (insert_catch_syscall): Likewise.
	(remove_catch_syscall): Likewise.
	* breakpoint.c (condition_completer): Likewise.
	(clear_command): Likewise.
	(update_breakpoint_locations): Likewise.
	* btrace.c (btrace_disable): Likewise.
	(btrace_teardown): Likewise.
	(btrace_maint_update_pt_packets): Likewise.
	(maint_btrace_clear_cmd): Likewise.
	* cli/cli-decode.c (lookup_cmd_1): Likewise.
	(lookup_cmd_composition): Likewise.
	* cli/cli-dump.c (scan_filename): Likewise.
	(restore_command): Likewise.
	* compile/compile-loc2c.c (compute_stack_depth): Likewise.
	* compile/compile-object-load.c (compile_object_load): Likewise.
	* compile/compile-object-run.c (compile_object_run): Likewise.
	* compile/compile.c (compile_to_object): Likewise.
	* completer.c (filename_completer): Likewise.
	(complete_files_symbols): Likewise.
	(complete_expression): Likewise.
	* corelow.c (core_open): Likewise.
	* ctf.c (ctf_start): Likewise.
	(ctf_write_status): Likewise.
	(ctf_write_uploaded_tsv): Likewise.
	(ctf_write_definition_end): Likewise.
	(ctf_open_dir): Likewise.
	(ctf_xfer_partial): Likewise.
	(ctf_trace_find): Likewise.
	* disasm.c (gdb_pretty_print_disassembler::pretty_print_insn):
	Likewise.
	* dwarf2loc.c (allocate_piece_closure): Likewise.
	(indirect_pieced_value): Likewise.
	(dwarf2_evaluate_loc_desc_full): Likewise.
	* dwarf2read.c (dw2_expand_marked_cus): Likewise.
	(dw2_expand_symtabs_matching): Likewise.
	(dw2_map_symbol_filenames): Likewise.
	(read_and_check_comp_unit_head): Likewise.
	(read_cutu_die_from_dwo): Likewise.
	(lookup_dwo_unit): Likewise.
	(read_comp_units_from_section): Likewise.
	(dwarf2_compute_name): Likewise.
	(handle_DW_AT_stmt_list): Likewise.
	(create_cus_hash_table): Likewise.
	(create_dwp_v2_section): Likewise.
	(dwarf2_rnglists_process): Likewise.
	(dwarf2_ranges_process): Likewise.
	(dwarf2_record_block_ranges): Likewise.
	(is_vtable_name): Likewise.
	(read_formatted_entries): Likewise.
	(skip_form_bytes): Likewise.
	* elfread.c (elf_symtab_read): Likewise.
	* exec.c (exec_file_command): Likewise.
	* f-valprint.c (f_val_print): Likewise.
	(info_common_command_for_block): Likewise.
	* guile/guile.c (initialize_scheme_side): Likewise.
	* guile/scm-breakpoint.c (gdbscm_breakpoint_commands): Likewise.
	* guile/scm-cmd.c (cmdscm_completer): Likewise.
	(gdbscm_register_command_x): Likewise.
	* guile/scm-frame.c (gdbscm_frame_read_var): Likewise.
	* guile/scm-param.c (gdbscm_parameter_value): Likewise.
	* guile/scm-ports.c (file_port_magic): Likewise.
	* guile/scm-pretty-print.c (ppscm_search_pp_list): Likewise.
	(ppscm_pretty_print_one_value): Likewise.
	(ppscm_print_children): Likewise.
	* guile/scm-string.c (gdbscm_string_to_argv): Likewise.
	* guile/scm-symtab.c (gdbscm_sal_symtab): Likewise.
	* guile/scm-type.c (gdbscm_type_next_field_x): Likewise.
	* guile/scm-utils.c (gdbscm_parse_function_args): Likewise.
	* i386-tdep.c (i386_register_reggroup_p): Likewise.
	* infcmd.c (run_command_1): Likewise.
	(until_next_fsm_clean_up): Likewise.
	* linespec.c (linespec_complete): Likewise.
	(find_label_symbols): Likewise.
	* m2-valprint.c (m2_val_print): Likewise.
	* memattr.c (require_user_regions): Likewise.
	(lookup_mem_region): Likewise.
	(disable_mem_command): Likewise.
	(mem_delete): Likewise.
	* mep-tdep.c (mep_register_name): Likewise.
	(mep_analyze_prologue): Likewise.
	* mi/mi-cmd-file.c (mi_cmd_file_list_shared_libraries): Likewise.
	* mi/mi-interp.c (mi_on_sync_execution_done): Likewise.
	* mi/mi-main.c (mi_cmd_trace_frame_collected): Likewise.
	* microblaze-linux-tdep.c (microblaze_linux_init_abi): Likewise.
	* minidebug.c (lzma_open): Likewise.
	* minsyms.c (lookup_minimal_symbol): Likewise.
	* mips-linux-tdep.c (mips64_fill_fpregset): Likewise.
	* mips-tdep.c (mips_stub_frame_sniffer): Likewise.
	(mips_o64_return_value): Likewise.
	(mips_single_step_through_delay): Likewise.
	(_initialize_mips_tdep): Likewise.
	* nios2-tdep.c (nios2_push_dummy_call): Likewise.
	(nios2_software_single_step): Likewise.
	* parse.c (find_minsym_type_and_address): Likewise.
	* psymtab.c (psym_relocate): Likewise.
	* python/py-breakpoint.c (bppy_get_commands): Likewise.
	(gdbpy_breakpoint_modified): Likewise.
	* python/py-infevents.c (create_inferior_call_event_object):
	Likewise.
	* python/py-record-btrace.c (btpy_list_item): Likewise.
	* python/py-type.c (typy_str): Likewise.
	* python/py-value.c (valpy_call): Likewise.
	* python/python.c (do_start_initialization): Likewise.
	* record-btrace.c (record_btrace_insn_history_range): Likewise.
	(record_btrace_call_history_range): Likewise.
	(record_btrace_record_method): Likewise.
	(record_btrace_xfer_partial): Likewise.
	(btrace_get_frame_function): Likewise.
	* record-full.c (record_full_open): Likewise.
	* record.c (get_context_size): Likewise.
	* registry.h (DEFINE_REGISTRY): Likewise.
	* remote-fileio.c (remote_fileio_request): Likewise.
	* remote.c (remote_update_thread_list): Likewise.
	(remote_check_symbols): Likewise.
	(remote_commit_resume): Likewise.
	(remote_interrupt): Likewise.
	(remote_insert_breakpoint): Likewise.
	(compare_sections_command): Likewise.
	* rust-exp.y (super_name): Likewise.
	(lex_string): Likewise.
	(convert_ast_to_type): Likewise.
	(convert_ast_to_expression): Likewise.
	* rust-lang.c (rust_print_struct_def): Likewise.
	(rust_print_type): Likewise.
	(rust_evaluate_subexp): Likewise.
	* rx-tdep.c (rx_register_type): Likewise.
	* ser-event.c (serial_event_clear): Likewise.
	* serial.c (serial_open): Likewise.
	* spu-tdep.c (spu_overlay_new_objfile): Likewise.
	* symfile.c (section_is_overlay): Likewise.
	(overlay_unmapped_address): Likewise.
	(overlay_mapped_address): Likewise.
	(simple_overlay_update_1): Likewise.
	(simple_overlay_update): Likewise.
	* symtab.c (symbol_find_demangled_name): Likewise.
	(search_symbols): Likewise.
	* target-descriptions.c (tdesc_predefined_type): Likewise.
	* target.c (target_commit_resume): Likewise.
	* thread.c (print_selected_thread_frame): Likewise.
	* top.c (new_ui_command): Likewise.
	(gdb_readline_no_editing): Likewise.
	* tracefile-tfile.c (tfile_open): Likewise.
	* tracepoint.c (create_tsv_from_upload): Likewise.
	* utils.c (quit): Likewise.
	(defaulted_query): Likewise.
	* valarith.c (value_concat): Likewise.
	* xml-syscall.c (xml_list_syscalls_by_group): Likewise.
	* xml-tdesc.c (target_fetch_description_xml): Likewise.
	* xtensa-tdep.c (xtensa_pseudo_register_read): Likewise.
	(xtensa_pseudo_register_write): Likewise.

gdb/gdbserver/ChangeLog:

	* regcache.c (registers_to_string): Remove unused variable.
2017-12-05 16:05:50 -05: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
Pedro Alves 726e13564b Assume termios is available, remove support for termio and sgtty
This commit garbage collects the termio and sgtty support.

GDB's terminal handling code still has support for the old termio and
sgtty interfaces in addition to termios.  However, I think it's pretty
safe to assume that for a long, long time, Unix-like systems provide
termios.  GNU/Linux, Solaris, Cygwin, AIX, DJGPP, macOS and the BSDs
all have had termios.h for many years.  Looking around the web, I
found discussions about FreeBSD folks trying to get rid of old sgtty.h
a decade ago:

  https://lists.freebsd.org/pipermail/freebsd-hackers/2007-March/019983.html

So I think support for termio and sgtty in GDB is just dead code that
is never compiled anywhere and is just getting in the way.  For
example, serial_noflush_set_tty_state and the raw<->cooked concerns
mentioned in inflow.c only exist because of sgtty (see
hardwire_noflush_set_tty_state).

Regtested on GNU/Linux.

Confirmed that I can still build Solaris, DJGPP and AIX GDB and that
the resulting GDBs still include the termios.h-guarded code.
Confirmed mingw-w64 GDB still builds and skips the termios.h-guarded
code.

gdb/ChangeLog:
2017-11-06  Pedro Alves  <palves@redhat.com>

	* Makefile.in (SER_HARDWIRE): Update comment.
	(HFILES_NO_SRCDIR): Remove gdb_termios.h.
	* common/gdb_termios.h: Delete file.
	* common/job-control.c: Include termios.h and unistd.h instead of
	gdb_termios.h.
	(gdb_setpgid): Remove HAVE_TERMIOS || TIOCGPGRP preprocessor
	check.
	(have_job_control): Check HAVE_TERMIOS_H instead of HAVE_TERMIOS.
	Remove sgtty code.
	* configure.ac: No longer check for termio.h and sgtty.h.
	* configure: Regenerate.
	* inflow.c: Include termios.h instead of gdb_termios.h.  Replace
	PROCESS_GROUP_TYPE checks with HAVE_TERMIOS_H checks throughout.
	Replace PROCESS_GROUP_TYPE references with pid_t references
	throughout.
	(gdb_getpgrp): Delete.
	(set_initial_gdb_ttystate): Use tcgetpgrp instead of gdb_getpgrp.
	(child_terminal_inferior): Remove comment.  Remove sgtty code.
	(child_terminal_ours_1): Use tcgetpgrp directly instead of
	gdb_getpgrp.  Use serial_set_tty_state instead aof
	serial_noflush_set_tty_state.  Remove sgtty code.
	* inflow.h: Include unistd.h instead of gdb_termios.h.  Replace
	PROCESS_GROUP_TYPE check with HAVE_TERMIOS_H check.
	(inferior_process_group): Now returns pid_t.
	* ser-base.c (ser_base_noflush_set_tty_state): Delete.
	* ser-base.h (ser_base_noflush_set_tty_state): Delete.
	* ser-event.c (serial_event_ops): Update.
	* ser-go32.c (dos_noflush_set_tty_state): Delete.
	(dos_ops): Update.
	* ser-mingw.c (hardwire_ops, tty_ops, pipe_ops, tcp_ops): Update.
	* ser-pipe.c (pipe_ops): Update.
	* ser-tcp.c (tcp_ops): Update.
	* ser-unix.c: Include termios.h instead of gdb_termios.h.  Remove
	HAVE_TERMIOS checks.
	[HAVE_TERMIO] (struct hardwire_ttystate): Delete.
	[HAVE_SGTTY] (struct hardwire_ttystate): Delete.
	(get_tty_state, set_tty_state): Drop termio and sgtty code, and
	assume termios.
	(hardwire_noflush_set_tty_state): Delete.
	(hardwire_print_tty_state, hardwire_drain_output)
	(hardwire_flush_output, hardwire_flush_input)
	(hardwire_send_break, hardwire_raw, hardwire_setbaudrate)
	(hardwire_setstopbits, hardwire_setparity): Drop termio and sgtty
	code, and assume termios.
	(hardwire_ops): Update.
	(_initialize_ser_hardwire): Remove HAVE_TERMIOS check.
	* serial.c (serial_noflush_set_tty_state): Delete.
	* serial.h (serial_noflush_set_tty_state): Delete.
	(serial_ops::noflush_set_tty_state): Delete.

gdb/gdbserver/ChangeLog:
2017-11-06  Pedro Alves  <palves@redhat.com>

	* configure.ac: No longer check for termio.h and sgtty.h.
	* configure: Regenerate.
	* remote-utils.c: Include termios.h instead of gdb_termios.h.
	(remote_open): Check HAVE_TERMIOS_H instead of HAVE_TERMIOS.
	Remove termio and sgtty code.
2017-11-06 15:36:46 +00:00
Tom Tromey 981a3fb359 Constify add_prefix_cmd
This changes add_prefix_cmd to accept a const-taking function as an
argument; then fixes up all the callers.

In a couple of spots I had to add a non-const overload of a function,
because the function is passed to two different command-adding
"constructors".  These overloads are temporary; once constification is
complete they can be removed.

This patch also fixes a typo I happened to notice while constifying.

Note that this touches a couple of files (gnu-nat.c and go32-nat.c)
that I can't build.  So, while I made a best-effort there, I am not
certain they will still compile.

Tested by rebuilding.

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

	* gdbthread.h (thread_command): Constify.
	* inferior.h (detach_command): Constify.
	* top.h (set_history, show_history): Constify.
	* arm-tdep.c (set_arm_command, show_arm_command): Constify.
	* serial.c (serial_set_cmd, serial_show_cmd): Constify.
	* bsd-kvm.c (bsd_kvm_cmd): Constify.
	* printcmd.c (set_command): Constify.
	(non_const_set_command): New function.
	* dcache.c (set_dcache_command, show_dcache_command): Constify.
	* breakpoint.c (enable_command, disable_command, delete_command)
	(catch_command, tcatch_command, set_breakpoint_cmd)
	(show_breakpoint_cmd): Constify.
	* macrocmd.c (macro_command): Constify.
	* infcmd.c (unset_command, kill_command, detach_command)
	(info_proc_cmd): Constify.
	* i386-tdep.c (set_mpx_cmd, show_mpx_cmd): Constify.
	* auto-load.c (show_auto_load_cmd, set_auto_load_cmd)
	(info_auto_load_cmd): Constify.
	* target-descriptions.c (set_tdesc_cmd, show_tdesc_cmd)
	(unset_tdesc_cmd): Constify.
	* ada-lang.c (set_ada_command, show_ada_command)
	(maint_set_ada_cmd, maint_show_ada_cmd): Constify.
	* guile/guile.c (set_guile_command, show_guile_command)
	(info_guile_command): Constify.
	* tui/tui-win.c (tui_command, set_tui_cmd, show_tui_cmd):
	Constify.
	* skip.c (skip_command): Constify.
	* compile/compile.c (_initialize_compile): Constify.
	* dwarf2read.c (set_dwarf_cmd, show_dwarf_cmd): Constify.
	* btrace.c (maint_btrace_cmd, maint_btrace_set_cmd)
	(maint_btrace_show_cmd, maint_btrace_pt_set_cmd)
	(maint_btrace_pt_show_cmd): Constify.
	* remote.c (set_remote_cmd, show_remote_cmd, remote_command):
	Constify.
	* python/python.c (user_show_python, user_set_python): Constify.
	* mips-tdep.c (set_mips_command, show_mips_command)
	(set_mipsfpu_command): Constify.
	* record-btrace.c (cmd_record_btrace_start)
	(cmd_set_record_btrace, cmd_show_record_btrace)
	(cmd_set_record_btrace_bts, cmd_show_record_btrace_bts)
	(cmd_set_record_btrace_pt, cmd_show_record_btrace_pt): Constify.
	* rs6000-tdep.c (set_powerpc_command, show_powerpc_command):
	Constify.
	* symfile.c (overlay_command): Constify.
	* spu-tdep.c (set_spu_command, show_spu_command): Constify.
	* cli/cli-logging.c (set_logging_command, show_logging_command):
	Constify.
	* cli/cli-dump.c (dump_command, append_command)
	(srec_dump_command, ihex_dump_command, verilog_dump_command)
	(tekhex_dump_command, binary_dump_command)
	(binary_append_command): Constify.
	* cli/cli-decode.c (struct cmd_list_element): Change type of
	"fun".
	* cli/cli-cmds.c (info_command, show_command, set_debug)
	(show_debug): Constify.
	(show_command): Add non-const overload.
	* top.c (set_history, show_history): Constify.
	* sh-tdep.c (set_sh_command, show_sh_command): Constify.
	* command.h (add_prefix_cmd): Accept a cmd_const_cfunc_ftype.
	* target.c (target_command): Constify.
	* sparc64-tdep.c (info_adi_command): Constify.
	* record-full.c (cmd_record_full_start): Constify.
	(set_record_full_command): Constify.  Fix typo.
	(show_record_full_command): Constify.
	* thread.c (thread_command, thread_apply_command): Constify.
	* memattr.c (dummy_cmd): Constify.
	* value.c (function_command): Constify.
	* frame.c (set_backtrace_cmd, show_backtrace_cmd): Constify.
	* probe.c (info_probes_command): Constify.
	* ser-tcp.c (set_tcp_cmd, show_tcp_cmd): Constify.
	* gnu-nat.c (set_task_cmd, show_task_cmd, set_thread_cmd)
	(show_thread_cmd, set_thread_default_cmd)
	(show_thread_default_cmd): Constify.
	(check_empty): Constify.
	* tracepoint.c (tfind_command): Constify.
	* cp-support.c (maint_cplus_command): Constify.
	* windows-tdep.c (info_w32_command): Constify.
	* record.c (cmd_record_start, set_record_command)
	(show_record_command, info_record_command, cmd_record_goto):
	Constify.
	* ravenscar-thread.c (set_ravenscar_command)
	(show_ravenscar_command): Constify.
	* utils.c (set_internal_problem_cmd, show_internal_problem_cmd):
	Constify.
	(add_internal_problem_command): Remove casts.
	* arc-tdep.c (maintenance_print_arc_command): Constify.
	* valprint.c (set_print, show_print, set_print_raw)
	(show_print_raw): Constify.
	* maint.c (maintenance_command, maintenance_info_command)
	(maintenance_print_command, maintenance_set_cmd)
	(maintenance_show_cmd, set_per_command_cmd)
	(show_per_command_cmd, maintenance_check_command): Constify.
	* language.c (set_check, show_check): Constify.
	* typeprint.c (show_print_type, set_print_type): Constify.
	* go32-nat.c (go32_info_dos_command): Constify.
2017-10-11 16:21:02 -06:00
Tom Tromey f1735a53a6 Rename _const functions to use overloading instead
This renames a few functions -- skip_spaces_const,
skip_to_space_const, get_number_const, extract_arg_const -- to drop
the "_const" suffix and instead rely on overloading.

This makes future const fixes simpler by reducing the number of lines
that must be changed.  I think it is also not any less clear, as all
these functions have the same interface as their non-const versions by
design.  Furthermore there's an example of using an overload in-tree
already, namely check_for_argument.

This patch was largely created using some perl one-liners; then a few
fixes were applied by hand.

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

	* common/common-utils.h (skip_to_space): Remove macro, redeclare
	as function.
	(skip_to_space): Rename from skip_to_space_const.
	* common/common-utils.c (skip_to_space): New function.
	(skip_to_space): Rename from skip_to_space_const.
	* cli/cli-utils.h (get_number): Rename from get_number_const.
	(extract_arg): Rename from extract_arg_const.
	* cli/cli-utils.c (get_number): Rename from get_number_const.
	(extract_arg): Rename from extract_arg_const.
	(number_or_range_parser::get_number): Use ::get_number.
	* aarch64-linux-tdep.c, ada-lang.c, arm-linux-tdep.c, ax-gdb.c,
	break-catch-throw.c, breakpoint.c, cli/cli-cmds.c, cli/cli-dump.c,
	cli/cli-script.c, cli/cli-setshow.c, compile/compile.c,
	completer.c, demangle.c, disasm.c, findcmd.c, linespec.c,
	linux-tdep.c, linux-thread-db.c, location.c, mi/mi-parse.c,
	minsyms.c, nat/linux-procfs.c, printcmd.c, probe.c,
	python/py-breakpoint.c, record.c, rust-exp.y, serial.c, stack.c,
	stap-probe.c, tid-parse.c, tracepoint.c: Update all callers.
2017-09-11 15:46:12 -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
Pedro Alves d7e747318f Eliminate make_cleanup_ui_file_delete / make ui_file a class hierarchy
This patch starts from the desire to eliminate
make_cleanup_ui_file_delete, but then goes beyond.  It makes ui_file &
friends a real C++ class hierarchy, and switches temporary
ui_file-like objects to stack-based allocation.

- mem_fileopen -> string_file

mem_fileopen is replaced with a new string_file class that is treated
as a value class created on the stack.  This alone eliminates most
make_cleanup_ui_file_delete calls, and, simplifies code a whole lot
(diffstat shows around 1k loc dropped.)

string_file's internal buffer is a std::string, thus the "string" in
the name.  This simplifies the implementation much, compared to
mem_fileopen, which managed growing its internal buffer manually.

- ui_file_as_string, ui_file_strdup, ui_file_obsavestring all gone

The new string_file class has a string() method that provides direct
writable access to the internal std::string buffer.  This replaced
ui_file_as_string, which forced a copy of the same data the stream had
inside.  With direct access via a writable reference, we can instead
move the string out of the string_stream, avoiding deep string
copying.

Related, ui_file_xstrdup calls are replaced with xstrdup'ping the
stream's string, and ui_file_obsavestring is replaced by
obstack_copy0.

With all those out of the way, getting rid of the weird ui_file_put
mechanism was possible.

- New ui_file::printf, ui_file::puts, etc. methods

These simplify / clarify client code.  I considered splitting
client-code changes, like these, e.g.:

  -  stb = mem_fileopen ();
  -  fprintf_unfiltered (stb, "%s%s%s",
  -		      _("The valid values are:\n"),
  -		      regdesc,
  -		      _("The default is \"std\"."));
  +  string_file stb;
  +  stb.printf ("%s%s%s",
  +	      _("The valid values are:\n"),
  +	      regdesc,
  +	      _("The default is \"std\"."));

In two steps, with the first step leaving fprintf_unfiltered (etc.)
calls in place, and only afterwards do a pass to change all those to
call stb.printf etc..  I didn't do that split, because (when I tried),
it turned out to be pointless make-work: the first pass would have to
touch the fprintf_unfiltered line anyway, to replace "stb" with
"&stb".

- gdb_fopen replaced with stack-based objects

This avoids the need for cleanups or unique_ptr's.  I.e., this:

      struct ui_file *file = gdb_fopen (filename, "w");
      if (filename == NULL)
 	perror_with_name (filename);
      cleanups = make_cleanup_ui_file_delete (file);
      // use file.
      do_cleanups (cleanups);

is replaced with this:

      stdio_file file;
      if (!file.open (filename, "w"))
 	perror_with_name (filename);
      // use file.

- odd contorsions in null_file_write / null_file_fputs around when to
  call to_fputs / to_write eliminated.

- Global null_stream object

A few places that were allocating a ui_file in order to print to
"nowhere" are adjusted to instead refer to a new 'null_stream' global
stream.

- TUI's tui_sfileopen eliminated.  TUI's ui_file much simplified

The TUI's ui_file was serving a dual purpose.  It supported being used
as string buffer, and supported being backed by a stdio FILE.  The
string buffer part is gone, replaced by using of string_file.  The
'FILE *' support is now much simplified, by making the TUI's ui_file
inherit from stdio_file.

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

	* ada-lang.c (type_as_string): Use string_file.
	* ada-valprint.c (ada_print_floating): Use string_file.
	* ada-varobj.c (ada_varobj_scalar_image)
	(ada_varobj_get_value_image): Use string_file.
	* aix-thread.c (aix_thread_extra_thread_info): Use string_file.
	* arm-tdep.c (_initialize_arm_tdep): Use string_printf.
	* breakpoint.c (update_inserted_breakpoint_locations)
	(insert_breakpoint_locations, reattach_breakpoints)
	(print_breakpoint_location, print_one_detail_ranged_breakpoint)
	(print_it_watchpoint): Use string_file.
	(save_breakpoints): Use stdio_file.
	* c-exp.y (oper): Use string_file.
	* cli/cli-logging.c (set_logging_redirect): Use ui_file_up and
	tee_file.
	(pop_output_files): Use delete.
	(handle_redirections): Use stdio_file and tee_file.
	* cli/cli-setshow.c (do_show_command): Use string_file.
	* compile/compile-c-support.c (c_compute_program): Use
	string_file.
	* compile/compile-c-symbols.c (generate_vla_size): Take a
	'string_file &' instead of a 'ui_file *'.
	(generate_c_for_for_one_variable): Take a 'string_file &' instead
	of a 'ui_file *'.  Use string_file.
	(generate_c_for_variable_locations): Take a 'string_file &'
	instead of a 'ui_file *'.
	* compile/compile-internal.h (generate_c_for_for_one_variable):
	Take a 'string_file &' instead of a 'ui_file *'.
	* compile/compile-loc2c.c (push, pushf, unary, binary)
	(print_label, pushf_register_address, pushf_register)
	(do_compile_dwarf_expr_to_c): Take a 'string_file &' instead of a
	'ui_file *'.  Adjust.
	* compile/compile.c (compile_to_object): Use string_file.
	* compile/compile.h (compile_dwarf_expr_to_c)
	(compile_dwarf_bounds_to_c): Take a 'string_file &' instead of a
	'ui_file *'.
	* cp-support.c (inspect_type): Use string_file and obstack_copy0.
	(replace_typedefs_qualified_name): Use string_file and
	obstack_copy0.
	* disasm.c (gdb_pretty_print_insn): Use string_file.
	(gdb_disassembly): Adjust reference the null_stream global.
	(do_ui_file_delete): Delete.
	(gdb_insn_length): Use null_stream.
	* dummy-frame.c (maintenance_print_dummy_frames): Use stdio_file.
	* dwarf2loc.c (dwarf2_compile_property_to_c)
	(locexpr_generate_c_location, loclist_generate_c_location): Take a
	'string_file &' instead of a 'ui_file *'.
	* dwarf2loc.h (dwarf2_compile_property_to_c): Likewise.
	* dwarf2read.c (do_ui_file_peek_last): Delete.
	(dwarf2_compute_name): Use string_file.
	* event-top.c (gdb_setup_readline): Use stdio_file.
	* gdbarch.sh (verify_gdbarch): Use string_file.
	* gdbtypes.c (safe_parse_type): Use null_stream.
	* guile/scm-breakpoint.c (gdbscm_breakpoint_commands): Use
	string_file.
	* guile/scm-disasm.c (gdbscm_print_insn_from_port): Take a
	'string_file *' instead of a 'ui_file *'.
	(gdbscm_arch_disassemble): Use string_file.
	* guile/scm-frame.c (frscm_print_frame_smob): Use string_file.
	* guile/scm-ports.c (class ioscm_file_port): Now a class that
	inherits from ui_file.
	(ioscm_file_port_delete, ioscm_file_port_rewind)
	(ioscm_file_port_put): Delete.
	(ioscm_file_port_write): Rename to ...
	(ioscm_file_port::write): ... this.  Remove file_port_magic
	checks.
	(ioscm_file_port_new): Delete.
	(ioscm_with_output_to_port_worker): Use ioscm_file_port and
	ui_file_up.
	* guile/scm-type.c (tyscm_type_name): Use string_file.
	* guile/scm-value.c (vlscm_print_value_smob, gdbscm_value_print):
	Use string_file.
	* infcmd.c (print_return_value_1): Use string_file.
	* infrun.c (print_target_wait_results): Use string_file.
	* language.c (add_language): Use string_file.
	* location.c (explicit_to_string_internal): Use string_file.
	* main.c (captured_main_1): Use null_file.
	* maint.c (maintenance_print_architecture): Use stdio_file.
	* mi/mi-cmd-stack.c (list_arg_or_local): Use string_file.
	* mi/mi-common.h (struct mi_interp) <out, err, log, targ,
	event_channel>: Change type to mi_console_file pointer.
	* mi/mi-console.c (mi_console_file_fputs, mi_console_file_flush)
	(mi_console_file_delete): Delete.
	(struct mi_console_file): Delete.
	(mi_console_file_magic): Delete.
	(mi_console_file_new): Delete.
	(mi_console_file::mi_console_file): New.
	(mi_console_file_delete): Delete.
	(mi_console_file_fputs): Delete.
	(mi_console_file::write): New.
	(mi_console_raw_packet): Delete.
	(mi_console_file::flush): New.
	(mi_console_file_flush): Delete.
	(mi_console_set_raw): Rename to ...
	(mi_console_file::set_raw): ... this.
	* mi/mi-console.h (class mi_console_file): New class.
	(mi_console_file_new, mi_console_set_raw): Delete.
	* mi/mi-interp.c (mi_interpreter_init): Use mi_console_file.
	(mi_set_logging): Use delete and tee_file.  Adjust.
	* mi/mi-main.c (output_register): Use string_file.
	(mi_cmd_data_evaluate_expression): Use string_file.
	(mi_cmd_data_read_memory): Use string_file.
	(mi_cmd_execute, print_variable_or_computed): Use string_file.
	* mi/mi-out.c (mi_ui_out::main_stream): New.
	(mi_ui_out::rewind): Use main_stream and
	string_file.
	(mi_ui_out::put): Use main_stream and string_file.
	(mi_ui_out::mi_ui_out): Remove 'stream' parameter.
	Allocate a 'string_file' instead.
	(mi_out_new): Don't allocate a mem_fileopen stream here.
	* mi/mi-out.h (mi_ui_out::mi_ui_out): Remove 'stream' parameter.
	(mi_ui_out::main_stream): Declare method.
	* printcmd.c (eval_command): Use string_file.
	* psymtab.c (maintenance_print_psymbols): Use stdio_file.
	* python/py-arch.c (archpy_disassemble): Use string_file.
	* python/py-breakpoint.c (bppy_get_commands): Use string_file.
	* python/py-frame.c (frapy_str): Use string_file.
	* python/py-framefilter.c (py_print_type, py_print_single_arg):
	Use string_file.
	* python/py-type.c (typy_str): Use string_file.
	* python/py-unwind.c (unwind_infopy_str): Use string_file.
	* python/py-value.c (valpy_str): Use string_file.
	* record-btrace.c (btrace_insn_history): Use string_file.
	* regcache.c (regcache_print): Use stdio_file.
	* reggroups.c (maintenance_print_reggroups): Use stdio_file.
	* remote.c (escape_buffer): Use string_file.
	* rust-lang.c (rust_get_disr_info): Use string_file.
	* serial.c (serial_open_ops_1): Use stdio_file.
	(do_serial_close): Use delete.
	* stack.c (print_frame_arg): Use string_file.
	(print_frame_args): Remove local mem_fileopen stream, not used.
	(print_frame): Use string_file.
	* symmisc.c (maintenance_print_symbols): Use stdio_file.
	* symtab.h (struct symbol_computed_ops) <generate_c_location>:
	Take a 'string_file *' instead of a 'ui_file *'.
	* top.c (new_ui): Use stdio_file and stderr_file.
	(free_ui): Use delete.
	(execute_command_to_string): Use string_file.
	(quit_confirm): Use string_file.
	* tracepoint.c (collection_list::append_exp): Use string_file.
	* tui/tui-disasm.c (tui_disassemble): Use string_file.
	* tui/tui-file.c: Don't include "ui-file.h".
	(enum streamtype, struct tui_stream): Delete.
	(tui_file_new, tui_file_delete, tui_fileopen, tui_sfileopen)
	(tui_file_isatty, tui_file_rewind, tui_file_put): Delete.
	(tui_file::tui_file): New method.
	(tui_file_fputs): Delete.
	(tui_file_get_strbuf): Delete.
	(tui_file::puts): New method.
	(tui_file_adjust_strbuf): Delete.
	(tui_file_flush): Delete.
	(tui_file::flush): New method.
	* tui/tui-file.h: Tweak intro comment.
	Include ui-file.h.
	(tui_fileopen, tui_sfileopen, tui_file_get_strbuf)
	(tui_file_adjust_strbuf): Delete declarations.
	(class tui_file): New class.
	* tui/tui-io.c (tui_initialize_io): Use tui_file.
	* tui/tui-regs.c (tui_restore_gdbout): Use delete.
	(tui_register_format): Use string_stream.
	* tui/tui-stack.c (tui_make_status_line): Use string_file.
	(tui_get_function_from_frame): Use string_file.
	* typeprint.c (type_to_string): Use string_file.
	* ui-file.c (struct ui_file, ui_file_magic, ui_file_new): Delete.
	(null_stream): New global.
	(ui_file_delete): Delete.
	(ui_file::ui_file): New.
	(null_file_isatty): Delete.
	(ui_file::~ui_file): New.
	(null_file_rewind): Delete.
	(ui_file::printf): New.
	(null_file_put): Delete.
	(null_file_flush): Delete.
	(ui_file::putstr): New.
	(null_file_write): Delete.
	(ui_file::putstrn): New.
	(null_file_read): Delete.
	(ui_file::putc): New.
	(null_file_fputs): Delete.
	(null_file_write_async_safe): Delete.
	(ui_file::vprintf): New.
	(null_file_delete): Delete.
	(null_file::write): New.
	(null_file_fseek): Delete.
	(null_file::puts): New.
	(ui_file_data): Delete.
	(null_file::write_async_safe): New.
	(gdb_flush, ui_file_isatty): Adjust.
	(ui_file_put, ui_file_rewind): Delete.
	(ui_file_write): Adjust.
	(ui_file_write_for_put): Delete.
	(ui_file_write_async_safe, ui_file_read): Adjust.
	(ui_file_fseek): Delete.
	(fputs_unfiltered): Adjust.
	(set_ui_file_flush, set_ui_file_isatty, set_ui_file_rewind)
	(set_ui_file_put, set_ui_file_write, set_ui_file_write_async_safe)
	(set_ui_file_read, set_ui_file_fputs, set_ui_file_fseek)
	(set_ui_file_data): Delete.
	(string_file::~string_file, string_file::write)
	(struct accumulated_ui_file, do_ui_file_xstrdup, ui_file_xstrdup)
	(do_ui_file_as_string, ui_file_as_string): Delete.
	(do_ui_file_obsavestring, ui_file_obsavestring): Delete.
	(struct mem_file): Delete.
	(mem_file_new): Delete.
	(stdio_file::stdio_file): New.
	(mem_file_delete): Delete.
	(stdio_file::stdio_file): New.
	(mem_fileopen): Delete.
	(stdio_file::~stdio_file): New.
	(mem_file_rewind): Delete.
	(stdio_file::set_stream): New.
	(mem_file_put): Delete.
	(stdio_file::open): New.
	(mem_file_write): Delete.
	(stdio_file_magic, struct stdio_file): Delete.
	(stdio_file_new, stdio_file_delete, stdio_file_flush): Delete.
	(stdio_file::flush): New.
	(stdio_file_read): Rename to ...
	(stdio_file::read): ... this.  Adjust.
	(stdio_file_write): Rename to ...
	(stdio_file::write): ... this.  Adjust.
	(stdio_file_write_async_safe): Rename to ...
	(stdio_file::write_async_safe) ... this.  Adjust.
	(stdio_file_fputs): Rename to ...
	(stdio_file::puts) ... this.  Adjust.
	(stdio_file_isatty): Delete.
	(stdio_file_fseek): Delete.
	(stdio_file::isatty): New.
	(stderr_file_write): Rename to ...
	(stderr_file::write) ... this.  Adjust.
	(stderr_file_fputs): Rename to ...
	(stderr_file::puts) ... this.  Adjust.
	(stderr_fileopen, stdio_fileopen, gdb_fopen): Delete.
	(stderr_file::stderr_file): New.
	(tee_file_magic): Delete.
	(struct tee_file): Delete.
	(tee_file::tee_file): New.
	(tee_file_new): Delete.
	(tee_file::~tee_file): New.
	(tee_file_delete): Delete.
	(tee_file_flush): Rename to ...
	(tee_file::flush): ... this.  Adjust.
	(tee_file_write): Rename to ...
	(tee_file::write): ... this.  Adjust.
	(tee_file::write_async_safe): New.
	(tee_file_fputs): Rename to ...
	(tee_file::puts): ... this.  Adjust.
	(tee_file_isatty): Rename to ...
	(tee_file::isatty): ... this.  Adjust.
	* ui-file.h (struct obstack, struct ui_file): Don't
	forward-declare.
	(ui_file_new, ui_file_flush_ftype, set_ui_file_flush)
	(ui_file_write_ftype)
	(set_ui_file_write, ui_file_fputs_ftype, set_ui_file_fputs)
	(ui_file_write_async_safe_ftype, set_ui_file_write_async_safe)
	(ui_file_read_ftype, set_ui_file_read, ui_file_isatty_ftype)
	(set_ui_file_isatty, ui_file_rewind_ftype, set_ui_file_rewind)
	(ui_file_put_method_ftype, ui_file_put_ftype, set_ui_file_put)
	(ui_file_delete_ftype, set_ui_file_data, ui_file_fseek_ftype)
	(set_ui_file_fseek): Delete.
	(ui_file_data, ui_file_delete, ui_file_rewind)
	(struct ui_file): New.
	(ui_file_up): New.
	(class null_file): New.
	(null_stream): Declare.
	(ui_file_write_for_put, ui_file_put): Delete.
	(ui_file_xstrdup, ui_file_as_string, ui_file_obsavestring):
	Delete.
	(ui_file_fseek, mem_fileopen, stdio_fileopen, stderr_fileopen)
	(gdb_fopen, tee_file_new): Delete.
	(struct string_file): New.
	(struct stdio_file): New.
	(stdio_file_up): New.
	(struct stderr_file): New.
	(class tee_file): New.
	* ui-out.c (ui_out::field_stream): Take a 'string_file &' instead
	of a 'ui_file *'.  Adjust.
	* ui-out.h (class ui_out) <field_stream>: Likewise.
	* utils.c (do_ui_file_delete, make_cleanup_ui_file_delete)
	(null_stream): Delete.
	(error_stream): Take a 'string_file &' instead of a 'ui_file *'.
	Adjust.
	* utils.h (struct ui_file): Delete forward declaration..
	(make_cleanup_ui_file_delete, null_stream): Delete declarations.
	(error_stream): Take a 'string_file &' instead of a
	'ui_file *'.
	* varobj.c (varobj_value_get_print_value): Use string_file.
	* xtensa-tdep.c (xtensa_verify_config): Use string_file.
	* gdbarch.c: Regenerate.
2017-02-02 11:11:47 +00:00
Simon Marchi ca1ca08b08 Remove dead serial_interface_lookup calls
By inspecting the serial_add_interface calls, I found that the serial
interface names that we have today are:

 - hardwire
 - terminal
 - pipe
 - tcp
 - event

 The calls to serial_interface_lookup with any other names are most
 likely leftovers which can be removed since these serial interfaces
 don't exist anymore.  The commits that removed the "pc" and "parallel"
 interfaces are respectively:

  cb2a4ac5da

and

  e386d4d2fb

gdb/ChangeLog:

	* serial.c (serial_open): Forget about "pc" and "lpt" serial interface.
2017-01-12 10:41:50 -05: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
Pedro Alves 00340e1b91 Introduce a serial interface for select'able events
This patch adds a new "event" struct serial type, that is an
abstraction specifically for waking up blocking waits/selects,
implemented on top of a pipe on POSIX, and on top of a native Windows
event (CreateEvent, etc.) on Windows.

This will be used to plug signal handler / mainline code races.

For example, GDB can indefinitely delay handling a quit request if the
user presses Ctrl-C between the last QUIT call and the next (blocking)
gdb_select call in the event loop:

      QUIT;
                  <<< press ctrl-c here and end up blocked in gdb_select
		      indefinitely.

      gdb_select (...); // whoops, SIGINT was already handled, no EINTR.

A global alone (either the quit flag, or the "ready" flag of the async
signal handlers in the event loop) is not sufficient.

To plug races such as these on POSIX systems, we have to register some
waitable file descriptor in the set of files gdb_select waits on, and
write to it from the signal handler.  This is classically a pipe, and
the pattern called the self-pipe trick.  On Linux, it could be a more
efficient eventfd instead, but I'm sticking with a pipe for
simplifity, as we need it for portability anyway.

(Alternatively, we could use pselect/ppoll, and block signals until
the pselect.  The latter is not a design I think GDB could use,
because we want the QUIT macro to be super cheap, as it is used in
loops.  Plus, Windows.)

This is a "struct serial" because Windows's gdb_select relies on that.
Windows's gdb_select, our "select" replacement, knows how to wait on
all kinds of handles (regular files, pipes, sockets, console, etc.)
unlike the native Windows "select" function, which can only wait on
sockets.  Each file descriptor for a "serial" type that is not
normally waitable with WaitForMultipleObjects must have a
corresponding struct serial instance.  gdb_select then internally
looks up the struct serial instance that wraps each file descriptor,
and asks it for the corresponding Windows waitable handle.

We could use serial_pipe() to create a "struct serial"-wrapped pipe
that is usable everywhere, including Windows.  That's what currently
python/python.c uses for cross-thread posting of events.

However, serial_write and serial_readchar are not designed to be
async-signal-safe on POSIX hosts.  It's easier to bypass those when
setting/clearing the event source.

And writing and a serial pipe is a bit heavy weight on Windows.
gdb_select requires an extra thread to wait on the pipe and several
Windows events, when a single manual-reset Windows event, with no
extra thread is sufficient.

The intended usage is simply:

- Call make_serial_event to create a serial event object.

- From the signal handler call serial_event_set to set the event.

- From mainline code, have select/poll wait for serial_event_fd(), in
  addition to whatever other files you're about to wait for.

gdb/ChangeLog:
2016-04-12  Pedro Alves  <palves@redhat.com>

	* Makefile.in (SFILES): Add ser-event.c.
	(HFILES_NO_SRCDIR): Add ser-event.h.
	(COMMON_OBS): Add ser-event.o.
	* ser-event.c, ser-event.h: New files.
	* serial.c (new_serial): New function, factored out from
	(serial_fdopen_ops): ... this.
	(serial_open_ops_1): New function, factored out from
	(serial_open): ... this.
	(serial_open_ops): New function.
	* serial.h (struct serial): Forware declare.
	(serial_open_ops): New declaration.
2016-04-12 16:53:21 +01:00
Pedro Alves 5f5219fc34 Remove unused struct serial::name field
Not used by anything.

gdb/ChangeLog:
2016-04-12  Pedro Alves  <palves@redhat.com>

	* serial.c (serial_open, serial_fdopen_ops, do_serial_close):
	Remove references to name.
	* serial.h (struct serial) <name>: Delete.
2016-04-12 16:53:01 +01:00
Joel Brobecker 618f726fcb GDB copyright headers update after running GDB's copyright.py script.
gdb/ChangeLog:

        Update year range in copyright notice of all files.
2016-01-01 08:43:22 +04:00
Simon Marchi 19ba03f495 Add some more casts (2/2)
See previous patch's description.

gdb/ChangeLog:

	* macrocmd.c (print_macro_callback): Add cast(s).
	* macrotab.c (macro_bcache_str): Likewise.
	(new_macro_definition): Likewise.
	* main.c (captured_main): Likewise.
	* maint.c (print_bfd_section_info): Likewise.
	* mdebugread.c (mdebug_build_psymtabs): Likewise.
	(basic_type): Likewise.
	* memattr.c (mem_region_cmp): Likewise.
	* memory-map.c (memory_map_start_memory): Likewise.
	(memory_map_end_memory): Likewise.
	(memory_map_start_property): Likewise.
	(memory_map_end_property): Likewise.
	(clear_result): Likewise.
	* memrange.c (compare_mem_ranges): Likewise.
	* mep-tdep.c (mep_analyze_frame_prologue): Likewise.
	* mi/mi-cmd-var.c (mi_cmd_var_update_iter): Likewise.
	* mi/mi-console.c (mi_console_file_delete): Likewise.
	(mi_console_file_fputs): Likewise.
	(mi_console_raw_packet): Likewise.
	(mi_console_file_flush): Likewise.
	(mi_console_set_raw): Likewise.
	* mi/mi-interp.c (mi_interpreter_resume): Likewise.
	(mi_new_thread): Likewise.
	(mi_thread_exit): Likewise.
	(mi_record_changed): Likewise.
	(mi_inferior_added): Likewise.
	(mi_inferior_appeared): Likewise.
	(mi_inferior_exit): Likewise.
	(mi_inferior_removed): Likewise.
	(mi_interp_data): Likewise.
	(mi_on_normal_stop): Likewise.
	(mi_traceframe_changed): Likewise.
	(mi_tsv_created): Likewise.
	(mi_tsv_deleted): Likewise.
	(mi_tsv_modified): Likewise.
	(mi_breakpoint_created): Likewise.
	(mi_breakpoint_deleted): Likewise.
	(mi_breakpoint_modified): Likewise.
	(mi_output_running_pid): Likewise.
	(mi_inferior_count): Likewise.
	(mi_solib_loaded): Likewise.
	(mi_solib_unloaded): Likewise.
	(mi_command_param_changed): Likewise.
	(mi_memory_changed): Likewise.
	(report_initial_inferior): Likewise.
	(mi_ui_out): Likewise.
	(mi_set_logging): Likewise.
	* mi/mi-main.c (collect_cores): Likewise.
	(print_one_inferior): Likewise.
	(free_vector_of_ints): Likewise.
	(free_splay_tree): Likewise.
	(mi_execute_command): Likewise.
	* mi/mi-out.c (mi_table_body): Likewise.
	(mi_table_end): Likewise.
	(mi_table_header): Likewise.
	(mi_begin): Likewise.
	(mi_end): Likewise.
	(mi_field_int): Likewise.
	(mi_field_string): Likewise.
	(mi_field_fmt): Likewise.
	(mi_flush): Likewise.
	(mi_redirect): Likewise.
	(field_separator): Likewise.
	(mi_open): Likewise.
	(mi_close): Likewise.
	(mi_out_buffered): Likewise.
	(mi_out_rewind): Likewise.
	(mi_out_put): Likewise.
	(mi_version): Likewise.
	(mi_out_data_dtor): Likewise.
	* mi/mi-parse.c (mi_parse_cleanup): Likewise.
	* microblaze-tdep.c (microblaze_frame_cache): Likewise.
	* minidebug.c (lzma_open): Likewise.
	(lzma_pread): Likewise.
	(lzma_close): Likewise.
	(lzma_stat): Likewise.
	* mips-linux-tdep.c (mips_linux_init_abi): Likewise.
	* mips-sde-tdep.c (mips_sde_frame_cache): Likewise.
	(mips_sde_elf_osabi_sniff_abi_tag_sections): Likewise.
	* mips-tdep.c (mips_insn16_frame_cache): Likewise.
	(mips_micro_frame_cache): Likewise.
	(mips_insn32_frame_cache): Likewise.
	(mips_stub_frame_cache): Likewise.
	(gdb_print_insn_mips): Likewise.
	(value_of_mips_user_reg): Likewise.
	(mips_gdbarch_init): Likewise.
	* mips64obsd-tdep.c (mips64obsd_supply_gregset): Likewise.
	* mipsnbsd-tdep.c (mipsnbsd_supply_fpregset): Likewise.
	(mipsnbsd_supply_gregset): Likewise.
	* mn10300-linux-tdep.c (am33_supply_fpregset_method): Likewise.
	(am33_collect_gregset_method): Likewise.
	(am33_collect_fpregset_method): Likewise.
	* mn10300-tdep.c (mn10300_analyze_frame_prologue): Likewise.
	* moxie-tdep.c (moxie_frame_cache): Likewise.
	* msp430-tdep.c (msp430_get_opcode_byte): Likewise.
	(msp430_analyze_frame_prologue): Likewise.
	* mt-tdep.c (mt_frame_unwind_cache): Likewise.
	* nios2-linux-tdep.c (nios2_supply_gregset): Likewise.
	(nios2_collect_gregset): Likewise.
	* nios2-tdep.c (nios2_frame_unwind_cache): Likewise.
	(nios2_stub_frame_cache): Likewise.
	* objc-lang.c (find_methods): Likewise.
	* objfiles.c (objfiles_pspace_data_cleanup): Likewise.
	(get_objfile_pspace_data): Likewise.
	(get_objfile_bfd_data): Likewise.
	(objfile_bfd_data_free): Likewise.
	(add_to_objfile_sections): Likewise.
	(do_free_objfile_cleanup): Likewise.
	(resume_section_map_updates_cleanup): Likewise.
	* opencl-lang.c (builtin_opencl_type): Likewise.
	* osabi.c (generic_elf_osabi_sniff_abi_tag_sections): Likewise.
	* osdata.c (osdata_start_osdata): Likewise.
	(osdata_start_item): Likewise.
	(osdata_start_column): Likewise.
	(osdata_end_column): Likewise.
	(clear_parsing_data): Likewise.
	(osdata_free_cleanup): Likewise.
	* parse.c (type_stack_cleanup): Likewise.
	(exp_uses_objfile_iter): Likewise.
	* ppc-linux-tdep.c (ppc_linux_supply_gregset): Likewise.
	(ppc_linux_collect_gregset): Likewise.
	(ppu2spu_prev_arch): Likewise.
	(ppu2spu_this_id): Likewise.
	(ppu2spu_prev_register): Likewise.
	(ppu2spu_unwind_register): Likewise.
	(ppu2spu_sniffer): Likewise.
	(ppu2spu_dealloc_cache): Likewise.
	(ppc_linux_init_abi): Likewise.
	* ppcfbsd-tdep.c (ppcfbsd_sigtramp_frame_cache): Likewise.
	* ppcobsd-tdep.c (ppcobsd_sigtramp_frame_cache): Likewise.
	* progspace.c (restore_program_space): Likewise.
	* psymtab.c (find_pc_sect_psymtab): Likewise.
	(compare_psymbols): Likewise.
	(psymbol_bcache_full): Likewise.
	(allocate_psymtab): Likewise.
	(discard_psymtabs_upto): Likewise.
	* python/py-block.c (set_block): Likewise.
	(del_objfile_blocks): Likewise.
	* python/py-breakpoint.c (build_bp_list): Likewise.
	* python/py-inferior.c (inferior_to_inferior_object): Likewise.
	(build_inferior_list): Likewise.
	(py_free_inferior): Likewise.
	* python/py-objfile.c (py_free_objfile): Likewise.
	(objfile_to_objfile_object): Likewise.
	* python/py-prettyprint.c (py_restore_tstate): Likewise.
	* python/py-progspace.c (py_free_pspace): Likewise.
	(pspace_to_pspace_object): Likewise.
	* python/py-symbol.c (set_symbol): Likewise.
	(del_objfile_symbols): Likewise.
	* python/py-symtab.c (set_sal): Likewise.
	(set_symtab): Likewise.
	(del_objfile_symtab): Likewise.
	(del_objfile_sal): Likewise.
	* python/py-type.c (save_objfile_types): Likewise.
	(set_type): Likewise.
	* python/py-unwind.c (pyuw_prev_register): Likewise.
	(pyuw_on_new_gdbarch): Likewise.
	* python/py-utils.c (py_decref): Likewise.
	(py_xdecref): Likewise.
	(gdb_py_generic_dict): Likewise.
	* python/py-xmethods.c (gdbpy_free_xmethod_worker_data): Likewise.
	(gdbpy_clone_xmethod_worker_data): Likewise.
	(gdbpy_get_xmethod_arg_types): Likewise.
	(gdbpy_get_xmethod_result_type): Likewise.
	(gdbpy_invoke_xmethod): Likewise.
	* python/python.c (gdbpy_apply_type_printers): Likewise.
	(gdbpy_free_type_printers): Likewise.
	* record-btrace.c (record_btrace_disable_callback): Likewise.
	(bfcache_hash): Likewise.
	(bfcache_eq): Likewise.
	(btrace_get_frame_function): Likewise.
	(record_btrace_frame_unwind_stop_reason): Likewise.
	(record_btrace_frame_this_id): Likewise.
	(record_btrace_frame_prev_register): Likewise.
	(record_btrace_frame_dealloc_cache): Likewise.
	* record-full.c (record_full_message_wrapper): Likewise.
	(record_full_save_cleanups): Likewise.
	* regcache.c (regcache_descr): Likewise.
	(do_regcache_xfree): Likewise.
	(do_regcache_invalidate): Likewise.
	(do_cooked_read): Likewise.
	(regcache_transfer_regset): Likewise.
	* reggroups.c (reggroup_add): Likewise.
	(reggroup_next): Likewise.
	(reggroup_prev): Likewise.
	* remote-fileio.c (do_remote_fileio_request): Likewise.
	* remote-notif.c (remote_async_get_pending_events_handler): Likewise.
	(do_notif_event_xfree): Likewise.
	* remote.c (get_remote_arch_state): Likewise.
	(remote_pspace_data_cleanup): Likewise.
	(get_remote_exec_file): Likewise.
	(set_pspace_remote_exec_file): Likewise.
	(compare_pnums): Likewise.
	(clear_threads_listing_context): Likewise.
	(remote_newthread_step): Likewise.
	(start_thread): Likewise.
	(end_thread): Likewise.
	(remove_child_of_pending_fork): Likewise.
	(remove_stop_reply_for_inferior): Likewise.
	(remove_stop_reply_of_remote_state): Likewise.
	(remote_notif_remove_once_on_match): Likewise.
	(stop_reply_match_ptid_and_ws): Likewise.
	(kill_child_of_pending_fork): Likewise.
	(register_remote_g_packet_guess): Likewise.
	(remote_read_description_p): Likewise.
	(remote_read_description): Likewise.
	(free_actions_list_cleanup_wrapper): Likewise.
	(remote_async_serial_handler): Likewise.
	* rl78-tdep.c (rl78_get_opcode_byte): Likewise.
	(rl78_analyze_frame_prologue): Likewise.
	* rs6000-tdep.c (ppc_supply_gregset): Likewise.
	(ppc_supply_fpregset): Likewise.
	(ppc_supply_vsxregset): Likewise.
	(ppc_supply_vrregset): Likewise.
	(ppc_collect_gregset): Likewise.
	(ppc_collect_fpregset): Likewise.
	(ppc_collect_vsxregset): Likewise.
	(ppc_collect_vrregset): Likewise.
	(e500_move_ev_register): Likewise.
	(do_regcache_raw_write): Likewise.
	(rs6000_frame_cache): Likewise.
	(rs6000_epilogue_frame_cache): Likewise.
	(rs6000_gdbarch_init): Likewise.
	* rx-tdep.c (rx_get_opcode_byte): Likewise.
	(rx_analyze_frame_prologue): Likewise.
	(rx_frame_type): Likewise.
	(rx_frame_sniffer_common): Likewise.
	* s390-linux-tdep.c (s390_check_for_saved): Likewise.
	(s390_frame_unwind_cache): Likewise.
	(s390_stub_frame_unwind_cache): Likewise.
	(s390_sigtramp_frame_unwind_cache): Likewise.
	* score-tdep.c (score_make_prologue_cache): Likewise.
	* sentinel-frame.c (sentinel_frame_prev_register): Likewise.
	(sentinel_frame_prev_arch): Likewise.
	* ser-base.c (fd_event): Likewise.
	(push_event): Likewise.
	(ser_base_write): Likewise.
	* ser-pipe.c (pipe_close): Likewise.
	* serial.c (serial_write): Likewise.
	* sh-tdep.c (sh_frame_cache): Likewise.
	(sh_stub_this_id): Likewise.
	* sh64-tdep.c (sh64_frame_cache): Likewise.
	* solib-aix.c (get_solib_aix_inferior_data): Likewise.
	(library_list_start_library): Likewise.
	(library_list_start_list): Likewise.
	(solib_aix_free_library_list): Likewise.
	* solib-darwin.c (get_darwin_info): Likewise.
	* solib-dsbt.c (get_dsbt_info): Likewise.
	* solib-spu.c (append_ocl_sos): Likewise.
	* solib-svr4.c (svr4_pspace_data_cleanup): Likewise.
	(get_svr4_info): Likewise.
	(library_list_start_library): Likewise.
	(svr4_library_list_start_list): Likewise.
	(hash_probe_and_action): Likewise.
	(equal_probe_and_action): Likewise.
	(svr4_update_solib_event_breakpoint): Likewise.
	(set_solib_svr4_fetch_link_map_offsets): Likewise.
	(svr4_fetch_link_map_offsets): Likewise.
	(svr4_have_link_map_offsets): Likewise.
	* solib-target.c (library_list_start_segment): Likewise.
	(library_list_start_section): Likewise.
	(library_list_start_library): Likewise.
	(library_list_end_library): Likewise.
	(library_list_start_list): Likewise.
	(solib_target_free_library_list): Likewise.
	* solib.c (solib_ops): Likewise.
	(set_solib_ops): Likewise.
	* sparc-sol2-tdep.c (sparc32_sol2_sigtramp_frame_cache): Likewise.
	* sparc-tdep.c (sparc_frame_cache): Likewise.
	(sparc32_frame_cache): Likewise.
	(sparc32_supply_gregset): Likewise.
	(sparc32_collect_gregset): Likewise.
	(sparc32_supply_fpregset): Likewise.
	(sparc32_collect_fpregset): Likewise.
	* sparc64-sol2-tdep.c (sparc64_sol2_sigtramp_frame_cache): Likewise.
	* sparc64-tdep.c (sparc64_supply_gregset): Likewise.
	(sparc64_collect_gregset): Likewise.
	(sparc64_supply_fpregset): Likewise.
	(sparc64_collect_fpregset): Likewise.
	* sparc64fbsd-tdep.c (sparc64fbsd_sigtramp_frame_cache): Likewise.
	* sparc64nbsd-tdep.c (sparc64nbsd_sigcontext_frame_cache): Likewise.
	* sparc64obsd-tdep.c (sparc64obsd_frame_cache): Likewise.
	(sparc64obsd_trapframe_cache): Likewise.
	* sparcnbsd-tdep.c (sparc32nbsd_sigcontext_frame_cache): Likewise.
	* sparcobsd-tdep.c (sparc32obsd_sigtramp_frame_cache): Likewise.
	* spu-multiarch.c (spu_gdbarch): Likewise.
	* spu-tdep.c (spu_frame_unwind_cache): Likewise.
	(spu2ppu_prev_arch): Likewise.
	(spu2ppu_this_id): Likewise.
	(spu2ppu_prev_register): Likewise.
	(spu2ppu_dealloc_cache): Likewise.
	(spu_dis_asm_print_address): Likewise.
	(gdb_print_insn_spu): Likewise.
	(spu_get_overlay_table): Likewise.
	* stabsread.c (rs6000_builtin_type): Likewise.
	* stack.c (do_print_variable_and_value): Likewise.
	* stap-probe.c (get_stap_base_address_1): Likewise.
	* symfile-debug.c (debug_qf_has_symbols): Likewise.
	(debug_qf_find_last_source_symtab): Likewise.
	(debug_qf_forget_cached_source_info): Likewise.
	(debug_qf_map_symtabs_matching_filename): Likewise.
	(debug_qf_lookup_symbol): Likewise.
	(debug_qf_print_stats): Likewise.
	(debug_qf_dump): Likewise.
	(debug_qf_relocate): Likewise.
	(debug_qf_expand_symtabs_for_function): Likewise.
	(debug_qf_expand_all_symtabs): Likewise.
	(debug_qf_expand_symtabs_with_fullname): Likewise.
	(debug_qf_map_matching_symbols): Likewise.
	(debug_qf_expand_symtabs_matching): Likewise.
	(debug_qf_find_pc_sect_compunit_symtab): Likewise.
	(debug_qf_map_symbol_filenames): Likewise.
	(debug_sym_get_probes): Likewise.
	(debug_sym_new_init): Likewise.
	(debug_sym_init): Likewise.
	(debug_sym_read): Likewise.
	(debug_sym_read_psymbols): Likewise.
	(debug_sym_finish): Likewise.
	(debug_sym_offsets): Likewise.
	(debug_sym_read_linetable): Likewise.
	(debug_sym_relocate): Likewise.
	(uninstall_symfile_debug_logging): Likewise.
	* symfile-mem.c (symbol_file_add_from_memory_wrapper): Likewise.
	* symfile.c (place_section): Likewise.
	(add_section_size_callback): Likewise.
	(load_progress): Likewise.
	(load_section_callback): Likewise.
	(clear_memory_write_data): Likewise.
	(allocate_symtab): Likewise.
	* symmisc.c (maintenance_expand_file_matcher): Likewise.
	* symtab.c (lookup_symtab_callback): Likewise.
	(hash_demangled_name_entry): Likewise.
	(eq_demangled_name_entry): Likewise.
	(get_symbol_cache): Likewise.
	(symbol_cache_cleanup): Likewise.
	(set_symbol_cache_size): Likewise.
	(symbol_cache_flush): Likewise.
	(maintenance_print_symbol_cache): Likewise.
	(maintenance_print_symbol_cache_statistics): Likewise.
	(delete_filename_seen_cache): Likewise.
	(output_partial_symbol_filename): Likewise.
	(search_symbols_file_matches): Likewise.
	(search_symbols_name_matches): Likewise.
	(do_free_completion_list): Likewise.
	(maybe_add_partial_symtab_filename): Likewise.
	(get_main_info): Likewise.
	(main_info_cleanup): Likewise.
	* target-dcache.c (target_dcache_cleanup): Likewise.
	(target_dcache_init_p): Likewise.
	(target_dcache_invalidate): Likewise.
	(target_dcache_get): Likewise.
	(target_dcache_get_or_init): Likewise.
	* target-descriptions.c (target_find_description): Likewise.
	(tdesc_find_type): Likewise.
	(tdesc_data_cleanup): Likewise.
	(tdesc_find_arch_register): Likewise.
	(tdesc_register_name): Likewise.
	(tdesc_register_type): Likewise.
	(tdesc_register_reggroup_p): Likewise.
	(set_tdesc_pseudo_register_name): Likewise.
	(set_tdesc_pseudo_register_type): Likewise.
	(set_tdesc_pseudo_register_reggroup_p): Likewise.
	(tdesc_use_registers): Likewise.
	(free_target_description): Likewise.
	* target-memory.c (compare_block_starting_address): Likewise.
	(cleanup_request_data): Likewise.
	(cleanup_write_requests_vector): Likewise.
	* target.c (open_target): Likewise.
	(cleanup_restore_target_terminal): Likewise.
	(free_memory_read_result_vector): Likewise.
	* thread.c (disable_thread_stack_temporaries): Likewise.
	(finish_thread_state_cleanup): Likewise.
	(do_restore_current_thread_cleanup): Likewise.
	(restore_current_thread_cleanup_dtor): Likewise.
	(set_thread_refcount): Likewise.
	(tp_array_compar): Likewise.
	(do_captured_thread_select): Likewise.
	* tic6x-tdep.c (tic6x_frame_unwind_cache): Likewise.
	(tic6x_stub_this_id): Likewise.
	* tilegx-tdep.c (tilegx_frame_cache): Likewise.
	* top.c (do_restore_instream_cleanup): Likewise.
	(gdb_readline_wrapper_cleanup): Likewise.
	(kill_or_detach): Likewise.
	(print_inferior_quit_action): Likewise.
	* tracefile-tfile.c (match_blocktype): Likewise.
	(build_traceframe_info): Likewise.
	* tracefile.c (trace_file_writer_xfree): Likewise.
	* tracepoint.c (memrange_cmp): Likewise.
	(do_collect_symbol): Likewise.
	(do_clear_collection_list): Likewise.
	(do_restore_current_traceframe_cleanup): Likewise.
	(restore_current_traceframe_cleanup_dtor): Likewise.
	(free_current_marker): Likewise.
	(traceframe_info_start_memory): Likewise.
	(traceframe_info_start_tvar): Likewise.
	(free_result): Likewise.
	* tramp-frame.c (tramp_frame_cache): Likewise.
	* tui/tui-file.c (tui_file_delete): Likewise.
	(tui_fileopen): Likewise.
	(tui_sfileopen): Likewise.
	(tui_file_isatty): Likewise.
	(tui_file_rewind): Likewise.
	(tui_file_put): Likewise.
	(tui_file_fputs): Likewise.
	(tui_file_get_strbuf): Likewise.
	(tui_file_adjust_strbuf): Likewise.
	(tui_file_flush): Likewise.
	* tui/tui-layout.c (make_command_window): Likewise.
	(make_data_window): Likewise.
	(show_source_disasm_command): Likewise.
	(show_data): Likewise.
	(make_source_or_disasm_window): Likewise.
	(show_source_or_disasm_and_command): Likewise.
	* tui/tui-out.c (tui_field_int): Likewise.
	(tui_field_string): Likewise.
	(tui_field_fmt): Likewise.
	(tui_text): Likewise.
	* typeprint.c (hash_typedef_field): Likewise.
	(eq_typedef_field): Likewise.
	(do_free_typedef_hash): Likewise.
	(copy_typedef_hash_element): Likewise.
	(do_free_global_table): Likewise.
	(find_global_typedef): Likewise.
	(find_typedef_in_hash): Likewise.
	* ui-file.c (ui_file_write_for_put): Likewise.
	(do_ui_file_xstrdup): Likewise.
	(mem_file_delete): Likewise.
	(mem_file_rewind): Likewise.
	(mem_file_put): Likewise.
	(mem_file_write): Likewise.
	(stdio_file_delete): Likewise.
	(stdio_file_flush): Likewise.
	(stdio_file_read): Likewise.
	(stdio_file_write): Likewise.
	(stdio_file_write_async_safe): Likewise.
	(stdio_file_fputs): Likewise.
	(stdio_file_isatty): Likewise.
	(stdio_file_fseek): Likewise.
	(tee_file_delete): Likewise.
	(tee_file_flush): Likewise.
	(tee_file_write): Likewise.
	(tee_file_fputs): Likewise.
	(tee_file_isatty): Likewise.
	* ui-out.c (do_cleanup_table_end): Likewise.
	(do_cleanup_end): Likewise.
	* user-regs.c (user_reg_add): Likewise.
	(user_reg_map_name_to_regnum): Likewise.
	(usernum_to_user_reg): Likewise.
	(maintenance_print_user_registers): Likewise.
	* utils.c (do_bfd_close_cleanup): Likewise.
	(do_fclose_cleanup): Likewise.
	(do_obstack_free): Likewise.
	(do_ui_file_delete): Likewise.
	(do_ui_out_redirect_pop): Likewise.
	(do_free_section_addr_info): Likewise.
	(restore_integer): Likewise.
	(do_unpush_target): Likewise.
	(do_htab_delete_cleanup): Likewise.
	(do_restore_ui_file): Likewise.
	(do_value_free): Likewise.
	(do_free_so): Likewise.
	(free_current_contents): Likewise.
	(do_regfree_cleanup): Likewise.
	(core_addr_hash): Likewise.
	(core_addr_eq): Likewise.
	(do_free_char_ptr_vec): Likewise.
	* v850-tdep.c (v850_frame_cache): Likewise.
	* varobj.c (do_free_variable_cleanup): Likewise.
	* vax-tdep.c (vax_supply_gregset): Likewise.
	(vax_frame_cache): Likewise.
	* vaxobsd-tdep.c (vaxobsd_sigtramp_frame_cache): Likewise.
	* xml-support.c (gdb_xml_body_text): Likewise.
	(gdb_xml_values_cleanup): Likewise.
	(gdb_xml_start_element): Likewise.
	(gdb_xml_start_element_wrapper): Likewise.
	(gdb_xml_end_element): Likewise.
	(gdb_xml_end_element_wrapper): Likewise.
	(gdb_xml_cleanup): Likewise.
	(gdb_xml_fetch_external_entity): Likewise.
	(gdb_xml_parse_attr_enum): Likewise.
	(xinclude_start_include): Likewise.
	(xinclude_end_include): Likewise.
	(xml_xinclude_default): Likewise.
	(xml_xinclude_start_doctype): Likewise.
	(xml_xinclude_end_doctype): Likewise.
	(xml_xinclude_cleanup): Likewise.
	(xml_fetch_content_from_file): Likewise.
	* xml-syscall.c (free_syscalls_info): Likewise.
	(syscall_start_syscall): Likewise.
	* xml-tdesc.c (tdesc_end_arch): Likewise.
	(tdesc_end_osabi): Likewise.
	(tdesc_end_compatible): Likewise.
	(tdesc_start_target): Likewise.
	(tdesc_start_feature): Likewise.
	(tdesc_start_reg): Likewise.
	(tdesc_start_union): Likewise.
	(tdesc_start_struct): Likewise.
	(tdesc_start_flags): Likewise.
	(tdesc_start_field): Likewise.
	(tdesc_start_vector): Likewise.
	(fetch_available_features_from_target): Likewise.
	* xstormy16-tdep.c (xstormy16_frame_cache): Likewise.
	* xtensa-tdep.c (xtensa_supply_gregset): Likewise.
	(xtensa_frame_cache): Likewise.
	(xtensa_frame_prev_register): Likewise.
	(xtensa_extract_return_value): Likewise.
2015-09-25 14:08:07 -04:00
Yury Grechishchev 236af5e336 GDB: Add set/show serial parity command.
The "set serial parity" command allows the user to control which
parity to use when communicating over a serial connection, rather
than having the parity hardcoded to none.

gdb/ChangeLog:

        * NEWS: Mention set/show serial parity command.
        * monitor.c (monitor_open): Call serial_setparity.
        * remote.c (remote_open_1): Likewise.
        * ser-base.c (ser_base_serparity): New function.
        * ser-base.h (ser_base_setparity): Add  declaration.
        * ser-go32.c (dos_ops): Set "setparity" field.
        * ser-mingw.c (ser_windows_raw): Do not set state.fParity and
        state.Parity.
        (ser_windows_setparity): New function.
        (hardwire_ops): Add ser_windows_setparity.
        (tty_ops): Add NULL for setparity field.
        (pipe_ops): Add ser_base_setparity.
        (tcp_ops): Likewise.
        * ser-pipe.c (pipe_ops): Likewise.
        * ser-tcp.c (tcp_ops): Likewise.
        * ser-unix.c (hardwire_setparity): Add declaration.
        (hardwire_raw): Don't reset PARENB flag.
        (hardwire_setparity): New function.
        (hardwire_ops): Add hardwire_setparity.
        * serial.c (serial_setparity): New function.
        (serial_parity): New global.
        (parity_none, parity_odd, parity_even, parity_enums, parity):
        New static globals.
        (set_parity): New function.
        (_initialize_serial): Add set/show serial parity commands.
        * serial.h (GDBPARITY_NONE): Define.
        (GDBPARITY_ODD): Define.
        (GDBPARITY_EVEN): Define.
        (serial_setparity) Add declaration.
        (struct serial_ops): Add setparity field.
        * target.h (serial_parity): Add declaration.

gdb/doc/ChangeLog:

        * gdb.texinfo (Remote configuration): Document "set/show
        serial parity" command.
2015-03-23 15:34:42 -07:00
Gary Benson 61012eef84 New common function "startswith"
This commit introduces a new inline common function "startswith"
which takes two string arguments and returns nonzero if the first
string starts with the second.  It also updates the 295 places
where this logic was written out longhand to use the new function.

gdb/ChangeLog:

	* common/common-utils.h (startswith): New inline function.
	All places where this logic was used updated to use the above.
2015-03-06 09:42:06 +00:00
Joel Brobecker 32d0add0a6 Update year range in copyright notice of all files owned by the GDB project.
gdb/ChangeLog:

        Update year range in copyright notice of all files.
2015-01-01 13:32:14 +04:00
Gary Benson 6d3d12ebef Include string.h in common-defs.h
This commit includes string.h in common-defs.h and removes all other
inclusions.

gdb/
2014-08-07  Gary Benson  <gbenson@redhat.com>

	* common/common-defs.h: Include string.h.
	* aarch64-tdep.c: Do not include string.h.
	* ada-exp.y: Likewise.
	* ada-lang.c: Likewise.
	* ada-lex.l: Likewise.
	* ada-typeprint.c: Likewise.
	* ada-valprint.c: Likewise.
	* aix-thread.c: Likewise.
	* alpha-linux-tdep.c: Likewise.
	* alpha-mdebug-tdep.c: Likewise.
	* alpha-nat.c: Likewise.
	* alpha-osf1-tdep.c: Likewise.
	* alpha-tdep.c: Likewise.
	* alphanbsd-tdep.c: Likewise.
	* amd64-dicos-tdep.c: Likewise.
	* amd64-linux-tdep.c: Likewise.
	* amd64-nat.c: Likewise.
	* amd64-sol2-tdep.c: Likewise.
	* amd64fbsd-tdep.c: Likewise.
	* amd64obsd-tdep.c: Likewise.
	* arch-utils.c: Likewise.
	* arm-linux-nat.c: Likewise.
	* arm-linux-tdep.c: Likewise.
	* arm-tdep.c: Likewise.
	* arm-wince-tdep.c: Likewise.
	* armbsd-tdep.c: Likewise.
	* armnbsd-nat.c: Likewise.
	* armnbsd-tdep.c: Likewise.
	* armobsd-tdep.c: Likewise.
	* avr-tdep.c: Likewise.
	* ax-gdb.c: Likewise.
	* ax-general.c: Likewise.
	* bcache.c: Likewise.
	* bfin-tdep.c: Likewise.
	* breakpoint.c: Likewise.
	* build-id.c: Likewise.
	* buildsym.c: Likewise.
	* c-exp.y: Likewise.
	* c-lang.c: Likewise.
	* c-typeprint.c: Likewise.
	* c-valprint.c: Likewise.
	* charset.c: Likewise.
	* cli-out.c: Likewise.
	* cli/cli-cmds.c: Likewise.
	* cli/cli-decode.c: Likewise.
	* cli/cli-dump.c: Likewise.
	* cli/cli-interp.c: Likewise.
	* cli/cli-logging.c: Likewise.
	* cli/cli-script.c: Likewise.
	* cli/cli-setshow.c: Likewise.
	* cli/cli-utils.c: Likewise.
	* coffread.c: Likewise.
	* common/agent.c: Likewise.
	* common/buffer.c: Likewise.
	* common/buffer.h: Likewise.
	* common/common-utils.c: Likewise.
	* common/filestuff.c: Likewise.
	* common/filestuff.c: Likewise.
	* common/format.c: Likewise.
	* common/print-utils.c: Likewise.
	* common/rsp-low.c: Likewise.
	* common/signals.c: Likewise.
	* common/vec.h: Likewise.
	* common/xml-utils.c: Likewise.
	* core-regset.c: Likewise.
	* corefile.c: Likewise.
	* corelow.c: Likewise.
	* cp-abi.c: Likewise.
	* cp-name-parser.y: Likewise.
	* cp-support.c: Likewise.
	* cp-valprint.c: Likewise.
	* cris-tdep.c: Likewise.
	* d-exp.y: Likewise.
	* darwin-nat.c: Likewise.
	* dbxread.c: Likewise.
	* dcache.c: Likewise.
	* demangle.c: Likewise.
	* dicos-tdep.c: Likewise.
	* disasm.c: Likewise.
	* doublest.c: Likewise.
	* dsrec.c: Likewise.
	* dummy-frame.c: Likewise.
	* dwarf2-frame.c: Likewise.
	* dwarf2loc.c: Likewise.
	* dwarf2read.c: Likewise.
	* elfread.c: Likewise.
	* environ.c: Likewise.
	* eval.c: Likewise.
	* event-loop.c: Likewise.
	* exceptions.c: Likewise.
	* exec.c: Likewise.
	* expprint.c: Likewise.
	* f-exp.y: Likewise.
	* f-lang.c: Likewise.
	* f-typeprint.c: Likewise.
	* f-valprint.c: Likewise.
	* fbsd-nat.c: Likewise.
	* findcmd.c: Likewise.
	* findvar.c: Likewise.
	* fork-child.c: Likewise.
	* frame.c: Likewise.
	* frv-linux-tdep.c: Likewise.
	* frv-tdep.c: Likewise.
	* gdb.c: Likewise.
	* gdb_bfd.c: Likewise.
	* gdbarch.c: Likewise.
	* gdbarch.sh: Likewise.
	* gdbtypes.c: Likewise.
	* gnu-nat.c: Likewise.
	* gnu-v2-abi.c: Likewise.
	* gnu-v3-abi.c: Likewise.
	* go-exp.y: Likewise.
	* go-lang.c: Likewise.
	* go32-nat.c: Likewise.
	* guile/guile.c: Likewise.
	* guile/scm-auto-load.c: Likewise.
	* hppa-hpux-tdep.c: Likewise.
	* hppa-linux-nat.c: Likewise.
	* hppanbsd-tdep.c: Likewise.
	* hppaobsd-tdep.c: Likewise.
	* i386-cygwin-tdep.c: Likewise.
	* i386-dicos-tdep.c: Likewise.
	* i386-linux-tdep.c: Likewise.
	* i386-nto-tdep.c: Likewise.
	* i386-sol2-tdep.c: Likewise.
	* i386-tdep.c: Likewise.
	* i386bsd-tdep.c: Likewise.
	* i386gnu-nat.c: Likewise.
	* i386nbsd-tdep.c: Likewise.
	* i386obsd-tdep.c: Likewise.
	* i387-tdep.c: Likewise.
	* ia64-libunwind-tdep.c: Likewise.
	* ia64-linux-nat.c: Likewise.
	* inf-child.c: Likewise.
	* inf-ptrace.c: Likewise.
	* inf-ttrace.c: Likewise.
	* infcall.c: Likewise.
	* infcmd.c: Likewise.
	* inflow.c: Likewise.
	* infrun.c: Likewise.
	* interps.c: Likewise.
	* iq2000-tdep.c: Likewise.
	* irix5-nat.c: Likewise.
	* jv-exp.y: Likewise.
	* jv-lang.c: Likewise.
	* jv-typeprint.c: Likewise.
	* jv-valprint.c: Likewise.
	* language.c: Likewise.
	* linux-fork.c: Likewise.
	* linux-nat.c: Likewise.
	* lm32-tdep.c: Likewise.
	* m2-exp.y: Likewise.
	* m2-typeprint.c: Likewise.
	* m32c-tdep.c: Likewise.
	* m32r-linux-nat.c: Likewise.
	* m32r-linux-tdep.c: Likewise.
	* m32r-rom.c: Likewise.
	* m32r-tdep.c: Likewise.
	* m68hc11-tdep.c: Likewise.
	* m68k-tdep.c: Likewise.
	* m68kbsd-tdep.c: Likewise.
	* m68klinux-nat.c: Likewise.
	* m68klinux-tdep.c: Likewise.
	* m88k-tdep.c: Likewise.
	* machoread.c: Likewise.
	* macrocmd.c: Likewise.
	* main.c: Likewise.
	* mdebugread.c: Likewise.
	* mem-break.c: Likewise.
	* memattr.c: Likewise.
	* memory-map.c: Likewise.
	* mep-tdep.c: Likewise.
	* mi/mi-cmd-break.c: Likewise.
	* mi/mi-cmd-disas.c: Likewise.
	* mi/mi-cmd-env.c: Likewise.
	* mi/mi-cmd-stack.c: Likewise.
	* mi/mi-cmd-var.c: Likewise.
	* mi/mi-cmds.c: Likewise.
	* mi/mi-console.c: Likewise.
	* mi/mi-getopt.c: Likewise.
	* mi/mi-interp.c: Likewise.
	* mi/mi-main.c: Likewise.
	* mi/mi-parse.c: Likewise.
	* microblaze-rom.c: Likewise.
	* microblaze-tdep.c: Likewise.
	* mingw-hdep.c: Likewise.
	* minidebug.c: Likewise.
	* minsyms.c: Likewise.
	* mips-irix-tdep.c: Likewise.
	* mips-linux-tdep.c: Likewise.
	* mips-tdep.c: Likewise.
	* mips64obsd-tdep.c: Likewise.
	* mipsnbsd-tdep.c: Likewise.
	* mipsread.c: Likewise.
	* mn10300-linux-tdep.c: Likewise.
	* mn10300-tdep.c: Likewise.
	* monitor.c: Likewise.
	* moxie-tdep.c: Likewise.
	* mt-tdep.c: Likewise.
	* nat/linux-btrace.c: Likewise.
	* nat/linux-osdata.c: Likewise.
	* nat/linux-procfs.c: Likewise.
	* nat/linux-ptrace.c: Likewise.
	* nat/linux-waitpid.c: Likewise.
	* nbsd-tdep.c: Likewise.
	* nios2-linux-tdep.c: Likewise.
	* nto-procfs.c: Likewise.
	* nto-tdep.c: Likewise.
	* objc-lang.c: Likewise.
	* objfiles.c: Likewise.
	* opencl-lang.c: Likewise.
	* osabi.c: Likewise.
	* osdata.c: Likewise.
	* p-exp.y: Likewise.
	* p-lang.c: Likewise.
	* p-typeprint.c: Likewise.
	* parse.c: Likewise.
	* posix-hdep.c: Likewise.
	* ppc-linux-nat.c: Likewise.
	* ppc-sysv-tdep.c: Likewise.
	* ppcfbsd-tdep.c: Likewise.
	* ppcnbsd-tdep.c: Likewise.
	* ppcobsd-tdep.c: Likewise.
	* printcmd.c: Likewise.
	* procfs.c: Likewise.
	* prologue-value.c: Likewise.
	* python/py-auto-load.c: Likewise.
	* python/py-gdb-readline.c: Likewise.
	* ravenscar-thread.c: Likewise.
	* regcache.c: Likewise.
	* registry.c: Likewise.
	* remote-fileio.c: Likewise.
	* remote-m32r-sdi.c: Likewise.
	* remote-mips.c: Likewise.
	* remote-notif.c: Likewise.
	* remote-sim.c: Likewise.
	* remote.c: Likewise.
	* reverse.c: Likewise.
	* rs6000-aix-tdep.c: Likewise.
	* ser-base.c: Likewise.
	* ser-go32.c: Likewise.
	* ser-mingw.c: Likewise.
	* ser-pipe.c: Likewise.
	* ser-tcp.c: Likewise.
	* ser-unix.c: Likewise.
	* serial.c: Likewise.
	* sh-tdep.c: Likewise.
	* sh64-tdep.c: Likewise.
	* shnbsd-tdep.c: Likewise.
	* skip.c: Likewise.
	* sol-thread.c: Likewise.
	* solib-dsbt.c: Likewise.
	* solib-frv.c: Likewise.
	* solib-osf.c: Likewise.
	* solib-som.c: Likewise.
	* solib-spu.c: Likewise.
	* solib-target.c: Likewise.
	* solib.c: Likewise.
	* somread.c: Likewise.
	* source.c: Likewise.
	* sparc-nat.c: Likewise.
	* sparc-sol2-tdep.c: Likewise.
	* sparc-tdep.c: Likewise.
	* sparc64-tdep.c: Likewise.
	* sparc64fbsd-tdep.c: Likewise.
	* sparc64nbsd-tdep.c: Likewise.
	* sparcnbsd-tdep.c: Likewise.
	* spu-linux-nat.c: Likewise.
	* spu-multiarch.c: Likewise.
	* spu-tdep.c: Likewise.
	* stabsread.c: Likewise.
	* stack.c: Likewise.
	* std-regs.c: Likewise.
	* symfile.c: Likewise.
	* symmisc.c: Likewise.
	* symtab.c: Likewise.
	* target.c: Likewise.
	* thread.c: Likewise.
	* tilegx-linux-nat.c: Likewise.
	* tilegx-tdep.c: Likewise.
	* top.c: Likewise.
	* tracepoint.c: Likewise.
	* tui/tui-command.c: Likewise.
	* tui/tui-data.c: Likewise.
	* tui/tui-disasm.c: Likewise.
	* tui/tui-file.c: Likewise.
	* tui/tui-layout.c: Likewise.
	* tui/tui-out.c: Likewise.
	* tui/tui-regs.c: Likewise.
	* tui/tui-source.c: Likewise.
	* tui/tui-stack.c: Likewise.
	* tui/tui-win.c: Likewise.
	* tui/tui-windata.c: Likewise.
	* tui/tui-winsource.c: Likewise.
	* typeprint.c: Likewise.
	* ui-file.c: Likewise.
	* ui-out.c: Likewise.
	* user-regs.c: Likewise.
	* utils.c: Likewise.
	* v850-tdep.c: Likewise.
	* valarith.c: Likewise.
	* valops.c: Likewise.
	* valprint.c: Likewise.
	* value.c: Likewise.
	* varobj.c: Likewise.
	* vax-tdep.c: Likewise.
	* vaxnbsd-tdep.c: Likewise.
	* vaxobsd-tdep.c: Likewise.
	* windows-nat.c: Likewise.
	* xcoffread.c: Likewise.
	* xml-support.c: Likewise.
	* xstormy16-tdep.c: Likewise.
	* xtensa-linux-nat.c: Likewise.

gdb/gdbserver/
2014-08-07  Gary Benson  <gbenson@redhat.com>

	* server.h: Do not include string.h.
	* event-loop.c: Likewise.
	* linux-low.c: Likewise.
	* regcache.c: Likewise.
	* remote-utils.c: Likewise.
	* spu-low.c: Likewise.
	* utils.c: Likewise.
2014-08-07 09:06:47 +01:00
Tom Tromey 635c7e8a05 make calls to help_list use enumerator
Currently there are many calls to help_list that pass the constant -1
as the "class" value.  However, the parameter is declared as being of
type enum command_class, and uses of the constant violate this
abstraction.

This patch fixes the error everywhere it occurs in the gdb sources.

Tested by rebuilding.

2014-06-13  Tom Tromey  <tromey@redhat.com>

	* cp-support.c (maint_cplus_command): Pass all_commands, not -1,
	to help_list.
	* guile/guile.c (info_guile_command): Pass all_commands, not -1,
	to help_list.
	* tui/tui-win.c (tui_command): Pass all_commands, not -1, to
	help_list.
	* tui/tui-regs.c (tui_reg_command): Pass all_commands, not -1, to
	help_list.Pass all_commands, not -1, to help_list.
	* cli/cli-dump.c (dump_command, append_command)
	(srec_dump_command, ihex_dump_command, tekhex_dump_command)
	(binary_dump_command, binary_append_command): Pass all_commands,
	not -1, to help_list.
	* cli/cli-cmds.c (info_command, set_debug): Pass all_commands, not
	-1, to help_list.
	* valprint.c (set_print, set_print_raw): Pass all_commands, not
	-1, to help_list.
	* typeprint.c (set_print_type): Pass all_commands, not -1, to
	help_list.
	* top.c (set_history): Pass all_commands, not -1, to help_list.
	* target-descriptions.c (set_tdesc_cmd, unset_tdesc_cmd): Pass
	all_commands, not -1, to help_list.
	* symfile.c (overlay_command): Pass all_commands, not -1, to
	help_list.
	* spu-tdep.c (info_spu_command): Pass all_commands, not -1, to
	help_list.
	* serial.c (serial_set_cmd): Pass all_commands, not -1, to
	help_list.
	* ser-tcp.c (set_tcp_cmd, show_tcp_cmd): Pass all_commands, not
	-1, to help_list.
	* remote.c (remote_command, set_remote_cmd): Pass all_commands,
	not -1, to help_list.
	* ravenscar-thread.c (set_ravenscar_command): Pass all_commands,
	not -1, to help_list.
	* maint.c (maintenance_command, maintenance_info_command)
	(maintenance_print_command, maintenance_set_cmd): Pass
	all_commands, not -1, to help_list.
	* macrocmd.c (macro_command): Pass all_commands, not -1, to
	help_list.
	* language.c (set_check): Pass all_commands, not -1, to help_list.
	* infcmd.c (unset_command): Pass all_commands, not -1, to
	help_list.
	* frame.c (set_backtrace_cmd): Pass all_commands, not -1, to
	help_list.
	* dwarf2read.c (set_dwarf2_cmd): Pass all_commands, not -1, to
	help_list.
	* dcache.c (set_dcache_command): Pass all_commands, not -1, to
	help_list.
	* breakpoint.c (save_command): Pass all_commands, not -1, to
	help_list.
	* ada-lang.c (maint_set_ada_cmd, set_ada_command): Pass
	all_commands, not -1, to help_list.
2014-06-13 09:29:19 -06:00
Joel Brobecker 0e58ee40a2 thinko in serial.c::serial_write debug trace
I noticed that, when using 'set debug serial 1', the "write" traces
would always be NUL characters:

    [
    w \x00][\x00][\x00][\x00][\x00][etc]

This is due to a small thinko in the loop that output each character,
where we accidently used the loop boundary instead of the loop index
to index the character to be printed.

After this patch is applied, the output now becomes:

    [
    w $][v][C][o][n][t][?][#][4][9]

gdb/ChangeLog:

	* serial.c (serial_write): Fix index of character to be printed
	in call to serial_logchar when serial debug traces are enabled.
2014-06-10 11:50:06 +02:00
Joel Brobecker 7f3c034326 Remove "set/show remotebaud" (deprecated) commands.
This patch removes support for the "set/show remotebaud" command,
which were deprecated in GDB 7.7, and should be now be removed
ahead of cutting the GDB 7.8 branch.

gdb/ChangeLog:

        * serial.c (_initialize_serial): Remove support for
        the "set remotebaud" and "show remotebaud" commands.
        * NEWS: Add entry documenting the removal of that command.

gdb/testsuite/ChangeLog:

        * config/monitor.exp (gdb_target_monitor): Replace use of
        "set remotebaud" by "set serial baud".
2014-05-28 12:58:59 -07:00
Tom Tromey 4ab76ea3fb Add target_ops argument to to_log_command
2014-02-19  Tom Tromey  <tromey@redhat.com>

	* target.h (struct target_ops) <to_log_command>: Add argument.
	(target_log_command): Add argument.
	* serial.h (serial_log_command): Add 'self' argument.
	* serial.c (serial_log_command): Add 'self' argument.
2014-02-19 07:45:57 -07:00
Tom Tromey fc270c357a replace XCALLOC with XCNEWVEC or XCNEW
This removes XCALLOC and replaces it either with XCNEWVEC, or, if the
number of elements being requested was 1, with XCNEW.

2014-01-13  Tom Tromey  <tromey@redhat.com>

	* defs.h (XCALLOC): Remove.
	* bcache.c (bcache_xmalloc): Use XCNEW, not XCALLOC.
	(print_bcache_statistics): Use XCNEWVEC, not XCALLOC.
	* dwarf2loc.c (allocate_piece_closure): Likewise.
	* elfread.c (elf_symfile_segments): Likewise.
	(elf_symfile_segments): Likewise.
	* gdbtypes.c (copy_type_recursive): Likewise.
	* i386-tdep.c (i386_gdbarch_init): Use XCNEW, not XCALLOC.
	* jit.c (jit_frame_sniffer): Use XCNEWVEC, not XCALLOC.
	* minsyms.c (prim_record_minimal_symbol_full): Use XCNEW, not
	XCALLOC.
	* mt-tdep.c (mt_gdbarch_init): Likewise.
	* opencl-lang.c (allocate_lval_closure): Use XCNEWVEC, not
	XCALLOC.
	* psymtab.c (psymbol_compare): Use XCNEW, not XCALLOC.
	* regcache.c (regcache_xmalloc_1): Use XCNEWVEC, not XCALLOC.
	* registry.c (registry_alloc_data): Likewise.
	* rs6000-tdep.c (rs6000_gdbarch_init): Use XCNEW, not XCALLOC.
	* s390-linux-tdep.c (s390_gdbarch_init): Likewise.
	* serial.c (serial_fdopen_ops): Likewise.
	* solib-aix.c (solib_aix_get_section_offsets): Use XCNEWVEC, not
	XCALLOC.
	* spu-tdep.c (spu_gdbarch_init): Use XCNEW, not XCALLOC.
	* symfile.c (default_symfile_segments): Use XCNEW and XCNEWVEC,
	not XCALLOC.
2014-01-13 07:31:29 -07:00
Tom Tromey 70ba0933ad replace XMALLOC with XNEW
This replaces XMALLOC with XNEW, and removes XMALLOC.  The only
non-mechanical bit here was remembering to edit gdbarch.sh.

2014-01-13  Tom Tromey  <tromey@redhat.com>

	* defs.h (XMALLOC): Remove.
	* avr-tdep.c (avr_gdbarch_init): Use XNEW, not XMALLOC.
	* bfin-tdep.c (bfin_gdbarch_init): Likewise.
	* cli-out.c (struct ui_out *): Likewise.
	* cli/cli-dump.c (add_dump_command): Likewise.
	(add_dump_command): Likewise.
	* complaints.c (get_complaints): Likewise.
	(find_complaint): Likewise.
	* dwarf2-frame.c (execute_cfa_program): Likewise.
	* dwarf2read.c (abbrev_table_read_table): Likewise.
	* gdbarch.sh: Likewise.
	* gdbarch.c: Rebuild.
	* inf-ttrace.c (inf_ttrace_add_page): Likewise.
	* interps.c (interp_new): Likewise.
	* lm32-tdep.c (lm32_gdbarch_init): Likewise.
	* m32r-tdep.c (m32r_gdbarch_init): Likewise.
	* mi/mi-console.c (mi_console_file_new): Likewise.
	* mi/mi-interp.c (mi_interpreter_init): Likewise.
	* mi/mi-out.c (mi_out_new): Likewise.
	* mi/mi-parse.c (mi_parse): Likewise.
	* microblaze-tdep.c (microblaze_gdbarch_init): Likewise.
	* moxie-tdep.c (moxie_gdbarch_init): Likewise.
	* observer.c (xalloc_observer_list_node): Likewise.
	* regcache.c (regcache_xmalloc_1): Likewise.
	* reggroups.c (reggroup_new): Likewise.
	(_initialize_reggroup): Likewise.
	* registry.c (register_data_with_cleanup): Likewise.
	* remote.c (remote_notif_stop_alloc_reply): Likewise.
	* ser-base.c (serial_ttystate): Likewise.
	* ser-mingw.c (make_pipe_state): Likewise.
	* ser-pipe.c (pipe_open): Likewise.
	* serial.c (serial_open): Likewise.
	* sh64-tdep.c (sh64_gdbarch_init): Likewise.
	* tui/tui-data.c (tui_alloc_generic_win_info): Likewise.
	(tui_alloc_win_info): Likewise.
	(tui_add_content_elements): Likewise.
	* tui/tui-file.c (tui_file_new): Likewise.
	* tui/tui-out.c (tui_out_new): Likewise.
	* ui-file.c (mem_file_new): Likewise.
	* ui-out.c (push_level): Likewise.
	(make_cleanup_ui_out_end): Likewise.
	(append_header_to_list): Likewise.
	(ui_out_new): Likewise.
	* user-regs.c (user_reg_add_builtin): Likewise.
2014-01-13 07:31:28 -07:00
Joel Brobecker ecd75fc8ee Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
Tom Tromey fcd488ca4e make serial_ops const
I noticed that the serial_ops vtable is not const, but really it ought
to be.

This patch constifies it, removing the only mutable field in the
process.

Tested by rebuilding on x86-64 Fedora 18, both natively and using the
mingw cross tools.

2013-12-19  Tom Tromey  <tromey@redhat.com>

	* serial.c (serial_ops_p): New typedef.
	(serial_ops_list): Now a VEC.
	(serial_interface_lookup): Return const.  Use VEC_iterate.
	(serial_add_interface): Make parameter const.
	(serial_open): Update.
	(serial_fdopen_ops): Make 'ops' const.
	(serial_pipe): Update.
	* ser-tcp.c (_initialize_ser_tcp): Update.
	* ser-pipe.c (_initialize_ser_pipe): Update.
	* ser-unix.c (_initialize_ser_hardwire): Update.
	* ser-mingw.c (_initialize_ser_windows): Update.
	* ser-go32.c (dos_ops): Now const.  Update.
	* serial.h (struct serial) <ops>: Now const.
	(struct serial_ops) <next>: Remove.
	(serial_add_interface): Make parameter const.
2013-12-19 08:50:46 -07:00
Tom Tromey 0e9f083f4c remove gdb_string.h
This removes gdb_string.h.  This patch is purely mechanical.  I
created it by running the two commands:

    git rm common/gdb_string.h
    perl -pi -e's/"gdb_string.h"/<string.h>/;'  *.[chyl] */*.[chyl]

2013-11-18  Tom Tromey  <tromey@redhat.com>

	* common/gdb_string.h: Remove.
	* aarch64-tdep.c: Use string.h, not gdb_string.h.
	* ada-exp.y: Use string.h, not gdb_string.h.
	* ada-lang.c: Use string.h, not gdb_string.h.
	* ada-lex.l: Use string.h, not gdb_string.h.
	* ada-typeprint.c: Use string.h, not gdb_string.h.
	* ada-valprint.c: Use string.h, not gdb_string.h.
	* aix-thread.c: Use string.h, not gdb_string.h.
	* alpha-linux-tdep.c: Use string.h, not gdb_string.h.
	* alpha-mdebug-tdep.c: Use string.h, not gdb_string.h.
	* alpha-nat.c: Use string.h, not gdb_string.h.
	* alpha-osf1-tdep.c: Use string.h, not gdb_string.h.
	* alpha-tdep.c: Use string.h, not gdb_string.h.
	* alphanbsd-tdep.c: Use string.h, not gdb_string.h.
	* amd64-dicos-tdep.c: Use string.h, not gdb_string.h.
	* amd64-linux-nat.c: Use string.h, not gdb_string.h.
	* amd64-linux-tdep.c: Use string.h, not gdb_string.h.
	* amd64-nat.c: Use string.h, not gdb_string.h.
	* amd64-sol2-tdep.c: Use string.h, not gdb_string.h.
	* amd64fbsd-tdep.c: Use string.h, not gdb_string.h.
	* amd64obsd-tdep.c: Use string.h, not gdb_string.h.
	* arch-utils.c: Use string.h, not gdb_string.h.
	* arm-linux-nat.c: Use string.h, not gdb_string.h.
	* arm-linux-tdep.c: Use string.h, not gdb_string.h.
	* arm-tdep.c: Use string.h, not gdb_string.h.
	* arm-wince-tdep.c: Use string.h, not gdb_string.h.
	* armbsd-tdep.c: Use string.h, not gdb_string.h.
	* armnbsd-nat.c: Use string.h, not gdb_string.h.
	* armnbsd-tdep.c: Use string.h, not gdb_string.h.
	* armobsd-tdep.c: Use string.h, not gdb_string.h.
	* avr-tdep.c: Use string.h, not gdb_string.h.
	* ax-gdb.c: Use string.h, not gdb_string.h.
	* ax-general.c: Use string.h, not gdb_string.h.
	* bcache.c: Use string.h, not gdb_string.h.
	* bfin-tdep.c: Use string.h, not gdb_string.h.
	* breakpoint.c: Use string.h, not gdb_string.h.
	* build-id.c: Use string.h, not gdb_string.h.
	* buildsym.c: Use string.h, not gdb_string.h.
	* c-exp.y: Use string.h, not gdb_string.h.
	* c-lang.c: Use string.h, not gdb_string.h.
	* c-typeprint.c: Use string.h, not gdb_string.h.
	* c-valprint.c: Use string.h, not gdb_string.h.
	* charset.c: Use string.h, not gdb_string.h.
	* cli-out.c: Use string.h, not gdb_string.h.
	* cli/cli-cmds.c: Use string.h, not gdb_string.h.
	* cli/cli-decode.c: Use string.h, not gdb_string.h.
	* cli/cli-dump.c: Use string.h, not gdb_string.h.
	* cli/cli-interp.c: Use string.h, not gdb_string.h.
	* cli/cli-logging.c: Use string.h, not gdb_string.h.
	* cli/cli-script.c: Use string.h, not gdb_string.h.
	* cli/cli-setshow.c: Use string.h, not gdb_string.h.
	* cli/cli-utils.c: Use string.h, not gdb_string.h.
	* coffread.c: Use string.h, not gdb_string.h.
	* common/common-utils.c: Use string.h, not gdb_string.h.
	* common/filestuff.c: Use string.h, not gdb_string.h.
	* common/linux-procfs.c: Use string.h, not gdb_string.h.
	* common/linux-ptrace.c: Use string.h, not gdb_string.h.
	* common/signals.c: Use string.h, not gdb_string.h.
	* common/vec.h: Use string.h, not gdb_string.h.
	* core-regset.c: Use string.h, not gdb_string.h.
	* corefile.c: Use string.h, not gdb_string.h.
	* corelow.c: Use string.h, not gdb_string.h.
	* cp-abi.c: Use string.h, not gdb_string.h.
	* cp-support.c: Use string.h, not gdb_string.h.
	* cp-valprint.c: Use string.h, not gdb_string.h.
	* cris-tdep.c: Use string.h, not gdb_string.h.
	* d-lang.c: Use string.h, not gdb_string.h.
	* dbxread.c: Use string.h, not gdb_string.h.
	* dcache.c: Use string.h, not gdb_string.h.
	* demangle.c: Use string.h, not gdb_string.h.
	* dicos-tdep.c: Use string.h, not gdb_string.h.
	* disasm.c: Use string.h, not gdb_string.h.
	* doublest.c: Use string.h, not gdb_string.h.
	* dsrec.c: Use string.h, not gdb_string.h.
	* dummy-frame.c: Use string.h, not gdb_string.h.
	* dwarf2-frame.c: Use string.h, not gdb_string.h.
	* dwarf2loc.c: Use string.h, not gdb_string.h.
	* dwarf2read.c: Use string.h, not gdb_string.h.
	* elfread.c: Use string.h, not gdb_string.h.
	* environ.c: Use string.h, not gdb_string.h.
	* eval.c: Use string.h, not gdb_string.h.
	* event-loop.c: Use string.h, not gdb_string.h.
	* exceptions.c: Use string.h, not gdb_string.h.
	* exec.c: Use string.h, not gdb_string.h.
	* expprint.c: Use string.h, not gdb_string.h.
	* f-exp.y: Use string.h, not gdb_string.h.
	* f-lang.c: Use string.h, not gdb_string.h.
	* f-typeprint.c: Use string.h, not gdb_string.h.
	* f-valprint.c: Use string.h, not gdb_string.h.
	* fbsd-nat.c: Use string.h, not gdb_string.h.
	* findcmd.c: Use string.h, not gdb_string.h.
	* findvar.c: Use string.h, not gdb_string.h.
	* fork-child.c: Use string.h, not gdb_string.h.
	* frame.c: Use string.h, not gdb_string.h.
	* frv-linux-tdep.c: Use string.h, not gdb_string.h.
	* frv-tdep.c: Use string.h, not gdb_string.h.
	* gdb.c: Use string.h, not gdb_string.h.
	* gdb_bfd.c: Use string.h, not gdb_string.h.
	* gdbarch.c: Use string.h, not gdb_string.h.
	* gdbtypes.c: Use string.h, not gdb_string.h.
	* gnu-nat.c: Use string.h, not gdb_string.h.
	* gnu-v2-abi.c: Use string.h, not gdb_string.h.
	* gnu-v3-abi.c: Use string.h, not gdb_string.h.
	* go-exp.y: Use string.h, not gdb_string.h.
	* go-lang.c: Use string.h, not gdb_string.h.
	* go32-nat.c: Use string.h, not gdb_string.h.
	* hppa-hpux-tdep.c: Use string.h, not gdb_string.h.
	* hppa-linux-nat.c: Use string.h, not gdb_string.h.
	* hppanbsd-tdep.c: Use string.h, not gdb_string.h.
	* hppaobsd-tdep.c: Use string.h, not gdb_string.h.
	* i386-cygwin-tdep.c: Use string.h, not gdb_string.h.
	* i386-dicos-tdep.c: Use string.h, not gdb_string.h.
	* i386-linux-nat.c: Use string.h, not gdb_string.h.
	* i386-linux-tdep.c: Use string.h, not gdb_string.h.
	* i386-nto-tdep.c: Use string.h, not gdb_string.h.
	* i386-sol2-tdep.c: Use string.h, not gdb_string.h.
	* i386-tdep.c: Use string.h, not gdb_string.h.
	* i386bsd-tdep.c: Use string.h, not gdb_string.h.
	* i386gnu-nat.c: Use string.h, not gdb_string.h.
	* i386nbsd-tdep.c: Use string.h, not gdb_string.h.
	* i386obsd-tdep.c: Use string.h, not gdb_string.h.
	* i387-tdep.c: Use string.h, not gdb_string.h.
	* ia64-libunwind-tdep.c: Use string.h, not gdb_string.h.
	* ia64-linux-nat.c: Use string.h, not gdb_string.h.
	* inf-child.c: Use string.h, not gdb_string.h.
	* inf-ptrace.c: Use string.h, not gdb_string.h.
	* inf-ttrace.c: Use string.h, not gdb_string.h.
	* infcall.c: Use string.h, not gdb_string.h.
	* infcmd.c: Use string.h, not gdb_string.h.
	* inflow.c: Use string.h, not gdb_string.h.
	* infrun.c: Use string.h, not gdb_string.h.
	* interps.c: Use string.h, not gdb_string.h.
	* iq2000-tdep.c: Use string.h, not gdb_string.h.
	* irix5-nat.c: Use string.h, not gdb_string.h.
	* jv-exp.y: Use string.h, not gdb_string.h.
	* jv-lang.c: Use string.h, not gdb_string.h.
	* jv-typeprint.c: Use string.h, not gdb_string.h.
	* jv-valprint.c: Use string.h, not gdb_string.h.
	* language.c: Use string.h, not gdb_string.h.
	* linux-fork.c: Use string.h, not gdb_string.h.
	* linux-nat.c: Use string.h, not gdb_string.h.
	* lm32-tdep.c: Use string.h, not gdb_string.h.
	* m2-exp.y: Use string.h, not gdb_string.h.
	* m2-typeprint.c: Use string.h, not gdb_string.h.
	* m32c-tdep.c: Use string.h, not gdb_string.h.
	* m32r-linux-nat.c: Use string.h, not gdb_string.h.
	* m32r-linux-tdep.c: Use string.h, not gdb_string.h.
	* m32r-rom.c: Use string.h, not gdb_string.h.
	* m32r-tdep.c: Use string.h, not gdb_string.h.
	* m68hc11-tdep.c: Use string.h, not gdb_string.h.
	* m68k-tdep.c: Use string.h, not gdb_string.h.
	* m68kbsd-tdep.c: Use string.h, not gdb_string.h.
	* m68klinux-nat.c: Use string.h, not gdb_string.h.
	* m68klinux-tdep.c: Use string.h, not gdb_string.h.
	* m88k-tdep.c: Use string.h, not gdb_string.h.
	* macrocmd.c: Use string.h, not gdb_string.h.
	* main.c: Use string.h, not gdb_string.h.
	* mdebugread.c: Use string.h, not gdb_string.h.
	* mem-break.c: Use string.h, not gdb_string.h.
	* memattr.c: Use string.h, not gdb_string.h.
	* memory-map.c: Use string.h, not gdb_string.h.
	* mep-tdep.c: Use string.h, not gdb_string.h.
	* mi/mi-cmd-break.c: Use string.h, not gdb_string.h.
	* mi/mi-cmd-disas.c: Use string.h, not gdb_string.h.
	* mi/mi-cmd-env.c: Use string.h, not gdb_string.h.
	* mi/mi-cmd-stack.c: Use string.h, not gdb_string.h.
	* mi/mi-cmd-var.c: Use string.h, not gdb_string.h.
	* mi/mi-cmds.c: Use string.h, not gdb_string.h.
	* mi/mi-console.c: Use string.h, not gdb_string.h.
	* mi/mi-getopt.c: Use string.h, not gdb_string.h.
	* mi/mi-interp.c: Use string.h, not gdb_string.h.
	* mi/mi-main.c: Use string.h, not gdb_string.h.
	* mi/mi-parse.c: Use string.h, not gdb_string.h.
	* microblaze-rom.c: Use string.h, not gdb_string.h.
	* microblaze-tdep.c: Use string.h, not gdb_string.h.
	* mingw-hdep.c: Use string.h, not gdb_string.h.
	* minidebug.c: Use string.h, not gdb_string.h.
	* minsyms.c: Use string.h, not gdb_string.h.
	* mips-irix-tdep.c: Use string.h, not gdb_string.h.
	* mips-linux-tdep.c: Use string.h, not gdb_string.h.
	* mips-tdep.c: Use string.h, not gdb_string.h.
	* mips64obsd-tdep.c: Use string.h, not gdb_string.h.
	* mipsnbsd-tdep.c: Use string.h, not gdb_string.h.
	* mipsread.c: Use string.h, not gdb_string.h.
	* mn10300-linux-tdep.c: Use string.h, not gdb_string.h.
	* mn10300-tdep.c: Use string.h, not gdb_string.h.
	* monitor.c: Use string.h, not gdb_string.h.
	* moxie-tdep.c: Use string.h, not gdb_string.h.
	* mt-tdep.c: Use string.h, not gdb_string.h.
	* nbsd-tdep.c: Use string.h, not gdb_string.h.
	* nios2-linux-tdep.c: Use string.h, not gdb_string.h.
	* nto-procfs.c: Use string.h, not gdb_string.h.
	* nto-tdep.c: Use string.h, not gdb_string.h.
	* objc-lang.c: Use string.h, not gdb_string.h.
	* objfiles.c: Use string.h, not gdb_string.h.
	* opencl-lang.c: Use string.h, not gdb_string.h.
	* osabi.c: Use string.h, not gdb_string.h.
	* osdata.c: Use string.h, not gdb_string.h.
	* p-exp.y: Use string.h, not gdb_string.h.
	* p-lang.c: Use string.h, not gdb_string.h.
	* p-typeprint.c: Use string.h, not gdb_string.h.
	* parse.c: Use string.h, not gdb_string.h.
	* posix-hdep.c: Use string.h, not gdb_string.h.
	* ppc-linux-nat.c: Use string.h, not gdb_string.h.
	* ppc-sysv-tdep.c: Use string.h, not gdb_string.h.
	* ppcfbsd-tdep.c: Use string.h, not gdb_string.h.
	* ppcnbsd-tdep.c: Use string.h, not gdb_string.h.
	* ppcobsd-tdep.c: Use string.h, not gdb_string.h.
	* printcmd.c: Use string.h, not gdb_string.h.
	* procfs.c: Use string.h, not gdb_string.h.
	* prologue-value.c: Use string.h, not gdb_string.h.
	* python/py-auto-load.c: Use string.h, not gdb_string.h.
	* python/py-gdb-readline.c: Use string.h, not gdb_string.h.
	* ravenscar-thread.c: Use string.h, not gdb_string.h.
	* regcache.c: Use string.h, not gdb_string.h.
	* registry.c: Use string.h, not gdb_string.h.
	* remote-fileio.c: Use string.h, not gdb_string.h.
	* remote-m32r-sdi.c: Use string.h, not gdb_string.h.
	* remote-mips.c: Use string.h, not gdb_string.h.
	* remote-sim.c: Use string.h, not gdb_string.h.
	* remote.c: Use string.h, not gdb_string.h.
	* reverse.c: Use string.h, not gdb_string.h.
	* rs6000-aix-tdep.c: Use string.h, not gdb_string.h.
	* ser-base.c: Use string.h, not gdb_string.h.
	* ser-go32.c: Use string.h, not gdb_string.h.
	* ser-mingw.c: Use string.h, not gdb_string.h.
	* ser-pipe.c: Use string.h, not gdb_string.h.
	* ser-tcp.c: Use string.h, not gdb_string.h.
	* ser-unix.c: Use string.h, not gdb_string.h.
	* serial.c: Use string.h, not gdb_string.h.
	* sh-tdep.c: Use string.h, not gdb_string.h.
	* sh64-tdep.c: Use string.h, not gdb_string.h.
	* shnbsd-tdep.c: Use string.h, not gdb_string.h.
	* skip.c: Use string.h, not gdb_string.h.
	* sol-thread.c: Use string.h, not gdb_string.h.
	* solib-dsbt.c: Use string.h, not gdb_string.h.
	* solib-frv.c: Use string.h, not gdb_string.h.
	* solib-osf.c: Use string.h, not gdb_string.h.
	* solib-spu.c: Use string.h, not gdb_string.h.
	* solib-target.c: Use string.h, not gdb_string.h.
	* solib.c: Use string.h, not gdb_string.h.
	* somread.c: Use string.h, not gdb_string.h.
	* source.c: Use string.h, not gdb_string.h.
	* sparc-nat.c: Use string.h, not gdb_string.h.
	* sparc-sol2-tdep.c: Use string.h, not gdb_string.h.
	* sparc-tdep.c: Use string.h, not gdb_string.h.
	* sparc64-tdep.c: Use string.h, not gdb_string.h.
	* sparc64fbsd-tdep.c: Use string.h, not gdb_string.h.
	* sparc64nbsd-tdep.c: Use string.h, not gdb_string.h.
	* sparcnbsd-tdep.c: Use string.h, not gdb_string.h.
	* spu-linux-nat.c: Use string.h, not gdb_string.h.
	* spu-multiarch.c: Use string.h, not gdb_string.h.
	* spu-tdep.c: Use string.h, not gdb_string.h.
	* stabsread.c: Use string.h, not gdb_string.h.
	* stack.c: Use string.h, not gdb_string.h.
	* std-regs.c: Use string.h, not gdb_string.h.
	* symfile.c: Use string.h, not gdb_string.h.
	* symmisc.c: Use string.h, not gdb_string.h.
	* symtab.c: Use string.h, not gdb_string.h.
	* target.c: Use string.h, not gdb_string.h.
	* thread.c: Use string.h, not gdb_string.h.
	* tilegx-linux-nat.c: Use string.h, not gdb_string.h.
	* tilegx-tdep.c: Use string.h, not gdb_string.h.
	* top.c: Use string.h, not gdb_string.h.
	* tracepoint.c: Use string.h, not gdb_string.h.
	* tui/tui-command.c: Use string.h, not gdb_string.h.
	* tui/tui-data.c: Use string.h, not gdb_string.h.
	* tui/tui-disasm.c: Use string.h, not gdb_string.h.
	* tui/tui-file.c: Use string.h, not gdb_string.h.
	* tui/tui-layout.c: Use string.h, not gdb_string.h.
	* tui/tui-out.c: Use string.h, not gdb_string.h.
	* tui/tui-regs.c: Use string.h, not gdb_string.h.
	* tui/tui-source.c: Use string.h, not gdb_string.h.
	* tui/tui-stack.c: Use string.h, not gdb_string.h.
	* tui/tui-win.c: Use string.h, not gdb_string.h.
	* tui/tui-windata.c: Use string.h, not gdb_string.h.
	* tui/tui-winsource.c: Use string.h, not gdb_string.h.
	* typeprint.c: Use string.h, not gdb_string.h.
	* ui-file.c: Use string.h, not gdb_string.h.
	* ui-out.c: Use string.h, not gdb_string.h.
	* user-regs.c: Use string.h, not gdb_string.h.
	* utils.c: Use string.h, not gdb_string.h.
	* v850-tdep.c: Use string.h, not gdb_string.h.
	* valarith.c: Use string.h, not gdb_string.h.
	* valops.c: Use string.h, not gdb_string.h.
	* valprint.c: Use string.h, not gdb_string.h.
	* value.c: Use string.h, not gdb_string.h.
	* varobj.c: Use string.h, not gdb_string.h.
	* vax-tdep.c: Use string.h, not gdb_string.h.
	* vaxnbsd-tdep.c: Use string.h, not gdb_string.h.
	* vaxobsd-tdep.c: Use string.h, not gdb_string.h.
	* windows-nat.c: Use string.h, not gdb_string.h.
	* xcoffread.c: Use string.h, not gdb_string.h.
	* xml-support.c: Use string.h, not gdb_string.h.
	* xstormy16-tdep.c: Use string.h, not gdb_string.h.
	* xtensa-linux-nat.c: Use string.h, not gdb_string.h.
2013-11-18 13:29:00 -07:00
Joel Brobecker 0d12017b31 Rename "set/show remotebaud" command into "set/show serial baud"
This patch renames the "set/show remotebaud" commands into
"set/show serial baud", and moves its implementation into serial.c.
It also moves the "baud_rate" global from top.c to serial.c, where
the new code is being added (the alternative was to add an include
of target.h).

And to facilitate the transition to the new setting name, this
patch also preserves the old commands, and marks them as deprecated
to alert the users of the change.

gdb/ChangeLog:

        * cli/cli-cmds.c (show_baud_rate): Moved to serial.c as
        serial_baud_show_cmd.
        (_initialize_cli_cmds): Delete the code creating the
        "set/show remotebaud" commands.
        * serial.c (baud_rate): Move here from top.c.
        (serial_baud_show_cmd): Move here from cli/cli-cmds.c.
        (_initialize_serial): Create "set/show serial baud" commands.
        Add "set/show remotebaud" command aliases.
        * top.c (baud_rate): Moved to serial.c.
        * NEWS: Document the new "set/show serial baud" commands,
        replacing "set/show remotebaud".

gdb/doc/ChangeLog:

        * gdb.texinfo: Replace "set remotebaud" and "show remotebaud"
        by "set serial baud" and "show serial baud" (resp) throughout.
2013-10-10 05:50:20 +00:00
Pedro Alves c628b528e0 serial_write: change prototype to take a void-pointer buffer.
While remote.c works with "char *" buffers most of the time, other
remote targets have binary-ish-er protocols, and choose to use
"unsigned char" throughout, like e.g., remote-mips.c or
remote-m32r-sdi.c.  That results in -Wpointer-sign warnings in those
targets, unless we add casts in calls to serial_write.  Since
serial_write is only concerned about sending raw host bytes out, and
serial_ops->write_prim already works with "void *"/"size_t", a similar
interface to the "write" or "send" system calls, I find it natural to
change serial_write's prototype accordingly, avoiding the need for
casts.

Tested on x86_64 Fedora 17, and also by building x86_64-mingw32
and DJGPP/go32 -hosted gdbs.

gdb/
2013-04-19  Pedro Alves  <palves@redhat.com>

	* ser-base.c (ser_base_write): Change prototype -- take 'void *'
	buffer and size_t size.  Adjust.
	* ser-base.h (ser_base_write): Adjust.
	* ser-go32.c (cnts): Change type to size_t.
	(dos_write): Change prototype -- take 'void *'
	buffer and size_t size.  Adjust.
	(dos_info): Print elements of 'cnts' as unsigned long.
	* serial.c (serial_write): Likewise.
	* serial.h (serial_write): Adjust.
	(struct serial_ops) <write>: Change prototype -- take 'void *'
	buffer and size_t size.  Adjust.
2013-04-19 15:26:17 +00:00
Keith Seitz 529480d058 * breakpoint.c (catch_syscall_split_args): Use skip_spaces.
(trace_pass_command): Likewise.
	* cli/cli-cmds.c: Include cli/cli-utils.h.
	(source_command): Use skip-spaces.
	(disassemble_command): Likewise.
	* findcmd.c: Include cli/cli-utils.h.
	(parse_find_args): Use skip_spaces.
	* go32-nat.c: Include cli/cli-utils.h.
	(go32_sldt): Use skip_spaces.
	(go32_sgdt): Likewise.
	(go32_sidt): Likewise.
	(go32_pde): Likewise.
	(go32_pte): Likewise.
	(go32_pte_for_address): Likewise.
	* infcmd.c: Include cli/cli-utils.h.
	(registers_info): Use skip_spaces.
	* linux-tdep.c (read_mapping): Use skip_spaces_const.
	(linux_info_proc): Likewise.
	* linux-thread-db.c: Include cli/cli-utils.h.
	(info_auto_load_libthread_db): Use skip_spaces_const.
	* m32r-rom.c: Include cli/cli-utils.h.
	(m32r_upload_command): Use skip_spaces.
	* maint.c: Include cli/cli-utils.h.
	(maintenance_translate_address): Use skip_spaces.
	* mi/mi-parse.c: Include cli/cli-utils.h.
	(mi_parse_argv): Use skip_spaces.
	(mi_parse): Likewise.
	* minsyms.c: Include cli/cli-utils.h.
	(msymbol_hash_iw): Use skip_spaces_const.
	* objc-lang.c: Include cli/cli-utils.h.
	(parse_selector): Use skip_spaces.
	(parse_method): Likewise.
	* python/python.c: Include cli/cli-utils.h.
	(python_interactive_command)[HAVE_PYTHON]: Use skip_spaces.
	(python_command)[HAVE_PYTHON]: Likewise.
	(python_interactive_command)[!HAVE_PYTHON]: Likewise.
	* remote-m32r-sdi.c: Include cli/cli-utils.h.
	(m32r_load): Use skip_spaces.
	* serial.c: Include cli/cli-utils.h.
	(serial_open): Use skip_spaces_const.
	* stack.c: Include cli/cli-utils.h.
	(parse_frame_specification_1): Use skip_spaces_const.
	* symfile.c: Include cli/cli-utils.h.
	(set_ext_lang_command): Use skip_spaces.
	* symtab.c: Include cli/cli-utils.h.
	(rbreak_command): Use skip_spaces.
	* thread.c (thread_name_command): Use skip_spaces.
	* tracepoint.c (validate_actionline): Use skip_spaces.
	(encode_actions_1): Likewise.
	(trace_find_range_command): Likewise.
	(trace_find_outside_command): Likewise.
	(trace_dump_actions): Likewise.
2013-03-07 21:57:30 +00:00
Joel Brobecker 28e7fd6234 Update years in copyright notice for the GDB files.
Two modifications:
  1. The addition of 2013 to the copyright year range for every file;
  2. The use of a single year range, instead of potentially multiple
     year ranges, as approved by the FSF.
2013-01-01 06:33:28 +00:00
Tom Tromey 29f5339515 * serial.c (deprecated_serial_fd): Remove.
* serial.h (deprecated_serial_fd): Remove.
2012-12-20 15:30:25 +00:00
Yao Qi ccce17b060 gdb/
* dwarf2loc.c (entry_values_debug): Add 'unsigned'.
	(_initialize_dwarf2loc): Call add_setshow_zuinteger_cmd instead of
	add_setshow_zinteger_cmd.
	* dwarf2loc.h: Update the declaration of 'entry_values_debug'.
	* dwarf2read.c (dwarf2_die_debug): Add 'unsigned'.
	(_initialize_dwarf2_read): Call add_setshow_zuinteger_cmd
	instead of add_setshow_zinteger_cmd.
	* darwin-nat.c (dwarwin_debug_flag): Add 'unsigned'.
	(_initialize_darwin_inferior): Call add_setshow_zuinteger_cmd
	instead of add_setshow_zinteger_cmd.
	* frame.c (frame_debug): Add 'unsigned'.
	(_intialize_frame): Call add_setshow_zuinteger_cmd instead of
	add_setshow_zinteger_cmd.
	* frame.h: Update the declaration of 'frame_debug'.
	* gdbtypes.c (overload_debug): Add 'unsigned'.
	(_initialize_gdbtypes): Call add_setshow_zuinteger_cmd instead of
	add_setshow_zinteger_cmd.
	* inferior.h: Update declaration of 'debug_infrun'.
	* infrun.c (debug_infrun): Add 'unsigned'.
	(_initialize_infrun): Call add_setshow_zuinteger_cmd instead of
	add_setshow_zinteger_cmd.
	* jit.c (jit_debug): Add 'unsigned'.
	(_initialize_jit): Call add_setshow_zuinteger_cmd instead of
	add_setshow_zinteger_cmd.
	* linux-nat.c (debug_linux_nat): Add 'unsigned'.
	(_initialize_linux_nat): Call add_setshow_zuinteger_cmd
	instead of add_setshow_zinteger_cmd.
	* linux-thread-db.c (libthread_db_debug): Add 'unsigned'.
	(_initialize_thread_db): Call add_setshow_zuinteger_cmd instead of
	add_setshow_zinteger_cmd.
	* machoread.c (mach_o_debug_level): Add 'unsigned'.
	(_initialize_machoread): Call add_setshow_zuinteger_cmd
	instead of add_setshow_zinteger_cmd.
	* mi/mi-cmd-var.c: Update the declaration of 'varobjdebug'.
	* microblaze-tdep.c (microblaze_debug_flag): Add 'unsigned'.
	(_initialize_microblaze_tdep): Call add_setshow_zuinteger_cmd
	intead of add_setshow_zinteger_cmd.
	* mips-tdep.c (mips_debug): Add 'unsigned'.
	(_initialize_mips_tdep): Call add_setshow_zuinteger_cmd
	instead of add_setshow_zinteger_cmd.
	* monitor.c (monitor_debug): Add 'unsigned'.
	(_initialize_remote_monitors): Call add_setshow_zuinteger_cmd instead of
	add_setshow_zinteger_cmd.
	* observer.c (observer_debug): Add 'unsigned'.
	(_initialize_observer): Call add_setshow_zuinteger_cmd instead of
	add_setshow_zinteger_cmd.
	* parse.c (expressiondebug): Add 'unsigned'.
	(_initialize_parse): Call add_setshow_zuinteger_cmd instead of
	add_setshow_zinteger_cmd.
	* record.c (record_debug): Add 'unsigned'.
	(_initialize_record): Call add_setshow_zuinteger_cmd instead of
	add_setshow_zinteger_cmd.
	* record.h: Update the declaration of 'record_debug'.
	* stap-probe.c (stap_expression_debug): Add 'unsigned'.
	(_initialize_stap_probe): Call add_setshow_zuinteger_cmd instead of
	add_setshow_zinteger_cmd.
	* serial.c (global_serial_debug_p): Add 'unsigned'.
	(_initialize_serial): Call add_setshow_zuinteger_cmd instead of
	add_setshow_zinteger_cmd.
	* solib-dsbt.c (solib_dsbt_debug): Add 'unsigned'.
	(_initialize_dsbt_solib): Call add_setshow_zuinteger_cmd instead of
	add_setshow_zinteger_cmd.
	* solib-frv.c (solib_frv_debug): Add 'unsigned'.
	(_initialize_frv_solib): Call add_setshow_zuinteger_cmd instead of
	add_setshow_zinteger_cmd.
	* target.c (targetdebug): Add 'unsigned'.
	(initialize_targets): Call add_setshow_zuinteger_cmd instead of
	add_setshow_zinteger_cmd.
	* valops.c (overload_debug): Add 'unsigned'.
	* varobj.c (varobjdebug): Add 'unsigned'.
	(_initialize_varobj): Call add_setshow_zuinteger_cmd instead of
	add_setshow_zinteger_cmd.
	* xtensa-tdep.c (xtensa_debug_level): Add 'unsigned'.
	(_initialize_xtensa_tdep): Call add_setshow_zuinteger_cmd
	instead of add_setshow_zinteger_cmd.

	* arch-utils.h: Remove the declaration of 'gdbarch_debug'.
	* gdbarch.sh (gdbarch_debug): Add 'unsigned'.
	(extern void _initialize_gdbarch): Call add_setshow_zuinteger_cmd
	instead of add_setshow_zinteger_cmd.
	* gdbarch.c, gdbarch.h: Re-generated.
2012-08-02 09:36:40 +00:00
Pedro Alves 5eb3b0622d 2012-06-13 Pedro Alves <palves@redhat.com>
Partial revert of previous change.

	* serial.c (scb_base): New global.
	(serial_for_fd): New.
	(serial_open, serial_fdopen_ops): Link new serial in open serials
	chain.
	(do_serial_close): Unlink serial from the open serials chain.
2012-06-13 11:06:52 +00:00
Pedro Alves ddefb60ff8 2012-06-11 Pedro Alves <palves@redhat.com>
* ser-base.c (run_async_handler_and_reschedule): New.
	(fd_event, push_event): Use it.
	* serial.c (serial_open, serial_fdopen_ops): Set the initial
	reference count to 1.
	(do_serial_close): Set the bufp field to NULL.  Use serial_unref
	instead of xfree.
	(serial_is_open, serial_ref, serial_unref): New.
	* serial.h (serial_open): Adjust comment.
	(serial_is_open): Declare.
	(serial_close): Adjust comment.
	(serial_ref, serial_unref) Declare.
	(struct serial): New field 'refcnt'.
2012-06-11 20:36:53 +00:00
Pedro Alves d5ad6aa5ce 2012-06-11 Pedro Alves <palves@redhat.com>
Remove #if 0'd "connect" command, and unnecessary associated
	refcounting and serial reuse bits.

	* serial.h (struct serial): Remove fields 'next' and 'refcnt'.
	* serial.c (last_serial_opened): Delete.
	(scb_base): Delete.
	(serial_open): Adjust.
	(serial_for_fd): Delete.
	(serial_fdopen_ops, do_serial_close): Adjust.
	(serial_fdopen_ops): Adjust.
2012-06-11 20:33:56 +00:00
Pedro Alves 318aa544a8 2012-06-11 Pedro Alves <palves@redhat.com>
* serial.c (do_serial_close): Remove early return when SCB is
	null.
2012-06-11 20:32:29 +00:00
Jan Kratochvil 4047852192 gdb/
Code cleanup: Make 1440 bytes of data segment read-only.
	* arch-utils.c (endian_enum): Make it const char *const [].
	* arm-tdep.c (fp_model_strings, arm_abi_strings, arm_mode_strings):
	Likewise.
	* breakpoint.c (always_inserted_enums): Likewise.
	* cli/cli-cmds.c (script_ext_enums): Likewise.
	* cli/cli-decode.c (add_setshow_enum_cmd, complete_on_enum): Make the
	enumlist parameter const char *const *.
	* cli/cli-decode.h (struct cmd_list_element): Make the enums field
	const char *const *.
	* command.h (complete_on_enum, add_setshow_enum_cmd): Make the enumlist
	parameter const char *const *.
	* cris-tdep.c (cris_modes): Make it const char *const [].
	* filesystem.c (target_file_system_kinds): Likewise.
	* i386-tdep.c (valid_flavors, valid_conventions): Likewise.
	* infrun.c (follow_fork_mode_kind_names, follow_exec_mode_names)
	(can_use_displaced_stepping_enum, scheduler_enums)
	(exec_direction_names): Likewise.
	* language.c (_initialize_language): Make the type_or_range_names and
	case_sensitive_names variables const char *const [].
	* mips-tdep.c (mips_abi_strings): Make it const char *const [].
	* python/python.c (python_excp_enums): Likewise.
	* remote.c (interrupt_sequence_modes): Likewise.
	* rs6000-tdep.c (powerpc_vector_strings): Likewise.
	* serial.c (logbase_enums): Likewise.
	* sh-tdep.c (sh_cc_enum): Likewise.
	* stack.c (print_frame_arguments_choices, print_entry_values_choices):
	Likewise.
	* symtab.c (multiple_symbols_modes): Likewise.
	* tui/tui-win.c (tui_border_kind_enums, tui_border_mode_enums):
	Likewise.
	* utils.c (internal_problem_modes): Likewise.
2012-01-28 18:08:22 +00:00