Tom Tromey [Wed, 20 Sep 2017 03:56:36 +0000 (21:56 -0600)]
Remove make_cleanup_restore_target_terminal
This removes make_cleanup_restore_target_terminal and generally
C++-ifies target terminal handling. It changes all target_terminal_*
functions to be static members of a new target_terminal class and
changes the cleanup to be a scoped_* class.
make_cleanup_override_quit_handler is also removed in favor of simply
using scoped_restore.
Note that there are some files in this patch that I could not compile.
Considering that some of the rewrites were automated, and that none of
these files involed cleanups, I feel that this is relatively safe.
Regression tested by the buildbot.
gdb/ChangeLog
2017-09-20 Tom Tromey <tom@tromey.com>
* windows-nat.c (get_windows_debug_event, windows_wait)
(do_initial_windows_stuff, windows_attach): Update.
* utils.c (vwarning, internal_vproblem): Update.
(ui_unregister_input_event_handler_cleanup)
(prepare_to_handle_input): Remove.
(class scoped_input_handler): New.
(defaulted_query, prompt_for_continue): Update.
* tui/tui-hooks.c (tui_refresh_frame_and_register_information):
Update.
* top.c (undo_terminal_modifications_before_exit): Update.
* target/target.h (target_terminal_init, target_terminal_inferior)
(target_terminal_ours): Don't declare.
(class target_terminal): New.
* target.h (target_terminal_is_inferior, target_terminal_is_ours)
(target_terminal_ours_for_output)
(make_cleanup_restore_target_terminal): Don't declare.
(target_terminal_info): Remove.
* target.c (enum terminal_state, terminal_state): Remove.
(target_terminal::terminal_state): Define.
(target_terminal::init): Rename from target_terminal_init.
(target_terminal::inferior): Rename from
target_terminal_inferior.
(target_terminal::ours): Rename from target_terminal_ours.
(target_terminal::ours_for_output): Rename from
target_terminal_ours_for_output.
(target_terminal::info): New method.
(cleanup_restore_target_terminal)
(make_cleanup_restore_target_terminal): Remove.
* solib.c (handle_solib_event): Update.
* remote.c (remote_serial_quit_handler): Update.
(remote_terminal_inferior, remote_wait_as): Update.
* record-full.c (record_full_wait_1): Update.
* nto-procfs.c (procfs_create_inferior): Update.
* nat/fork-inferior.c (startup_inferior): Update.
* mi/mi-interp.c (mi_new_thread, mi_thread_exit)
(mi_record_changed, mi_inferior_added, mi_inferior_appeared)
(mi_inferior_exit, mi_inferior_removed, mi_traceframe_changed)
(mi_tsv_created, mi_tsv_deleted, mi_tsv_modified)
(mi_breakpoint_created, mi_breakpoint_deleted)
(mi_breakpoint_modified, mi_on_resume, mi_solib_loaded)
(mi_solib_unloaded, mi_command_param_changed, mi_memory_changed)
(mi_user_selected_context_changed, report_initial_inferior):
Update.
* linux-nat.c (linux_nat_attach, linux_nat_terminal_ours)
(linux_nat_terminal_inferior): Update.
* infrun.c (follow_fork_inferior)
(handle_vfork_child_exec_or_exit, do_target_resume)
(check_curr_ui_sync_execution_done, handle_inferior_event_1)
(handle_signal_stop, maybe_remove_breakpoints, normal_stop):
Update.
* inflow.c (child_terminal_init, info_terminal_command): Update.
* infcmd.c (post_create_inferior, continue_1, prepare_one_step)
(attach_command): Update.
* infcall.c (call_thread_fsm_should_stop): Update.
* gnu-nat.c (gnu_attach): Update.
* extension.c (struct active_ext_lang_state)
(restore_active_ext_lang): Update.
* exceptions.c (print_flush): Update.
* event-top.c (async_enable_stdin, default_quit_handler): Update.
(struct quit_handler_cleanup_data, restore_quit_handler)
(restore_quit_handler_dtor, make_cleanup_override_quit_handler):
Remove.
* cp-support.c (gdb_demangle): Update.
* breakpoint.c (update_inserted_breakpoint_locations)
(insert_breakpoint_locations, handle_jit_event)
(disable_breakpoints_in_unloaded_shlib): Update.
* annotate.c (annotate_breakpoints_invalid)
(annotate_frames_invalid): Update.
gdb/gdbserver/ChangeLog
2017-09-20 Tom Tromey <tom@tromey.com>
* target.c (target_terminal::terminal_state): Define.
(target_terminal::init): Rename from target_terminal_init.
(target_terminal::inferior): Rename from
target_terminal_inferior.
(target_terminal::ours): Rename from target_terminal_ours.
(target_terminal::ours_for_output, target_terminal::info): New.
Tom Tromey [Tue, 12 Sep 2017 20:14:33 +0000 (14:14 -0600)]
Overload catch_command_errors
This changes catch_command_errors_const to be an overload of
catch_command_errors, which may mildly help future constification
efforts.
Tested by rebuilding.
gdb/ChangeLog
2017-09-20 Tom Tromey <tom@tromey.com>
* main.c (catch_command_errors): Rename from
catch_command_errors_const.
(captured_main_1): Update.
Pedro Alves [Wed, 20 Sep 2017 15:12:54 +0000 (16:12 +0100)]
Make "list ambiguous" show symbol names too
Currently, with an ambiguous "list first,last", we get:
(gdb) list bar,main
Specified first line 'bar' is ambiguous:
file: "src/gdb/testsuite/gdb.cp/overload.cc", line number: 97
file: "src/gdb/testsuite/gdb.cp/overload.cc", line number: 98
This commit makes gdb's output above a bit clearer by printing the
symbol name as well:
(gdb) list bar,main
Specified first line 'bar' is ambiguous:
file: "src/gdb/testsuite/gdb.cp/overload.cc", line number: 97, symbol: "bar(A)"
file: "src/gdb/testsuite/gdb.cp/overload.cc", line number: 98, symbol: "bar(B)"
And while at it, makes gdb print the symbol name when actually listing
multiple locations too. I.e., before (with "set listsize 2"):
(gdb) list bar
file: "src/gdb/testsuite/gdb.cp/overload.cc", line number: 97
96
97 int bar (A) { return 11; }
file: "src/gdb/testsuite/gdb.cp/overload.cc", line number: 98
97 int bar (A) { return 11; }
98 int bar (B) { return 22; }
After:
(gdb) list bar
file: "src/gdb/testsuite/gdb.cp/overload.cc", line number: 97, symbol: "bar(A)"
96
97 int bar (A) { return 11; }
file: "src/gdb/testsuite/gdb.cp/overload.cc", line number: 98, symbol: "bar(B)"
97 int bar (A) { return 11; }
98 int bar (B) { return 22; }
Currently, the result of decoding a linespec loses information about
the original symbol that was found. All we end up with is an address.
This makes it difficult to find the original symbol again to get at
its print name. Fix that by storing a pointer to the symbol in the
sal. We already store the symtab and obj_section, so it feels like a
natural progression to me. This avoids having to do any extra symbol
lookup too.
gdb/ChangeLog:
2017-09-20 Pedro Alves <palves@redhat.com>
* cli/cli-cmds.c (list_command): Use print_sal_location.
(print_sal_location): New function.
(ambiguous_line_spec): Use print_sal_location.
* linespec.c (symbol_to_sal): Record the symbol in the sal.
* symtab.c (find_function_start_sal): Likewise.
* symtab.h (symtab_and_line::symbol): New field.
gdb/testsuite/ChangeLog:
2017-09-20 Pedro Alves <palves@redhat.com>
* gdb.base/list-ambiguous.exp (test_list_ambiguous_symbol): Expect
symbol names in gdb's output.
* gdb.cp/overload.exp ("list all overloads"): Likewise.
Pedro Alves [Wed, 20 Sep 2017 15:12:54 +0000 (16:12 +0100)]
Fix "list ambiguous_variable"
The "list" command allows specifying the name of variables as
argument, not just functions, so that users can type "list
a_global_variable".
That support is a broken when it comes to ambiguous locations though.
If there's more than one such global variable in the program, e.g.,
static globals in different compilation units, GDB ends up listing the
source of the first variable it finds, only.
linespec.c does find both symbol and minsym locations for all the
globals. The problem is that it ends up merging all the resulting
sals into one, because they all have address, zero. I.e., all sals
end up with sal.pc == 0, so maybe_add_address returns false for all
but the first.
The zero addresses appear because:
- in the minsyms case, linespec.c:minsym_found incorrectly treats all
minsyms as if they were function/text symbols. In list mode we can
end up with data symbols there, and we shouldn't be using
find_pc_sect_line on data symbols.
- in the debug symbols case, symbol_to_sal misses recording an address
(sal.pc) for non-block, non-label symbols.
gdb/ChangeLog:
2017-09-20 Pedro Alves <palves@redhat.com>
* linespec.c (minsym_found): Handle non-text minsyms.
(symbol_to_sal): Record a sal.pc for non-block, non-label symbols.
gdb/testsuite/ChangeLog:
2017-09-20 Pedro Alves <palves@redhat.com>
* gdb.base/list-ambiguous.exp (test_list_ambiguous_function):
Rename to ...
(test_list_ambiguous_symbol): ... this and add a symbol name
parameter. Adjust.
(test_list_ambiguous_function): Reimplement on top of
test_list_ambiguous_symbol and also test listing ambiguous
variables.
* gdb.base/list-ambiguous0.c (ambiguous): Rename to ...
(ambiguous_fun): ... this.
(ambiguous_var): New.
* gdb.base/list-ambiguous1.c (ambiguous): Rename to ...
(ambiguous_fun): ... this.
(ambiguous_var): New.
Walfred Tedeschi [Wed, 20 Sep 2017 13:24:47 +0000 (15:24 +0200)]
[OBV] amd64-features-makefile: add missing backslash.
In an old commit the backslash of was missing in the rule for creating the
i386-avx-mpx-avx512-pku.dat file. No need to regenerate the files, this
was done by another commit from Yao.
2017-09-20 Walfred Tedeschi <walfred.tedeschi@intel.com>
* features/Makefile (i386-avx-mpx-avx512-pku.dat): Add backslash.
Walfred Tedeschi [Wed, 20 Sep 2017 12:47:04 +0000 (14:47 +0200)]
add ChangeLog from previous commit
Walfred Tedeschi [Wed, 20 Sep 2017 11:42:21 +0000 (13:42 +0200)]
gdb - avx512: tests were failing due to missing memory aligment.
Test was running on a fault during code execution. Analysis have shown
that the wrong instruction had been used. An instruction that takes
not alligned memory is more appropriated for the task.
ChangeLog:
2017-09-20 Walfred Tedeschi <walfred.tedeschi@intel.com>
gdb/testesuite/ChangeLog:
* gdb.arch/i386-avx512.c (move_zmm_data_to_reg): Use
vmovups instead vmovaps.
(move_zmm_data_to_memory): Use vmovups instead vmovaps.
Change-Id: I4a95560861ef1792ed6ce86578fdd726162863f1
Alan Modra [Tue, 19 Sep 2017 23:47:56 +0000 (09:17 +0930)]
[GOLD] PowerPC function address in non-PIC
ppc32, like many targets, defines the address of a function as the PLT
call stub code for functions referenced but not defined in a non-PIC
executable. ppc32 gold, unlike other targets, inherits the ppc64
multiple stub capability for dealing with very large binaries where
one set of stubs can't be reached from all code locations. This means
there can be multiple choices of address for a function, which might
cause function pointer comparison failures. So for ppc32, make
non-branch references always use the first stub group.
(PowerPC64 ELFv1 is always PIC so doesn't need to define the address
of an external function as the PLT stub. PowerPC64 ELFv2 needs a
special set of global entry stubs to serve as the address of external
functions, so it too is not affected by this bug.)
* powerpc.cc (Target_powerpc::Branch_info::make_stub): Put
stubs for ppc32 non-branch relocs in first stub table.
(Target_powerpc::Relocate::relocate): Resolve similarly.
GDB Administrator [Wed, 20 Sep 2017 00:00:30 +0000 (00:00 +0000)]
Automatic date update in version.in
John Baldwin [Mon, 11 Sep 2017 21:57:37 +0000 (14:57 -0700)]
Add a 'starti' command.
This works like 'start' but it stops at the first instruction rather
than the first line in main(). This is useful if one wants to single
step through runtime linker startup.
While here, introduce a RUN_ARGS_HELP macro for shared help text
between run, start, and starti. This includes expanding the help for
start and starti to include details from run's help text.
gdb/ChangeLog:
* NEWS (Changes since GDB 8.0): Add starti.
* infcmd.c (enum run_break): New.
(run_command_1): Queue pending event for RUN_STOP_AT_FIRST_INSN
case.
(run_command): Use enum run_how.
(start_command): Likewise.
(starti_command): New function.
(RUN_ARGS_HELP): New macro.
(_initialize_infcmd): Use RUN_ARGS_HELP for run and start
commands. Add starti command.
gdb/doc/ChangeLog:
* gdb.texinfo (Starting your Program): Add description of
starti command. Mention starti command as an alternative for
debugging the elaboration phase.
gdb/testsuite/ChangeLog:
* gdb.base/starti.c: New file.
* gdb.base/starti.exp: New file.
* lib/gdb.exp (gdb_starti_cmd): New procedure.
Maciej W. Rozycki [Tue, 19 Sep 2017 14:20:41 +0000 (15:20 +0100)]
MIPS/LD: Add OpenBSD/mips64 support
Complement commit
26eebcf553d7 ("Update OpenBSD/mips64 support"),
<https://sourceware.org/ml/binutils/2005-04/msg00382.html>, which added
OpenBSD/mips64 support to GAS, and also add it to LD, avoiding a build
failure at the configuration stage, like:
*** ld does not support target mips64-unknown-openbsd
*** see ld/configure.tgt for supported targets
make[1]: *** [configure-ld] Error 1
As per OS support only include n64 MIPS emulations, and use the
traditional ones, matching the choice already made with the addition of
GAS support.
ld/
* configure.tgt <mips64el-*-openbsd*, mips64-*-openbsd*>: New
targets.
Yao Qi [Tue, 19 Sep 2017 09:18:57 +0000 (10:18 +0100)]
Remove one explicit rule for monitor.o
gdb/monitor.c was removed by
40e0b27 (Delete the remaining ROM monitor
targets).
gdb:
2017-09-19 Yao Qi <yao.qi@linaro.org>
* Makefile.in (monitor.o): Remove the rule.
Yao Qi [Tue, 19 Sep 2017 09:10:03 +0000 (10:10 +0100)]
Use DISABLE_COPY_AND_ASSIGN
We have many classes that copy cotr and assignment operator are deleted,
so this patch replaces these existing mechanical code with macro
DISABLE_COPY_AND_ASSIGN.
gdb:
2017-09-19 Yao Qi <yao.qi@linaro.org>
* annotate.h (struct annotate_arg_emitter): Use
DISABLE_COPY_AND_ASSIGN.
* common/refcounted-object.h (refcounted_object): Likewise.
* completer.h (struct completion_result): Likewise.
* dwarf2read.c (struct dwarf2_per_objfile): Likewise.
* filename-seen-cache.h (filename_seen_cache): Likewise.
* gdbcore.h (thread_section_name): Likewise.
* gdb_regex.h (compiled_regex): Likewise.
* gdbthread.h (scoped_restore_current_thread): Likewise.
* inferior.h (scoped_restore_current_inferior): Likewise.
* jit.c (jit_reader): Likewise.
* linespec.h (struct linespec_result): Likewise.
* mi/mi-parse.h (struct mi_parse): Likewise.
* nat/fork-inferior.c (execv_argv): Likewise.
* progspace.h (scoped_restore_current_program_space): Likewise.
* python/python-internal.h (class gdbpy_enter): Likewise.
* regcache.h (regcache): Likewise.
* target-descriptions.c (struct tdesc_reg): Likewise.
(struct tdesc_type): Likewise.
(struct tdesc_feature): Likewise.
* ui-out.h (ui_out_emit_type): Likewise.
Alan Modra [Tue, 19 Sep 2017 03:52:49 +0000 (13:22 +0930)]
PowerPC64 stubs don't match calculated size
After the PR 21411 fix, the linker generated .eh_frame for ppc64 glink
can be edited by the generic code. The sequence of events goes
something like:
1) Some object file adds .eh_frame aligned to 8, making the output
.eh_frame aligned to at least 8, so linker generated .eh_frame FDE
is padded to an 8 byte boundary.
2) All .eh_frame past the glink .eh_frame is garbage collected.
3) Generic code detects that last FDE (the glink .eh_frame) doesn't
need to be padded to an 8 byte boundary, reducing size from 88 to
84.
4) elf64-ppc.c check fails.
PR 21441
* elf64-ppc.c (ppc64_elf_build_stubs): Don't check glink_eh_frame
size.
Alan Modra [Tue, 19 Sep 2017 02:29:30 +0000 (11:59 +0930)]
PR22150, ld keeps a version reference for gc'd symbols
elf_gc_sweep_symbol should run after verdefs are calculated, since
the verdef code creates symbols for the versions. However,
elf_gc_sweep_symbol needs to run before verrefs so as to not emit
useless verrefs for symbols that are gc'd.
I've also removed a _bfd_elf_link_renumber_dynsyms calls added by
Maciej after I fussed about it when reviewing. On further examination
the call appears to be unnecessary. Looking at renumber_dynsyms also
made me realize that the test to exclude .gnu.version has been wrong
since 2016-04-26 (git commit
d5486c4372), so fix that too.
PR 22150
* elflink.c (bfd_elf_size_dynamic_sections): Garbage collect
symbols before calculating verrefs. Don't renumber dynsyms
after gc. Exclude .gnu.version when zero or one dynsym.
Localize some vars and reindent.
Alan Modra [Tue, 19 Sep 2017 02:15:51 +0000 (11:45 +0930)]
[GOLD, PowerPC] Add --no-stub-group-multi
The trouble with stubs per output section is that ppc32 uses a plt
stub as the address of a global function. This needs to be unique,
otherwise we'll get multiple addresses for a function.
Obviously this is only a partial solution, since ppc32 will get
multiple stubs when code is larger than 33M. A proper fix will
involve selecting a unique stub to use for non-branch relocs.
* options.h (stub-group-multi): Default to true. Add
--no-stub-group-multi.
GDB Administrator [Tue, 19 Sep 2017 00:00:29 +0000 (00:00 +0000)]
Automatic date update in version.in
H.J. Lu [Mon, 18 Sep 2017 20:05:25 +0000 (13:05 -0700)]
Check error return from bfd_canonicalize_dynamic_reloc
Since bfd_canonicalize_dynamic_reloc returns -1 on error, check it in
_bfd_x86_elf_get_synthetic_symtab.
PR ld/22148
* elfxx-x86.c (_bfd_x86_elf_get_synthetic_symtab): Check error
return from bfd_canonicalize_dynamic_reloc.
Simon Marchi [Mon, 18 Sep 2017 11:09:20 +0000 (13:09 +0200)]
dwarf2expr: Remove unused abort_expression label in execute_stack_op
The label abort_expression is unused, so remove it.
gdb/ChangeLog:
* dwarf2expr.c (dwarf_expr_context::execute_stack_op): Remove
label abort_expression.
Nick Clifton [Mon, 18 Sep 2017 08:21:38 +0000 (09:21 +0100)]
[PATCH] Sync libiberty/ & include/ with GCC - addendum: update elfcpp/dwarf.h with the new DW_CFA_DUP macro.
From the original email:
Note this brings in the interface files for libcc1/G++ as well, which
we will be needing in GDB soon anyway. That commit renamed a method
in the C interface and that required a small update to GDB's compile/
code, which I've included that in this patch to keep the tree
building.
From the follow up email:
That breaks gold:
g++ -DHAVE_CONFIG_H -I. -I../../binutils/gold -I../../binutils/gold -I../../binutils/gold/../include -I../../binutils/gold/../elfcpp -DLOCALEDIR="\"/usr/share/locale\"" -DBINDIR="\"/usr/bin\"" -DTOOLBINDIR="\"/usr/x86_64-linux/bin\"" -DTOOLLIBDIR="\"/usr/x86_64-linux/lib\"" -W -Wall -Werror -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -frandom-seed=dwarf_reader.o -O2 -g -MT dwarf_reader.o -MD -MP -MF .deps/dwarf_reader.Tpo -c -o dwarf_reader.o ../../binutils/gold/dwarf_reader.cc
In file included from ../../binutils/gold/../elfcpp/dwarf.h:83:0,
from ../../binutils/gold/dwarf_reader.cc:30:
../../binutils/gold/../include/dwarf2.def:781:1: error: expected ?}? before ?DW_CFA_DUP?
DW_CFA_DUP (DW_CFA_AARCH64_negate_ra_state, 0x2d)
GDB Administrator [Mon, 18 Sep 2017 00:00:30 +0000 (00:00 +0000)]
Automatic date update in version.in
GDB Administrator [Sun, 17 Sep 2017 00:00:32 +0000 (00:00 +0000)]
Automatic date update in version.in
Simon Marchi [Sat, 16 Sep 2017 12:22:11 +0000 (14:22 +0200)]
Refactor handle_qxfer_libraries and friends to use std::string
Using std::string in handle_qxfer_libraries and friends allow to
simplify the code. We don't have to manually free the buffer, and we
don't have to pre-compute the required space.
gdb/gdbserver/ChangeLog:
* server.c (accumulate_file_name_length): Remove.
(emit_dll_description): Adjust to std::string change.
(handle_qxfer_libraries): Use std::string to hold document.
Simon Marchi [Sat, 16 Sep 2017 12:19:31 +0000 (14:19 +0200)]
Make xml_escape_text return an std::string
This is a simple replacement, it allows removing some manual free'ing in
the callers.
gdb/ChangeLog:
* common/buffer.c (buffer_xml_printf): Adjust.
* common/xml-utils.c (xml_escape_text): Change return type to
std::string, update code accordingly.
* common/xml-utils.h (xml_escape_text): Change return type to
std::string.
* rs6000-aix-tdep.c (rs6000_aix_shared_library_to_xml): Adjust.
* windows-tdep.c (windows_xfer_shared_library): Adjust.
* unittests/xml-utils-selftests.c (test_xml_escape_text):
Adjust.
gdb/gdbserver/ChangeLog:
* linux-low.c (linux_qxfer_libraries_svr4): Adjust to change of
return type of xml_escape_text.
* server.c (emit_dll_description): Likewise.
Simon Marchi [Sat, 16 Sep 2017 12:16:27 +0000 (14:16 +0200)]
Add unit test for xml_escape_text
The following patch modifies xml_escape_text, so I took the opportunity
to write a unit test for it.
gdb/ChangeLog:
* Makefile.in (SUBDIR_UNITTESTS_SRCS): Add new source file.
(SUBDIR_UNITTESTS_OBS): Add new object file.
* unittests/xml-utils-selftests.c: New file.
Simon Marchi [Sat, 16 Sep 2017 12:06:03 +0000 (14:06 +0200)]
Add selftests run filtering
With the growing number of selftests, I think it would be useful to be
able to run only a subset of the tests. This patch associates a name to
each registered selftest. It then allows doing something like:
(gdb) maintenance selftest aarch64
Running self-tests.
Running selftest aarch64-analyze-prologue.
Running selftest aarch64-process-record.
Ran 2 unit tests, 0 failed
or with gdbserver:
./gdbserver --selftest=aarch64
In both cases, only the tests that contain "aarch64" in their name are
ran. To help validate that the tests you want to run were actually ran,
it also prints a message with the test name before running each test.
Right now, all the arch-dependent tests are registered as a single test
of the selftests. To be able to filter those too, I made them
"first-class citizen" selftests. The selftest type is an interface,
with different implementations for "simple selftests" and "arch
selftests". The run_tests function simply iterates on that an invokes
operator() on each test.
I changed the tests data structure from a vector to a map, because
- it allows iterating in a stable (alphabetical) order
- it allows to easily verify if a test with a given name has been
registered, to avoid duplicates
There's also a new command "maintenance info selftests" that lists the
registered selftests.
gdb/ChangeLog:
* common/selftest.h (selftest): New struct/interface.
(register_test): Add name parameter, add new overload.
(run_tests): Add filter parameter.
(for_each_selftest_ftype): New typedef.
(for_each_selftest): New declaration.
* common/selftest.c (tests): Change type to
map<string, unique_ptr<selftest>>.
(simple_selftest): New struct.
(register_test): New function.
(register_test): Add name parameter and use it.
(run_tests): Add filter parameter and use it. Add prints.
Adjust to vector -> map change.
* aarch64-tdep.c (_initialize_aarch64_tdep): Add names when
registering selftests.
* arm-tdep.c (_initialize_arm_tdep): Likewise.
* disasm-selftests.c (_initialize_disasm_selftests): Likewise.
* dwarf2-frame.c (_initialize_dwarf2_frame): Likewise.
* dwarf2loc.c (_initialize_dwarf2loc): Likewise.
* findvar.c (_initialize_findvar): Likewise.
* gdbarch-selftests.c (_initialize_gdbarch_selftests): Likewise.
* maint.c (maintenance_selftest): Update call to run_tests.
(maintenance_info_selftests): New function.
(_initialize_maint_cmds): Register "maintenance info selftests"
command. Update "maintenance selftest" doc.
* regcache.c (_initialize_regcache): Add names when registering
selftests.
* rust-exp.y (_initialize_rust_exp): Likewise.
* selftest-arch.c (gdbarch_selftest): New struct.
(gdbarch_tests): Remove.
(register_test_foreach_arch): Add name parameter. Call
register_test.
(tests_with_arch): Remove, move most content to
gdbarch_selftest::operator().
(_initialize_selftests_foreach_arch): Remove.
* selftest-arch.h (register_test_foreach_arch): Add name
parameter.
(run_tests_with_arch): New declaration.
* utils-selftests.c (_initialize_utils_selftests): Add names
when registering selftests.
* utils.c (_initialize_utils): Likewise.
* unittests/array-view-selftests.c
(_initialize_array_view_selftests): Likewise.
* unittests/environ-selftests.c (_initialize_environ_selftests):
Likewise.
* unittests/function-view-selftests.c
(_initialize_function_view_selftests): Likewise.
* unittests/offset-type-selftests.c
(_initialize_offset_type_selftests): Likewise.
* unittests/optional-selftests.c
(_initialize_optional_selftests): Likewise.
* unittests/scoped_restore-selftests.c
(_initialize_scoped_restore_selftests): Likewise.
* NEWS: Document "maintenance selftest" and "maint info
selftests".
gdb/gdbserver/ChangeLog:
* server.c (captured_main): Accept argument for --selftest.
Update run_tests call.
* linux-x86-tdesc-selftest.c (initialize_low_tdesc): Add names
when registering selftests.
gdb/doc/ChangeLog:
* gdb.texinfo (Maintenance Commands): Document filter parameter
of "maint selftest". Document "maint info selftests" command.
Simon Marchi [Sat, 16 Sep 2017 11:45:56 +0000 (13:45 +0200)]
mi_load_progress: Restore current_uiout using a scoped_restore
Simply use a scoped_restore instead of manually saving and restoring
current_uiout.
gdb/ChangeLog:
* mi/mi-main.c (mi_load_progress): Restore current_uiout using a
scoped_restore.
Simon Marchi [Sat, 16 Sep 2017 11:45:55 +0000 (13:45 +0200)]
mi_load_progress: Use unique_ptr to manage ui_out lifetime
In mi_load_progress, we xfree a ui_out object. Because ui_out is not
trivially destructible, it should be freed with delete. This patch
makes use of a unique_ptr to do it.
gdb/ChangeLog:
* mi/mi-main.c (mi_load_progress): Make uiout variable
a unique_ptr.
diff --git a/gdb/mi/mi-main.c b/gdb/mi/mi-main.c index
0ee2605..
0359dc1
100644 --- a/gdb/mi/mi-main.c +++ b/gdb/mi/mi-main.c @@ -2325,7 +2325,6
@@ mi_load_progress (const char *section_name, static char
*previous_sect_name = NULL; int new_section; struct ui_out *saved_uiout;
- struct ui_out *uiout; struct mi_interp *mi = (struct mi_interp *)
current_interpreter ();
/* This function is called through deprecated_show_load_progress
@@ -2333,17 +2332,19 @@ mi_load_progress (const char *section_name,
of this function. */
saved_uiout = current_uiout;
+ std::unique_ptr<ui_out> uiout;
+
if (current_interp_named_p (INTERP_MI)
|| current_interp_named_p (INTERP_MI2))
- current_uiout = mi_out_new (2);
+ uiout.reset (mi_out_new (2));
else if (current_interp_named_p (INTERP_MI1))
- current_uiout = mi_out_new (1);
+ uiout.reset (mi_out_new (1));
else if (current_interp_named_p (INTERP_MI3))
- current_uiout = mi_out_new (3);
+ uiout.reset (mi_out_new (3));
else
return;
- uiout = current_uiout;
+ current_uiout = uiout.get ();
new_section = (previous_sect_name ?
strcmp (previous_sect_name, section_name) : 1);
@@ -2356,12 +2357,12 @@ mi_load_progress (const char *section_name,
fputs_unfiltered (current_token, mi->raw_stdout);
fputs_unfiltered ("+download", mi->raw_stdout);
{
- ui_out_emit_tuple tuple_emitter (uiout, NULL);
+ ui_out_emit_tuple tuple_emitter (uiout.get (), NULL);
uiout->field_string ("section", section_name);
uiout->field_int ("section-size", total_section);
uiout->field_int ("total-size", grand_total);
}
- mi_out_put (uiout, mi->raw_stdout);
+ mi_out_put (uiout.get (), mi->raw_stdout);
fputs_unfiltered ("\n", mi->raw_stdout);
gdb_flush (mi->raw_stdout);
}
@@ -2374,19 +2375,18 @@ mi_load_progress (const char *section_name,
fputs_unfiltered (current_token, mi->raw_stdout);
fputs_unfiltered ("+download", mi->raw_stdout);
{
- ui_out_emit_tuple tuple_emitter (uiout, NULL);
+ ui_out_emit_tuple tuple_emitter (uiout.get (), NULL);
uiout->field_string ("section", section_name);
uiout->field_int ("section-sent", sent_so_far);
uiout->field_int ("section-size", total_section);
uiout->field_int ("total-sent", total_sent);
uiout->field_int ("total-size", grand_total);
}
- mi_out_put (uiout, mi->raw_stdout);
+ mi_out_put (uiout.get (), mi->raw_stdout);
fputs_unfiltered ("\n", mi->raw_stdout);
gdb_flush (mi->raw_stdout);
}
- xfree (uiout);
current_uiout = saved_uiout;
}
Sergio Durigan Junior [Sun, 10 Sep 2017 16:17:18 +0000 (12:17 -0400)]
Use std::vector on tdesc->reg_defs (gdbserver/tdesc.h)
This is a followup patch to the build breakage fix on AArch64. While
doing the fix, I found it better to convert tdesc->reg_defs (on
gdbserver/tdesc.h) from using VEC to using std::vector. This makes
the code easier to read and maintain, and also is one more step
towards the C++fication.
Regtested on BuildBot.
2017-09-16 Sergio Durigan Junior <sergiodj@redhat.com>
* regcache.c (get_thread_regcache): Update code to use "std::vector"
instead of "VEC" for "target_desc.reg_defs".
(regcache_cpy): Likewise.
(registers_to_string): Likewise.
(registers_from_string): Likewise.
(find_regno): Likewise.
(supply_regblock): Likewise.
(regcache_raw_read_unsigned): Likewise.
* tdesc.c (init_target_desc): Likewise.
(tdesc_create_reg): Likewise.
* tdesc.h: Remove declaration of "tdesc_reg_p". Include <vector>.
(struct target_desc) <reg_defs>: Convert to "std::vector".
(target_desc): Do not initialize "reg_defs".
(~target_desc): Update code to use "std::vector" instead of "VEC"
for "target_desc.reg_defs".
(operator==): Likewise.
GDB Administrator [Sat, 16 Sep 2017 00:00:34 +0000 (00:00 +0000)]
Automatic date update in version.in
Pedro Alves [Fri, 15 Sep 2017 16:40:33 +0000 (17:40 +0100)]
Sync libiberty/ & include/ with GCC
Note this brings in the interface files for libcc1/G++ as well, which
we will be needing in GDB soon anyway. That commit renamed a method
in the C interface and that required a small update to GDB's compile/
code, which I've included that in this patch to keep the tree
building.
include/ChangeLog:
2017-09-15 Pedro Alves <palves@redhat.com>
* ansidecl.h (DISABLE_COPY_AND_ASSIGN): New macro.
2017-09-12 Jiong Wang <jiong.wang@arm.com>
* dwarf2.def (DW_CFA_AARCH64_negate_ra_state): New DW_CFA_DUP.
* dwarf2.h (DW_CFA_DUP): New define.
2017-08-21 Richard Biener <rguenther@suse.de>
* simple-object.h (simple_object_copy_lto_debug_sections): New
function.
2017-05-18 Martin Liska <mliska@suse.cz>
* ansidecl.h: Define CONSTEXPR macro.
2017-05-24 Nathan Sidwell <nathan@acm.org>
* libiberty.h (ASTRDUP): Adjust cast to avoid warning.
2017-01-30 Alexandre Oliva <aoliva@redhat.com>
Introduce C++ support in libcc1.
* gcc-c-fe.def (int_type_v0): Rename from...
(int_type): ... this. Introduce new version.
(float_type_v0): Rename from...
(float_type): ... this. Introduce new version.
(char_type): New.
* gcc-c-interface.h (gcc_c_api_version): Add GCC_C_FE_VERSION_1.
(gcc_type_array): Move...
* gcc-interface.h: ... here.
* gcc-cp-fe.def: New.
* gcc-cp-interface.h: New.
2016-04-29 Oleg Endo <olegendo@gcc.gnu.org>
* longlong.h (umul_ppmm): Remove SHMEDIA checks.
(__umulsidi3, count_leading_zeros): Remove SHMEDIA implementations.
2017-09-15 Yao Qi <yao.qi@linaro.org>
Pedro Alves <palves@redhat.com>
* ansidecl.h (DISABLE_COPY_AND_ASSIGN): New macro.
2017-09-12 Jiong Wang <jiong.wang@arm.com>
* dwarf2.def (DW_CFA_AARCH64_negate_ra_state): New DW_CFA_DUP.
* dwarf2.h (DW_CFA_DUP): New define.
2017-08-21 Richard Biener <rguenther@suse.de>
* simple-object.h (simple_object_copy_lto_debug_sections): New
function.
2017-05-18 Martin Liska <mliska@suse.cz>
* ansidecl.h: Define CONSTEXPR macro.
2017-05-24 Nathan Sidwell <nathan@acm.org>
* libiberty.h (ASTRDUP): Adjust cast to avoid warning.
2017-01-30 Alexandre Oliva <aoliva@redhat.com>
Introduce C++ support in libcc1.
* gcc-c-fe.def (int_type_v0): Rename from...
(int_type): ... this. Introduce new version.
(float_type_v0): Rename from...
(float_type): ... this. Introduce new version.
(char_type): New.
* gcc-c-interface.h (gcc_c_api_version): Add GCC_C_FE_VERSION_1.
(gcc_type_array): Move...
* gcc-interface.h: ... here.
* gcc-cp-fe.def: New.
* gcc-cp-interface.h: New.
2016-04-29 Oleg Endo <olegendo@gcc.gnu.org>
* longlong.h (umul_ppmm): Remove SHMEDIA checks.
(__umulsidi3, count_leading_zeros): Remove SHMEDIA implementations.
libiberty/ChangeLog:
2017-09-15 Nathan Sidwell <nathan@acm.org>
PR demangler/82195
* cp-demangle.c (d_name): Add 'toplevel' parm. Pass to ...
(d_local_name): ... here. Parse trailing function args on nested
local_name.
(d_encoding, d_special_name, d_class_enum_type): Adjust d_name calls.
* testsuite/demangle-expected: Add tests.
2017-09-15 Richard Biener <rguenther@suse.de>
PR lto/81968
* simple-object-elf.c (simple_object_elf_copy_lto_debug_sections):
Iterate marking dependent sections necessary.
2017-09-15 Nathan Sidwell <nathan@acm.org>
* cp-demangle.c (is_fnqual_component_type): Reimplement using
FNQUAL_COMPONENT_CASE.
(d_encoding): Hold bare_function_type in local var.
(d_local_name): Build name in both cases and build result once.
Collapse switch-if to single conditional.
(d_local_name):
* testsuite/demangle-expected: Realign blank lines with tests.
2017-09-12 Jiong Wang <jiong.wang@arm.com>
* dwarfnames.c (DW_CFA_DUP): New define.
gdb/ChangeLog:
2017-09-15 Pedro Alves <palves@redhat.com>
* compile/compile-c-types.c (convert_enum, convert_int)
(convert_float): Adjust to refer to int_type_v0 and float_type_v0.
Simon Marchi [Fri, 15 Sep 2017 16:02:51 +0000 (18:02 +0200)]
gdbserver: Remove thread_to_gdb_id
As explained in the previous patch, the gdb_id concept is no longer
relevant. The function thread_to_gdb_id is trivial, it returns the
thread's ptid. Remove it and replace its usage with ptid_of.
The changes in nto-low.c and lynx-low.c are fairly straightforward, but
I was not able to build test them.
gdb/gdbserver/ChangeLog:
* inferiors.h (thread_to_gdb_id): Remove.
* inferiors.c (thread_to_gdb_id): Remove.
* server.c (handle_qxfer_threads_worker, handle_query): Adjust.
* lynx-low.c (lynx_resume, lynx_wait_1, lynx_fetch_registers,
lynx_store_registers, lynx_read_memory, lynx_write_memory):
Likewise.
* nto-low.c (nto_fetch_registers, nto_store_registers,
nto_stopped_by_watchpoint, nto_stopped_data_address): Likewise.
Simon Marchi [Fri, 15 Sep 2017 16:02:51 +0000 (18:02 +0200)]
gdbserver: Remove gdb_id_to_thread_id
From what I understand, this function is not doing anything useful as of
today.
Here's the result of my archeological research:
- The field thread_info::gdb_id was added in
a06660f7 Use LWP IDs for thread IDs in gdbserver
There was problem when using a 32-bits gdb with a 64-bits gdbserver.
For some reason that I don't fully understand, the thread ids
exchanged between gdb and gdbserver could overflow a 32 bits data
type. My guess is that they were the thread address (e.g. the
0x7ffff7f20b40 in "Thread 0x7ffff7f20b40 (LWP 1058)" today). This
patch changed that so gdb/gdbserver would talk in terms of the OS
assigned numerical id (as shown in ps). It therefore added a way to
convert between this gdb_id (the numerical id) and the thread id (the
address).
-
95954743cb Implement the multiprocess extensions, and add linux
multiprocess supportNon-stop mode support.
This patch made gdbserver deal with threads using their numerical ids
and not the address-like id. Starting from there, the gdb_id <->
thread id conversion was not needed anymore, since the remote protocol
and gdbserver were using the same kind of ids again. The gdb_id field
in the thread_info structure was also unused starting there.
-
d50171e4 Teach linux gdbserver to step-over-breakpoints.
This patch moved the thread_info structure around, and got rid of the
gdb_id field (which was unused).
Looking at the implementation of gdb_id_to_thread_id, it is not doing
anything useful. It is looking up a thread by ptid using
find_thread_ptid, which basically loops over all threads looking at
their entry.id field. If a thread with that ptid is found, it returns
its entry.id field. So it will always return the same thing as it input
(with the exception of if no thread exist with that ptid, then it will
return null_ptid).
gdb/gdbserver/ChangeLog:
* inferiors.h (gdb_id_to_thread_id): Remove.
* inferiors.c (gdb_id_to_thread_id): Remove.
* server.c (process_serial_event): Adjust to gdb_id_to_thread_id
removal. Move pid declaration closer to where it's used.
Simon Marchi [Fri, 15 Sep 2017 15:59:37 +0000 (17:59 +0200)]
gdbserver: Move detach code to its own function
The code required to handle the 'D' packet is non trivial, so move it
out to its own function.
The moved out code is identical, except for the call to strtol and some
breaks that became returns.
Tested manually, and by running gdb.base/*detach*.exp with
native-gdbserver and native-extended-gdbserver.
gdb/gdbserver/ChangeLog:
* server.c (handle_detach): New function.
(process_serial_event): Move code out, call handle_detach.
Simon Marchi [Fri, 15 Sep 2017 15:59:36 +0000 (17:59 +0200)]
Deduplicate require_running macros and move them up
I find it very confusing to define the require_running in the middle of
the file, and re-define it to something else later in the middle of the
same file. I think it would be better if those macros had different
names so that we know exactly what they do.
gdb/gdbserver/ChangeLog:
* server.c (require_running): Rename to ...
(require_running_or_return): ... this ...
(require_running_or_break): ... and this.
(handle_query, process_serial_event): Adjust.
Nick Clifton [Fri, 15 Sep 2017 15:18:20 +0000 (16:18 +0100)]
Add -l option to src-release script.
Since we are updating src-release.sh I thought I would check in this
small patch. It adds the option to create lzip compressed tarballs
via the -l command line option.
* src-release.sh (LZIPPROG): New define. Provides the name of the
lzip program.
(do_lz): New function. Compresses a tarball using the lzip
program.
(do_compress): Add support for lzip compression.
(usage): Mention -l option.
(build_release): Support -l option to invoke lzip compression.
Simon Marchi [Fri, 15 Sep 2017 14:41:35 +0000 (16:41 +0200)]
linux-low: Remove unused variables
gdb/gdbserver/ChangeLog:
* linux-low.c (linux_set_resume_request): Remove unused
variables.
Simon Marchi [Fri, 15 Sep 2017 14:41:34 +0000 (16:41 +0200)]
dwarf2read: Replace copy_string usages with savestring
copy_string does the exact same thing as savestring, so replace the
usages of the former with the latter.
gdb/ChangeLog:
* dwarf2read.c (copy_string): Remove.
(parse_macro_definition): Replace copy_string with savestring.
Simon Marchi [Fri, 15 Sep 2017 12:53:07 +0000 (14:53 +0200)]
gdbserver: Remove duplicate functions to find any thread of process
We have about 6 functions/callbacks to find_inferior meant to find a
thread that belongs to a given pid. Remove all but
find_any_thread_of_pid and replace their uses with
find_any_thread_of_pid.
gdb/gdbserver/ChangeLog:
* server.c (first_thread_of): Remove.
(process_serial_event): Replace usage of first_thread_of with
find_any_thread_of_pid.
* tracepoint.c (same_process_p): Remove.
(gdb_agent_about_to_close): Replace usage of same_process_p with
find_any_thread_of_pid.
* linux-x86-low.c (same_process_callback): Remove.
(x86_arch_setup_process_callback): Replace usage of
same_process_callback with find_any_thread_of_pid.
* thread-db.c (any_thread_of): Remove.
(switch_to_process): Replace usage of any_thread_of with
find_any_thread_of_pid.
* inferiors.c (thread_pid_matches_callback): Remove.
(find_thread_process): Adjust to use find_any_thread_of_pid.
Yao Qi [Fri, 15 Sep 2017 12:05:39 +0000 (13:05 +0100)]
Fix x86 build failures
Christophe Lyon told me that GDB build failed on i386-linux with
--enable-64-bit-bfd=yes, so I audit the gdb/configure.tgt again. I
find that i386-darwin has the same issue too. Additionally, GDB
for solaris target fails to build too. This patch fixes all of them.
gdb:
2017-09-15 Yao Qi <yao.qi@linaro.org>
* configure.tgt (i[34567]86-*-darwin*): Append amd64.o to
gdb_target_obs.
(i[34567]86-*-solaris2.1[0-9]* | x86_64-*-solaris2.1[0-9]*):
Likewise.
(i[34567]86-*-linux*): Likewise.
Alan Modra [Fri, 15 Sep 2017 10:38:02 +0000 (20:08 +0930)]
PR22118, Incorrectly-capitalized regexp
PR 22118
* testsuite/ld-aarch64/erratum843419.d: Correct regexp.
Alan Modra [Fri, 15 Sep 2017 05:03:58 +0000 (14:33 +0930)]
Enable/disable various dirs in src-release.sh
gold needs to be enabled for a binutils release, but it's rather odd
to do so for gas, gdb or sim. This patch passes various --enable and
--disable options depending on the directories being released.
* src-release.sh (do_proto_toplev): Revert last patch. Enable or
disable binutils, gas, gdb, gold, gprof, ld, libdecnumber, readline,
and sim depending on $tool and $support_files. Echo configure line.
Alan Modra [Fri, 15 Sep 2017 00:52:13 +0000 (10:22 +0930)]
Error when 32-bit ar tries to handle 4G or larger files
We used to silently truncate the size returned by stat() to 32 bits.
While it is possible to make binutils handle a 64-bit off_t on a
32-bit host, to me the effort needed doesn't seem worth the benefit.
Instead, error if we truncate the size. I've written the test the way
I have to avoid a signed/unsigned warning.
PR 22116
* archive.c (bfd_ar_hdr_from_filesystem): Detect when status.st_size
overflows bfd_size_type.
GDB Administrator [Fri, 15 Sep 2017 00:00:28 +0000 (00:00 +0000)]
Automatic date update in version.in
Simon Marchi [Thu, 14 Sep 2017 20:36:57 +0000 (22:36 +0200)]
Make dwarf_expr_context::stack an std::vector
Replace the manually managed array with a vector. It is mostly
straightforward, except maybe one thing in execute_stack_op, in the
handling of DW_OP_fbreg. When the code stumbles on that opcode while
evaluating an expression, it needs to evaluate a subexpression to find
where the fb reg has been saved. Rather than creating a new context, it
reuses the current context. It saves the size of the stack before and
restores the stack to that size after.
I think we can do a little bit better by saving the current stack
locally and installing a new empty stack. This way, if the
subexpression is malformed and underflows, we'll get an exception.
Before, it would have overwritten the top elements of the top-level
expression. The evaluation of the top-level expression would have then
resumed with the same stack size, but possibly some corrupted elements.
gdb/ChangeLog:
* dwarf2expr.h (dwarf_stack_value): Add constructor.
(dwarf_expr_context) <~dwarf_expr_context>: Define as default.
<stack>: Change type to std::vector.
<stack_len, stack_allocated>: Remove.
<grow_stack>: Remove.
* dwarf2expr.c (dwarf_expr_context::dwarf_expr_context): Adjust.
(dwarf_expr_context::~dwarf_expr_context): Remove.
(dwarf_expr_context::grow_stack): Remove.
(dwarf_expr_context::push): Adjust.
(dwarf_expr_context::pop): Adjust.
(dwarf_expr_context::fetch): Adjust.
(dwarf_expr_context::fetch_in_stack_memory): Adjust.
(dwarf_expr_context::stack_empty_p): Adjust.
(dwarf_expr_context::execute_stack_op): Adjust.
H.J. Lu [Thu, 14 Sep 2017 19:45:18 +0000 (12:45 -0700)]
globalaudit.rd: Allow additional bits in DT_FLAGS_1
With -PIE on x86-64, we get
0x000000006ffffffb (FLAGS_1) Flags: GLOBAUDIT PIE
We should allow additional bits in DT_FLAGS_1.
PR ld/22139
* testsuite/ld-elf/globalaudit.rd: Allow additional bits in
DT_FLAGS_1.
H.J. Lu [Thu, 14 Sep 2017 18:41:58 +0000 (11:41 -0700)]
x86: Cache section contents and relocations
bfd/
PR ld/22135
* elf32-i386.c (elf_i386_convert_load_reloc): Add an argument
to indicate if conversion is performed.
(elf_i386_check_relocs): Cache section contents and relocations
if conversion is performed.
* elf64-x86-64.c (elf_x86_64_check_relocs): Cache section
contents and relocations if conversion is performed.
ld/
PR ld/22135
* testsuite/ld-i386/i386.exp: Run pr22135.
* testsuite/ld-x86-64/x86-64.exp: Likewise.
* testsuite/ld-i386/pr22135.d: New file.
* testsuite/ld-i386/pr22135.s: Likewise.
* testsuite/ld-x86-64/pr22135.d: Likewise.
* testsuite/ld-x86-64/pr22135.s: Likewise.
Pedro Alves [Thu, 14 Sep 2017 17:09:42 +0000 (18:09 +0100)]
gdb.base/nodebug.exp: Rename called functions
I'm seeing these failures on my system:
FAIL: gdb.base/nodebug.exp: p (double) mult (2.0, 3.0)
FAIL: gdb.base/nodebug.exp: p ((double (*) (double, double)) mult)(2.0f, 3.0f)
FAIL: gdb.base/nodebug.exp: p ((double (*) (double, double)) mult)(2, 3)
The problem is simply that GDB is finding a symbol named "mult" from
glibc's debug info:
(gdb) ptype mult
type = enum expression_operator {var, num, lnot, mult, divide, module, plus, minus, less_than, greater_than, less_or_equal, greater_or_equal, equal, not_equal, land, lor, qmop}
(gdb) info types expression_operator
All types matching regular expression "expression_operator":
File plural-exp.h:
enum expression_operator;
Fix this by unloading symbols from shared libraries.
gdb/testsuite/ChangeLog:
2017-09-14 Pedro Alves <palves@redhat.com>
* gdb.base/nodebug.exp (nodebug_runto): New procedure.
(top level): Use it instead of runto.
Simon Marchi [Thu, 14 Sep 2017 14:54:37 +0000 (16:54 +0200)]
Make dwarf_expr_context::stack_empty_p return a bool
gdb/ChangeLog:
* dwarf2expr.h (dwarf_expr_context) <stack_empty_p>: Change
return type to bool.
* dwarf2expr.c (dwarf_expr_context::stack_empty_p): Likewise.
Simon Marchi [Thu, 14 Sep 2017 14:13:33 +0000 (16:13 +0200)]
Make dwarf_stack_value::in_stack_memory a bool
Replace int with bool, because that's what it is.
gdb/ChangeLog:
* dwarf2expr.h (dwarf_expr_piece) <v.mem.in_stack_memory>:
Change type to bool.
(dwarf_stack_value) <in_stack_memory>: Likewise.
(dwarf_expr_context) <push_address>: Change parameter type to
bool.
<fetch_in_stack_memory>: Change return type to bool.
<push>: Change parameter type to bool.
* dwarf2expr.c (dwarf_expr_context::push): Change parameter type
to bool.
(dwarf_expr_context::push_address): Likewise.
(dwarf_expr_context::fetch_in_stack_memory): Change return type
to bool.
(dwarf_expr_context::execute_stack_op): Adjust.
* dwarf2loc.c (dwarf2_evaluate_loc_desc_full): Adjust.
Simon Marchi [Thu, 14 Sep 2017 13:57:01 +0000 (15:57 +0200)]
Make dwarf_expr_piece::pieces an std::vector
Change the manually managed array dwarf_expr_piece::piece with an
std::vector. After passing the pieces array to allocate_piece_closure,
dwarf2_evaluate_loc_desc_full doesn't need that data anymore. We can
therefore move the content of the vector to avoid copying it.
Reg-tested on the buildbot.
gdb/ChangeLog:
* dwarf2expr.h (struct dwarf_expr_piece): Move up.
(struct dwarf_expr_context) <n_pieces>: Remove.
<pieces>: Change type to std::vector.
* dwarf2expr.c (dwarf_expr_context::dwarf_expr_context): Adjust.
(dwarf_expr_context::~dwarf_expr_context): Don't manually free
pieces.
(dwarf_expr_context::add_piece): Adjust.
* dwarf2loc.c (struct piece_closure): Initialize fields.
<n_pieces>: Remove.
<pieces>: Change type to std::vector.
(allocate_piece_closure): Adjust, change parameter to
std::vector rvalue and std::move it to piece_closure.
(rw_pieced_value): Adjust.
(check_pieced_synthetic_pointer): Adjust.
(indirect_synthetic_pointer): Adjust.
(coerce_pieced_ref): Adjust.
(free_pieced_value_closure): Adjust. Use delete to free
piece_closure.
(dwarf2_evaluate_loc_desc_full): Adjust. std::move ctx.pieces
to allocate_piece_closure.
(dwarf2_loc_desc_get_symbol_read_needs): Adjust.
Nick Clifton [Thu, 14 Sep 2017 10:15:55 +0000 (11:15 +0100)]
Fix address violation when parsing a corrupt PE binary.
PR binutils/22113
* peXXigen.c (pe_print_idata): Extend check for HintName vector
entries.
matt rice [Wed, 13 Sep 2017 16:46:22 +0000 (09:46 -0700)]
Add enable-gold and enable-ld to src-release
So that the tarball picks up gold bison output.
* src-release.sh (do_proto_toplev): Enable gold during release process.
Alan Modra [Thu, 14 Sep 2017 00:49:31 +0000 (10:19 +0930)]
PR22127, as segfaults assembling invalid .reloc
"sec" gets set to NULL on errors in the offset expression. This patch
disables part of the reloc expression processing that needs "sec"
valid. I didn't disable the entire reloc expression handling so that
errors in the reloc expression are reported even when the offset
expression has an error.
PR 22127
* write.c (resolve_reloc_expr_symbols): Don't segfault when
sec has been set to NULL.
GDB Administrator [Thu, 14 Sep 2017 00:00:26 +0000 (00:00 +0000)]
Automatic date update in version.in
H.J. Lu [Wed, 13 Sep 2017 11:25:14 +0000 (04:25 -0700)]
elfxx-x86.h: Fix a typo in comments
* elfxx-x86.h: Fix a typo in comments.
GDB Administrator [Wed, 13 Sep 2017 00:00:31 +0000 (00:00 +0000)]
Automatic date update in version.in
Simon Marchi [Tue, 12 Sep 2017 12:15:23 +0000 (14:15 +0200)]
probe: Replace VEC(probe_ops_cp) with std::vector
This patch replaces the usage of VEC to store pointers to probe_ops with
an std::vector. The sole usage of that vector type is one global
variable that holds the ops for the various kinds of probes, so this is
pretty straightforward (no allocation/deallocation issues).
gdb/ChangeLog:
* probe.h (probe_ops_cp): Remove typedef.
(DEF_VEC_P (probe_ops_cp)): Remove.
(all_probe_ops): Change type to std::vector.
* probe.c (info_probes_for_ops): Adjust to vector change.
(probe_linespec_to_ops): Likewise.
(all_probe_ops): Change type to std::vector.
(_initialize_probe): Adjust to vector change.
* dtrace-probe.c (_initialize_dtrace_probe): Likewise.
* elfread.c (elf_get_probes): Likewise.
* stap-probe.c (_initialize_stap_probe): Likewise.
Simon Marchi [Tue, 12 Sep 2017 11:55:32 +0000 (13:55 +0200)]
Make collect_probes return an std::vector
Change collect_probes so it returns an std::vector<bound_probe> instead
of a VEC(bound_probe_s). This allows removing some cleanups. It also
seems like enable_probes_command and disable_probes_command were not
freeing that vector.
The comparison function compare_probes needs to be updated to return a
bool indicating whether the first parameter is "less than" the second
parameter.
I defined two constructors to bound_probe. The default constructor is
needed, for example, so the instance in struct bp_location can be
constructed without parameters. The constructor with parameters is
useful so we can use emplace_back and pass the values directly.
The s390 builder on the buildbot shows a weird failure that I can't
explain:
../../binutils-gdb/gdb/elfread.c: In function void probe_key_free(bfd*, void*):
../../binutils-gdb/gdb/elfread.c:1346:8: error: types may not be defined in a for-range-declaration [-Werror]
for (struct probe *probe : *probes)
^~~~~~
I guess it's a bug with that specific version< of the compiler, since no
other gcc gives me that error. It is using:
g++ (GCC) 6.3.1
20161221 (Red Hat 6.3.1-1)
Any idea about this problem?
gdb/ChangeLog:
* probe.h (struct bound_probe): Define constructors.
* probe.c (bound_probe_s): Remove typedef.
(DEF_VEC_O (bound_probe_s)): Remove VEC.
(collect_probes): Change return type to std::vector, remove
cleanup.
(compare_probes): Return bool, change parameter type. Change
semantic to "less than".
(gen_ui_out_table_header_info): Change parameter to std::vector
and update.
(exists_probe_with_pops): Likewise.
(info_probes_for_ops): Update to std::vector change.
(enable_probes_command): Likewise.
(disable_probes_command): Likewise.
Simon Marchi [Tue, 12 Sep 2017 11:37:00 +0000 (13:37 +0200)]
Make probe_ops::get_probes fill an std::vector
This patch changes one usage of VEC to std::vector. It is a relatively
straightforward 1:1 change. The implementations of
sym_probe_fns::sym_get_probes return a borrowed reference to their probe
vectors, meaning that the caller should not free it. In the new code, I
made them return a const reference to the vector.
This patch and the following one were tested by the buildbot. I didn't
see any failures that looked related to this one.
gdb/ChangeLog:
* probe.h (struct probe_ops) <get_probes>: Change parameter from
vec to std::vector.
* probe.c (parse_probes_in_pspace): Update.
(find_probes_in_objfile): Update.
(find_probe_by_pc): Update.
(collect_probes): Update.
(probe_any_get_probes): Update.
* symfile.h (struct sym_probe_fns) <sym_get_probes> Change
return type to reference to std::vector.
* dtrace-probe.c (dtrace_process_dof_probe): Change parameter to
std::vector and update.
(dtrace_process_dof): Likewise.
(dtrace_get_probes): Likewise.
* elfread.c (elf_get_probes): Change return type to std::vector,
store an std::vector in bfd_data.
(probe_key_free): Update to std::vector.
* stap-probe.c (handle_stap_probe): Change parameter to
std::vector and update.
(stap_get_probes): Likewise.
* symfile-debug.c (debug_sym_get_probes): Change return type to
std::vector and update.
GDB Administrator [Tue, 12 Sep 2017 00:00:28 +0000 (00:00 +0000)]
Automatic date update in version.in
Tom Tromey [Sat, 9 Sep 2017 16:47:10 +0000 (10:47 -0600)]
Remove make_show_memory_breakpoints_cleanup
This removes make_show_memory_breakpoints_cleanup, replacing it with
make_scoped_restore_show_memory_breakpoints and updating all callers.
ChangeLog
2017-09-11 Tom Tromey <tom@tromey.com>
* breakpoint.c (program_breakpoint_here_p): Update.
* target.c (make_scoped_restore_show_memory_breakpoints): Rename
from make_show_memory_breakpoints_cleanup. Return a
scoped_restore_tmpl<int>.
(restore_show_memory_breakpoints): Remove.
* ppc-linux-tdep.c (ppc_linux_memory_remove_breakpoint): Update.
* mem-break.c (memory_validate_breakpoint): Update.
* ia64-tdep.c (ia64_memory_insert_breakpoint): Update.
(ia64_memory_remove_breakpoint): Update.
(ia64_breakpoint_from_pc): Update.
* target.h (make_scoped_restore_show_memory_breakpoints): Rename
from make_show_memory_breakpoints_cleanup.
Tom Tromey [Sat, 9 Sep 2017 16:46:36 +0000 (10:46 -0600)]
Use std::string in d-namespace.c
This removes some cleanups from d-namespace.c by replacing manual
string management with std::string.
ChangeLog
2017-09-11 Tom Tromey <tom@tromey.com>
* d-namespace.c (d_lookup_symbol): Use std::string.
(find_symbol_in_baseclass): Likewise.
Tom Tromey [Sat, 9 Sep 2017 16:17:11 +0000 (10:17 -0600)]
Use std::string in ctf_start
This changes ctf_start to use std::string, allowing for some cleanup
removal.
ChangeLog
2017-09-11 Tom Tromey <tom@tromey.com>
* ctf.c (ctf_start): Use std::string.
Tom Tromey [Sat, 9 Sep 2017 16:14:52 +0000 (10:14 -0600)]
Remove cleanups from find_frame_funname
This changes find_frame_funname to return a unique_xmalloc_ptr and
then fixes up the callers. This removes several cleanups.
ChangeLog
2017-09-11 Tom Tromey <tom@tromey.com>
* ada-lang.c (is_known_support_routine): Update.
(ada_unhandled_exception_name_addr_from_raise): Update.
* guile/scm-frame.c (gdbscm_frame_name): Update.
* python/py-frame.c (frapy_name): Update.
(frapy_function): Update.
* stack.h (find_frame_funname): Update.
* stack.c (find_frame_funname): Return unique_xmalloc_ptr.
(print_frame): Update.
Tom Tromey [Sat, 9 Sep 2017 15:56:27 +0000 (09:56 -0600)]
Remove cleanups from findcmd.c
This removes cleanups from findcmd.c, replacing manual buffer
management with a gdb::byte_vector.
ChangeLog
2017-09-11 Tom Tromey <tom@tromey.com>
* findcmd.c (put_bits): Take a gdb::byte_vector.
(parse_find_args): Return gdb::byte_vector. "args" now const.
Remove "pattern_bufp" and "pattern_lenp" parameters. Remove
cleanups.
(find_command): Update.
Tom Tromey [Sun, 13 Aug 2017 20:44:08 +0000 (14:44 -0600)]
Replace clear_hook_in_cleanup with scoped_restore_hook_in
This removes clear_hook_in_cleanup in favor of a scoped_restore-like
class. scoped_restore itself can't be used because hook_in is a
bitfield.
ChangeLog
2017-09-11 Tom Tromey <tom@tromey.com>
* cli/cli-script.c (class scoped_restore_hook_in): New.
(clear_hook_in_cleanup): Remove.
(execute_cmd_pre_hook, execute_cmd_post_hook): Use
scoped_restore_hook_in.
Tom Tromey [Sun, 13 Aug 2017 20:40:46 +0000 (14:40 -0600)]
Replace interp_set_temp with scoped_restore_interp
This removes interp_set_temp and an associated cleanup, in favor of a
new RAII class, scoped_restore_interp.
ChangeLog
2017-09-11 Tom Tromey <tom@tromey.com>
* cli/cli-script.c (restore_interp): Remove.
(read_command_lines): Use scoped_restore_interp.
* interps.c (scoped_restore_interp::set_temp): Rename from
interp_set_temp.
* interps.h (class scoped_restore_interp): New.
(interp_set_temp): Remove.
Tom Tromey [Sun, 13 Aug 2017 16:55:28 +0000 (10:55 -0600)]
Change setup_breakpoint_reporting to return a scoped_restore
This changes setup_breakpoint_reporting to return a scoped_restore,
allowing for some cleanup removal.
ChangeLog
2017-09-11 Tom Tromey <tom@tromey.com>
* mi/mi-cmd-catch.c (mi_cmd_catch_assert)
(mi_cmd_catch_exception, mi_catch_load_unload): Update.
* mi/mi-cmd-break.c (setup_breakpoint_reporting): Return a
scoped_restore.
(mi_cmd_break_insert_1): Update.
* mi/mi-cmd-break.h (setup_breakpoint_reporting): Return a
scoped_restore.
Tom Tromey [Sun, 10 Sep 2017 20:48:30 +0000 (14:48 -0600)]
Make extract_arg return a std::string
Change extract_arg to return a std::string and fix up all the users.
I think string is mildly better than unique_xmalloc_ptr<char>, when
possible, because it provides a more robust API.
I changed the error messages emitted from find_location_by_number to
avoid either writing to a string or an extra allocation; this can be
changed but I thought that the new message was not any less clear.
You can see an example in the testsuite patch.
ChangeLog
2017-09-11 Tom Tromey <tom@tromey.com>
* demangle.c (demangle_command): Update.
* breakpoint.c (disable_command): Update.
(enable_command): Update.
(find_location_by_number): Make "number" const. Use
get_number_trailer.
* cli/cli-utils.c (extract_arg): Return std::string.
* probe.c (parse_probe_linespec): Update. Change types.
(collect_probes): Take string arguments.
(parse_probe_linespec): Likewise.
(info_probes_for_ops): Update.
(enable_probes_command): Update.
(disable_probes_command): Update.
* break-catch-sig.c (catch_signal_split_args): Update.
* mi/mi-parse.c (mi_parse): Update.
testsuite/ChangeLog
2017-09-11 Tom Tromey <tom@tromey.com>
* gdb.base/ena-dis-br.exp (test_ena_dis_br): Update test.
Tom Tromey [Sun, 10 Sep 2017 20:29:22 +0000 (14:29 -0600)]
Constify language_enum
Change language_enum to take a const argument.
ChangeLog
2017-09-11 Tom Tromey <tom@tromey.com>
* language.h (language_enum): Make argument const.
* language.c (language_enum): Make argument const.
Tom Tromey [Sun, 10 Sep 2017 20:19:19 +0000 (14:19 -0600)]
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.
Tom Tromey [Fri, 8 Sep 2017 21:38:12 +0000 (15:38 -0600)]
Make it simpler to add events to Python
The first patch in this series went through several iterations as I'd
forgotten how many places had to be touched to add a new event and a
new event type.
This patch simplifies the process using two new ".def" files. Now, a
new event type can be added by adding a line to "py-event-types.def",
and a new event registry can be added by adding a line to
"py-all-events.def".
ChangeLog
2017-09-11 Tom Tromey <tom@tromey.com>
* python/python.c (do_start_initialization): Use
py-event-types.def to initialize types.
Define all object type structures.
* python/python-internal.h: Don't declare event initialization
functions.
* python/py-threadevent.c (thread_event_object_type): Don't
define.
* python/py-stopevent.c (stop_event_object_type): Don't define.
* python/py-signalevent.c (signal_event_object_type): Don't
declare or define.
* python/py-newobjfileevent.c (new_objfile_event_object_type)
(clear_objfiles_event_object_type): Don't declare or define.
* python/py-infevents.c (inferior_call_pre_event_object_type)
(inferior_call_post_event_object_type)
(register_changed_event_object_type)
(memory_changed_event_object_type): Don't declare or define.
* python/py-inferior.c (new_thread_event_object_type)
(new_inferior_event_object_type)
(inferior_deleted_event_object_type): Don't declare or define.
* python/py-exitedevent.c (exited_event_object_type): Don't
declare or define.
* python/py-evts.c (gdbpy_initialize_py_events): Use
py-all-events.def.
* python/py-events.h (thread_event_object_type): Don't declare.
(events_object): Use py-all-events.def.
* python/py-event.h (GDBPY_NEW_EVENT_TYPE): Remove. Use
py-event-types.def.
* python/py-event-types.def: New file.
* python/py-continueevent.c (create_continue_event_object): Don't
declare or define.
* python/py-bpevent.c (breakpoint_event_object_type): Don't
declare or define.
* python/py-all-events.def: New file.
Tom Tromey [Fri, 8 Sep 2017 20:26:43 +0000 (14:26 -0600)]
Small event ownership clean up in Python layer
It seems cleaner to me for functions like create_thread_event_object,
which pass object ownership to their callers, to directly return a
gdb_ref<>. This way the ownership transfer is part of the API. This
patch makes this change.
ChangeLog
2017-09-11 Tom Tromey <tom@tromey.com>
* python/py-threadevent.c (create_thread_event_object): Return
gdbpy_ref.
* python/py-stopevent.h (create_stop_event_object)
(create_breakpoint_event_object, create_signal_event_object):
Update.
* python/py-stopevent.c (create_stop_event_object): Return
gdbpy_ref.
(emit_stop_event): Update.
* python/py-signalevent.c (create_signal_event_object): Return
gdbpy_ref.
* python/py-infevents.c (create_inferior_call_event_object):
Update.
* python/py-event.h (create_event_object)
(create_thread_event_object): Update.
* python/py-event.c (create_event_object): Return gdbpy_ref.
* python/py-continueevent.c: Return gdbpy_ref.
* python/py-bpevent.c (create_breakpoint_event_object): Return
gdbpy_ref.
Tom Tromey [Tue, 5 Sep 2017 18:07:00 +0000 (12:07 -0600)]
Add new_inferior, inferior_deleted, and new_thread events
This adds a few new events to gdb's Python layer: new_inferior,
inferior_deleted, and new_thread. I wanted to be able to add a
combined inferior/thread display window to my GUI, and I needed a few
events to make this work. This is PR python/15622.
ChangeLog
2017-09-11 Tom Tromey <tom@tromey.com>
PR python/15622:
* NEWS: Add entry.
* python/python.c (do_start_initialization): Initialize new event
types.
* python/python-internal.h (gdbpy_initialize_new_inferior_event)
(gdbpy_initialize_inferior_deleted_event)
(gdbpy_initialize_new_thread_event): Declare.
* python/py-threadevent.c (create_thread_event_object): Add option
"thread" parameter.
* python/py-inferior.c (new_thread_event_object_type)
(new_inferior_event_object_type)
(inferior_deleted_event_object_type): Declare.
(python_new_inferior, python_inferior_deleted): New functions.
(add_thread_object): Emit new_thread event.
(gdbpy_initialize_inferior): Attach new functions to corresponding
observers.
(new_thread, new_inferior, inferior_deleted): Define new event
types.
* python/py-evts.c (gdbpy_initialize_py_events): Add new
registries.
* python/py-events.h (events_object) <new_inferior,
inferior_deleted, new_thread>: New fields.
* python/py-event.h (create_thread_event_breakpoint): Add optional
"thread" parameter.
doc/ChangeLog
2017-09-11 Tom Tromey <tom@tromey.com>
* python.texi (Events In Python): Document new events.
testsuite/ChangeLog
2017-09-11 Tom Tromey <tom@tromey.com>
* gdb.python/py-infthread.exp: Add tests for new_thread event.
* gdb.python/py-inferior.exp: Add tests for new inferior events.
Kuan-Lin Chen [Mon, 11 Sep 2017 05:46:27 +0000 (13:46 +0800)]
nds32: Rename __BIT() to N32_BIT().
GDB Administrator [Mon, 11 Sep 2017 00:00:31 +0000 (00:00 +0000)]
Automatic date update in version.in
Sergio Durigan Junior [Sun, 10 Sep 2017 21:50:29 +0000 (17:50 -0400)]
Fix build breakage on GNU/Linux AArch64, take 2
The last commit unfortunately was not enough to fix the build breakage
on AArch64. I made a mistake and did not test it alone on BuildBot,
but along with another patch that was responsible for fixing the
breakage.
The failure is:
In file included from /usr/include/string.h:640:0,
from build-gnulib-gdbserver/import/string.h:41,
from ../../../binutils-gdb/gdb/gdbserver/../common/common-defs.h:56,
from ../../../binutils-gdb/gdb/gdbserver/server.h:22,
from ../../../binutils-gdb/gdb/gdbserver/regcache.c:19:
In function ‘void* memset(void*, int, size_t)’,
inlined from ‘regcache* init_register_cache(regcache*, const target_desc*, unsigned char*)’ at ../../../binutils-gdb/gdb/gdbserver/regcache.c:150:50:
/usr/include/aarch64-linux-gnu/bits/string3.h:81:32: error: call to ‘__warn_memset_zero_len’ declared with attribute warning: memset used with constant zero length parameter; this could be due to transposed parameters [-Werror]
__warn_memset_zero_len ();
^
In function ‘void* memset(void*, int, size_t)’,
inlined from ‘regcache* get_thread_regcache(thread_info*, int)’ at ../../../binutils-gdb/gdb/gdbserver/regcache.c:57:60:
/usr/include/aarch64-linux-gnu/bits/string3.h:81:32: error: call to ‘__warn_memset_zero_len’ declared with attribute warning: memset used with constant zero length parameter; this could be due to transposed parameters [-Werror]
__warn_memset_zero_len ();
This is likely due to a GCC bug, because for some reason the compiler
assumes that the third argument to the memset:
memset (regcache->register_status, REG_UNAVAILABLE,
VEC_length (tdesc_reg_p, regcache->tdesc->reg_defs));
is always zero, which is not always true.
Anyway, the simple fix for this is to guard the memset calls with:
if (!VEC_empty (tdesc_reg_p, regcache->tdesc->reg_defs))
This time, I made sure to regtest only this patch on BuildBot, and it
finally solved the breakage.
gdb/gdbserver/ChangeLog:
2017-09-10 Sergio Durigan Junior <sergiodj@redhat.com>
* regcache.c (get_thread_regcache): Guard calls to "memset"
with "!VEC_empty".
Sergio Durigan Junior [Sun, 10 Sep 2017 16:16:54 +0000 (12:16 -0400)]
Fix build breakage on GNU/Linux AArch64
This patch fixes the build breakage that has been happening on AArch64
since September 5th. The breakage was introduced by the following
commit:
author Yao Qi <yao.qi@linaro.org>
Tue, 5 Sep 2017 04:54:52 -0400 (09:54 +0100)
committer Yao Qi <yao.qi@linaro.org>
Tue, 5 Sep 2017 04:54:52 -0400 (09:54 +0100)
commit
f7000548a2b79d7e5cb924468117ca4245e6b820
Use VEC for target_desc.reg_defs
The build log for this commit can be seen here:
<https://gdb-build.sergiodj.net/builders/Ubuntu-AArch64-native-gdbserver-m64/builds/2696/steps/compile%20gdb/logs/stdio>
And the underlying problem is that the code is not calling the new
function "allocate_target_description" to allocate the "struct
target_desc" using "new" instead of XNEW, which end up not properly
initializing the fields of the structure.
Regtested on BuildBot.
gdb/gdbserver/ChangeLog:
2017-09-10 Sergio Durigan Junior <sergiodj@redhat.com>
* linux-low.c (handle_extended_wait): Use
"allocate_target_description" instead of "XNEW".
* linux-x86-low.c (initialize_low_arch): Likewise.
Andrew Burgess [Sun, 6 Aug 2017 20:45:08 +0000 (21:45 +0100)]
gdb: Remove check for gdb_stderr == NULL
Recent changes made gdb_stderr a macro:
#define gdb_stderr (*current_ui_gdb_stderr_ptr ())
and current_ui_gdb_stderr_ptr return this:
¤t_ui->m_gdb_stderr
The problem is that this is undefined if current_ui is NULL, which can
happen early on during gdb start up.
If we run into an error during early gdb start up then we write the
error message to gdb_stderr. However, if we are too early during the
start up then current_ui is NULL, and using the gdb_stderr macro
triggers undefined behaviour.
We try to avoid this using a check 'gdb_stderr == NULL' which was fine
before the recent changes, but now, still triggers undefined behaviour.
A better check is instead 'current_ui == NULL' which is what I use in
this patch.
Triggering this failure is pretty hard, most of the really early errors
are only triggered if pretty basic things are not as expected, for
example, if the default signal handlers are not as expected. Seeing one
of these errors trigger usually means that someone working on gdb has
made an incorrect change. Still, the errors are present in gdb, and
should we ever trigger one it would be nice if gdb didn't crash.
For testing this change I've been applying this patch which adds an
unconditional error into a function called early during gdb start up.
Later in the same function is a real error call which, in some
circumstances could be triggered:
## START ##
diff --git a/gdb/common/signals-state-save-restore.c b/gdb/common/signals-state-save-restore.c
index
d11a9ae006c..
d75ba70f894 100644
--- a/gdb/common/signals-state-save-restore.c
+++ b/gdb/common/signals-state-save-restore.c
@@ -37,6 +37,9 @@ static sigset_t original_signal_mask;
void
save_original_signals_state (void)
{
+
+ internal_error (__FILE__, __LINE__, "example error");
+
#ifdef HAVE_SIGACTION
int i;
int res;
## END ##
gdb/ChangeLog:
* utils.c (abort_with_message): Don't compare gdb_stderr to NULL,
check current_ui instead.
(internal_vproblem): Likewise.
GDB Administrator [Sun, 10 Sep 2017 00:00:33 +0000 (00:00 +0000)]
Automatic date update in version.in
Simon Marchi [Sat, 9 Sep 2017 20:51:58 +0000 (22:51 +0200)]
Remove unnecessary calls to is_mi_like_p in print_thread_info_1
There are two calls to uiout->is_mi_like_p in the else branch of a
if (uiout->is_mi_like_p ()), we already know they will return false.
A bit lower, there are two if (!uiout->is_mi_like_p ()) that we can
merge.
gdb/ChangeLog:
* thread.c (print_thread_info_1): Remove unnecessary calls to
uiout->is_mi_like_p.
Tom Tromey [Wed, 6 Sep 2017 23:18:23 +0000 (17:18 -0600)]
Use std::vector in add_using_directive
This changes add_using_directive to accept a std::vector and then
changes the callers. This allows removing a cleanup.
ChangeLog
2017-09-09 Tom Tromey <tom@tromey.com>
* namespace.h (add_using_directive): Update.
* namespace.c (add_using_directive): Change type of excludes to
std::vector.
* dwarf2read.c (read_import_statement): Use std::vector.
(read_namespace): Update.
* cp-namespace.c (cp_scan_for_anonymous_namespaces): Update.
Tom Tromey [Wed, 6 Sep 2017 22:16:38 +0000 (16:16 -0600)]
Use gdb::def_vector in create_sals_line_offset
This changes create_sals_line_offset to use gdb::def_vector, removing
some cleanups.
ChangeLog
2017-09-09 Tom Tromey <tom@tromey.com>
* linespec.c (create_sals_line_offset): Use gdb::def_vector.
Tom Tromey [Mon, 14 Aug 2017 06:15:33 +0000 (00:15 -0600)]
Use gdb::byte_vector in pascal_object_print_value
This changes pascal_object_print_value to use a gdb::byte_vector.
This removes a cleanup. This change also points out how the previous
code had a possible use-after-free bug.
ChangeLog
2017-09-09 Tom Tromey <tom@tromey.com>
* p-valprint.c (pascal_object_print_value): Use gdb::byte_vector.
Tom Tromey [Wed, 6 Sep 2017 22:03:28 +0000 (16:03 -0600)]
Use gdb::def_vector in func_command
This changes func_command to use gdb::def_vector, removing a cleanup.
ChangeLog
2017-09-09 Tom Tromey <tom@tromey.com>
* stack.c (func_command): Use gdb::def_vector.
Tom Tromey [Thu, 7 Sep 2017 03:41:40 +0000 (21:41 -0600)]
Use ui_out_emit_list and ui_out_emit_tuple with gdb::optional
This changes a few spots to use ui_out_emit_list and/or
ui_out_emit_tuple with gdb::optional, to preserve existing behavior.
This allows for the removal of a few more cleanups.
ChangeLog
2017-09-09 Tom Tromey <tom@tromey.com>
* mi/mi-cmd-var.c (mi_cmd_var_list_children): Use gdb::optional,
ui_out_emit_list, ui_out_emit_tuple.
(mi_cmd_var_update): Likewise.
Tom Tromey [Sun, 13 Aug 2017 16:47:32 +0000 (10:47 -0600)]
Remove make_cleanup_ui_out_redirect_pop
This patch introduces ui_out_redirect_pop. All uses of
make_cleanup_ui_out_redirect_pop are replaced with this new class.
ChangeLog
2017-09-09 Tom Tromey <tom@tromey.com>
* mi/mi-interp.c (mi_user_selected_context_changed): Use
ui_out_redirect_pop.
* guile/scm-ports.c (ioscm_with_output_to_port_worker): Use
ui_out_redirect_pop.
* utils.c (do_ui_out_redirect_pop)
(make_cleanup_ui_out_redirect_pop): Remove.
* top.c (execute_command_to_string): Use ui_out_redirect_pop.
* utils.h (make_cleanup_ui_out_redirect_pop): Remove.
* ui-out.h (ui_out_redirect_pop): New class.
Tom Tromey [Fri, 11 Aug 2017 21:17:59 +0000 (15:17 -0600)]
Use ui_out_emit_list in more places
This changes various spots to use ui_out_emit_list, removing some
cleanups.
ChangeLog
2017-09-09 Tom Tromey <tom@tromey.com>
* mi/mi-main.c (output_cores): Use ui_out_emit_list.
(list_available_thread_groups, mi_cmd_list_thread_groups)
(mi_cmd_data_list_changed_registers, mi_cmd_data_read_memory)
(mi_cmd_data_read_memory_bytes, mi_cmd_trace_frame_collected):
Likewise.
Tom Tromey [Fri, 11 Aug 2017 21:17:26 +0000 (15:17 -0600)]
Use ui_out_emit_tuple in disasm.c
This changes one spot in disasm.c to use ui_out_emit_tuple. This
patch required a large reindentation, so I've separated it out.
ChangeLog
2017-09-09 Tom Tromey <tom@tromey.com>
* disasm.c (gdb_pretty_print_disassembler::pretty_print_insn): Use
ui_out_emit_tuple.
Tom Tromey [Fri, 11 Aug 2017 21:02:04 +0000 (15:02 -0600)]
Use ui_out_emit_tuple in more places
This changes more places to use ui_out_emit_tuple, removing cleanups.
ChangeLog
2017-09-09 Tom Tromey <tom@tromey.com>
* target.c (flash_erase_command): Use ui_out_emit_tuple.
* stack.c (print_frame): Use ui_out_emit_tuple.
* spu-tdep.c (info_spu_event_command): Use ui_out_emit_tuple.
(info_spu_mailbox_command, info_spu_dma_command)
(info_spu_proxydma_command): Likewise.
* mi/mi-main.c (mi_cmd_trace_frame_collected): Use
ui_out_emit_tuple, gdb::byte_vector, bin2hex.
* mi/mi-cmd-file.c (mi_cmd_file_list_shared_libraries): Use
ui_out_emit_tuple.
* breakpoint.c (print_it_watchpoint): Use ui_out_emit_tuple.
Tom Tromey [Sat, 9 Sep 2017 15:16:49 +0000 (09:16 -0600)]
Remove make_cleanup_ui_out_table_begin_end
This changes the few remaining uses of
make_cleanup_ui_out_table_begin_end to use ui_out_emit_table instead,
and then removes the cleanup.
ChangeLog
2017-09-09 Tom Tromey <tom@tromey.com>
* ui-out.h (make_cleanup_ui_out_table_begin_end): Remove.
(class ui_out_emit_table): Update comment.
* ui-out.c (do_cleanup_table_end)
(make_cleanup_ui_out_table_begin_end): Remove.
* spu-tdep.c (info_spu_mailbox_list): Use ui_out_emit_table.
(info_spu_dma_cmdlist): Likewise.
* probe.c (info_probes_for_ops): Use ui_out_emit_table.
* darwin-nat-info.c (darwin_debug_regions_recurse): Use
ui_out_emit_table.
Tom Tromey [Sat, 9 Sep 2017 15:15:23 +0000 (09:15 -0600)]
Use ui_out_emit_table and ui_out_emit_list in print_thread_info_1
This changes print_thread_info_1 to use ui_out_emit_table and
ui_out_emit_list. Which one is used depends on whether the ui-out is
mi-like; so the emitters are wrapped in gdb::optional.
ChangeLog
2017-09-09 Tom Tromey <tom@tromey.com>
* thread.c (print_thread_info_1): Use ui_out_emit_table,
ui_out_emit_list, gdb::optional.
John Baldwin [Sat, 9 Sep 2017 18:02:37 +0000 (11:02 -0700)]
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.
Alan Modra [Sat, 9 Sep 2017 12:25:22 +0000 (21:55 +0930)]
PowerPC64 --plt-align
This changes the PowerPC64 --plt-align option to perform the usual
alignment of code as suggested by its name, as well as the previous
behaviour of padding so as to reduce boundary crossing. The old
behaviour is had by using a negative parameter.
The default is also changed to align plt stub code by default to 32
byte boundaries, the point being to get better bctr branch prediction
on power8 and power9 hardware.
bfd/
* elf64-ppp.c (plt_stub_pad): Handle positive and negative
plt_stub_align.
ld/
* ld.texinfo (--plt-align): Describe new behaviour of option.
* emultempl/ppc64elf.em (params): Default plt_stub_align to 5.
* testsuite/ld-powerpc/powerpc.exp: Pass --no-plt-align for
selected tests.
* testsuite/ld-powerpc/relbrlt.d: Pass --no-plt-align.
* testsuite/ld-powerpc/elfv2so.d: Adjust expected output.
H.J. Lu [Sat, 9 Sep 2017 14:29:15 +0000 (07:29 -0700)]
x86: Update UNDEFINED_WEAK_RESOLVED_TO_ZERO
Since the only information which SYMBOL_REFERENCES_LOCAL_P doesn't check
is relocations, UNDEFINED_WEAK_RESOLVED_TO_ZERO only needs to check for
relocations with SYMBOL_REFERENCES_LOCAL_P.
* elf32-i386.c (elf_i386_relocate_section): Update usage of
UNDEFINED_WEAK_RESOLVED_TO_ZERO.
(elf_i386_finish_dynamic_symbol): Likewise.
* elf64-x86-64.c (elf_x86_64_relocate_section): Likewise.
(elf_x86_64_finish_dynamic_symbol): Likewise.
* elfxx-x86.c (elf_x86_allocate_dynrelocs): Likewise.
(_bfd_x86_elf_fixup_symbol): Likewise.
H.J. Lu [Sat, 9 Sep 2017 14:19:36 +0000 (07:19 -0700)]
x86: Don't check has_non_got_reloc
_bfd_x86_elf_link_symbol_references_local should depend only on symbol
references, not relocations, to work in check_relocs.
* elfxx-x86.c (_bfd_x86_elf_link_symbol_references_local): Don't
check has_non_got_reloc.
H.J. Lu [Sat, 9 Sep 2017 12:31:30 +0000 (05:31 -0700)]
x86: Remove restriction on NOTRACK prefix position
Since the NOTRACK prefix is no longer required to be the last prefix
before the REX prefix, restriction on the NOTRACK prefix position is
removed from assembler as well as disassembler. Assembler encodes the
NOTRACK prefix the same way as the DS segment register, which places
it before other prefixes. Disassembler displays prefixes in the order
they appear.
gas/
* config/tc-i386.c (NOTRACK_PREFIX): Removed.
(REX_PREFIX): Updated.
(MAX_PREFIXES): Likewise.
(parse_insn): Remove restriction on NOTRACK prefix position.
* testsuite/gas/i386/notrack.s: Add tests with NOTRACK prefix
before other prefixes.
* testsuite/gas/i386/x86-64-notrack.s: Likewise.
* testsuite/gas/i386/notrackbad.s: Remove tests with NOTRACK
prefix before other prefixes.
* testsuite/gas/i386/x86-64-notrackbad.s: Likewise.
* testsuite/gas/i386/notrack-intel.d: Updated.
* testsuite/gas/i386/notrack.d: Likewise.
* testsuite/gas/i386/notrackbad.l: Likewise.
* testsuite/gas/i386/x86-64-notrack-intel.d: Likewise.
* testsuite/gas/i386/x86-64-notrack.d: Likewise.
* testsuite/gas/i386/x86-64-notrackbad.l: Likewise.
opcodes/
* i386-dis.c (last_active_prefix): Removed.
(ckprefix): Don't set last_active_prefix.
(NOTRACK_Fixup): Don't check last_active_prefix.
H.J. Lu [Sat, 9 Sep 2017 12:05:16 +0000 (05:05 -0700)]
x86: Properly handle __ehdr_start
After _bfd_i386_elf_convert_load and _bfd_x86_64_elf_convert_load are
removed, elf_i386_convert_load_reloc and elf_x86_64_convert_load_reloc
see __ehdr_start as an undefined symbol when they are called from
check_relocs to convert GOT relocations against local symbols. But
__ehdr_start will be defined as a hidden symbol by linker at the later
stage if it is referenced. This patch marks __ehdr_start as a defined
local symbol at the start of check_relocs if it is referenced and not
defined.
bfd/
PR ld/22115
* elf32-i386.c (elf_i386_convert_load_reloc): Check linker_def.
Don't use UNDEFINED_WEAK_RESOLVED_TO_ZERO.
* elf64-x86-64.c (elf_x86_64_convert_load_reloc): Check
linker_def. Don't use UNDEFINED_WEAK_RESOLVED_TO_ZERO.
* elfxx-x86.c (_bfd_x86_elf_link_check_relocs): Set local_ref
and linker_def on __ehdr_start if it is referenced and not
defined.
(_bfd_x86_elf_link_symbol_references_local): Also set local_ref
and return TRUE when building executable, if a symbol has
non-GOT/non-PLT relocations in text section or there is no
dynamic linker.
* elfxx-x86.h (elf_x86_link_hash_entry): Add linker_def.
ld/
PR ld/22115
* ld-i386/i386.exp: Run PR ld/22115 tests,
* ld/testsuite/ld-x86-64/x86-64.exp: Likewise.
* testsuite/ld-i386/pr22115-1.s: New file.
* testsuite/ld-i386/pr22115-1a.d: Likewise.
* testsuite/ld-i386/pr22115-1b.d: Likewise.
* testsuite/ld-i386/pr22115-1c.d: Likewise.
* testsuite/ld-i386/pr22115-1d.d: Likewise.
* testsuite/ld-x86-64/pr22115-1.s: Likewise.
* testsuite/ld-x86-64/pr22115-1a-x32.d: Likewise.
* testsuite/ld-x86-64/pr22115-1a.d: Likewise.
* testsuite/ld-x86-64/pr22115-1b-x32.d: Likewise.
* testsuite/ld-x86-64/pr22115-1b.d: Likewise.
* testsuite/ld-x86-64/pr22115-1c-x32.d: Likewise.
* testsuite/ld-x86-64/pr22115-1c.d: Likewise.
* testsuite/ld-x86-64/pr22115-1d-x32.d: Likewise.
* testsuite/ld-x86-64/pr22115-1d.d: Likewise.
GDB Administrator [Sat, 9 Sep 2017 00:00:19 +0000 (00:00 +0000)]
Automatic date update in version.in