Commit Graph

91755 Commits

Author SHA1 Message Date
Tom Tromey a0d65762f1 Constify some commands in source.c
gdb/ChangeLog
2017-09-27  Tom Tromey  <tom@tromey.com>

	* source.c (show_substitute_path_command)
	(unset_substitute_path_command, set_substitute_path_command):
	Constify.
2017-09-27 08:44:43 -06:00
Tom Tromey 5897114462 Constify commands maint.c, plus maintenance_print_type
In addition to the constification, this fixes a command-repeat bug.

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

	* typeprint.c (maintenance_print_type): Constify.
	* maint.c (maintenance_dump_me, maintenance_demangle)
	(maintenance_time_display, maintenance_info_sections)
	(maintenance_print_statistics, maintenance_deprecate)
	(maintenance_undeprecate): Constify.
	(maintenance_do_deprecate): Constify.  Use std::string.
	(maintenance_selftest): Constify.
	* gdbtypes.h (maintenance_print_type): Constify.
2017-09-27 08:44:43 -06:00
Tom Tromey c482f52ccf Constify unwind_command
gdb/ChangeLog
2017-09-27  Tom Tromey  <tom@tromey.com>

	* hppa-tdep.c (unwind_command): Constify.
2017-09-27 08:44:42 -06:00
Tom Tromey e100df1a2e Constify some commands in target-descriptions.c
gdb/ChangeLog
2017-09-27  Tom Tromey  <tom@tromey.com>

	* target-descriptions.c (unset_tdesc_filename_cmd)
	(maint_print_c_tdesc_cmd, maintenance_check_xml_descriptions):
	Constify.
2017-09-27 08:44:41 -06:00
Tom Tromey 31d56ade0e Constify maintenance_print_dummy_frames
gdb/ChangeLog
2017-09-27  Tom Tromey  <tom@tromey.com>

	* dummy-frame.c (maintenance_print_dummy_frames): Constify.
2017-09-27 08:44:40 -06:00
Tom Tromey b961da0bb0 Constify some commands in tui.c
gdb/ChangeLog
2017-09-27  Tom Tromey  <tom@tromey.com>

	* tui/tui.c (tui_enable_command, tui_disable_command): Constify.
2017-09-27 08:44:39 -06:00
Tom Tromey e2d8ae16c0 Constify tui_reg_command
gdb/ChangeLog
2017-09-27  Tom Tromey  <tom@tromey.com>

	* tui/tui-regs.c (tui_reg_command): Constify.
2017-09-27 08:44:38 -06:00
Tom Tromey 863779b0c6 Constify some commands in skip.c
gdb/ChangeLog
2017-09-27  Tom Tromey  <tom@tromey.com>

	* skip.c (skip_file_command, skip_function_command)
	(skip_enable_command, skip_disable_command, skip_delete_command):
	Constify.
2017-09-27 08:44:37 -06:00
Tom Tromey cdb34d4a1c Constify some commands in record-btrace.c
gdb/ChangeLog
2017-09-27  Tom Tromey  <tom@tromey.com>

	* record-btrace.c (cmd_record_btrace_bts_start)
	(cmd_record_btrace_pt_start): Constify.
2017-09-27 08:44:37 -06:00
Tom Tromey e99c83e741 Constify some commands in symmisc.c
gdb/ChangeLog
2017-09-27  Tom Tromey  <tom@tromey.com>

	* symmisc.c (maintenance_print_symbols)
	(maintenance_print_msymbols, maintenance_print_objfiles)
	(maintenance_info_symtabs, maintenance_check_symtabs)
	(maintenance_expand_symtabs, maintenance_info_line_tables):
	Constify.
2017-09-27 08:44:36 -06:00
Tom Tromey 32faf971cd Constify new_ui_command
gdb/ChangeLog
2017-09-27  Tom Tromey  <tom@tromey.com>

	* top.c (new_ui_command): Constify.
2017-09-27 08:44:35 -06:00
Tom Tromey 2cf311ebad Constify some commands in symfile.c
gdb/ChangeLog
2017-09-27  Tom Tromey  <tom@tromey.com>

	* symfile.c (add_symbol_file_command)
	(remove_symbol_file_command, list_overlays_command)
	(map_overlay_command, unmap_overlay_command)
	(overlay_auto_command, overlay_manual_command)
	(overlay_off_command, overlay_load_command): Constify.
2017-09-27 08:44:34 -06:00
Tom Tromey e6738699f7 Constify some commands in spu-tdep.c
gdb/ChangeLog
2017-09-27  Tom Tromey  <tom@tromey.com>

	* spu-tdep.c (info_spu_event_command, info_spu_signal_command)
	(info_spu_mailbox_command, info_spu_dma_command)
	(info_spu_proxydma_command): Constify.
2017-09-27 08:44:33 -06:00
Tom Tromey aa360cd5dd Constify some commands in cli-logging.c
gdb/ChangeLog
2017-09-27  Tom Tromey  <tom@tromey.com>

	* cli/cli-logging.c (set_logging_on, set_logging_off): Constify.
2017-09-27 08:44:32 -06:00
Tom Tromey 898241a5ba Constify user_defined_command
gdb/ChangeLog
2017-09-27  Tom Tromey  <tom@tromey.com>

	* cli/cli-script.c (user_defined_command): Constify.
2017-09-27 08:44:31 -06:00
Tom Tromey 2d0ac1068b Constify commands in cli-dump.c
gdb/ChangeLog
2017-09-27  Tom Tromey  <tom@tromey.com>

	* cli/cli-dump.c (dump_memory_command, dump_value_command)
	(dump_srec_memory, dump_srec_value, dump_ihex_memory)
	(dump_ihex_value, dump_verilog_memory, dump_verilog_value)
	(dump_tekhex_memory, dump_tekhex_value, dump_binary_memory)
	(dump_binary_value, append_binary_memory, append_binary_value):
	Constify.
	(struct dump_context) <func>: Constify.
	(add_dump_command): Update.
2017-09-27 08:44:31 -06:00
Tom Tromey dede02ce4d Constify some commands in cli-cmds.c
gdb/ChangeLog
2017-09-27  Tom Tromey  <tom@tromey.com>

	* cli/cli-cmds.c (show_version, show_configuration)
	(source_command, show_user): Constify.
2017-09-27 08:44:30 -06:00
Tom Tromey d3cb6b99c5 Constify maintenance_print_target_stack
gdb/ChangeLog
2017-09-27  Tom Tromey  <tom@tromey.com>

	* target.c (maintenance_print_target_stack): Constify.
2017-09-27 08:44:29 -06:00
Tom Tromey 1970a12f32 Constify interpreter_exec_cmd
gdb/ChangeLog
2017-09-27  Tom Tromey  <tom@tromey.com>

	* interps.c (interpreter_exec_cmd): Constify.
2017-09-27 08:44:28 -06:00
Tom Tromey 4124365135 Constify cmd_record_full_restore
gdb/ChangeLog
2017-09-27  Tom Tromey  <tom@tromey.com>

	* record-full.c (cmd_record_full_restore): Constify.
2017-09-27 08:44:27 -06:00
Tom Tromey 4465d9db2f Constify some functions in memattr.c
gdb/ChangeLog
2017-09-27  Tom Tromey  <tom@tromey.com>

	* memattr.c (enable_mem_command, disable_mem_command)
	(delete_mem_command): Constify.
2017-09-27 08:44:26 -06:00
Tom Tromey ad25e4234a Constify show_convenience
gdb/ChangeLog
2017-09-27  Tom Tromey  <tom@tromey.com>

	* value.c (show_convenience): Constify.
2017-09-27 08:44:25 -06:00
Tom Tromey d64097b17c Constify core_file_command
gdb/ChangeLog
2017-09-27  Tom Tromey  <tom@tromey.com>

	* gdbcore.h (core_file_command): Update.
	* corefile.c (core_file_command): Constify.
2017-09-27 08:44:25 -06:00
Tom Tromey 4d4589ef76 Constify maintenance_print_user_registers
gdb/ChangeLog
2017-09-27  Tom Tromey  <tom@tromey.com>

	* user-regs.c (maintenance_print_user_registers): Constify.
2017-09-27 08:44:24 -06:00
Tom Tromey 32a7bf17c9 Constify maintenance_cplus_namespace
gdb/ChangeLog
2017-09-27  Tom Tromey  <tom@tromey.com>

	* cp-namespace.c (maintenance_cplus_namespace): Constify.
2017-09-27 08:44:23 -06:00
Tom Tromey 4a47555179 Constify first_component_command
gdb/ChangeLog
2017-09-27  Tom Tromey  <tom@tromey.com>

	* cp-support.c (first_component_command): Constify.
2017-09-27 08:44:22 -06:00
Tom Tromey 990b9f9f5a Constify some functions in psymtab.c
gdb/ChangeLog
2017-09-27  Tom Tromey  <tom@tromey.com>

	* psymtab.c (maintenance_print_psymbols)
	(maintenance_info_psymtabs, maintenance_check_psymtabs):
	Constify.
2017-09-27 08:44:21 -06:00
Tom Tromey c281872eec Constify display_tib
gdb/ChangeLog
2017-09-27  Tom Tromey  <tom@tromey.com>

	* windows-tdep.c (display_tib): Constify.
2017-09-27 08:44:20 -06:00
Tom Tromey 5b64bf744c Constify two functions in linux-fork.c
gdb/ChangeLog
2017-09-27  Tom Tromey  <tom@tromey.com>

	* linux-fork.c (delete_checkpoint_command)
	(detach_checkpoint_command): Constify.
2017-09-27 08:44:19 -06:00
Tom Tromey 4ada038f6a Constify two functions in cp-abi.c
gdb/ChangeLog
2017-09-27  Tom Tromey  <tom@tromey.com>

	* cp-abi.c (set_cp_abi_cmd, show_cp_abi_cmd): Constify.
2017-09-27 08:44:19 -06:00
Tom Tromey 57f5a81bd2 Constify dump_arc_instruction_command
gdb/ChangeLog
2017-09-27  Tom Tromey  <tom@tromey.com>

	* arc-tdep.c (dump_arc_instruction_command): Constify.
2017-09-27 08:44:18 -06:00
Tom Tromey b0a8e6c443 Constify two functions in valprint.c
gdb/ChangeLog
2017-09-27  Tom Tromey  <tom@tromey.com>

	* valprint.c (set_radix, show_radix): Constify.
2017-09-27 08:44:17 -06:00
Tom Tromey 8d97dc1cea Constify info_probes_dtrace_command
gdb/ChangeLog
2017-09-27  Tom Tromey  <tom@tromey.com>

	* dtrace-probe.c (info_probes_dtrace_command): Constify.
2017-09-27 08:44:16 -06:00
Tom Tromey eb7c454d73 Constify not_just_help_class_command
gdb/ChangeLog
2017-09-27  Tom Tromey  <tom@tromey.com>

	* command.h (not_just_help_class_command): Update.
	* cli/cli-decode.h (not_just_help_class_command): Update.
	* cli/cli-decode.c (not_just_help_class_command): Constify.
2017-09-27 08:44:15 -06:00
Tom Tromey e4e3333549 Constify add_cmd gdb_bfd.c
This constifies a command function in gdb_bfd.c.

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

	* gdb_bfd.c (maintenance_info_bfds): Constify.
2017-09-27 08:44:14 -06:00
Tom Tromey 0450cc4ce8 Add add_cmd function overloads
This adds two add_cmd overloads: one whose callback takes a const char *,
and one that doesn't accept a function at all.  The no-function overload
was introduced to avoid ambiguity when NULL was passed as the function.

Long term the goal is for all commands to take const arguments, and
for the non-const variants to be removed entirely.

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

	* cli/cli-decode.c (add_cmd, set_cmd_cfunc): New function
	overloads.
	(do_add_cmd): Rename from add_cmd.  Don't call set_cmd_cfunc.
	(do_const_cfunc): New function.
	(cmd_cfunc_eq): New overload.
	(cli_user_command_p): Check do_const_cfunc.
	* cli/cli-decode.h (struct cmd_list_element) <function>: New field
	const_cfunc.
	* command.h (add_cmd): Add const overload and no-function
	overload.
	(set_cmd_cfunc): Add const overload.
	(cmd_const_cfunc_ftype): Declare.
	(cmd_cfunc_eq): Add const overload.
	* breakpoint.c, cli-cmds.c, cli-dump.c, guile/scm-cmd.c,
	python/py-cmd.c, target.c, tracepoint.c: Use no-function add_cmd
	overload.
2017-09-27 08:44:14 -06:00
Tom Tromey a9bbfbd85f Add support for __VA_OPT__
C++2a adds a "__VA_OPT__" feature that can be used to control the
pesky "," emission when the final (variable) argument of a variadic
macro is empty.  This patch implements this feature for gdb.  (A patch
to implement it for gcc is pending.)

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

	* macroexp.c (get_next_token_for_substitution): New function.
	(substitute_args): Call it.  Check for __VA_OPT__.

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

	* gdb.base/macscp.exp: Add __VA_OPT__ tests.
2017-09-27 07:51:33 -06:00
Nick Clifton 1948519604 Prevent an infinite loop in the DWARF parsing code when encountering a CU structure with a small negative size.
PR 22219
	* dwarf.c (process_debug_info): Add a check for a negative
	cu_length field.
2017-09-27 10:42:51 +01:00
Alan Modra 6bd6a03d69 PR22216, infinite loop in readelf process_symbol_table
This should make readelf bombproof given a fuzzed DT_HASH.  Also
removes a bogus check that would have resulted in wrong histograms.

	PR 22216
	* readelf.c (process_symbol_table): Check that DT_HASH symbol
	chains are only visited once, and report an error if not.  Display
	invalid symbol index if chain is out of range.  Use the same logic
	when calculating histograms rather than the PR 17531 fix.  Delete
	bogus check that chained index is less than number of buckets.
2017-09-27 15:54:18 +09:30
Kuan-Lin Chen cd28e7aaf3 nds32: Fix a tautological comparison. 2017-09-27 13:07:19 +08:00
GDB Administrator 25c7861f70 Automatic date update in version.in 2017-09-27 00:00:23 +00:00
H.J. Lu ac69a0d75b x86-64: Don't pass output_bfd to info->callbacks->minfo
Don't pass output_bfd to info->callbacks->minfo when dumping local IFUNC
functions in the map file.

	PR ld/22199
	* elf64-x86-64.c (elf_x86_64_finish_dynamic_symbol): Don't pass
	output_bfd to info->callbacks->minfo.
2017-09-26 14:41:22 -07:00
Walfred Tedeschi 5230b05a94 dwarf2read: Restrict ICC workaround to ICC<14
GDB has a workaround for DWARF output by ICC, related to missing
DW_AT_declaration on incomplete types.  The bug was fixed in ICC 14,
so this commit adjusts GDB accordingly.

For the version check, this adds a new parser function for the ICC
producer string.  While at it, it also adds unit tests for the
producer parsing covering the new function and preexisting parsers.

gdb/ChangeLog:
2017-09-26  Walfred Tedeschi  <walfred.tedeschi@intel.com>
	    Pedro Alves <palves@redhat.com>

	* dwarf2read.c (dwarf2_cu): Remove field producer_is_icc and add
	producer_is_icc_lt_14.
	(producer_is_icc_lt_14): New function.
	(check_producer): Add code for checking version of ICC.
	(producer_is_icc): Move to producer.c.
	(read_structure_type): Restrict ICC workaround to ICC<14.
	* producer.c: Include selftest.h.
	(producer_is_icc, producer_parsing_tests, _initialize_producer):
	New functions.
	* producer.h (producer_is_icc): New declaration.
2017-09-26 18:32:00 +01:00
Walfred Tedeschi b32b108aba Move GDB producer parsing routines to a separate file
gdb/ChangeLog:
2017-09-26  Walfred Tedeschi  <walfred.tedeschi@intel.com>

	* Makefile.in (SFILES): Add producer.c.
	(COMMON_OBS): Add producer.o
	* amd64-tdep.c (producer.h): Add new include.
	* dwarf2read.c (producer.h): Add new include.
	* producer.c: New file.
	* producer.h: New file.
	* utils.c (producer_is_gcc, producer_is_gcc_ge_4): Move to
	producer.c.
	* utils.h (producer_is_gcc, producer_is_gcc_ge_4): Move to
	producer.h.
2017-09-26 18:26:41 +01:00
Sergio Durigan Junior 75352e283f Use "switch_to_thread" more thoroughly on gdbserver
This is a technical debt that I left when I ported "switch_to_thread"
to gdbserver.  It's a simple patch that converts occurences of:

  current_thread = find_thread_ptid (ptid);

to:

  switch_to_thread (ptid);

This patch also converts a simple "if" to a "gdb_assert" on
gdbserver's version of "switch_to_thread":

  gdb_assert (ptid != minus_one_ptid);

This change makes the code more similar to what GDB already does.

Regtested on BuildBot.

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

	* gdbthread.h: Include "common-gdbthread.h".
	* inferiors.c (switch_to_thread): Use "gdb_assert" instead of
	"if" when validating the ptid.
	* remote-utils.c: Include "gdbthread.h".
	(prepare_resume_reply): Use "switch_to_thread".
	* target.c (done_accessing_memory): Likewise.
2017-09-26 12:50:25 -04:00
Matthias Klose 5007d765ae Allow linking GDB with ncursesw
Triggered by https://launchpad.net/bugs/1275210, to be able to cope
with UTF-8 characters in gdbtui.

Reference:
  https://sourceware.org/ml/gdb-patches/2017-09/msg00356.html

gdb/ChangeLog:
2017-09-26  Matthias Klose  <doko@ubuntu.com>

	* configure.ac: Search ncursesw before ncurses.
	Check ncursesw/ncurses.h before ncurses/ncurses.h.
	* gdb_curses.h: Include <ncursesw/ncurses.h>
	* config.in, configure: Regenerate.
2017-09-26 16:23:19 +01:00
Nick Clifton 262c0a877f Fix an assertion failure when parsing a fuzzed x86_64 ELF binary.
PR 22172
	* elf64-x86-64.c (elf_x86_64_info_to_howto): Do not trigger an
	assertion failure if elf_x86_64_rtype_to_howto has already issued
	an error message.
2017-09-26 16:03:10 +01:00
Cary Coutant 00956d3a8a Fix incorrect register mask.
PR gold/22213
	* sparc.cc (Target_sparc): Fix incorrect register mask.
2017-09-26 07:33:04 -07:00
Alan Modra 33e0a9a056 Tidy reading data in read_formatted_entries
Using read_attribute_value accomplishes two things: It checks for
unexpected formats, and ensures the buffer pointer always increments.

	PR 22210
	* dwarf2.c (read_formatted_entries): Use read_attribute_value to
	read data.
2017-09-26 23:23:44 +09:30
Nick Clifton 30d0157a2a Avoid needless resource usage when processing a corrupt DWARF directory or file name table.
PR 22210
	* dwarf2.c (read_formatted_entries): Fail early if we know that
	the loop parsing data entries will overflow the end of the
	section.
2017-09-26 14:37:47 +01:00