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.
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.
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.
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.
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.
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.
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.
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.
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.