binutils-gdb.git
7 years agoRemove cleanups from cp-support.c
Tom Tromey [Thu, 28 Sep 2017 02:46:18 +0000 (20:46 -0600)]
Remove cleanups from cp-support.c

This removes some cleanups from cp-support.c, using std::string.

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

* cp-support.c (gdb_demangle): Use std::string.

7 years agoRemove some cleanups from stack.c
Tom Tromey [Thu, 28 Sep 2017 02:42:21 +0000 (20:42 -0600)]
Remove some cleanups from stack.c

This removes some cleanups from stack.c by using std::string or
gdb::unique_xmalloc_ptr.  One cleanup remains in this file; I did not
remove it here because it is handled in another patch series that has
yet to be resolved.

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

* stack.c (parse_frame_specification): Use std::string
(info_frame_command): Use gdb::unique_xmalloc_ptr.

7 years agoRemove cleanup from tilegx-tdep.c
Tom Tromey [Thu, 28 Sep 2017 02:39:32 +0000 (20:39 -0600)]
Remove cleanup from tilegx-tdep.c

This removes a cleanup from tilegx-tdep.c, by using gdb::byte_vector.

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

* tilegx-tdep.c (tilegx_push_dummy_call): Use gdb::byte_vector.

7 years agoRemove cleanups from utils.c
Tom Tromey [Thu, 28 Sep 2017 02:38:07 +0000 (20:38 -0600)]
Remove cleanups from utils.c

This removes a couple of cleanups from utils.c through the use of
std::string.

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

* utils.c (vfprintf_maybe_filtered): Use std::string.
(vfprintf_unfiltered): Likewise.

7 years agoRemove cleanup from display_gdb_prompt
Tom Tromey [Thu, 28 Sep 2017 02:30:19 +0000 (20:30 -0600)]
Remove cleanup from display_gdb_prompt

This removes a cleanup from display_gdb_prompt by using std::string.

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

* event-top.c (top_level_prompt): Return std::string.
(display_gdb_prompt): Update.

7 years agoIntroduce string_vprintf
Tom Tromey [Thu, 28 Sep 2017 13:44:50 +0000 (07:44 -0600)]
Introduce string_vprintf

This adds string_vprintf, a va_list variant of string_printf.  This
will be used in later patches.

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

* unittests/common-utils-selftests.c (format): New function.
(string_vprintf_tests): New function.
(_initialize_common_utils_selftests): Register new tests.
* common/common-utils.c (string_vprintf): New function.
* common/common-utils.h (string_vprintf): Declare.

7 years agoPR21978, objdump does not display line numbers in certain cases
Alan Modra [Fri, 29 Sep 2017 22:50:08 +0000 (08:20 +0930)]
PR21978, objdump does not display line numbers in certain cases

Same line but different file ought to display file and line.

PR 21978
* objdump.c: Formatting.
(show_line): Reset prev_line when function name changes.

7 years agoAutomatic date update in version.in
GDB Administrator [Sat, 30 Sep 2017 00:00:28 +0000 (00:00 +0000)]
Automatic date update in version.in

7 years agoConstify unpack_varlen_hex & fix fallout
Pedro Alves [Fri, 29 Sep 2017 16:15:36 +0000 (17:15 +0100)]
Constify unpack_varlen_hex & fix fallout

I ran into non-const unpack_varlen_hex while working on something
else, and decided to just fix it first.  Ends up constifying a good
deal of remote packet parsing.

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

* common/rsp-low.c (unpack_varlen_hex): Constify.
* common/rsp-low.h (unpack_varlen_hex): Constify.
* linux-nat.c (linux_child_static_tracepoint_markers_by_strid):
Constify.
* remote.c (remote_set_permissions, read_ptid)
(remote_current_thread, remote_get_threads_with_qthreadinfo)
(remote_static_tracepoint_marker_at)
(remote_static_tracepoint_markers_by_strid)
(stop_reply_extract_thread, remote_parse_stop_reply): Constify.
* tracepoint.c (parse_trace_status, parse_tracepoint_status)
(parse_tracepoint_definition, parse_tsv_definition)
(parse_static_tracepoint_marker_definition): Constify.
* tracepoint.h (parse_static_tracepoint_marker_definition)
(parse_trace_status, parse_tracepoint_status)
(parse_tracepoint_definition, parse_tsv_definition): Constify.

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

* ax.c (gdb_parse_agent_expr): Constify.
* ax.h (gdb_parse_agent_expr): Constify.
* mem-break.c (add_breakpoint_condition, add_breakpoint_commands):
Constify.
* mem-break.h (add_breakpoint_condition, add_breakpoint_commands): Constify.
* remote-utils.c (hex_or_minus_one, read_ptid): Constify.
* remote-utils.h (read_ptid): Constify.
* server.c (handle_qxfer_exec_file, handle_query, handle_v_cont)
(process_point_options, process_serial_event): Constify.
* tracepoint.c (add_tracepoint_action, cmd_qtdp, cmd_qtdpsrc)
(cmd_qtdv, cmd_qtenable_disable, cmd_qtro, cmd_qtframe, cmd_qtp)
(cmd_qtbuffer): Constify.

7 years agogdb/remote.c: Eliminate target_buf/target_buf_size hack
Pedro Alves [Fri, 29 Sep 2017 16:09:05 +0000 (17:09 +0100)]
gdb/remote.c: Eliminate target_buf/target_buf_size hack

This finally eliminates an old hack left in place when tracepoint RSP
support was migrated from tracepoint.c to remote.c, back in
35b1e5cca081 ("Make tracepoint operations go through target vector.")
over 7 years ago.

Tested on x86_64 GNU/Linux.

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

* remote.c (target_buf, target_buf_size): Delete.
(remote_get_noisy_reply): Remove buf_p and sizeof_buf parameters.
Use the connection's packet buffer instead.
All callers adjusted.
(_initialize_remote): Remove references to target_buf and
target_buf_size.

7 years agogdbserver/libthread_db: Don't ignore memory reading failures
Pedro Alves [Fri, 29 Sep 2017 11:33:41 +0000 (12:33 +0100)]
gdbserver/libthread_db: Don't ignore memory reading failures

If we had this in place before, then the regression fixed by the
previous commit would have been been visible is all test runs.  E.g.:

  Running src/gdb/testsuite/gdb.threads/multi-create-ns-info-thr.exp ...
  FAIL: gdb.threads/multi-create-ns-info-thr.exp: continue to breakpoint 6

Debugging manually we'd see this:
  gdbserver: Cannot get thread handle for LWP 1467: generic error

Instead of:
  gdbserver: PID mismatch!  Expected 27472, got 27471

which is misleading - gdbserver didn't 27471, that was stale stack
data from previous function invocations.

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

* proc-service.c (ps_pdread): Return PS_ERR if reading memory
fails.

7 years agoFix gdbserver regression exposed by gdb.threads/multi-create-ns-info-thr.exp
Pedro Alves [Fri, 29 Sep 2017 12:06:34 +0000 (13:06 +0100)]
Fix gdbserver regression exposed by gdb.threads/multi-create-ns-info-thr.exp

Commit 8629910955a7 ("Add thread_db_notice_clone to gdbserver")
introduced calls into libthread_db without making sure that the
current thread is pointing to a know-stopped thread.  This resulted in
sometimes thread_db_notice_clone failing->find_one_thread failing like
this, as seen when running gdb.threads/multi-create-ns-info-thr.exp:

~~~
  Thread <6> executing
  Thread <7> executing
  gdbserver: PID mismatch!  Expected 27472, got 27471
  gdbserver: Cannot find thread after clone.

  Thread <1000> executing
  Thread <1001> executing
~~~

Things go south from here and sometimes that ends up resulting in
gdbserver crashing and the test failing.

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

* linux-low.c (handle_extended_wait): Pass parent thread instead
of process to thread_db_notice_clone.
* linux-low.h (thread_db_notice_clone): Replace parent process
parameter with parent thread parameter.
* thread-db.c (find_one_thread): Add comment.
(thread_db_notice_clone): Replace parent process parameter with
parent thread parameter.  Temporarily switch to the parent thread.

7 years agoFail when string merge can't alloc memory
Alan Modra [Fri, 29 Sep 2017 03:37:56 +0000 (13:07 +0930)]
Fail when string merge can't alloc memory

I was looking at Debian bug #874674 again today, and think I might
have spotted the problem.  It appears that merge.c tries to cope with
memory allocation failures in some circumstances, but doesn't quite
manage to get everything right.  This patch will make ld report memory
allocation failures instead of silently not merging strings.

* merge.c (merge_strings): Return FALSE on malloc failure.
(_bfd_merge_sections): Return failures from record_section and
merge_strings.

7 years agoAutomatic date update in version.in
GDB Administrator [Fri, 29 Sep 2017 00:00:24 +0000 (00:00 +0000)]
Automatic date update in version.in

7 years agoMove utils-selftests.c -> gdb/unittests/
Pedro Alves [Thu, 28 Sep 2017 21:31:42 +0000 (22:31 +0100)]
Move utils-selftests.c -> gdb/unittests/

This file was only under gdb/ currently because it predates the
gdb/unittests/ directory.

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

* Makefile.in (SUBDIR_UNITTESTS_SRCS): Add
unittests/common-utils-selftests.c.
(SUBDIR_UNITTESTS_OBS): Add common-utils-selftests.o.
(COMMON_OBS): Remove utils-selftests.o.
* utils-selftests.c: Move to ...
* unittests/common-utils-selftests.c: ... here and rename self
test to "string_printf".

7 years ago(open_and_init_dwp_file): Protect against some segvs
Doug Evans [Thu, 28 Sep 2017 16:20:59 +0000 (09:20 -0700)]
(open_and_init_dwp_file): Protect against some segvs

This is a "tiny patch", no assignment required.

2017-09-28  Alexander Shaposhnikov <alexander.v.shaposhnikov@gmail.com>

* dwarf2read.c (open_and_init_dwp_file): Protect against dwp_file
having NULL cus or tus.

7 years agoSkip the PR 14918 linker test for ARM targets.
Nick Clifton [Thu, 28 Sep 2017 10:33:20 +0000 (11:33 +0100)]
Skip the PR 14918 linker test for ARM targets.

 I am applying a patch that has been lying around in the Fedora
  binutils sources for a while.  It skips the PR14918 linker test for
  ARM based targets.  This test checks that libgcc is not included in a
  link of an empty executable.  This works for most targets, but on the
  ARM the crt1.o startup code calls __libc_csu_init which is in
  /usr/lib/libc_nonshared.a(elf-init.oS).  This in turn needs
  __aeabi_unwind_cpp_pr0@@GCC_3.5 which is provided by libgcc_s.so.1,
  and so the test fails.

7 years agoPR22220, BFD linker wrongly marks symbols as PREVAILING_DEF_IRONLY
Alan Modra [Thu, 28 Sep 2017 07:41:38 +0000 (17:11 +0930)]
PR22220, BFD linker wrongly marks symbols as PREVAILING_DEF_IRONLY

non_ir_ref_dynamic wasn't being set in the case where we have a
versioned dynamic symbol definition with a non-versioned matching IR
symbol.

bfd/
PR 22220
* elflink.c (_bfd_elf_merge_symbol): Set non_ir_ref_dynamic in
a case where plugin_notice isn't called.
ld/
* testsuite/ld-plugin/pr22220.h,
* testsuite/ld-plugin/pr22220lib.cc,
* testsuite/ld-plugin/pr22220lib.ver,
* testsuite/ld-plugin/pr22220main.cc: New test.
* testsuite/ld-plugin/lto.exp: Run it.

7 years agoAutomatic date update in version.in
GDB Administrator [Thu, 28 Sep 2017 00:00:30 +0000 (00:00 +0000)]
Automatic date update in version.in

7 years agoComplete tdep move to convert_typed_floating
Ulrich Weigand [Wed, 27 Sep 2017 17:05:21 +0000 (19:05 +0200)]
Complete tdep move to convert_typed_floating

Many tdep files need to perform conversions between two floating-point
types, usually when accessing FP registers.  Most targets now use the
convert_typed_floating helper routine to do so.  However, a small number
still use the old method of converting via a DOUBLEST.  Since we want
to get rid of DOUBLEST, these targets need to be moved to the new
method as well.

The main obstacle is that for convert_typed_floating we need an actual
*type*, not just a floatformat.

In arm-tdep.c, this is very straightforward, since there is already a
type using the ARM extended floatformat.

For sh-tdep.c and sh64-tdep.c, no such type already exists, so I've
added one to the gdbarch_tdep struct as done on other targets.

gdb/ChangeLog
2017-09-27  Ulrich Weigand  <uweigand@de.ibm.com>

* arm-tdep.c: (convert_from_extended): Remove.
(convert_to_extended): Likewise.
(arm_extract_return_value): Use convert_typed_floating.
(arm_store_return_value): Likewise.

* sh-tdep.h (struct gdbarch_tdep): Add sh_littlebyte_bigword_type.
* sh-tdep.c: Do not include "floatformat.h".
(sh_littlebyte_bigword_type): New function.
(sh_register_convert_to_virtual): Use convert_typed_floating.
(sh_register_convert_to_raw): Likewise.
* sh64-tdep.c: (struct gdbarch_tdep): Add sh_littlebyte_bigword_type.
(sh64_littlebyte_bigword_type): New function.
(sh64_extract_return_value): Use convert_typed_floating.
(sh64_register_convert_to_virtual): Likewise.
(sh64_register_convert_to_raw): Likewise.

7 years agoSimplify floatformat_from_type
Ulrich Weigand [Wed, 27 Sep 2017 17:03:36 +0000 (19:03 +0200)]
Simplify floatformat_from_type

For historical reasons, the TYPE_FLOATFORMAT element is still set to hold
an array of two floatformat structs, one for big-endian and the other for
little-endian.  When accessing the element via floatformat_from_type,
the code would check the type's byte order and return the appropriate
floatformat.

However, these days this is quite unnecessary, since the type's byte order
is already known at the time the type is allocated and the floatformat is
installed into TYPE_FLOATFORMAT.  Therefore, we can just install the correct
version here.

Also, moves the (now trivially simple) floatformat_from_type accessor to
gdbtypes.{c,h}, since it doesn't really need to be in doublest.c now.

gdb/ChangeLog
2017-09-27  Ulrich Weigand  <uweigand@de.ibm.com>

* doublest.h (floatformat_from_type): Move to gdbtypes.h.
* doublest.c (floatformat_from_type): Move to gdbtypes.c.

* gdbtypes.h (union type_specific): Make field floatformat hold
just a single struct floatformat, not an array.
(floatformat_from_type): Move here.
* gdbtypes.c (floatformat_from_type): Move here.  Update to
changed TYPE_FLOATFORMAT definition.
(verify_floatformat): Update to changed TYPE_FLOATFORMAT.
(recursive_dump_type): Likewise.
(init_float_type): Install correct floatformat for byte order.
(arch_float_type): Likewise.

7 years agoMake init_type/arch_type take a size in bits
Ulrich Weigand [Wed, 27 Sep 2017 17:02:00 +0000 (19:02 +0200)]
Make init_type/arch_type take a size in bits

This changes the interfaces to init_type and arch_type to take the
type length in bits as input (instead of as bytes).  The routines
assert that the length is a multiple of TARGET_CHAR_BIT.

For consistency, arch_flags_type is changed likewise, so that now
all type creation interfaces always use length in bits.

All callers are updated in the straightforward manner.

The assert actually found a bug in read_range_type, where the
init_integer_type routine was called with a wrong argument (probably
a bug introduced with the conversion to use init_integer_type).

gdb/ChangeLog
2017-09-27  Ulrich Weigand  <uweigand@de.ibm.com>

* gdbtypes.c (init_type): Change incoming argument from
length-in-bytes to length-in-bits.  Assert length is a
multiple of TARGET_CHAR_BITS.
(arch_type, arch_flags_type): Likewise.
(init_integer_type): Update call to init_type.
(init_character_type): Likewise.
(init_boolean_type): Likewise.
(init_float_type): Likewise.
(init_decfloat_type): Likewise.
(init_complex_type): Likewise.
(init_pointer_type): Likewise.
(objfile_type): Likewise.
(arch_integer_type): Update call to arch_type.
(arch_character_type): Likewise.
(arch_boolean_type): Likewise.
(arch_float_type): Likewise.
(arch_decfloat_type): Likewise.
(arch_complex_type): Likewise.
(arch_pointer_type): Likewise.
(gdbtypes_post_init): Likewise.

* dwarf2read.c (dwarf2_init_float_type): Update call to init_type.
(read_base_type): Likewise.
* mdebugread.c (basic_type): Likewise.
* stabsread.c (dbx_init_float_type): Likewise.
(rs6000_builtin_type): Likewise.
(read_range_type): Likewise.  Also, fix call to init_integer_type
with erroneous length argument.

* ada-lang.c (ada_language_arch_info): Update call to arch_type.
* d-lang.c (build_d_types): Likewise.
* f-lang.c (build_fortran_types): Likewise.
* go-lang.c (build_go_types): Likewise.
* opencl-lang.c (build_opencl_types): Likewise.
* jit.c (finalize_symtab): Likewise.
* gnu-v3-abi.c (build_gdb_vtable_type): Likewise.
(build_std_type_info_type): Likewise.
* target-descriptions.c (tdesc_gdb_type): Likewise.  Also,
update call to arch_flags_type.

* linux-tdep.c (linux_get_siginfo_type_with_fields): Update call to
arch_type.
* fbsd-tdep.c (fbsd_get_siginfo_type): Likewise.
* windows-tdep.c (windows_get_tlb_type): Likewise.

* avr-tdep.c (avr_gdbarch_init): Update call to arch_type.
* ft32-tdep.c (ft32_gdbarch_init): Likewise.
* m32c-tdep.c (make_types): Likewise.
* rl78-tdep.c (rl78_gdbarch_init): Likewise.
(rl78_psw_type): Update call to arch_flags_type.
* m68k-tdep.c (m68k_ps_type): Update call to arch_flags_type.
* rx-tdep.c (rx_psw_type): Likewise.
(rx_fpsw_type): Likewise.
* sparc-tdep.c (sparc_psr_type): Likewise.
(sparc_fsr_type): Likewise.
* sparc64-tdep.c (sparc64_pstate_type): Likewise.
(sparc64_ccr_type): Likewise.
(sparc64_fsr_type): Likewise.
(sparc64_fprs_type): Likewise.

7 years agoAdd support for the new names of the RISC-V fmv.x.s and fmv.s.x instructions, vis...
Nick Clifton [Wed, 27 Sep 2017 15:21:36 +0000 (16:21 +0100)]
Add support for the new names of the RISC-V fmv.x.s and fmv.s.x instructions, vis: fmv.x.w and fmv.w.x.

PR 22179
opcodes * riscv-opc.c (riscv_opcodes): Add fmv.x.w and fmv.w.x as the new
names for the fmv.x.s and fmv.s.x instructions respectively.

gas * testsuite/gas/riscv/fmv.x.s: New file: Tests the support for the
renamed fmv.x.s and fmv.s.x instructions.
* testsuite/gas/riscv/fmv.x.d: New file: Test driver.

7 years agoConstify find_command
Tom Tromey [Wed, 13 Sep 2017 03:33:48 +0000 (21:33 -0600)]
Constify find_command

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

* findcmd.c (find_command): Constify.

7 years agoConstify some commands in ada-tasks.c
Tom Tromey [Wed, 13 Sep 2017 03:33:21 +0000 (21:33 -0600)]
Constify some commands in ada-tasks.c

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

* ada-tasks.c (task_command_1, task_command): Constify.

7 years agoConstify some commands in symtab.c
Tom Tromey [Wed, 13 Sep 2017 03:32:30 +0000 (21:32 -0600)]
Constify some commands in symtab.c

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

* symtab.c (maintenance_print_symbol_cache)
(maintenance_flush_symbol_cache)
(maintenance_print_symbol_cache_statistics): Constify.

7 years agoConstify some commands in inferior.c
Tom Tromey [Wed, 13 Sep 2017 03:32:18 +0000 (21:32 -0600)]
Constify some commands in inferior.c

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

* inferior.c (detach_inferior_command, kill_inferior_command)
(inferior_command): Constify.

7 years agoConstify some commands in regcache.c
Tom Tromey [Wed, 13 Sep 2017 03:31:41 +0000 (21:31 -0600)]
Constify some commands in regcache.c

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

* regcache.c (regcache_print, maintenance_print_registers)
(maintenance_print_raw_registers)
(maintenance_print_cooked_registers)
(maintenance_print_register_groups)
(maintenance_print_remote_registers): Constify.

7 years agoConstify some commands in printcmd.c
Tom Tromey [Wed, 13 Sep 2017 03:30:50 +0000 (21:30 -0600)]
Constify some commands in printcmd.c

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

* printcmd.c (map_display_numbers, undisplay_command)
(enable_disable_display_command, enable_display_command)
(disable_display_command): Constify.

7 years agoConstify some commands in breakpoint.c
Tom Tromey [Wed, 13 Sep 2017 03:25:07 +0000 (21:25 -0600)]
Constify some commands in breakpoint.c

This also makes delete_command static; but now I wonder if it is used
in Insight and should not be touched.

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

* breakpoint.h (delete_command): Don't declare.
* breakpoint.c (delete_command, enable_once_command)
(enable_count_command, enable_delete_command, breakpoint_1)
(maintenance_info_breakpoints, stopin_command, stopat_command)
(delete_command, delete_trace_command, save_breakpoints)
(save_breakpoints_command, save_tracepoints_command): Constify.

7 years agoConstify some commands in macrocmd.c
Tom Tromey [Wed, 13 Sep 2017 03:22:55 +0000 (21:22 -0600)]
Constify some commands in macrocmd.c

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

* macrocmd.c (macro_expand_command, macro_expand_once_command)
(skip_ws, extract_identifier, macro_define_command)
(macro_undef_command, macro_list_command): Constify.

7 years agoConstify some commands in infcmd.c
Tom Tromey [Wed, 13 Sep 2017 03:20:36 +0000 (21:20 -0600)]
Constify some commands in infcmd.c

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

* infcmd.c (environment_info, set_environment_command)
(unset_environment_command, path_info, info_proc_cmd_1)
(info_proc_cmd_mappings, info_proc_cmd_stat)
(info_proc_cmd_status, info_proc_cmd_cwd, info_proc_cmd_cmdline)
(info_proc_cmd_exe, info_proc_cmd_all): Constify.

7 years agoConstify some commands in i386-tdep.c
Tom Tromey [Wed, 13 Sep 2017 03:17:26 +0000 (21:17 -0600)]
Constify some commands in i386-tdep.c

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

* i386-tdep.c (i386_mpx_info_bounds, i386_mpx_set_bounds):
Constify.

7 years agoConstify add_symbol_file_from_memory_command
Tom Tromey [Wed, 13 Sep 2017 03:17:01 +0000 (21:17 -0600)]
Constify add_symbol_file_from_memory_command

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

* symfile-mem.c (add_symbol_file_from_memory_command): Constify.

7 years agoConstify demangle_command
Tom Tromey [Wed, 13 Sep 2017 03:16:47 +0000 (21:16 -0600)]
Constify demangle_command

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

* demangle.c (demangle_command): Constify.

7 years agoConstify maintenance_info_program_spaces_command
Tom Tromey [Wed, 13 Sep 2017 03:15:46 +0000 (21:15 -0600)]
Constify maintenance_info_program_spaces_command

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

* progspace.c (maintenance_info_program_spaces_command):
Constify.

7 years agoConstify some commands in compile.c
Tom Tromey [Wed, 13 Sep 2017 03:14:41 +0000 (21:14 -0600)]
Constify some commands in compile.c

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

* compile/compile.c (check_raw_argument, compile_file_command)
(compile_code_command, compile_print_command): Constify.

7 years agoConstify maintenance_print_reggroups
Tom Tromey [Wed, 13 Sep 2017 03:13:51 +0000 (21:13 -0600)]
Constify maintenance_print_reggroups

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

* reggroups.c (maintenance_print_reggroups): Constify.

7 years agoConstify save_gdb_index_command
Tom Tromey [Wed, 13 Sep 2017 03:13:40 +0000 (21:13 -0600)]
Constify save_gdb_index_command

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

* dwarf2read.c (save_gdb_index_command): Constify.

7 years agoConstify info_probes_stap_command
Tom Tromey [Wed, 13 Sep 2017 03:13:21 +0000 (21:13 -0600)]
Constify info_probes_stap_command

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

* stap-probe.c (info_probes_stap_command): Constify.

7 years agoConstify unset_exec_wrapper_command
Tom Tromey [Wed, 13 Sep 2017 03:13:03 +0000 (21:13 -0600)]
Constify unset_exec_wrapper_command

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

* fork-child.c (unset_exec_wrapper_command): Constify.

7 years agoConstify some commands in btrace.c
Tom Tromey [Wed, 13 Sep 2017 03:12:42 +0000 (21:12 -0600)]
Constify some commands in btrace.c

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

* btrace.c (get_uint, get_context_size, no_chunk)
(maint_btrace_packet_history_cmd)
(maint_btrace_clear_packet_history_cmd, maint_btrace_clear_cmd)
(maint_info_btrace_cmd): Constify.

7 years agoConstify delete_bookmark_command
Tom Tromey [Wed, 13 Sep 2017 03:09:47 +0000 (21:09 -0600)]
Constify delete_bookmark_command

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

* reverse.c (delete_bookmark_command): Constify.

7 years agoConstify some commands in remote.c
Tom Tromey [Wed, 13 Sep 2017 03:09:35 +0000 (21:09 -0600)]
Constify some commands in remote.c

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

* remote.c (set_memory_packet_size)
(set_memory_write_packet_size, show_memory_write_packet_size)
(set_memory_read_packet_size, show_memory_read_packet_size)
(compare_sections_command, packet_command, remote_put_command)
(remote_get_command, remote_delete_command): Constify.

7 years agoConstify some commands in mips-tdep.c
Tom Tromey [Wed, 13 Sep 2017 03:05:40 +0000 (21:05 -0600)]
Constify some commands in mips-tdep.c

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

* mips-tdep.c (show_mipsfpu_command, set_mipsfpu_single_command)
(set_mipsfpu_double_command, set_mipsfpu_none_command)
(set_mipsfpu_auto_command): Constify.

7 years agoConstify cd_command
Tom Tromey [Wed, 13 Sep 2017 03:02:08 +0000 (21:02 -0600)]
Constify cd_command

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

* cli/cli-cmds.h (cd_command): Constify.
* cli/cli-cmds.c (cd_command): Constify.

7 years agoConstify some commands in thread.c
Tom Tromey [Wed, 13 Sep 2017 02:45:21 +0000 (20:45 -0600)]
Constify some commands in thread.c

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

* thread.c (thread_name_command, thread_find_command): Constify.

7 years agoConstify some commands in probes.c
Tom Tromey [Wed, 13 Sep 2017 02:42:32 +0000 (20:42 -0600)]
Constify some commands in probes.c

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

* probe.c (enable_probes_command, disable_probes_command):
Constify.

7 years agoConstify some commands in exec.c, plus symbol_file_command
Tom Tromey [Wed, 13 Sep 2017 00:39:07 +0000 (18:39 -0600)]
Constify some commands in exec.c, plus symbol_file_command

Note that this commit also changes deprecated_file_changed_hook -- not
used in the tree, but Insight will require a (presumably minor)
change.

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

* symfile.c (symbol_file_command): Constify.
* gdbcore.h (deprecated_file_changed_hook): Constify.
* exec.c (deprecated_file_changed_hook, exec_file_command)
(file_command): Constify.
* defs.h (symbol_file_command): Constify.

7 years agoConstify some commands in remote-fileio.c
Tom Tromey [Wed, 13 Sep 2017 00:38:19 +0000 (18:38 -0600)]
Constify some commands in remote-fileio.c

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

* remote-fileio.c (set_system_call_allowed)
(show_system_call_allowed): Constify.

7 years agoConstify some commands in tracepoint.c
Tom Tromey [Wed, 13 Sep 2017 00:37:46 +0000 (18:37 -0600)]
Constify some commands in tracepoint.c

In addition to the constification, this fixes a command-repeat bug.

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

* tracepoint.c (delete_trace_variable_command)
(tfind_end_command, tfind_start_command, tfind_pc_command)
(tfind_tracepoint_command, tfind_line_command)
(tfind_range_command, tfind_outside_command): Constify.

7 years agoConstify some commands in ax-gdb.c
Tom Tromey [Tue, 12 Sep 2017 21:00:06 +0000 (15:00 -0600)]
Constify some commands in ax-gdb.c

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

* ax-gdb.c (maint_agent_printf_command, agent_command)
(agent_eval_command): Constify.

7 years agoConstify some linespec functions
Tom Tromey [Wed, 13 Sep 2017 00:32:41 +0000 (18:32 -0600)]
Constify some linespec functions

This changes a few linespec functions to work on "const char *" and
then fixes up all the callers.  This allows further constification
elsewhere.

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

* tracepoint.c (info_scope_command): Constify.
* python/python.c (gdbpy_decode_line): Constify.
* python/py-breakpoint.c (bppy_init): Constify.
* mi/mi-cmd-break.c (mi_cmd_break_insert_1): Constify.
* location.h: (new_linespec_location)
(string_to_event_location_basic, string_to_event_location):
Constify.
* location.c (new_linespec_location)
(string_to_event_location_basic, string_to_event_location):
Constify.
* linespec.h (decode_line_with_current_source)
(decode_line_with_last_displayed, linespec_lex_to_end): Constify.
* linespec.c (linespec_lex_to_end)
(decode_line_with_current_source)
(decode_line_with_last_displayed): Constify.
* guile/scm-breakpoint.c (gdbscm_register_breakpoint_x):
Constify.
* cli/cli-cmds.c (edit_command, list_command): Constify.
* breakpoint.h (until_break_command, watch_command_wrapper)
(awatch_command_wrapper, rwatch_command_wrapper)
(init_ada_exception_breakpoint): Constify.
* breakpoint.c (break_command_1, dprintf_command)
(break_range_command, watch_command_wrapper)
(rwatch_command_wrapper, awatch_command_wrapper)
(until_break_command, init_ada_exception_breakpoint)
(strace_marker_create_sals_from_location, trace_command)
(ftrace_command, strace_command, struct tracepoint): Constify.
* ax-gdb.c (agent_command_1): Constify.
* ada-lang.c (ada_exception_sal): Constify.

7 years agoConstify some commands in record.c
Tom Tromey [Tue, 12 Sep 2017 20:56:48 +0000 (14:56 -0600)]
Constify some commands in record.c

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

* record.c (cmd_record_delete, cmd_record_stop, cmd_record_save)
(cmd_record_goto_begin, cmd_record_goto_end, get_insn_number)
(get_context_size, no_chunk, get_insn_history_modifiers)
(cmd_record_insn_history, get_call_history_modifiers)
(cmd_record_call_history): Constify.

7 years agoConstify some commands in source.c
Tom Tromey [Tue, 12 Sep 2017 20:45:14 +0000 (14:45 -0600)]
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.

7 years agoConstify commands maint.c, plus maintenance_print_type
Tom Tromey [Tue, 12 Sep 2017 20:40:43 +0000 (14:40 -0600)]
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.

7 years agoConstify unwind_command
Tom Tromey [Sun, 10 Sep 2017 03:52:56 +0000 (21:52 -0600)]
Constify unwind_command

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

* hppa-tdep.c (unwind_command): Constify.

7 years agoConstify some commands in target-descriptions.c
Tom Tromey [Sun, 10 Sep 2017 03:52:05 +0000 (21:52 -0600)]
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.

7 years agoConstify maintenance_print_dummy_frames
Tom Tromey [Sun, 10 Sep 2017 03:51:39 +0000 (21:51 -0600)]
Constify maintenance_print_dummy_frames

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

* dummy-frame.c (maintenance_print_dummy_frames): Constify.

7 years agoConstify some commands in tui.c
Tom Tromey [Sun, 10 Sep 2017 03:51:21 +0000 (21:51 -0600)]
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.

7 years agoConstify tui_reg_command
Tom Tromey [Sun, 10 Sep 2017 03:51:10 +0000 (21:51 -0600)]
Constify tui_reg_command

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

* tui/tui-regs.c (tui_reg_command): Constify.

7 years agoConstify some commands in skip.c
Tom Tromey [Sun, 10 Sep 2017 03:50:56 +0000 (21:50 -0600)]
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.

7 years agoConstify some commands in record-btrace.c
Tom Tromey [Sun, 10 Sep 2017 03:46:34 +0000 (21:46 -0600)]
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.

7 years agoConstify some commands in symmisc.c
Tom Tromey [Sun, 10 Sep 2017 03:45:47 +0000 (21:45 -0600)]
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.

7 years agoConstify new_ui_command
Tom Tromey [Sun, 10 Sep 2017 03:44:55 +0000 (21:44 -0600)]
Constify new_ui_command

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

* top.c (new_ui_command): Constify.

7 years agoConstify some commands in symfile.c
Tom Tromey [Sun, 10 Sep 2017 03:44:31 +0000 (21:44 -0600)]
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.

7 years agoConstify some commands in spu-tdep.c
Tom Tromey [Sun, 10 Sep 2017 03:41:50 +0000 (21:41 -0600)]
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.

7 years agoConstify some commands in cli-logging.c
Tom Tromey [Sun, 10 Sep 2017 03:40:53 +0000 (21:40 -0600)]
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.

7 years agoConstify user_defined_command
Tom Tromey [Sun, 10 Sep 2017 03:40:16 +0000 (21:40 -0600)]
Constify user_defined_command

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

* cli/cli-script.c (user_defined_command): Constify.

7 years agoConstify commands in cli-dump.c
Tom Tromey [Sun, 10 Sep 2017 03:39:18 +0000 (21:39 -0600)]
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.

7 years agoConstify some commands in cli-cmds.c
Tom Tromey [Sun, 10 Sep 2017 03:37:20 +0000 (21:37 -0600)]
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.

7 years agoConstify maintenance_print_target_stack
Tom Tromey [Sun, 10 Sep 2017 03:34:29 +0000 (21:34 -0600)]
Constify maintenance_print_target_stack

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

* target.c (maintenance_print_target_stack): Constify.

7 years agoConstify interpreter_exec_cmd
Tom Tromey [Sun, 10 Sep 2017 03:32:11 +0000 (21:32 -0600)]
Constify interpreter_exec_cmd

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

* interps.c (interpreter_exec_cmd): Constify.

7 years agoConstify cmd_record_full_restore
Tom Tromey [Sun, 10 Sep 2017 03:31:57 +0000 (21:31 -0600)]
Constify cmd_record_full_restore

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

* record-full.c (cmd_record_full_restore): Constify.

7 years agoConstify some functions in memattr.c
Tom Tromey [Sun, 10 Sep 2017 03:30:40 +0000 (21:30 -0600)]
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.

7 years agoConstify show_convenience
Tom Tromey [Sun, 10 Sep 2017 03:29:57 +0000 (21:29 -0600)]
Constify show_convenience

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

* value.c (show_convenience): Constify.

7 years agoConstify core_file_command
Tom Tromey [Sun, 10 Sep 2017 03:25:44 +0000 (21:25 -0600)]
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.

7 years agoConstify maintenance_print_user_registers
Tom Tromey [Sun, 10 Sep 2017 03:24:08 +0000 (21:24 -0600)]
Constify maintenance_print_user_registers

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

* user-regs.c (maintenance_print_user_registers): Constify.

7 years agoConstify maintenance_cplus_namespace
Tom Tromey [Sun, 10 Sep 2017 03:23:03 +0000 (21:23 -0600)]
Constify maintenance_cplus_namespace

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

* cp-namespace.c (maintenance_cplus_namespace): Constify.

7 years agoConstify first_component_command
Tom Tromey [Sun, 10 Sep 2017 03:22:52 +0000 (21:22 -0600)]
Constify first_component_command

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

* cp-support.c (first_component_command): Constify.

7 years agoConstify some functions in psymtab.c
Tom Tromey [Sun, 10 Sep 2017 03:22:28 +0000 (21:22 -0600)]
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.

7 years agoConstify display_tib
Tom Tromey [Sun, 10 Sep 2017 03:22:05 +0000 (21:22 -0600)]
Constify display_tib

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

* windows-tdep.c (display_tib): Constify.

7 years agoConstify two functions in linux-fork.c
Tom Tromey [Sun, 10 Sep 2017 03:00:26 +0000 (21:00 -0600)]
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.

7 years agoConstify two functions in cp-abi.c
Tom Tromey [Sun, 10 Sep 2017 02:59:50 +0000 (20:59 -0600)]
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.

7 years agoConstify dump_arc_instruction_command
Tom Tromey [Sun, 10 Sep 2017 02:59:14 +0000 (20:59 -0600)]
Constify dump_arc_instruction_command

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

* arc-tdep.c (dump_arc_instruction_command): Constify.

7 years agoConstify two functions in valprint.c
Tom Tromey [Sun, 10 Sep 2017 02:58:42 +0000 (20:58 -0600)]
Constify two functions in valprint.c

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

* valprint.c (set_radix, show_radix): Constify.

7 years agoConstify info_probes_dtrace_command
Tom Tromey [Sun, 10 Sep 2017 02:57:56 +0000 (20:57 -0600)]
Constify info_probes_dtrace_command

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

* dtrace-probe.c (info_probes_dtrace_command): Constify.

7 years agoConstify not_just_help_class_command
Tom Tromey [Sun, 10 Sep 2017 02:57:10 +0000 (20:57 -0600)]
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.

7 years agoConstify add_cmd gdb_bfd.c
Tom Tromey [Sun, 10 Sep 2017 02:55:20 +0000 (20:55 -0600)]
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.

7 years agoAdd add_cmd function overloads
Tom Tromey [Sun, 10 Sep 2017 02:51:33 +0000 (20:51 -0600)]
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.

7 years agoAdd support for __VA_OPT__
Tom Tromey [Mon, 18 Sep 2017 02:36:41 +0000 (20:36 -0600)]
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.

7 years agoPrevent an infinite loop in the DWARF parsing code when encountering a CU structure...
Nick Clifton [Wed, 27 Sep 2017 09:42:51 +0000 (10:42 +0100)]
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.

7 years agoPR22216, infinite loop in readelf process_symbol_table
Alan Modra [Wed, 27 Sep 2017 05:44:00 +0000 (15:14 +0930)]
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.

7 years agonds32: Fix a tautological comparison.
Kuan-Lin Chen [Wed, 27 Sep 2017 05:04:35 +0000 (13:04 +0800)]
nds32: Fix a tautological comparison.

7 years agoAutomatic date update in version.in
GDB Administrator [Wed, 27 Sep 2017 00:00:23 +0000 (00:00 +0000)]
Automatic date update in version.in

7 years agox86-64: Don't pass output_bfd to info->callbacks->minfo
H.J. Lu [Tue, 26 Sep 2017 21:41:22 +0000 (14:41 -0700)]
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.

7 years agodwarf2read: Restrict ICC workaround to ICC<14
Walfred Tedeschi [Tue, 26 Sep 2017 17:26:41 +0000 (18:26 +0100)]
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.

7 years agoMove GDB producer parsing routines to a separate file
Walfred Tedeschi [Tue, 26 Sep 2017 17:26:41 +0000 (18:26 +0100)]
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.

7 years agoUse "switch_to_thread" more thoroughly on gdbserver
Sergio Durigan Junior [Fri, 15 Sep 2017 04:27:53 +0000 (00:27 -0400)]
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.

7 years agoAllow linking GDB with ncursesw
Matthias Klose [Tue, 26 Sep 2017 15:23:19 +0000 (16:23 +0100)]
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.