Maciej W. Rozycki [Thu, 21 Jun 2018 20:40:57 +0000 (21:40 +0100)]
MIPS/BFD: Correct formatting of compact EH backend methods
Correct the formatting of `_bfd_mips_elf_compact_eh_encoding' and
`_bfd_mips_elf_cant_unwind_opcode' definitions which extend beyond 79
columns.
bfd/
* elfxx-mips.c (_bfd_mips_elf_compact_eh_encoding)
(_bfd_mips_elf_cant_unwind_opcode): Correct formatting.
Maciej W. Rozycki [Thu, 21 Jun 2018 20:40:56 +0000 (21:40 +0100)]
MIPS/BFD: Keep EI_ABIVERSION setting together
Shuffle code in `_bfd_mips_post_process_headers' so that the setting of
the EI_ABIVERSION ELF file header field is complete before calling
`_bfd_elf_post_process_headers'. This used to be the case, but was
changed with commit
351cdf24d223 ("[MIPS] Implement O32 FPXX, FP64 and
FP64A ABI extensions") for no reason.
bfd/
* elfxx-mips.c (_bfd_mips_post_process_headers): Keep
EI_ABIVERSION setting together.
Maciej W. Rozycki [Thu, 21 Jun 2018 20:40:56 +0000 (21:40 +0100)]
MIPS/BFD: Use enumeration constants for EI_ABIVERSION
Define enumeration constants based on generated `libc-abis.h' from GNU
libc, adding a MIPS_ prefix as these are port-specific. Use them to
replace magic numbers stored in the EI_ABIVERSION field of the ELF file
header.
bfd/
* elfxx-mips.c (MIPS_LIBC_ABI_DEFAULT, MIPS_LIBC_ABI_MIPS_PLT)
(MIPS_LIBC_ABI_UNIQUE, MIPS_LIBC_ABI_MIPS_O32_FP64)
(MIPS_LIBC_ABI_MAX): New enumeration constants.
(_bfd_mips_post_process_headers): Use them in place of magic
numbers.
Jim Wilson [Thu, 21 Jun 2018 18:45:43 +0000 (11:45 -0700)]
RISC-V: Fix 3 PIE related ld testsuite failures.
bfd/
* elfnn-riscv.c (riscv_elf_finish_dynamic_symbol): Update comment.
Use SYMBOL_REFERENCES_LOCAL. Add asserts for h->got.offset.
Pedro Alves [Thu, 21 Jun 2018 16:09:31 +0000 (17:09 +0100)]
Use thread_info and inferior pointers more throughout
This is more preparation bits for multi-target support.
In a multi-target scenario, we need to address the case of different
processes/threads running on different targets that happen to have the
same PID/PTID. E.g., we can have both process 123 in target 1, and
process 123 in target 2, while they're in reality different processes
running on different machines. Or maybe we've loaded multiple
instances of the same core file. Etc.
To address this, in my WIP multi-target branch, threads and processes
are uniquely identified by the (process_stratum target_ops *, ptid_t)
and (process_stratum target_ops *, pid) tuples respectively. I.e.,
each process_stratum instance has its own thread/process number space.
As you can imagine, that requires passing around target_ops * pointers
in a number of functions where we're currently passing only a ptid_t
or an int. E.g., when we look up a thread_info object by ptid_t in
find_thread_ptid, the ptid_t alone isn't sufficient.
In many cases though, we already have the thread_info or inferior
pointer handy, but we "lose" it somewhere along the call stack, only
to look it up again by ptid_t/pid. Since thread_info or inferior
objects know their parent target, if we pass around thread_info or
inferior pointers when possible, we avoid having to add extra
target_ops parameters to many functions, and also, we eliminate a
number of by ptid_t/int lookups.
So that's what this patch does. In a bit more detail:
- Changes a number of functions and methods to take a thread_info or
inferior pointer instead of a ptid_t or int parameter.
- Changes a number of structure fields from ptid_t/int to inferior or
thread_info pointers.
- Uses the inferior_thread() function whenever possible instead of
inferior_ptid.
- Uses thread_info pointers directly when possible instead of the
is_running/is_stopped etc. routines that require a lookup.
- A number of functions are eliminated along the way, such as:
int valid_gdb_inferior_id (int num);
int pid_to_gdb_inferior_id (int pid);
int gdb_inferior_id_to_pid (int num);
int in_inferior_list (int pid);
- A few structures and places hold a thread_info pointer across
inferior execution, so now they take a strong reference to the
(refcounted) thread_info object to avoid the thread_info pointer
getting stale. This is done in enable_thread_stack_temporaries and
in the infcall.c code.
- Related, there's a spot in infcall.c where using a RAII object to
handle the refcount would be handy, so a gdb::ref_ptr specialization
for thread_info is added (thread_info_ref, in gdbthread.h), along
with a gdb_ref_ptr policy that works for all refcounted_object types
(in common/refcounted-object.h).
gdb/ChangeLog:
2018-06-21 Pedro Alves <palves@redhat.com>
* ada-lang.h (ada_get_task_number): Take a thread_info pointer
instead of a ptid_t. All callers adjusted.
* ada-tasks.c (ada_get_task_number): Likewise. All callers
adjusted.
(print_ada_task_info, display_current_task_id, task_command_1):
Adjust.
* breakpoint.c (watchpoint_in_thread_scope): Adjust to use
inferior_thread.
(breakpoint_kind): Adjust.
(remove_breakpoints_pid): Rename to ...
(remove_breakpoints_inf): ... this. Adjust to take an inferior
pointer. All callers adjusted.
(bpstat_clear_actions): Use inferior_thread.
(get_bpstat_thread): New.
(bpstat_do_actions): Use it.
(bpstat_check_breakpoint_conditions, bpstat_stop_status): Adjust
to take a thread_info pointer. All callers adjusted.
(set_longjmp_breakpoint_for_call_dummy, set_momentary_breakpoint)
(breakpoint_re_set_thread): Use inferior_thread.
* breakpoint.h (struct inferior): Forward declare.
(bpstat_stop_status): Update.
(remove_breakpoints_pid): Delete.
(remove_breakpoints_inf): New.
* bsd-uthread.c (bsd_uthread_target::wait)
(bsd_uthread_target::update_thread_list): Use find_thread_ptid.
* btrace.c (btrace_add_pc, btrace_enable, btrace_fetch)
(maint_btrace_packet_history_cmd)
(maint_btrace_clear_packet_history_cmd): Adjust.
(maint_btrace_clear_cmd, maint_info_btrace_cmd): Adjust to use
inferior_thread.
* cli/cli-interp.c: Include "inferior.h".
* common/refcounted-object.h (struct
refcounted_object_ref_policy): New.
* compile/compile-object-load.c: Include gdbthread.h.
(store_regs): Use inferior_thread.
* corelow.c (core_target::close): Use current_inferior.
(core_target_open): Adjust to use first_thread_of_inferior and use
the current inferior.
* ctf.c (ctf_target::close): Adjust to use current_inferior.
* dummy-frame.c (dummy_frame_id) <ptid>: Delete, replaced by ...
<thread>: ... this new field. All references adjusted.
(dummy_frame_pop, dummy_frame_discard, register_dummy_frame_dtor):
Take a thread_info pointer instead of a ptid_t.
* dummy-frame.h (dummy_frame_push, dummy_frame_pop)
(dummy_frame_discard, register_dummy_frame_dtor): Take a
thread_info pointer instead of a ptid_t.
* elfread.c: Include "inferior.h".
(elf_gnu_ifunc_resolver_stop, elf_gnu_ifunc_resolver_return_stop):
Use inferior_thread.
* eval.c (evaluate_subexp): Likewise.
* frame.c (frame_pop, has_stack_frames, find_frame_sal): Use
inferior_thread.
* gdb_proc_service.h (struct thread_info): Forward declare.
(struct ps_prochandle) <ptid>: Delete, replaced by ...
<thread>: ... this new field. All references adjusted.
* gdbarch.h, gdbarch.c: Regenerate.
* gdbarch.sh (get_syscall_number): Replace 'ptid' parameter with a
'thread' parameter. All implementations and callers adjusted.
* gdbthread.h (thread_info) <set_running>: New method.
(delete_thread, delete_thread_silent): Take a thread_info pointer
instead of a ptid.
(global_thread_id_to_ptid, ptid_to_global_thread_id): Delete.
(first_thread_of_process): Delete, replaced by ...
(first_thread_of_inferior): ... this new function. All callers
adjusted.
(any_live_thread_of_process): Delete, replaced by ...
(any_live_thread_of_inferior): ... this new function. All callers
adjusted.
(switch_to_thread, switch_to_no_thread): Declare.
(is_executing): Delete.
(enable_thread_stack_temporaries): Update comment.
<enable_thread_stack_temporaries>: Take a thread_info pointer
instead of a ptid_t. Incref the thread.
<~enable_thread_stack_temporaries>: Decref the thread.
<m_ptid>: Delete
<m_thr>: New.
(thread_stack_temporaries_enabled_p, push_thread_stack_temporary)
(get_last_thread_stack_temporary)
(value_in_thread_stack_temporaries, can_access_registers_thread):
Take a thread_info pointer instead of a ptid_t. All callers
adjusted.
* infcall.c (get_call_return_value): Use inferior_thread.
(run_inferior_call): Work with thread pointers instead of ptid_t.
(call_function_by_hand_dummy): Work with thread pointers instead
of ptid_t. Use thread_info_ref.
* infcmd.c (proceed_thread_callback): Access thread's state
directly.
(ensure_valid_thread, ensure_not_running): Use inferior_thread,
access thread's state directly.
(continue_command): Use inferior_thread.
(info_program_command): Use find_thread_ptid and access thread
state directly.
(proceed_after_attach_callback): Use thread state directly.
(notice_new_inferior): Take a thread_info pointer instead of a
ptid_t. All callers adjusted.
(exit_inferior): Take an inferior pointer instead of a pid. All
callers adjusted.
(exit_inferior_silent): New.
(detach_inferior): Delete.
(valid_gdb_inferior_id, pid_to_gdb_inferior_id)
(gdb_inferior_id_to_pid, in_inferior_list): Delete.
(detach_inferior_command, kill_inferior_command): Use
find_inferior_id instead of valid_gdb_inferior_id and
gdb_inferior_id_to_pid.
(inferior_command): Use inferior and thread pointers.
* inferior.h (struct thread_info): Forward declare.
(notice_new_inferior): Take a thread_info pointer instead of a
ptid_t. All callers adjusted.
(detach_inferior): Delete declaration.
(exit_inferior, exit_inferior_silent): Take an inferior pointer
instead of a pid. All callers adjusted.
(gdb_inferior_id_to_pid, pid_to_gdb_inferior_id, in_inferior_list)
(valid_gdb_inferior_id): Delete.
* infrun.c (follow_fork_inferior, proceed_after_vfork_done)
(handle_vfork_child_exec_or_exit, follow_exec): Adjust.
(struct displaced_step_inferior_state) <pid>: Delete, replaced by
...
<inf>: ... this new field.
<step_ptid>: Delete, replaced by ...
<step_thread>: ... this new field.
(get_displaced_stepping_state): Take an inferior pointer instead
of a pid. All callers adjusted.
(displaced_step_in_progress_any_inferior): Adjust.
(displaced_step_in_progress_thread): Take a thread pointer instead
of a ptid_t. All callers adjusted.
(displaced_step_in_progress, add_displaced_stepping_state): Take
an inferior pointer instead of a pid. All callers adjusted.
(get_displaced_step_closure_by_addr): Adjust.
(remove_displaced_stepping_state): Take an inferior pointer
instead of a pid. All callers adjusted.
(displaced_step_prepare_throw, displaced_step_prepare)
(displaced_step_fixup): Take a thread pointer instead of a ptid_t.
All callers adjusted.
(start_step_over): Adjust.
(infrun_thread_ptid_changed): Remove bit updating ptids in the
displaced step queue.
(do_target_resume): Adjust.
(fetch_inferior_event): Use inferior_thread.
(context_switch, get_inferior_stop_soon): Take an
execution_control_state pointer instead of a ptid_t. All callers
adjusted.
(switch_to_thread_cleanup): Delete.
(stop_all_threads): Use scoped_restore_current_thread.
* inline-frame.c: Include "gdbthread.h".
(inline_state) <inline_state>: Take a thread pointer instead of a
ptid_t. All callers adjusted.
<ptid>: Delete, replaced by ...
<thread>: ... this new field.
(find_inline_frame_state): Take a thread pointer instead of a
ptid_t. All callers adjusted.
(skip_inline_frames, step_into_inline_frame)
(inline_skipped_frames, inline_skipped_symbol): Take a thread
pointer instead of a ptid_t. All callers adjusted.
* inline-frame.h (skip_inline_frames, step_into_inline_frame)
(inline_skipped_frames, inline_skipped_symbol): Likewise.
* linux-fork.c (delete_checkpoint_command): Adjust to use thread
pointers directly.
* linux-nat.c (get_detach_signal): Likewise.
* linux-thread-db.c (thread_from_lwp): New 'stopped' parameter.
(thread_db_notice_clone): Adjust.
(thread_db_find_new_threads_silently)
(thread_db_find_new_threads_2, thread_db_find_new_threads_1): Take
a thread pointer instead of a ptid_t. All callers adjusted.
* mi/mi-cmd-var.c: Include "inferior.h".
(mi_cmd_var_update_iter): Update to use thread pointers.
* mi/mi-interp.c (mi_new_thread): Update to use the thread's
inferior directly.
(mi_output_running_pid, mi_inferior_count): Delete, bits factored
out to ...
(mi_output_running): ... this new function.
(mi_on_resume_1): Adjust to use it.
(mi_user_selected_context_changed): Adjust to use inferior_thread.
* mi/mi-main.c (proceed_thread): Adjust to use thread pointers
directly.
(interrupt_thread_callback): : Adjust to use thread and inferior
pointers.
* proc-service.c: Include "gdbthread.h".
(ps_pglobal_lookup): Adjust to use the thread's inferior directly.
* progspace-and-thread.c: Include "inferior.h".
* progspace.c: Include "inferior.h".
* python/py-exitedevent.c (create_exited_event_object): Adjust to
hold a reference to an inferior_object.
* python/py-finishbreakpoint.c (bpfinishpy_init): Adjust to use
inferior_thread.
* python/py-inferior.c (struct inferior_object): Give the type a
tag name instead of a typedef.
(python_on_normal_stop): No need to check if the current thread is
listed.
(inferior_to_inferior_object): Change return type to
inferior_object. All callers adjusted.
(find_thread_object): Delete, bits factored out to ...
(thread_to_thread_object): ... this new function.
* python/py-infthread.c (create_thread_object): Use
inferior_to_inferior_object.
(thpy_is_stopped): Use thread pointer directly.
(gdbpy_selected_thread): Use inferior_thread.
* python/py-record-btrace.c (btpy_list_object) <ptid>: Delete
field, replaced with ...
<thread>: ... this new field. All users adjusted.
(btpy_insn_or_gap_new): Drop const.
(btpy_list_new): Take a thread pointer instead of a ptid_t. All
callers adjusted.
* python/py-record.c: Include "gdbthread.h".
(recpy_insn_new, recpy_func_new): Take a thread pointer instead of
a ptid_t. All callers adjusted.
(gdbpy_current_recording): Use inferior_thread.
* python/py-record.h (recpy_record_object) <ptid>: Delete
field, replaced with ...
<thread>: ... this new field. All users adjusted.
(recpy_element_object) <ptid>: Delete
field, replaced with ...
<thread>: ... this new field. All users adjusted.
(recpy_insn_new, recpy_func_new): Take a thread pointer instead of
a ptid_t. All callers adjusted.
* python/py-threadevent.c: Include "gdbthread.h".
(get_event_thread): Use thread_to_thread_object.
* python/python-internal.h (struct inferior_object): Forward
declare.
(find_thread_object, find_inferior_object): Delete declarations.
(thread_to_thread_object, inferior_to_inferior_object): New
declarations.
* record-btrace.c: Include "inferior.h".
(require_btrace_thread): Use inferior_thread.
(record_btrace_frame_sniffer)
(record_btrace_tailcall_frame_sniffer): Use inferior_thread.
(get_thread_current_frame): Use scoped_restore_current_thread and
switch_to_thread.
(get_thread_current_frame): Use thread pointer directly.
(record_btrace_replay_at_breakpoint): Use thread's inferior
pointer directly.
* record-full.c: Include "inferior.h".
* regcache.c: Include "gdbthread.h".
(get_thread_arch_regcache): Use the inferior's address space
directly.
(get_thread_regcache, registers_changed_thread): New.
* regcache.h (get_thread_regcache(thread_info *thread)): New
overload.
(registers_changed_thread): New.
(remote_target) <remote_detach_1>: Swap order of parameters.
(remote_add_thread): <remote_add_thread>: Return the new thread.
(get_remote_thread_info(ptid_t)): New overload.
(remote_target::remote_notice_new_inferior): Use thread pointers
directly.
(remote_target::process_initial_stop_replies): Use
thread_info::set_running.
(remote_target::remote_detach_1, remote_target::detach)
(extended_remote_target::detach): Adjust.
* stack.c (frame_show_address): Use inferior_thread.
* target-debug.h (target_debug_print_thread_info_pp): New.
* target-delegates.c: Regenerate.
* target.c (default_thread_address_space): Delete.
(memory_xfer_partial_1): Use current_inferior.
(target_detach): Use current_inferior.
(target_thread_address_space): Delete.
(generic_mourn_inferior): Use current_inferior.
* target.h (struct target_ops) <thread_address_space>: Delete.
(target_thread_address_space): Delete.
* thread.c (init_thread_list): Use ALL_THREADS_SAFE. Use thread
pointers directly.
(delete_thread_1, delete_thread, delete_thread_silent): Take a
thread pointer instead of a ptid_t. Adjust all callers.
(ptid_to_global_thread_id, global_thread_id_to_ptid): Delete.
(first_thread_of_process): Delete, replaced by ...
(first_thread_of_inferior): ... this new function. All callers
adjusted.
(any_thread_of_process): Rename to ...
(any_thread_of_inferior): ... this, and take an inferior pointer.
(any_live_thread_of_process): Rename to ...
(any_live_thread_of_inferior): ... this, and take an inferior
pointer.
(thread_stack_temporaries_enabled_p, push_thread_stack_temporary)
(value_in_thread_stack_temporaries)
(get_last_thread_stack_temporary): Take a thread pointer instead
of a ptid_t. Adjust all callers.
(thread_info::set_running): New.
(validate_registers_access): Use inferior_thread.
(can_access_registers_ptid): Rename to ...
(can_access_registers_thread): ... this, and take a thread
pointer.
(print_thread_info_1): Adjust to compare thread pointers instead
of ptids.
(switch_to_no_thread, switch_to_thread): Make extern.
(scoped_restore_current_thread::~scoped_restore_current_thread):
Use m_thread pointer directly.
(scoped_restore_current_thread::scoped_restore_current_thread):
Use inferior_thread.
(thread_command): Use thread pointer directly.
(thread_num_make_value_helper): Use inferior_thread.
* top.c (execute_command): Use inferior_thread.
* tui/tui-interp.c: Include "inferior.h".
* varobj.c (varobj_create): Use inferior_thread.
(value_of_root_1): Use find_thread_global_id instead of
global_thread_id_to_ptid.
Alan Hayward [Wed, 20 Jun 2018 08:31:37 +0000 (09:31 +0100)]
Avoid memcpys in regcache read_part/write_part for full registers.
Additionally, tidy up the functions: Remove asserts, use gdb_byte,
update comments.
gdb/
* regcache.c (readable_regcache::read_part): Avoid memcpy when
possible.
(regcache::write_part): Likewise.
(readable_regcache::cooked_read_part): Update comment.
(readable_regcache::cooked_write_part): Likewise.
* regcache.h: (readable_regcache::read_part): Likewise.
(regcache::write_part): Likewise.
Alan Modra [Wed, 20 Jun 2018 04:46:52 +0000 (14:16 +0930)]
Regen doc/Makefile.in
Also make the automake strictness "foreign". My regeneration of the
three doc/Makefile.in files already had --foreign in the automake
invocation, so this just makes it explicit.
bfd/
* doc/Makefile.am (AUTOMAKE_OPTIONS): Add "foreign".
* doc/Makefile.in: Regenerate.
binutils/
* doc/Makefile.am (AUTOMAKE_OPTIONS): Add "foreign".
* doc/Makefile.in: Regenerate.
gas/
* doc/Makefile.am (AUTOMAKE_OPTIONS): Add "foreign".
* doc/Makefile.in: Regenerate.
zlib/
* Makefile.in: Regenerate.
Richard Bunt [Thu, 21 Jun 2018 13:09:34 +0000 (14:09 +0100)]
Enable hardware watchpoints on attach for aarch64
This commit fixes a bug whereby hardware watchpoints are not used on
aarch64 when attaching to a target. The fix adds an aarch64 specialization
of post_attach which records the number of available hardware debug registers
using aarch64_linux_get_debug_reg_capacity. This implementation mirrors that
of aarch64_linux_child_post_startup_inferior which successfully enables the
use of hardware watchpoints when launching the target under the debugger.
gdb/ChangeLog:
* aarch64-linux-nat.c (post_attach): New.
(aarch64_linux_nat_target::post_attach): Override post_attach to
record the number of hardware debug registers.
gdb/testsuite/ChangeLog:
* gdb.base/watchpoint-hw-attach.c: New test.
* gdb.base/watchpoint-hw-attach.exp: New file.
Alan Hayward [Thu, 21 Jun 2018 08:37:58 +0000 (09:37 +0100)]
Use offsets instead of addresses in ELF_SECTION_IN_SEGMENT for non SHT_NOBITS
For sections that are not SHT_NOBITS, use sh_offset and p_offset instead of
sh_addr and p_vaddr when calculating if a section fits in a segment. Both
methods are valid when using the GNU linker.
include/
* elf/internal.h (ELF_SECTION_IN_SEGMENT): Don’t check addresses
for non SHT_NOBITS.
Tom Tromey [Wed, 20 Jun 2018 21:35:04 +0000 (15:35 -0600)]
Fix a memory leak in py-param.c
Mark Wielaard pointed out this memory leak to me:
==17633== 775 bytes in 1 blocks are definitely lost in loss record 13,346 of 13,967
==17633== at 0x4C2DB6B: malloc (vg_replace_malloc.c:299)
==17633== by 0x6652B7: xmalloc (common-utils.c:45)
==17633== by 0xC4C889: xstrdup (xstrdup.c:34)
==17633== by 0x5A71FD: unicode_to_encoded_string(_object*, char const*) (py-utils.c:81)
==17633== by 0x5A73EB: python_string_to_host_string(_object*) (py-utils.c:158)
==17633== by 0x59CC6C: get_doc_string(_object*, _object*) (py-param.c:334)
==17633== by 0x59D2AA: parmpy_init(_object*, _object*, _object*) (py-param.c:728)
The bug here is that parmpy_init is written as though
add_setshow_generic takes ownership of its doc-string arguments.
However, it does not. This patch fixes the bug in a straightforward
way and also applies some missing constification to make the problem
more apparent.
Tested on x86-64 Fedora 26.
gdb/ChangeLog
2018-06-20 Tom Tromey <tom@tromey.com>
* python/py-param.c (add_setshow_generic): Make parameters const.
(parmpy_init): Update.
GDB Administrator [Thu, 21 Jun 2018 00:00:39 +0000 (00:00 +0000)]
Automatic date update in version.in
Simon Marchi [Wed, 20 Jun 2018 16:49:03 +0000 (12:49 -0400)]
Rename regcache_cooked_read_ftype and make a function_view
regcache_cooked_read_ftype can be converted to a function_view, which
allows us to use lambda functions and therefore avoid having to pass an
opaque pointer parameter.
Adjusting the fallouts showed that the "const regcache &" passed to the
readonly_detached_regcache constructor is cast to non-const in
do_cooked_read. I changed the constructor parameter to be non-const.
Finally, I renamed the typedef from regcache_cooked_read_ftype to
register_read_ftype, since there is nothing that forces us to use it
only for regcaches nor cooked registers.
gdb/ChangeLog:
* regcache.h (regcache_cooked_read_ftype): Rename to...
(register_read_ftype): ...this, change type to function_view.
(class reg_buffer) <save>: Remove src parameter.
(readonly_detached_regcache) <readonly_detached_regcache>: Make
parameter non-const in first overload. Remove src parameter in
second overload.
* regcache.c (do_cooked_read): Remove.
(readonly_detached_regcache::readonly_detached_regcache): Make
parameter non-const, adjust call to other constructor.
(reg_buffer::save): Remove src parameter.
* frame.c (do_frame_register_read): Remove.
(frame_save_as_regcache): Use lambda function.
* ppc-linux-tdep.c (ppu2spu_unwind_register): Change type of src
parameter to ppu2spu_data *.
(ppu2spu_sniffer): Use lambda function.
Simon Marchi [Wed, 20 Jun 2018 16:46:28 +0000 (12:46 -0400)]
testsuite: Fix cc-with-tweaks.sh being executed in the wrong shell
The cc-with-tweaks.sh script needs to be executed with bash. When
trying to run this:
make check RUNTESTFLAGS="--target_board=dwarf4-gdb-index" TESTS="gdb.base/return.exp"
I get:
gdb compile failed, /home/emaisin/src/binutils-gdb/gdb/contrib/cc-with-tweaks.sh: 174: /home/emaisin/src/binutils-gdb/gdb/contrib/cc-with-tweaks.sh: Bad substitution
The reason is that the board files execute cc-with-tweaks.sh using
/bin/sh, which points to dash on my machine. Remove the /bin/sh part
and let the shebang choose the right interpreter.
gdb/testsuite/ChangeLog:
* boards/cc-with-tweaks.exp: Don't call cc-with-tweaks.sh
through /bin/sh.
* boards/dwarf4-gdb-index.exp: Likewise.
* boards/fission-dwp.exp: Likewise.
Simon Marchi [Wed, 20 Jun 2018 16:40:54 +0000 (12:40 -0400)]
Remove struct keyword in range-based for-loop
Fix this with gcc 6.3.0, and make the loop variable const while at it:
/home/simark/src/binutils-gdb/gdb/record-full.c: In member function 'virtual int record_full_target::insert_breakpoint(gdbarch*, bp_target_info*)':
/home/simark/src/binutils-gdb/gdb/record-full.c:1789:8: error: types may not be defined in a for-range-declaration [-Werror]
for (struct record_full_breakpoint &bp : record_full_breakpoints)
gdb/ChangeLog:
* record-full.c (record_full_target::insert_breakpoint): Remove
"struct" keyword, add const.
Nick Clifton [Wed, 20 Jun 2018 15:30:05 +0000 (16:30 +0100)]
Fix potential illegal memroy access when using a build-id note with a negative size.
PR 23316
* opncls.c (get_build_id): Check for a negative or excessive data
size in the build-id note.
Ulrich Weigand [Wed, 20 Jun 2018 14:24:16 +0000 (16:24 +0200)]
Improve gdb.base/float128.exp failure message
If the "print large128" sub-test fails in a manner that typically
indicates internal overflow due to GDB being built without MPFR
support, explicitly state this in the failure message.
gdb/testsuite/ChangeLog:
2018-06-20 Ulrich Weigand <uweigand@de.ibm.com>
* gdb.base/float128.exp: Add comment and improved fail message
to the failure case of "print large128" test.
Renlin Li [Fri, 27 Apr 2018 09:48:18 +0000 (10:48 +0100)]
[BFD][AARCH64]Properly truncate no overflow checking relocation value for load/store immediate.
bfd/ChangeLog:
2018-06-20 Renlin Li <renlin.li@arm.com>
* elfxx-aarch64.c (_bfd_aarch64_elf_resolve_relocation): Use PG_OFFSET
to resolve BFD_RELOC_AARCH64_TLSLD_LDST16_DTPREL_LO12_NC,
BFD_RELOC_AARCH64_TLSLD_LDST32_DTPREL_LO12_NC,
BFD_RELOC_AARCH64_TLSLD_LDST64_DTPREL_LO12_NC,
BFD_RELOC_AARCH64_TLSLD_LDST8_DTPREL_LO12_NC,
BFD_RELOC_AARCH64_TLSLE_LDST16_TPREL_LO12_NC,
BFD_RELOC_AARCH64_TLSLE_LDST32_TPREL_LO12_NC,
BFD_RELOC_AARCH64_TLSLE_LDST64_TPREL_LO12_NC,
BFD_RELOC_AARCH64_TLSLE_LDST8_TPREL_LO12_NC.
ld/ChangeLog:
2018-06-20 Renlin Li <renlin.li@arm.com>
* testsuite/ld-aarch64/emit-relocs-115.d: Update test with new value.
* testsuite/ld-aarch64/emit-relocs-534.d: Likewise.
* testsuite/ld-aarch64/emit-relocs-555.d: Likewise.
Nick Clifton [Wed, 20 Jun 2018 11:38:10 +0000 (12:38 +0100)]
Change the ARM assembler's ADR and ADRl pseudo-ops so that they will only set the bottom bit of imported thumb function symbols if the -mthumb-interwork option is active.
For more information see the email thread starting here:
https://www.sourceware.org/ml/binutils/2018-05/msg00348.html
PR 21458
* tc-arm.c (do_adr): Only set the bottom bit of an imported thumb
function symbol address if -mthumb-interwork is active.
(do_adrl): Likewise.
* doc/c-arm.texi: Update descriptions of the -mthumb-interwork
option and the ADR and ADRL pseudo-ops.
* NEWS: Mention the new behaviour of the ADR and ADRL pseudo-ops.
* testsuite/gas/arm/pr21458.d: Add -mthumb-interwork option to
assembler command line.
* testsuite/gas/arm/adr.d: Likewise.
* testsuite/gas/arm/adrl.d: Likewise.
Nick Clifton [Wed, 20 Jun 2018 09:43:00 +0000 (10:43 +0100)]
Stop objcopy from corrupting mach-o files.
PR 23299
* mach-o.c (cputype): New function.
(cpusubtype): New function.
(bfd_mach_o_bfd_print_private_data): New function. Dispalys the
values in the MACH-O file header.
(bfd_mach_o_bfd_copy_private_header_data): Copy the cputype and
cpusubtype fields from the input bfd's mach-o header to the output
bfd.
* mach-o-target.c (bfd_mach_o_bfd_print_private_bfd_data):
Redefine to bfd_mach_o_bfd_print_private_data.
* mach-o.h (bfd_mach_o_bfd_print_private_bfd_data): Prototype.
Cary Coutant [Wed, 20 Jun 2018 08:24:11 +0000 (01:24 -0700)]
Fix problem where gold does not create base version for executables.
gold/
PR gold/23268
* dynobj.cc (Versions::Versions): Change init for needs_base_version_.
(Versions::record_version): Add verdefs for both shared objects and
executables.
(Versions::add_def): Likewise for base version.
(Versions::add_need): Don't add base version for executables.
(Versions::version_index): Look up version for both shared objects and
executables.
* testsuite/Makefile.am (ver_test_14): New test case.
* testsuite/Makefile.in: Regenerate.
* testsuite/ver_test_14.script: New version script.
* testsuite/ver_test_14.sh: New test script.
Sebastian Huber [Tue, 19 Jun 2018 05:12:48 +0000 (07:12 +0200)]
RISC-V: Accept constant operands in la and lla
opcodes/
PR gas/23305
* riscv-opc.c (riscv_opcodes): Use new format specifier 'B' for
la and lla.
gas/
PR gas/23305
* config/tc-riscv.c (riscv_ip): Add format specifier 'B' for
constants and symbols.
* testsuite/gas/riscv/lla32.d: New file.
* testsuite/gas/riscv/lla32.s: Likewise.
* testsuite/gas/riscv/lla64-fail.d: Likewise.
* testsuite/gas/riscv/lla64-fail.l: Likewise.
* testsuite/gas/riscv/lla64-fail.s: Likewise.
* testsuite/gas/riscv/lla64.d: Likewise.
* testsuite/gas/riscv/lla64.s: Likewise.
Cary Coutant [Wed, 20 Jun 2018 02:03:25 +0000 (19:03 -0700)]
Fix typo in most recent entry.
Cary Coutant [Wed, 20 Jun 2018 01:57:28 +0000 (18:57 -0700)]
Replace thread config with automatic config using ax_pthread.m4.
The autotools library macro (AX_PTHREAD) is now used to detect if
pthreads is present and multi-threaded linking in gold is automatically
enabled if it is found. This enables multi-threaded gold on platforms
where pthreads is enabled via other methods than just -lpthread
(e.g., MinGW).
2018-06-19 Joshua Watt <jpewhacker@gmail.com>
Cary Coutant <ccoutant@gmail.com>
gold/
* configure.ac: Replace manual thread configuration with AX_PTHREAD.
Add --enable-threads=auto.
* Makefile.am (THREADFLAGS, THREADLIBS): New defines.
(AM_CFLAGS, AM_CXXFLAGS): Add $(THREADFLAGS.
(THREADSLIB): Remove; change all references to THREADLIBS.
* Makefile.in: Regenerate.
* aclocal.m4: Regenerate.
* config.in: Regenerate.
* configure: Regenerate.
* testsuite/Makefile.am (THREADSLIB): Replace with...
(THREADFLAGS, THREADLIBS): ... these.
(LDADD): Remove; add as individual defines for...
(object_unittest, binary_unittest, leb128_unittest)
(overflow_unittest): ... these tests.
(tls_test, tls_pic_test, tls_pie_test, tls_pie_pic_test)
(tls_shared_test, tls_shared_ie_test, tls_shared_gd_to_ie_test)
(tls_shared_gnu2_gd_to_ie_test, tls_shared_gnu2_test_LDFLAGS)
(tls_shared_nonpic_test_LDFLAGS): Add $(THREADFLAGS) and ($THREADLIBS).
* testsuite/Makefile.in: Regenerate.
Cary Coutant [Tue, 19 Jun 2018 23:52:54 +0000 (16:52 -0700)]
Remove *.stderr when "make clean".
gold/
* testsuite/Makefile.am (MOSTLYCLEANFILES): Add *.stderr.
* testsuite/Makefile.in: Regenerate.
GDB Administrator [Wed, 20 Jun 2018 00:00:56 +0000 (00:00 +0000)]
Automatic date update in version.in
Maciej W. Rozycki [Tue, 19 Jun 2018 23:37:51 +0000 (00:37 +0100)]
PR ld/22966: Fix n64 MIPS `.got.plt' range checks
The addressable signed 32-bit range for n64 MIPS `.got.plt' references
is from 0xffffffff7fff8000 to 0x7fff7fff, due to how the composition of
an LUI and an LD instruction works for address calculation in the 64-bit
addressing mode, such as when CP0.Status.UX=1.
We currently have a range check in `mips_finish_exec_plt', however it is
not correct as it verifies that the `.got.plt' start address referred is
between 0xffffffff80000000 and 0x7fffffff. It is also implemented as an
assertion rather than a proper error message despite that the situation
can be triggered by user input. Additionally there is no check made for
individual `.got.plt' entries referred even though they can be out of
range while the `.got.plt' start address is not.
Fix all these problems and use the correct range for the check, limiting
it to n64 output files, and then issue a proper error message both in
`mips_finish_exec_plt' and in `_bfd_mips_elf_finish_dynamic_symbol',
suggesting the use of the `-Ttext-segment=...' option that will often
work and with the default linker scripts in particular. Add suitable
tests covering boundary cases.
bfd/
PR ld/22966
* elfxx-mips.c (_bfd_mips_elf_finish_dynamic_symbol): Verify the
`.got.plt' entry referred is in range.
(mips_finish_exec_plt): Correct the range check for `.got.plt'
start. Replace the assertion used for that with a proper error
message.
ld/
PR ld/22966
* testsuite/ld-mips-elf/n64-plt-1.dd: New test.
* testsuite/ld-mips-elf/n64-plt-1.gd: New test.
* testsuite/ld-mips-elf/n64-plt-2.ed: New test.
* testsuite/ld-mips-elf/n64-plt-3.ed: New test.
* testsuite/ld-mips-elf/n64-plt-4.dd: New test.
* testsuite/ld-mips-elf/n64-plt-4.gd: New test.
* testsuite/ld-mips-elf/n64-plt-1.ld: New test linker script.
* testsuite/ld-mips-elf/n64-plt-2.ld: New test linker script.
* testsuite/ld-mips-elf/n64-plt-3.ld: New test linker script.
* testsuite/ld-mips-elf/n64-plt-4.ld: New test linker script.
* testsuite/ld-mips-elf/n64-plt.s: New test source.
* testsuite/ld-mips-elf/n64-plt-lib.s: New test source.
* testsuite/ld-mips-elf/mips-elf.exp: Run the new tests.
Maciej W. Rozycki [Tue, 19 Jun 2018 23:37:51 +0000 (00:37 +0100)]
MIPS/BFD: Fix `loc' formatting in `_bfd_mips_elf_finish_dynamic_symbol'
Fix a formatting fallout in `_bfd_mips_elf_finish_dynamic_symbol' from
commit
ce558b89b15a ("Delete duplicate target short-cuts to dynamic
sections").
bfd/
* elfxx-mips.c (_bfd_mips_elf_finish_dynamic_symbol): Fix
formatting.
Maciej W. Rozycki [Tue, 19 Jun 2018 23:37:51 +0000 (00:37 +0100)]
MIPS/LD/testsuite: XFAIL DT_TEXTREL map file warning test
Remove:
FAIL: DT_TEXTREL map file warning
introduced with commit
63c1f59d6655 ("readonly_dynrelocs"), coming from
the lack of a "dynamic relocation against `foo' in read-only section
`.rodata'" warning message produced.
The cause of the failure is that for sections which have dynamic
relocations attached the MIPS backend sets SHF_WRITE, in
`mips_elf_create_dynamic_relocation', yielding:
$ readelf -S textrel.so | grep rodata
[ 8] .rodata PROGBITS
00000254 000254 000004 00 WA 0 0 1
$
so the section is read/write and therefore there is nothing to warn
about.
This arrangement came from commit
7403cb6305f5 ("PATCH for N32 ABI"),
<https://sourceware.org/ml/binutils/1999-q2/msg00375.html>, i.e. for all
practical purposes it has been there since forever, and therefore it can
be considered a part of the ABI and the test case irrelevant for MIPS
targets.
We don't have a clean way to request UNSUPPORTED result, which would be
the most appropriate here, so just XFAIL the test instead.
ld/
* testsuite/ld-elf/shared.exp: XFAIL DT_TEXTREL map file warning
test for `mips*-*-*'.
Simon Marchi [Tue, 19 Jun 2018 20:54:48 +0000 (16:54 -0400)]
Bump to autoconf 2.69 and automake 1.15.1
When trying to run the update-gnulib.sh script in gdb, I get this:
Error: Wrong automake version (Unescaped left brace in regex is deprecated, passed through in regex; marked by <-- HERE in m/\${ <-- HERE ([^ =:+{}]+)}/ at /opt/automake/1.11.1/bin/automake line 4113.), we need 1.11.1.
Aborting.
Apparently, it's an issue with a regex in automake that triggers a
warning starting with Perl 5.22. It has been fixed in automake 1.15.1.
So I think it's a good excuse to bump the versions of autoconf and
automake used in the gnulib import. And to avoid requiring multiple
builds of autoconf/automake, it was suggested that we bump the required
version of those tools for all binutils-gdb.
For autoconf, the 2.69 version is universally available, so it's an easy
choice. For automake, different distros and distro versions have
different automake versions. But 1.15.1 seems to be the most readily
available as a package. In any case, it's easy to build it from source.
I removed the version checks from AUTOMAKE_OPTIONS and AC_PREREQ,
because I don't think they are useful in our case. They only specify a
lower bound for the acceptable version of automake/autoconf. That's
useful if you let the user choose the version of the tool they want to
use, but want to set a minimum version (because you use a feature that
was introduced in that version). In our case, we force people to use a
specific version anyway. For the autoconf version, we have the check in
config/override.m4 that enforces the version we want. It will be one
less thing to update next time we change autotools version.
I hit a few categories of problems that required some changes. They are
described below along with the chosen solutions.
Problem 1:
configure.ac:17: warning: AM_INIT_AUTOMAKE: two- and three-arguments forms are deprecated. For more info, see:
configure.ac:17: http://www.gnu.org/software/automake/manual/automake.html#Modernize-AM_005fINIT_005fAUTOMAKE-invocation
Solution 1:
Adjust the code based on the example at that URL.
Problem 2 (in zlib/):
Makefile.am: error: required file './INSTALL' not found
Makefile.am: 'automake --add-missing' can install 'INSTALL'
Makefile.am: error: required file './NEWS' not found
Makefile.am: error: required file './AUTHORS' not found
Makefile.am: error: required file './COPYING' not found
Makefile.am: 'automake --add-missing' can install 'COPYING'
Solution 2:
Add the foreign option to AUTOMAKE_OPTIONS.
Problem 3:
doc/Makefile.am:20: error: support for Cygnus-style trees has been removed
Solution 3:
Remove the cygnus options.
Problem 4:
Makefile.am:656: warning: 'INCLUDES' is the old name for 'AM_CPPFLAGS' (or '*_CPPFLAGS')
Solution 4:
Rename "INCLUDES = " to "AM_CPPFLAGS += " (because AM_CPPFLAGS is
already defined earlier).
Problem 5:
doc/Makefile.am:71: warning: suffix '.texinfo' for Texinfo files is discouraged; use '.texi' instead
doc/Makefile.am: warning: Oops!
doc/Makefile.am: It appears this file (or files included by it) are triggering
doc/Makefile.am: an undocumented, soon-to-be-removed automake hack.
doc/Makefile.am: Future automake versions will no longer place in the builddir
doc/Makefile.am: (rather than in the srcdir) the generated '.info' files that
doc/Makefile.am: appear to be cleaned, by e.g. being listed in CLEANFILES or
doc/Makefile.am: DISTCLEANFILES.
doc/Makefile.am: If you want your '.info' files to be placed in the builddir
doc/Makefile.am: rather than in the srcdir, you have to use the shiny new
doc/Makefile.am: 'info-in-builddir' automake option.
Solution 5:
Rename .texinfo files to .texi.
Problem 6:
doc/Makefile.am: warning: Oops!
doc/Makefile.am: It appears this file (or files included by it) are triggering
doc/Makefile.am: an undocumented, soon-to-be-removed automake hack.
doc/Makefile.am: Future automake versions will no longer place in the builddir
doc/Makefile.am: (rather than in the srcdir) the generated '.info' files that
doc/Makefile.am: appear to be cleaned, by e.g. being listed in CLEANFILES or
doc/Makefile.am: DISTCLEANFILES.
doc/Makefile.am: If you want your '.info' files to be placed in the builddir
doc/Makefile.am: rather than in the srcdir, you have to use the shiny new
doc/Makefile.am: 'info-in-builddir' automake option.
Solution 6:
Remove the hack at the bottom of doc/Makefile.am and use
the info-in-builddir automake option.
Problem 7:
doc/Makefile.am:35: error: required file '../texinfo.tex' not found
doc/Makefile.am:35: 'automake --add-missing' can install 'texinfo.tex'
Solution 7:
Use the no-texinfo.tex automake option. We also have one in
texinfo/texinfo.tex, not sure if we should point to that, or move it
(or a newer version of it added with automake --add-missing) to
top-level.
Problem 8:
Makefile.am:131: warning: source file 'config/tc-aarch64.c' is in a subdirectory,
Makefile.am:131: but option 'subdir-objects' is disabled
automake: warning: possible forward-incompatibility.
automake: At least a source file is in a subdirectory, but the 'subdir-objects'
automake: automake option hasn't been enabled. For now, the corresponding output
automake: object file(s) will be placed in the top-level directory. However,
automake: this behaviour will change in future Automake versions: they will
automake: unconditionally cause object files to be placed in the same subdirectory
automake: of the corresponding sources.
automake: You are advised to start using 'subdir-objects' option throughout your
automake: project, to avoid future incompatibilities.
Solution 8:
Use subdir-objects, that means adjusting references to some .o that will now
be in config/.
Problem 9:
configure.ac:375: warning: AC_LANG_CONFTEST: no AC_LANG_SOURCE call detected in body
../../lib/autoconf/lang.m4:193: AC_LANG_CONFTEST is expanded from...
../../lib/autoconf/general.m4:2601: _AC_COMPILE_IFELSE is expanded from...
../../lib/autoconf/general.m4:2617: AC_COMPILE_IFELSE is expanded from...
../../lib/m4sugar/m4sh.m4:639: AS_IF is expanded from...
../../lib/autoconf/general.m4:2042: AC_CACHE_VAL is expanded from...
../../lib/autoconf/general.m4:2063: AC_CACHE_CHECK is expanded from...
configure.ac:375: the top level
Solution 9:
Use AC_LANG_SOURCE, or use proper quoting.
Problem 10 (in intl/):
configure.ac:7: warning: AC_COMPILE_IFELSE was called before AC_USE_SYSTEM_EXTENSIONS
/usr/share/aclocal/threadlib.m4:36: gl_THREADLIB_EARLY_BODY is expanded from...
/usr/share/aclocal/threadlib.m4:29: gl_THREADLIB_EARLY is expanded from...
/usr/share/aclocal/threadlib.m4:318: gl_THREADLIB is expanded from...
/usr/share/aclocal/lock.m4:9: gl_LOCK is expanded from...
/usr/share/aclocal/intl.m4:211: gt_INTL_SUBDIR_CORE is expanded from...
/usr/share/aclocal/intl.m4:25: AM_INTL_SUBDIR is expanded from...
/usr/share/aclocal/gettext.m4:57: AM_GNU_GETTEXT is expanded from...
configure.ac:7: the top level
Solution 10:
Add AC_USE_SYSTEM_EXTENSIONS in configure.ac.
ChangeLog:
* libtool.m4: Use AC_LANG_SOURCE.
* configure.ac: Remove AC_PREREQ, use AC_LANG_SOURCE.
* README-maintainer-mode: Update version requirements.
* ar-lib: New file.
* test-driver: New file.
* configure: Re-generate.
bfd/ChangeLog:
* Makefile.am (AUTOMAKE_OPTIONS): Remove 1.11.
(INCLUDES): Rename to ...
(AM_CPPFLAGS): ... this.
* configure.ac: Remove AC_PREREQ.
* doc/Makefile.am (AUTOMAKE_OPTIONS): Remove 1.9, cygnus, add
info-in-builddir no-texinfo.tex.
(info_TEXINFOS): Rename bfd.texinfo to bfd.texi.
* doc/bfd.texinfo: Rename to ...
* doc/bfd.texi: ... this.
* Makefile.in: Re-generate.
* aclocal.m4: Re-generate.
* config.in: Re-generate.
* configure: Re-generate.
* doc/Makefile.in: Re-generate.
binutils/ChangeLog:
* configure.ac: Remove AC_PREREQ.
* doc/Makefile.am (AUTOMAKE_OPTIONS): Remove cygnus, add
info-in-builddir no-texinfo.tex.
* Makefile.in: Re-generate.
* aclocal.m4: Re-generate.
* config.in: Re-generate.
* configure: Re-generate.
* doc/Makefile.in: Re-generate.
config/ChangeLog:
* override.m4 (_GCC_AUTOCONF_VERSION): Bump from 2.64 to 2.69.
etc/ChangeLog:
* configure.in: Remove AC_PREREQ.
* configure: Re-generate.
gas/ChangeLog:
* Makefile.am (AUTOMAKE_OPTIONS): Remove 1.11, add subdir-objects.
(TARG_CPU_O, OBJ_FORMAT_O, ATOF_TARG_O): Add config/ prefix.
* configure.ac (TARG_CPU_O, OBJ_FORMAT_O, ATOF_TARG_O, emfiles,
extra_objects): Add config/ prefix.
* doc/as.texinfo: Rename to...
* doc/as.texi: ... this.
* doc/Makefile.am: Rename as.texinfo to as.texi throughout.
Remove DISTCLEANFILES hack.
(AUTOMAKE_OPTIONS): Remove 1.8, cygnus, add no-texinfo.tex and
info-in-builddir.
* Makefile.in: Re-generate.
* aclocal.m4: Re-generate.
* config.in: Re-generate.
* configure: Re-generate.
* doc/Makefile.in: Re-generate.
gdb/ChangeLog:
* common/common-defs.h (PACKAGE_NAME, PACKAGE_VERSION,
PACKAGE_STRING, PACKAGE_TARNAME): Undefine.
* configure.ac: Remove AC_PREREQ, add missing quoting.
* gnulib/configure.ac: Modernize usage of
AC_INIT/AM_INIT_AUTOMAKE. Remove AC_PREREQ.
* gnulib/update-gnulib.sh (AUTOCONF_VERSION): Bump to 2.69.
(AUTOMAKE_VERSION): Bump to 1.15.1.
* configure: Re-generate.
* config.in: Re-generate.
* aclocal.m4: Re-generate.
* gnulib/aclocal.m4: Re-generate.
* gnulib/config.in: Re-generate.
* gnulib/configure: Re-generate.
* gnulib/import/Makefile.in: Re-generate.
gdb/gdbserver/ChangeLog:
* configure.ac: Remove AC_PREREQ, add missing quoting.
* configure: Re-generate.
* config.in: Re-generate.
* aclocal.m4: Re-generate.
gdb/testsuite/ChangeLog:
* configure.ac: Remove AC_PREREQ.
* configure: Re-generate.
gold/ChangeLog:
* configure.ac: Remove AC_PREREQ, add missing quoting and usage
of AC_LANG_SOURCE.
* Makefile.in: Re-generate.
* aclocal.m4: Re-generate.
* configure: Re-generate.
* testsuite/Makefile.in: Re-generate.
gprof/ChangeLog:
* configure.ac: Remove AC_PREREQ.
* Makefile.am: Remove DISTCLEANFILES hack.
(AUTOMAKE_OPTIONS): Remove 1.11, add info-in-builddir.
* Makefile.in: Re-generate.
* aclocal.m4: Re-generate.
* configure: Re-generate.
* gconfig.in: Re-generate.
intl/ChangeLog:
* configure.ac: Add AC_USE_SYSTEM_EXTENSIONS, remove AC_PREREQ.
* configure: Re-generate.
* config.h.in: Re-generate.
* aclocal.m4: Re-generate.
ld/ChangeLog:
* configure.ac: Remove AC_PREREQ.
* Makefile.am: Remove DISTCLEANFILES hack, rename ld.texinfo to
ld.texi, ldint.texinfo to ldint.texi throughout.
(AUTOMAKE_OPTIONS): Add info-in-builddir.
* README: Rename ld.texinfo to ld.texi, ldint.texinfo to
ldint.texi throughout.
* gen-doc.texi: Likewise.
* h8-doc.texi: Likewise.
* ld.texinfo: Rename to ...
* ld.texi: ... this.
* ldint.texinfo: Rename to ...
* ldint.texi: ... this.
* Makefile.in: Re-generate.
* aclocal.m4: Re-generate.
* config.in: Re-generate.
* configure: Re-generate.
libdecnumber/ChangeLog:
* configure.ac: Remove AC_PREREQ.
* configure: Re-generate.
* aclocal.m4.
libiberty/ChangeLog:
* configure.ac: Remove AC_PREREQ.
* configure: Re-generate.
* config.in: Re-generate.
opcodes/ChangeLog:
* Makefile.am (AUTOMAKE_OPTIONS): Remove 1.11.
* configure.ac: Remove AC_PREREQ.
* Makefile.in: Re-generate.
* aclocal.m4: Re-generate.
* configure: Re-generate.
readline/ChangeLog.gdb:
* configure: Re-generate.
* examples/rlfe/configure: Re-generate.
sim/ChangeLog:
* All configure.ac: Remove AC_PREREQ.
* All configure: Re-generate.
zlib/ChangeLog.bin-gdb:
* configure.ac: Modernize AC_INIT call, remove AC_PREREQ.
* Makefile.am (AUTOMAKE_OPTIONS): Remove 1.8, cygnus, add
foreign.
* Makefile.in: Re-generate.
* aclocal.m4: Re-generate.
* configure: Re-generate.
Simon Marchi [Mon, 18 Jun 2018 15:31:15 +0000 (11:31 -0400)]
include: Sync with GCC
Bring changes from GCC in shared headers.
include/ChangeLog:
Sync with GCC
2018-05-24 Tom Rix <trix@juniper.net>
* dwarf2.def (DW_FORM_strx*, DW_FORM_addrx*): New.
2017-11-20 Kito Cheng <kito.cheng@gmail.com>
* longlong.h [__riscv] (__umulsidi3): Define.
[__riscv] (umul_ppmm): Likewise.
[__riscv] (__muluw3): Likewise.
Pedro Alves [Tue, 19 Jun 2018 17:16:40 +0000 (18:16 +0100)]
Silence -Wmaybe-uninitialized warning in minsyms.c:lookup_minimal_symbol_by_pc_section
Compiling with GCC 8.1 shows this warning:
gdb/minsyms.c: In function 'bound_minimal_symbol lookup_minimal_symbol_by_pc_section(CORE_ADDR, obj_section*, lookup_msym_prefer)':
gdb/minsyms.c:825:40: warning: 'want_type' may be used uninitialized in this function [-Wmaybe-uninitialized]
&& MSYMBOL_TYPE (&msymbol[hi]) != want_type
That warning is a false positive, because the switch that converts
enum lookup_msym_prefer values to enum enum minimal_symbol_type values
has a case for every lookup_msym_prefer enumerator:
switch (prefer)
{
case lookup_msym_prefer::TEXT:
want_type = mst_text;
break;
case lookup_msym_prefer::TRAMPOLINE:
want_type = mst_solib_trampoline;
break;
case lookup_msym_prefer::GNU_IFUNC:
want_type = mst_text_gnu_ifunc;
break;
}
The problem is that GCC assumes that enum variables may hold values
other than the named enumerators (like e.g., "lookup_msym_prefer
prefer = (lookup_msym_prefer) 10;").
Rework the code a bit, adding a gdb_assert to make it explicit to the
compiler that want_type is initialized in all normal-return paths.
gdb/ChangeLog:
2018-06-19 Pedro Alves <palves@redhat.com>
* minsyms.c (msym_prefer_to_msym_type): New, factored out from ...
(lookup_minimal_symbol_by_pc_section): ... here with
gdb_assert_not_reached added.
Pedro Alves [Tue, 19 Jun 2018 15:30:13 +0000 (16:30 +0100)]
Change inline frame breakpoint skipping logic (fix gdb.gdb/selftest.exp)
Currently, gdb.gdb/selftest.exp fails if you build GDB with
optimization (-O2, etc.).
The reason is that after setting a breakpoint in captured_main, we
stop at:
...
Breakpoint 1, captured_main_1 (context=<optimized out>) at src/gdb/main.c:492
...
while selftest_setup expects a stop at captured_main.
Here, captured_main_1 has been inlined into captured_main, and
captured_main has been inlined into gdb_main:
...
$ nm ./build/gdb/gdb | egrep ' [tT] .*captured_main|gdb_main' | c++filt
000000000061b950 T gdb_main(captured_main_args*)
...
Indeed, the two inlined functions show up in the backtrace:
...
(gdb) bt
#0 captured_main_1 (context=<optimized out>) at main.c:492
#1 captured_main (data=<optimized out>) at main.c:1147
#2 gdb_main (args=args@entry=0x7fffffffdb80) at main.c:1173
#3 0x000000000040fea5 in main (argc=<optimized out>, argv=<optimized out>)
at gdb.c:32
...
We're now stopping at captured_main_1 because commit
ddfe970e6bec
("Don't elide all inlined frames") makes GDB present a stop at the
innermost inlined frame if the program stopped by a user breakpoint.
Now, the selftest.exp testcase explicitly asks to stop at
"captured_main", not "captured_main_1", so I'm thinking that it's
GDB'S behavior that should be improved. That is what this commit
does, by only showing a stop at an inline frame if the user breakpoint
was set in that frame's block.
Before this commit:
(top-gdb) b captured_main
Breakpoint 1 at 0x792f99: file src/gdb/main.c, line 492.
(top-gdb) r
Starting program: build/gdb/gdb
Breakpoint 1, captured_main_1 (context=<optimized out>) at src/gdb/main.c:492
492 lim_at_start = (char *) sbrk (0);
(top-gdb)
After this commit, we now instead get:
(top-gdb) b captured_main
Breakpoint 1 at 0x791339: file src/gdb/main.c, line 492.
(top-gdb) r
Starting program: build/gdb/gdb
Breakpoint 1, captured_main (data=<optimized out>) at src/gdb/main.c:1147
1147 captured_main_1 (context);
(top-gdb)
and:
(top-gdb) b captured_main_1
Breakpoint 2 at 0x791339: file src/gdb/main.c, line 492.
(top-gdb) r
Starting program: build/gdb/gdb
Breakpoint 2, captured_main_1 (context=<optimized out>) at src/gdb/main.c:492
492 lim_at_start = (char *) sbrk (0);
(top-gdb)
Note that both captured_main and captured_main_1 resolved to the same
address, 0x791339. That is necessary to trigger the issue in
question. The gdb.base/inline-break.exp testcase currently does not
exercise that, but the new test added by this commit does. That new
test fails without the GDB fix and passes with the fix. No
regressions on x86-64 GNU/Linux.
While at it, the THIS_PC comparison in stopped_by_user_bp_inline_frame
is basically a nop, so just remove it -- if a software or hardware
breakpoint explains the stop, then it must be that it was installed at
the current PC.
gdb/ChangeLog:
2018-06-19 Pedro Alves <palves@redhat.com>
* inline-frame.c (stopped_by_user_bp_inline_frame): Replace PC
parameter with a block parameter. Compare location's block symbol
with the frame's block instead of addresses.
(skip_inline_frames): Pass the current block instead of the
frame's address. Break out as soon as we determine the frame
should not be skipped.
gdb/testsuite/ChangeLog:
2018-06-19 Pedro Alves <palves@redhat.com>
* gdb.opt/inline-break.c (func_inline_callee, func_inline_caller)
(func_extern_caller): New.
(main): Call func_extern_caller.
* gdb.opt/inline-break.exp: Add tests for inline frame skipping
logic change.
Andreas Schwab [Tue, 19 Jun 2018 14:39:40 +0000 (16:39 +0200)]
Fix ChangeLog entry
Andreas Schwab [Mon, 18 Jun 2018 08:29:31 +0000 (10:29 +0200)]
readelf: Handle more RISC-V relocations
* readelf.c (is_16bit_abs_reloc): Handle R_RISCV_SET16.
(is_8bit_abs_reloc): New function.
(is_6bit_abs_reloc): New function.
(is_6bit_inplace_sub_reloc): New function.
(apply_relocations): Use them. Handle 6-bit relocations.
Simon Marchi [Tue, 19 Jun 2018 00:44:50 +0000 (20:44 -0400)]
Fix ChangeLog merge conflict
I noticed that gdb/testsuite/ChangeLog had some conflict markers... this
patch fixes it.
GDB Administrator [Tue, 19 Jun 2018 00:01:05 +0000 (00:01 +0000)]
Automatic date update in version.in
Eric Botcazou [Mon, 18 Jun 2018 22:05:40 +0000 (00:05 +0200)]
This was already applied on the GCC side.
* Makefile.def (fortran): Add check-target-libgomp-fortran.
* Makefile.tpl (check-target-libgomp-fortran): New phony target.
* Makefile.in: Regenerate.
* configure: Regenerate.
Weimin Pan [Mon, 18 Jun 2018 21:15:13 +0000 (21:15 +0000)]
Fix failure to find member of a typedef base class
The test case below demonstrates the problem, as described in this PR's Comment 5:
typedef struct {
int x;
} A;
struct C : A {
int y;
};
int main()
{
C c;
return 55;
}
$ gdb a.out
(gdb) ptype C::x
Internal error: non-aggregate type to value_struct_elt_for_reference
In value_struct_elt_for_reference(), need to call check_typedef() on
the aggregate type to handle the case of *curtype being ptr->typedef.
Tested on x86_64-linux. No regressions.
Simon Marchi [Mon, 18 Jun 2018 20:21:30 +0000 (16:21 -0400)]
Remove current_traceframe declaration
The variable has been removed in c12a508 ("Add client_state struct."),
remove the leftover declaration.
gdb/gdbserver/ChangeLog:
* tracepoint.h (current_traceframe): Remove declaration.
Tom Tromey [Sun, 27 May 2018 15:33:24 +0000 (09:33 -0600)]
Use unique_xmalloc_ptr in solib-aix.c
This removes a cleanup from solib-aix.c via unique_xmalloc_ptr.
gdb/ChangeLog
2018-06-18 Tom Tromey <tom@tromey.com>
* solib-aix.c (solib_aix_get_section_offsets): Return
unique_xmalloc_ptr.
(solib_aix_solib_create_inferior_hook): Update.
Tom Tromey [Sun, 27 May 2018 15:31:26 +0000 (09:31 -0600)]
Use unique_xmalloc_ptr in darwin_current_sos
This changes darwin_current_sos to use unique_xmalloc_ptr rather than
a cleanup.
gdb/ChangeLog
2018-06-18 Tom Tromey <tom@tromey.com>
* solib-darwin.c (darwin_current_sos): Use unique_xmalloc_ptr.
Tom Tromey [Sun, 27 May 2018 15:27:56 +0000 (09:27 -0600)]
Use unique_xmalloc_ptr in two solib functions
This removes a couple of cleanups by using unique_xmalloc_ptr instead.
These two changes are combined because the two functions are very
similar.
gdb/ChangeLog
2018-06-18 Tom Tromey <tom@tromey.com>
* solib-frv.c (frv_relocate_main_executable): Use
unique_xmalloc_ptr.
* solib-dsbt.c (dsbt_relocate_main_executable): Use
unique_xmalloc_ptr.
Tom Tromey [Tue, 29 May 2018 19:51:58 +0000 (13:51 -0600)]
Remove resume_section_map_updates_cleanup
This removes resume_section_map_updates_cleanup, replacing it with a
scoped_restore.
Tested by the buildbot.
gdb/ChangeLog
2018-06-18 Tom Tromey <tom@tromey.com>
* objfiles.h (inhibit_section_map_updates): Update.
(resume_section_map_updates, resume_section_map_updates_cleanup):
Remove.
* solib-svr4.c (svr4_handle_solib_event): Update.
* objfiles.c (inhibit_section_map_updates): Return
scoped_restore_tmpl<int>.
(resume_section_map_updates, resume_section_map_updates_cleanup):
Remove.
Tom Tromey [Mon, 21 May 2018 18:35:59 +0000 (12:35 -0600)]
Use unique_xmalloc_ptr for read_string
This changes read_string's "buffer" out-parameter to be a
unique_xmalloc_ptr, then updates the users. This allows for the
removal of some cleanups.
I chose unique_xmalloc_ptr rather than byte_vector here due to the way
Guile unwinding seems to work.
Tested by the buildbot.
gdb/ChangeLog
2018-06-18 Tom Tromey <tom@tromey.com>
* valprint.h (read_string): Update.
* valprint.c (read_string): Change type of "buffer".
(val_print_string): Update.
* python/py-value.c (valpy_string): Update.
* language.h (struct language_defn) <la_get_string>: Change
type of "buffer".
(default_get_string, c_get_string): Update.
* language.c (default_get_string): Change type of "buffer".
* guile/scm-value.c (gdbscm_value_to_string): Update.
* c-lang.c (c_get_string): Change type of "buffer".
Tom Tromey [Thu, 7 Jun 2018 22:49:57 +0000 (16:49 -0600)]
Remove cleanups from ser-mingw.c
This removes the only cleanup from ser-mingw.c, replacing it with a
specialization of std::unique_ptr.
Tested by the buildbot.
gdb/ChangeLog
2018-06-18 Tom Tromey <tom@tromey.com>
* ser-mingw.c (struct pipe_state_destroyer): New.
(pipe_state_up): New typedef.
(cleanup_pipe_state): Remove.
(pipe_windows_open): Use pipe_state_up. Don't release argv.
Tom Tromey [Sat, 2 Jun 2018 05:02:37 +0000 (23:02 -0600)]
Remove la_error
While working on the parser code, I noticed that yyerror is exported
from each parser. It is used by this code in parse.c:
TRY
{
if (lang->la_parser (&ps))
lang->la_error (NULL);
}
However, it seems to me that la_error will never be called here,
because in every case, la_parser throws an exception on error -- each
implementation of yyerror just calls error.
So, this patch removes la_error and makes all the yyerror functions
static. This is handy primarily because it makes it simpler to make
the expression parsers pure.
Tested by the buildbot.
gdb/ChangeLog
2018-06-18 Tom Tromey <tom@tromey.com>
* rust-lang.h (rust_yyerror): Don't declare.
* rust-lang.c (rust_language_defn): Update.
* rust-exp.y (yyerror): Now static.
* parse.c (parse_exp_in_context_1): Update.
* p-lang.h (p_yyerror): Don't declare.
* p-lang.c (p_language_defn): Update.
* p-exp.y (yyerror): Now static.
* opencl-lang.c (opencl_language_defn): Update.
* objc-lang.c (objc_language_defn): Update.
* m2-lang.h (m2_yyerror): Don't declare.
* m2-lang.c (m2_language_defn): Update.
* m2-exp.y (yyerror): Now static.
* language.h (struct language_defn) <la_error>: Remove.
* language.c (unk_lang_error): Remove.
(unknown_language_defn, auto_language_defn): Remove.
* go-lang.h (go_yyerror): Don't declare.
* go-lang.c (go_language_defn): Update.
* go-exp.y (yyerror): Now static.
* f-lang.h (f_yyerror): Don't declare.
* f-lang.c (f_language_defn): Update.
* f-exp.y (yyerror): Now static.
* d-lang.h (d_yyerror): Don't declare.
* d-lang.c (d_language_defn): Update.
* d-exp.y (yyerror): Now static.
* c-lang.h (c_yyerror): Don't declare.
* c-lang.c (c_language_defn, cplus_language_defn)
(asm_language_defn, minimal_language_defn): Update.
* c-exp.y (yyerror): Now static.
* ada-lang.h (ada_yyerror): Don't declare.
* ada-lang.c (ada_language_defn): Update.
* ada-exp.y (yyerror): Now static.
Simon Marchi [Mon, 18 Jun 2018 13:37:12 +0000 (09:37 -0400)]
configure.ac: Sync with GCC
Here's an extra one... I'll need to make some changes to the root
configure.ac. This patch makes sure it is in sync with GCC first.
ChangeLog:
* configure.ac: Sync with GCC, remove MPX-related things.
Simon Marchi [Sat, 16 Jun 2018 03:07:44 +0000 (23:07 -0400)]
libdecnumber: Sync with GCC
Simon Marchi [Mon, 18 Jun 2018 13:37:44 +0000 (09:37 -0400)]
zlib: Sync with GCC
zlib/ChangeLog.bin-gdb:
Sync with FSF GCC sources.
Simon Marchi [Sat, 16 Jun 2018 03:07:42 +0000 (23:07 -0400)]
libiberty: Sync with GCC
Also sync include/simple-object.h, which goes together with the change
in libiberty.
Simon Marchi [Mon, 18 Jun 2018 13:32:39 +0000 (09:32 -0400)]
config: Sync with GCC
... and re-generate all possible configure files, since they may depend
on things in config/.
config/ChangeLog:
Sync with GCC
2018-06-08 Martin Liska <mliska@suse.cz>
* bootstrap-mpx.mk: Remove.
2018-05-10 Martin Liska <mliska@suse.cz>
PR bootstrap/64914
* bootstrap-ubsan.mk: Define UBSAN_BOOTSTRAP.
2018-05-09 Joshua Watt <jpewhacker@gmail.com>
* ax_pthread.m4: Add file.
2018-05-08 Richard Biener <rguenther@suse.de>
PR bootstrap/85571
* bootstrap-lto-noplugin.mk: Disable compare.
* bootstrap-lto.mk: Supply contrib/compare-lto for do-compare.
2018-04-24 H.J. Lu <hongjiu.lu@intel.com>
PR bootstrap/85490
* bootstrap-cet.mk (STAGE4_CFLAGS): New.
2018-04-24 H.J. Lu <hongjiu.lu@intel.com>
PR target/85485
* bootstrap-cet.mk (STAGE2_CFLAGS): Remove -mcet.
(STAGE3_CFLAGS): Likewise.
2018-04-24 H.J. Lu <hongjiu.lu@intel.com>
PR target/85485
* cet.m4 (GCC_CET_FLAGS): Replace -mcet with -mshstk.
2018-04-19 Jakub Jelinek <jakub@redhat.com>
* cet.m4 (GCC_CET_FLAGS): Default to --disable-cet, replace
--enable-cet=default with --enable-cet=auto.
2018-04-18 David Malcolm <dmalcolm@redhat.com>
PR jit/85384
* acx.m4 (GCC_BASE_VER): Remove \$\$ from sed expression.
Alan Modra [Mon, 18 Jun 2018 07:12:23 +0000 (16:42 +0930)]
Build ifunc tests when non-native
Plus a number of fixes to the pr23169 tests.
* testsuite/lib/ld-lib.exp (check_ifunc_available): Pass without
running executable when non-native.
(check_ifunc_attribute_available): Likewise.
* testsuite/ld-ifunc/pr23169a.rd: Remove extraneous lines. Match
st_other strings. Pass when func is an ifunc.
* testsuite/ld-ifunc/pr23169b.rd: Remove extraneous lines. Correct
reloc regexp. Correct match-anything line.
* testsuite/ld-ifunc/pr23169c.rd: Remove extraneous lines. Match
st_other strings.
Mephi [Mon, 18 Jun 2018 11:56:44 +0000 (12:56 +0100)]
Add support for the TLV relocation generated by LLVM for x86_64 MACH-O targets.
PR 23297
* mach-o-x86-64.c (x86_64_howto_table): Add entry for
BFD_RELOC_MACH_O_X86_64_RELOC_TLV.
(bfd_mach_o_x86_64_canonicalize_one_reloc): Handle the new reloc.
(bfd_mach_o_x86_64_swap_reloc_out): Likewise.
* reloc.c (BFD_RELOC_MACH_O_X86_64_TV): New entry.
* bfd-in2.h: Regenerate.
* libbfd.h: Regenerate.
Alan Hayward [Fri, 15 Jun 2018 11:23:23 +0000 (12:23 +0100)]
Ptrace support for AArch64 SVE gdbserver
Add checks to detect SVE tdesc. Easiest way to do this is by checking the
size of the vector registers.
Use the common aarch64 ptrace copy functions for reading/writing registers.
A wrapper is required due to the common functions using reg_buffer_common.
gdbserver/
* linux-aarch64-low.c (is_sve_tdesc): New function.
(aarch64_sve_regs_copy_to_regcache): Likewise.
(aarch64_sve_regs_copy_from_regcache): Likewise.
(aarch64_regs_info): Add SVE checks.
(initialize_low_arch): Initialize SVE.
Alan Hayward [Fri, 15 Jun 2018 11:21:31 +0000 (12:21 +0100)]
Ptrace support for Aarch64 SVE
Add support for reading and writing registers for Aarch64 SVE.
We need to support the cases where the kernel only gives us a
fpsimd structure. This occurs when there is no active SVE state
in the kernel (for example, after starting a new process).
Added checks to make sure the vector length has not changed whilst
the process is running.
gdb/
* aarch64-linux-nat.c (fetch_sveregs_from_thread): New function.
(store_sveregs_to_thread): Likewise.
(aarch64_linux_fetch_inferior_registers): Check for SVE.
(aarch64_linux_store_inferior_registers): Likewise.
* nat/aarch64-sve-linux-ptrace.c (aarch64_sve_get_sveregs): New
function.
(aarch64_sve_regs_copy_to_regcache): Likewise.
(aarch64_sve_regs_copy_from_regcache): Likewise.
* nat/aarch64-sve-linux-ptrace.h (aarch64_sve_get_sveregs): New
declaration.
(aarch64_sve_regs_copy_to_regcache): Likewise.
(aarch64_sve_regs_copy_from_regcache): Likewise.
(sve_context): Structure from Linux headers.
(SVE_SIG_ZREGS_SIZE): Define from Linux headers.
(SVE_SIG_ZREG_SIZE): Likewise.
(SVE_SIG_PREG_SIZE): Likewise.
(SVE_SIG_FFR_SIZE): Likewise.
(SVE_SIG_REGS_OFFSET): Likewise.
(SVE_SIG_ZREGS_OFFSET): Likewise.
(SVE_SIG_ZREG_OFFSET): Likewise.
(SVE_SIG_ZREGS_SIZE): Likewise.
(SVE_SIG_PREGS_OFFSET): Likewise.
(SVE_SIG_PREG_OFFSET): Likewise.
(SVE_SIG_PREGS_SIZE): Likewise.
(SVE_SIG_FFR_OFFSET): Likewise.
(SVE_SIG_REGS_SIZE): Likewise.
(SVE_SIG_CONTEXT_SIZE): Likewise.
(SVE_PT_REGS_MASK): Likewise.
(SVE_PT_REGS_FPSIMD): Likewise.
(SVE_PT_REGS_SVE): Likewise.
(SVE_PT_VL_INHERIT): Likewise.
(SVE_PT_VL_ONEXEC): Likewise.
(SVE_PT_REGS_OFFSET): Likewise.
(SVE_PT_FPSIMD_OFFSET): Likewise.
(SVE_PT_FPSIMD_SIZE): Likewise.
(SVE_PT_SVE_ZREG_SIZE): Likewise.
(SVE_PT_SVE_PREG_SIZE): Likewise.
(SVE_PT_SVE_FFR_SIZE): Likewise.
(SVE_PT_SVE_FPSR_SIZE): Likewise.
(SVE_PT_SVE_FPCR_SIZE): Likewise.
(__SVE_SIG_TO_PT): Likewise.
(SVE_PT_SVE_OFFSET): Likewise.
(SVE_PT_SVE_ZREGS_OFFSET): Likewise.
(SVE_PT_SVE_ZREG_OFFSET): Likewise.
(SVE_PT_SVE_ZREGS_SIZE): Likewise.
(SVE_PT_SVE_PREGS_OFFSET): Likewise.
(SVE_PT_SVE_PREG_OFFSET): Likewise.
(SVE_PT_SVE_PREGS_SIZE): Likewise.
(SVE_PT_SVE_FFR_OFFSET): Likewise.
(SVE_PT_SVE_FPSR_OFFSET): Likewise.
(SVE_PT_SVE_FPCR_OFFSET): Likewise.
(SVE_PT_SVE_SIZE): Likewise.
(SVE_PT_SIZE): Likewise.
(HAS_SVE_STATE): New define.
gdbserver/
* Makefile.in: Add aarch64-sve-linux-ptrace.c.
Alan Hayward [Thu, 14 Jun 2018 09:10:03 +0000 (10:10 +0100)]
Add Aarch64 SVE compatibility macros
This header provides compatibility support for SVE allow building
even when the underlying host system lacks support for SVE.
If the binary is then run on an SVE-enabled kernel then support
will automatically be available.
gdb/
* nat/aarch64-sve-linux-sigcontext.h: New file.
* nat/aarch64-sve-linux-ptrace.h (SVE_VQ_BYTES): Move to
new files.
(SVE_VQ_MIN): Likewise.
(SVE_VQ_MAX): Likewise.
(SVE_VL_MIN): Likewise.
(SVE_VL_MAX): Likewise.
(SVE_NUM_ZREGS): Likewise.
(SVE_NUM_PREGS): Likewise.
(sve_vl_valid): Likewise.
(struct user_sve_header): Likewise.
Tom de Vries [Mon, 11 Jun 2018 11:34:57 +0000 (13:34 +0200)]
[gdb/testsuite/ada] Fix number-of-bp test in bp_inlined_func.exp
At the moment, bp_inlined_func.exp passes for a combined current gcc and
gdb-binutils repos build but fails for a build with system gcc (7.3.1) and
ld (2.29.1).
It checks for 4 breakpoints on read_small:
...
gdb_test "break read_small" \
"Breakpoint $decimal at $hex: read_small\\. \\(4 locations\\)" \
"set breakpoint at read_small"
...
and fails because it gets 5 breakpoint locations instead:
...
(gdb) break read_small
Breakpoint 2 at 0x401f9a: read_small. (5 locations)
(gdb) FAIL: gdb.ada/bp_inlined_func.exp: set breakpoint at read_small
...
The 4 expected breakpoint locations are inlined versions of read_small, and
the 5th breakpoint location has this address:
...
(gdb) info breakpoint
Num Type Disp Enb Address What
1 breakpoint keep y <MULTIPLE>
1.1 y 0x0000000000401f9a in b.read_small
at bp_inlined_func/b.adb:20
...
which is the read_small function itself:
...
(gdb) x 0x0000000000401f9a
0x401f9a <b__read_small+4>: 0x22f8058b
...
This patch updates the test to allow 5 breakpoint locations.
Tested on the configurations mentioned above, on x86_64.
2018-06-18 Tom de Vries <tdevries@suse.de>
* gdb.ada/bp_inlined_func.exp: Allow 5 breakpoint locations.
GDB Administrator [Mon, 18 Jun 2018 00:01:09 +0000 (00:01 +0000)]
Automatic date update in version.in
GDB Administrator [Sun, 17 Jun 2018 00:00:41 +0000 (00:00 +0000)]
Automatic date update in version.in
Andrew Burgess [Thu, 10 May 2018 22:52:49 +0000 (23:52 +0100)]
gdb: Don't drop SIGSTOP during stop_all_threads
This patch fixes an issue where GDB would sometimes hang when
attaching to a multi-threaded process. This issue was especially
likely to trigger if the machine (running the inferior) was under
load.
In summary, the problem is an imbalance between two functions in
linux-nat.c, stop_callback and stop_wait_callback. In stop_callback
we send SIGSTOP to a thread, but _only_ if the thread is not already
stopped, and if it is not signalled, which means it should stop soon.
In stop_wait_callback we wait for the SIGSTOP to arrive, however, we
are aware that the thread might have been signalled for some other
reason, and so if a signal other than SIGSTOP causes the thread to
stop then we stash that signal away so it can be reported back later.
If we get a SIGSTOP then this is discarded, after all, this signal was
sent from stop_callback. Except that this might not be the case, it
could be that SIGSTOP was sent to a thread from elsewhere in GDB, in
which case we would not have sent another SIGSTOP from stop_callback
and the SIGSTOP received in stop_wait_callback should not be ignored.
Below I've laid out the exact sequence of events that I saw that lead
me to track down the above diagnosis.
After attaching to the inferior GDB sends a SIGSTOP to all of the
threads and then returns to the event loop waiting for interesting
things to happen.
Eventually the first target event is detected (this will be the first
SIGSTOP arriving) and GDB calls inferior_event_handler which calls
fetch_inferior_event. Inside fetch_inferior_event GDB calls
do_target_wait which calls target_wait to find a thread with an event.
The target_wait call ends up in linux_nat_wait_1, which first checks
to see if any threads already have stashed stop events to report, and
if there are none then we enter a loop fetching as many events as
possible out of the kernel. This event fetching is non-blocking, and
we give up once the kernel has no more events ready to give us.
All of the events from the kernel are passed through
linux_nat_filter_event which stashes the wait status for all of the
threads that reported a SIGSTOP, these will be returned by future
calls to linux_nat_wait_1.
Lets assume for a moment that we've attached to a multi-threaded
inferior, and that all but one thread has reported its stop during the
initial wait call in linux_nat_wait_1. The other thread will be
reporting a SIGSTOP, but the kernel has not yet managed to deliver
that signal to GDB before GDB gave up waiting and continued handling
the events it already had. GDB selects one of the threads that has
reported a SIGSTOP and passes this thread ID back to
fetch_inferior_event.
To handle the thread's SIGSTOP, GDB calls handle_signal_stop, which
calls stop_all_threads, this calls wait_one, which in turn calls
target_wait.
The first call to target_wait at this point will result in a stashed
wait status being returned, at which point we call setup_inferior.
The call to setup_inferior leads to a call into try_thread_db_load_1
which results in a call to linux_stop_and_wait_all_lwps. This in turn
calls stop_callback on each thread followed by stop_wait_callback on
each thread.
We're now ready to make the mistake. In stop_callback we see that our
problem thread is not stopped, but is signalled, so it should stop
soon. As a result we don't send another SIGSTOP.
We then enter stop_wait_callback, eventually the problem thread stops
with SIGSTOP which we _incorrectly_ assume came from stop_callback,
and we discard.
Once stop_wait_callback has done its damage we return from
linux_stop_and_wait_all_lwps, finish in try_thread_db_load_1, and
eventually unwind back to the call to setup_inferior in
stop_all_threads. GDB now loops around, and performs another
target_wait to get the next event from the inferior.
The target_wait calls causes us to once again reach linux_nat_wait_1,
and we pass through some code that calls resume_stopped_resumed_lwps.
This allows GDB to resume threads that are physically stopped, but
which GDB doesn't see any good reason for the thread to remain
stopped. In our case, the problem thread which had its SIGSTOP
discarded is stopped, but doesn't have a stashed wait status to
report, and so GDB sets the thread going again.
We are now stuck waiting for an event on the problem thread that might
never arrive.
When considering how to write a test for this bug I struggled. The
issue was only spotted _randomly_ when a machine was heavily loaded
with many multi-threaded applications, and GDB was being attached (by
script) to all of these applications in parallel. In one reproducer I
required around 5 applications each of 5 threads per machine core in
order to reproduce the bug 2 out of 3 times.
What we really want to do though is simulate the kernel being slow to
report events through waitpid during the initial attach. The solution
I came up with was to write an LD_PRELOAD library that intercepts
(some) waitpid calls and rate limits them to one per-second. Any more
than that simply return 0 indicating there's no event available.
Obviously this can only be applied to waitpid calls that have the
WNOHANG flag set.
Unfortunately, once you ignore a waitpid call GDB can get a bit stuck.
Usually, once the kernel has made a child status available to waitpid
GDB will be sent a SIGCHLD signal. However, if the kernel makes 5
child statuses available but, due to the preload library we only
collect one of them, then the kernel will not send any further SIGCHLD
signals, and so, when GDB, thinking that the remaining statuses have
not yet arrived sits waiting for a SIGCHLD it will be disappointed.
The solution, implemented within the preload library, is that, when we
hold back a waitpid result from GDB we spawn a new thread. This
thread delays for a short period, and then sends GDB a SIGCHLD. This
causes GDB to retry the waitpid, at which point sufficient time has
passed and our library allows the waitpid call to complete.
gdb/ChangeLog:
* linux-nat.c (stop_wait_callback): Don't discard SIGSTOP if it
was requested by GDB.
gdb/testsuite/ChangeLog:
* gdb.threads/attach-slow-waitpid.c: New file.
* gdb.threads/attach-slow-waitpid.exp: New file.
* gdb.threads/slow-waitpid.c: New file.
GDB Administrator [Sat, 16 Jun 2018 00:00:56 +0000 (00:00 +0000)]
Automatic date update in version.in
Tom de Vries [Thu, 14 Jun 2018 21:52:30 +0000 (23:52 +0200)]
[gdb] Add me to write-after-approval section in MAINTAINERS
I've committed one patch modifying gdb ([gdb/cli] Honour 'print pretty' when
printing result of finish command) and I'm covered by the Novell blanket
copyright assignment. So AFAIU, I qualify for write-after-approval.
This patch adds me to the MAINTAINERS file in the write-after-approval section.
2018-06-15 Tom de Vries <tdevries@suse.de>
* MAINTAINERS (Write After Approval): Add Tom de Vries.
GDB Administrator [Fri, 15 Jun 2018 00:00:48 +0000 (00:00 +0000)]
Automatic date update in version.in
Simon Marchi [Thu, 14 Jun 2018 22:38:23 +0000 (18:38 -0400)]
update-gnulib.sh: Report required versions of autoconf/aclocal
Update the messages printed when the wrong version of autoconf/aclocal
is found to include the expected version too, like we already do for
automake.
gdb/ChangeLog:
* gnulib/update-gnulib.sh: Print expected versions of
autoconf/aclocal.
Simon Marchi [Thu, 14 Jun 2018 22:23:39 +0000 (18:23 -0400)]
type alignment: Use type_length_units
The type alignment value is returned in 8-bit-bytes instead of target
memory addressable units. For example, on a target with 16-bit-bytes
where sizeof(int) == 1 (one addressable unit), alignof(int) currently
returns 2. After, this patch, it returns 1.
gdb/ChangeLog:
* arch-utils.c (default_type_align): Use type_length_units.
* gdbtypes.c (type_align): Use type_length_units.
Sergio Durigan Junior [Thu, 14 Jun 2018 21:46:15 +0000 (17:46 -0400)]
Fix "beneath" conversion on AIX
GDB build on AIX is broken according to BuildBot:
../../binutils-gdb/gdb/aix-thread.c: In member function 'virtual void aix_thread_target::mourn_inferior()':
../../binutils-gdb/gdb/aix-thread.c:1735:34: error: 'beneath' cannot be used as a function
target_ops *beneath = beneath ();
^
This obvious commit fixes it. There's apparently another issue
breaking the build there, but that's unrelated.
gdb/ChangeLog:
2018-06-14 Sergio Durigan Junior <sergiodj@redhat.com>
* aix-thread.c (aix_thread_target::xfer_partial): Use
"beneath" as a method.
Faraz Shahbazker [Thu, 14 Jun 2018 20:34:49 +0000 (21:34 +0100)]
MIPS: Add Global INValidate ASE support
Add support for the Global INValidate Application Specific Extension
for Release 6 of the MIPS Architecture.
[1] "MIPS Architecture for Programmers Volume II-A: The MIPS32
Instruction Set Manual", Imagination Technologies Ltd., Document
Number: MD00086, Revision 6.06, December 15, 2016, Section 3.2
"Alphabetical List of Instructions", pp. 187-191
bfd/
* elfxx-mips.c (print_mips_ases): Add GINV extension.
binutils/
* readelf.c (print_mips_ases): Add GINV extension.
gas/
* NEWS: Mention MIPS Global INValidate ASE support.
* config/tc-mips.c (options): Add OPTION_GINV and OPTION_NO_GINV.
(md_longopts): Likewise.
(mips_ases): Define availability for GINV.
(mips_convert_ase_flags): Map ASE_GINV to AFL_ASE_GINV.
(md_show_usage): Add help for -mginv and -mno-ginv.
* doc/as.texinfo: Document -mginv, -mno-ginv.
* doc/c-mips.texi: Document -mginv, -mno-ginv, .set ginv and
.set noginv.
* testsuite/gas/mips/ase-errors-1.s: Add error checks for GINV
ASE.
* testsuite/gas/mips/ase-errors-2.s: Likewise.
* testsuite/gas/mips/ase-errors-1.l: Likewise.
* testsuite/gas/mips/ase-errors-2.l: Likewise.
* testsuite/gas/mips/ginv.d: New test.
* testsuite/gas/mips/ginv-err.d: New test.
* testsuite/gas/mips/ginv-err.l: New test stderr output.
* testsuite/gas/mips/ginv.s: New test source.
* testsuite/gas/mips/ginv-err.s: New test source.
* testsuite/gas/mips/mips.exp: Run the new tests.
include/
* elf/mips.h (AFL_ASE_GINV, AFL_ASE_RESERVED1): New macros.
(AFL_ASE_MASK): Update to include AFL_ASE_GINV.
* opcode/mips.h: Document "+\" operand format.
(ASE_GINV): New macro.
opcodes/
* mips-dis.c (mips_arch_choices): Add GINV to mips32r6 and
mips64r6 descriptors.
(parse_mips_ase_option): Handle -Mginv option.
(print_mips_disassembler_options): Document -Mginv.
* mips-opc.c (decode_mips_operand) <+\>: New operand format.
(GINV): New macro.
(mips_opcodes): Define ginvi and ginvt.
Maciej W. Rozycki [Thu, 14 Jun 2018 20:34:48 +0000 (21:34 +0100)]
MIPS: Add CRC ASE support (ChangeLog)
Add missing ChangeLog entry in gas/ for NEWS from commit
730c31740a69
("MIPS: Add CRC ASE support").
Tom de Vries [Thu, 14 Jun 2018 20:25:38 +0000 (22:25 +0200)]
[gdb] Fixup incomplete patch
0dbfed25e9
Philippe Waroquiers [Mon, 4 Jun 2018 21:21:00 +0000 (23:21 +0200)]
Fix/improve on-line help of 'define' command.
There is an inconsistency between the doc and the online help.
=> the doc is correct, so fixing/improving the on-line help.
2018-06-14 Philippe Waroquiers <philippe.waroquiers@skynet.be>
* cli/cli-script.c (_initialize_cli_script): Fix online documentation
of 'define' command.
Tom de Vries [Sun, 10 Jun 2018 14:19:17 +0000 (16:19 +0200)]
[gdb] Add 'Concept Index' entry '&' for background execution
GDB's execution commands have a foreground and background variant: f.i.,
there's 'continue' and 'continue&', and both are listed individually in the
'Command, Variable, and Function Index'. But the '&' is not listed in the
'Concept Index' as being connected with the concept background execution.
This patch adds an '&' in the 'Concept Index':
...
* $_, $__, and value history: Memory. (line 119)
+* &, background execution of commands: Background Execution.
+ (line 16)
* --annotate: Mode Options. (line 121)
...
pointing to this line in 'Background Execution':
...
To specify background execution, add a '&' to the command.
...
Build on x86_64.
2018-06-14 Tom de Vries <tdevries@suse.de>
* gdb.texinfo (Background Execution): Add @cindex for '&'.
Pedro Alves [Thu, 14 Jun 2018 16:47:03 +0000 (17:47 +0100)]
Avoid gdb.base/fork-running-state.exp lingering processes
Currently, the gdb.base/fork-running-state.exp testcase leaves a few
processes lingering until a 3 minutes alarm kills them:
pedro 28308 1 0 13:55 ? 00:00:00 /home/pedro/gdb/binutils-gdb/build/gdb/testsuite/outputs/gdb.base/fork-running-state/fork-running-state
pedro 28340 1 0 13:55 ? 00:00:00 /home/pedro/gdb/binutils-gdb/build/gdb/testsuite/outputs/gdb.base/fork-running-state/fork-running-state
pedro 28372 1 0 13:55 ? 00:00:00 /home/pedro/gdb/binutils-gdb/build/gdb/testsuite/outputs/gdb.base/fork-running-state/fork-running-state
pedro 28400 1 0 13:55 ? 00:00:00 /home/pedro/gdb/binutils-gdb/build/gdb/testsuite/outputs/gdb.base/fork-running-state/fork-running-state
pedro 28431 1 0 13:55 ? 00:00:00 /home/pedro/gdb/binutils-gdb/build/gdb/testsuite/outputs/gdb.base/fork-running-state/fork-running-state
pedro 28463 1 0 13:55 ? 00:00:00 /home/pedro/gdb/binutils-gdb/build/gdb/testsuite/outputs/gdb.base/fork-running-state/fork-running-state
Those processes used to kill themselves, but that was changed by
commit
f50d8a2eaea0 ("Fix gdb.base/fork-running-state.exp race").
This commit restores the self-killing, but only in the cases gdb won't
try killing the processes, thus avoiding the old race.
(The restored code in fork_parent isn't exactly the same as it was.
In this version, we're exiting immediately when 'wait' returns
success, while in the old version we'd loop again and end up in the
perror call. The output from that perror call is not expected by the
"kill inferior" tests, and would result in a test FAIL.)
gdb/testsuite/ChangeLog:
2018-06-14 Pedro Alves <palves@redhat.com>
* gdb.base/fork-running-state.c: Include <errno.h>.
(exit_if_relative_exits): New.
(fork_child): If 'exit_if_relative_exits' is true, exit if the parent
exits.
(fork_parent): If 'exit_if_relative_exits' is true, exit if the
child exits.
Tom de Vries [Fri, 8 Jun 2018 10:37:53 +0000 (12:37 +0200)]
[gdb/cli] Honour 'print pretty' when printing result of finish command
Consider this testcase:
...
struct s {
int a;
int b;
};
struct s foo ()
{
struct s r;
r.a = 1;
r.b = 2;
return r;
}
int
main (void)
{
struct s v;
v = foo ();
return v.a + v.b;
}
...
When we compile it with -g, load the exec with gdb, and run till the end of foo,
we can print r:
...
(gdb) p r
$1 = {a = 1, b = 2}
...
and by setting pretty printing to on, we can get the fields of r printed each
on its own line:
...
(gdb) set print pretty
(gdb) p r
$2 = {
a = 1,
b = 2
}
...
However, when we finish foo, the printed function result value is not using
the pretty printing setting:
...
(gdb) finish
Run till exit from #0 foo () at test.c:11
0x00000000004004c1 in main () at test.c:18
18 v = foo ();
Value returned is $3 = {a = 1, b = 2}
...
This patch fixes that by using get_user_print_options instead of
get_no_prettyformat_print_options in print_return_value_1, which gives us:
...
(gdb) finish
Run till exit from #0 foo () at test.c:11
0x00000000004004c1 in main () at test.c:18
18 v = foo ();
Value returned is $2 = {
a = 1,
b = 2
}
...
Build & reg-tested on x86_64.
2018-06-14 Tom de Vries <tdevries@suse.de>
PR cli/22573
* infcmd.c (print_return_value_1): Use get_user_print_options instead of
get_no_prettyformat_print_options.
* gdb.base/finish-pretty.c: New test.
* gdb.base/finish-pretty.exp: New file.
H.J. Lu [Thu, 14 Jun 2018 12:37:19 +0000 (05:37 -0700)]
elf: Check if the first symbol version is base version
Check VER_FLG_BASE instead of assuming that the first symbol version is
base version.
bfd/
PR binutils/23267
* elf.c (_bfd_elf_get_symbol_version_string): Check if the first
symbol version is base version.
binutils/
PR binutils/23267
* readelf.c (get_symbol_version_string): Check if the first
symbol version is base version.
Pedro Alves [Thu, 14 Jun 2018 11:54:09 +0000 (12:54 +0100)]
Revert accidental push of "Inline breakpoints" commit
Pedro Alves [Thu, 14 Jun 2018 11:25:41 +0000 (12:25 +0100)]
gdb.gdb/selftest.exp, Use multi_line to build gdb's expected startup output
This regex had to be touched at least twice these past few days. Use
multi_line to make it more readable.
Note this also tightens the regex a little bit in some spots.
gdb/testsuite/ChangeLog:
2018-06-14 Pedro Alves <palves@redhat.com>
* gdb.gdb/selftest.exp (test_with_self): Use multi_line to build
gdb's expected startup output.
Pedro Alves [Thu, 14 Jun 2018 11:23:56 +0000 (12:23 +0100)]
Inline breakpoints
gdb/ChangeLog:
yyyy-mm-dd Pedro Alves <palves@redhat.com>
* inline-frame.c (stopped_by_user_bp_inline_frame): Replace PC
parameter with a block parameter. Compare location's block symbol
with the frame's block instead of addresses.
(skip_inline_frames): Pass the current block instead of the
frame's address. Break out as soon as we determine the frame
should not be skipped.
gdb/testsuite/ChangeLog:
yyyy-mm-dd Pedro Alves <palves@redhat.com>
* gdb.opt/inline-break.c (func_callee, func_caller): New.
(main): Call func_caller.
Pedro Alves [Thu, 14 Jun 2018 10:40:23 +0000 (11:40 +0100)]
Remove stale inline function handling from selftest_setup
Before commit
70ee000084aa ("[gdb] Allow function arguments in bp
print match in selftest_setup"), this pattern in selftest_setup:
-re "Starting program.*Breakpoint \[0-9\]+,.* at .*main.c:.*$function.*$gdb_prompt $" {
# $function may be inlined, so the program stops at the line
# calling $function.
pass "$description"
}
happened to match if captured_main_1 was inlined and captured_main was
not, because captured_main calls captured_main_1 first thing, which
coincidentally matches "$function.*":
Breakpoint 1, captured_main (data=<optimized out>) at src/gdb/main.c:1147
1147 captured_main_1 (context);
That would probably be better "$function .*", with a space, but I
think that even better is to remove the "may be inlined" case too now,
because since
ddfe970e6bec ("Don't elide all inlined frames") GDB
presents the stop at the inline function instead of at the caller.
gdb/testsuite/ChangeLog:
2018-06-14 Pedro Alves <palves@redhat.com>
* lib/selftest-support.exp (selftest_setup): Remove inlined
function handling.
Tom de Vries [Tue, 12 Jun 2018 13:02:10 +0000 (15:02 +0200)]
[gdb] Allow function arguments in bp print match in selftest_setup
2018-06-14 Tom de Vries <tdevries@suse.de>
* lib/selftest-support.exp (selftest_setup): Allow function arguments in
matching of breakpoint printing.
Tom de Vries [Thu, 14 Jun 2018 09:08:32 +0000 (11:08 +0200)]
[gdb/testsuite] Add missing ChangeLog entries
Alan Modra [Wed, 13 Jun 2018 23:29:12 +0000 (08:59 +0930)]
ELF dynsyms
Many ELF targets arrange to emit a number of section symbols in
.dynsym for use by dynamic relocations. This happens before the
dynamic relocations are output, and the need for those symbols
determined. In most cases they are not needed. A proper analysis of
the need for dynamic section symbols is target specific and tedious,
so this patch just excludes them in the obvious case when no
dynamic relocations are present.
The patch also runs the new pr23161 and pr23162 tests on more targets.
bfd/
* elf-bfd.h (struct elf_link_hash_table): Add "dynamic_relocs".
* elflink.c (_bfd_elf_init_2_index_sections): Comment fix.
(_bfd_elf_add_dynamic_entry): Set "dynamic_relocs".
(_bfd_elf_link_renumber_dynsyms): Exclude all section symbols when
"dynamic_relocs" is not set.
* elfxx-mips.c (count_section_dynsyms): Likewise.
ld/
* testsuite/ld-elf/readelf.exp: Delete DUMP and selection of
variant ver_def.vd.
* testsuite/ld-elf/ver_def-tic6x.vd: Delete.
* testsuite/ld-elf/shared.exp: Run most pr23161 and pr23162 tests for
linux, nacl and gnu targets.
* testsuite/ld-mips-elf/mips-elf.exp: Set base_syms to 1.
* testsuite/ld-elf/pr23161a.rd: Don't check reloc type. Allow any
order of __bss_start, _edata and _end.
* testsuite/ld-elf/pr23161b.rd: Don't check plt and dyn relocs.
Allow and order of __bss_start, _edata and _end.
* testsuite/ld-elf/pr23162.rd: Fail if __bss_start, _edata or _end
relocs are present rather than testing for no relocations.
* testsuite/ld-aarch64/gc-plt-relocs.d,
* testsuite/ld-aarch64/ifunc-1-local.d,
* testsuite/ld-aarch64/ifunc-1.d,
* testsuite/ld-aarch64/ifunc-2-local.d,
* testsuite/ld-aarch64/ifunc-2.d,
* testsuite/ld-aarch64/ifunc-21.d,
* testsuite/ld-aarch64/ifunc-3a.d,
* testsuite/ld-arm/farcall-mixed-lib-v4t.d,
* testsuite/ld-arm/farcall-mixed-lib.d,
* testsuite/ld-arm/gc-hidden-1.d,
* testsuite/ld-arm/tls-gdesc-got.d,
* testsuite/ld-arm/tls-lib-loc.d,
* testsuite/ld-arm/tls-longplt-lib.d,
* testsuite/ld-arm/tls-thumb1.d,
* testsuite/ld-cris/libdso-10.d,
* testsuite/ld-cris/libdso-11.d,
* testsuite/ld-cris/libdso-13b.d,
* testsuite/ld-cris/libdso-14.d,
* testsuite/ld-cris/libdso-15.d,
* testsuite/ld-cris/pic-gc-72.d,
* testsuite/ld-cris/pic-gc-73.d,
* testsuite/ld-cris/tls-gc-71.d,
* testsuite/ld-mips-elf/mips16-pic-4a.nd,
* testsuite/ld-mips-elf/pic-and-nonpic-3a.dd,
* testsuite/ld-mips-elf/pie-n32.d,
* testsuite/ld-mips-elf/pie-n64.d,
* testsuite/ld-mips-elf/pie-o32.d: Update for removed dynamic
section symbols.
Alan Modra [Wed, 13 Jun 2018 14:27:17 +0000 (23:57 +0930)]
PR23282, Reinstate seek optimization
PR 23282
* bfdio.c (bfd_seek): Optimize away seeks to current position.
Simon Marchi [Thu, 14 Jun 2018 01:57:10 +0000 (21:57 -0400)]
Fix GDB sparc build
Cross-compiling for sparc64 bumped into a few issues, fixed by this
patch.
1. Include target.h in sparc-nat.h fixes:
/home/emaisin/src/binutils-gdb/gdb/sparc-nat.h:45:8: error: ‘target_xfer_status’ does not name a type
extern target_xfer_status sparc_xfer_wcookie (enum target_object object,
2. Remove extra semi-colon at sparc64-linux-nat.c:40 fixes:
/home/emaisin/src/binutils-gdb/gdb/sparc64-linux-nat.c:41:3: error: expected unqualified-id before ‘{’ token
{ sparc_store_inferior_registers (this, regcache, regnum); }
3. Remove "this" argument fixes:
/home/emaisin/src/binutils-gdb/gdb/sparc64-linux-nat.c: In member function ‘virtual void sparc64_linux_nat_target::fetch_registers(regcache*, int)’:
/home/emaisin/src/binutils-gdb/gdb/sparc64-linux-nat.c:38:59: error: cannot convert ‘sparc64_linux_nat_target*’ to ‘regcache*’ for argument ‘1’ to ‘void sparc_fetch_inferior_registers(regcache*, int)’
{ sparc_fetch_inferior_registers (this, regcache, regnum); }
^
/home/emaisin/src/binutils-gdb/gdb/sparc64-linux-nat.c: In member function ‘virtual void sparc64_linux_nat_target::store_registers(regcache*, int)’:
/home/emaisin/src/binutils-gdb/gdb/sparc64-linux-nat.c:41:59: error: cannot convert ‘sparc64_linux_nat_target*’ to ‘regcache*’ for argument ‘1’ to ‘void sparc_store_inferior_registers(regcache*, int)’
{ sparc_store_inferior_registers (this, regcache, regnum); }
^
4. Use sparc64_forget_process instead of sparc_forget_process fixes:
/home/emaisin/src/binutils-gdb/gdb/sparc64-linux-nat.c: In member function ‘virtual void sparc64_linux_nat_target::low_forget_process(pid_t)’:
/home/emaisin/src/binutils-gdb/gdb/sparc64-linux-nat.c:47:30: error: ‘sparc_forget_process’ was not declared in this scope
{ sparc_forget_process (pid); }
^
gdb/ChangeLog:
* sparc-nat.h: Include target.h.
* sparc64-linux-nat.c (class sparc64_linux_nat_target)
<fetch_registers>: Remove this argument in function call.
<store_registers>: Remove this argument in function call, remove
extra semicolon.
<low_forget_process>: Call sparc64_forget_process instead of
sparc_forget_process.
GDB Administrator [Thu, 14 Jun 2018 00:00:36 +0000 (00:00 +0000)]
Automatic date update in version.in
Scott Egerton [Wed, 13 Jun 2018 14:39:05 +0000 (15:39 +0100)]
MIPS: Add CRC ASE support
Add support for the CRC Application Specific Extension for Release 6 of
the MIPS Architecture.
[1] "MIPS Architecture for Programmers Volume II-A: The MIPS32
Instruction Set Manual", Imagination Technologies Ltd., Document
Number: MD00086, Revision 6.06, December 15, 2016, Section 3.2
"Alphabetical List of Instructions", pp. 143-148
[2] "MIPS Architecture for Programmers Volume II-A: The MIPS64
Instruction Set Manual", Imagination Technologies Ltd., Document
Number: MD00087, Revision 6.06, December 15, 2016, Section 3.2
"Alphabetical List of Instructions", pp. 165-170
ChangeLog:
bfd/
2018-06-13 Scott Egerton <scott.egerton@imgtec.com>
Faraz Shahbazker <Faraz.Shahbazker@mips.com>
* elfxx-mips.c (print_mips_ases): Add CRC.
binutils/
2018-06-13 Scott Egerton <scott.egerton@imgtec.com>
Faraz Shahbazker <Faraz.Shahbazker@mips.com>
* readelf.c (print_mips_ases): Add CRC.
gas/
2018-06-13 Scott Egerton <scott.egerton@imgtec.com>
Faraz Shahbazker <Faraz.Shahbazker@mips.com>
Maciej W. Rozycki <macro@mips.com>
* config/tc-mips.c (options): Add OPTION_CRC and OPTION_NO_CRC.
(md_longopts): Likewise.
(md_show_usage): Add help for -mcrc and -mno-crc.
(mips_ases): Define availability for CRC and CRC64.
(mips_convert_ase_flags): Map ASE_CRC to AFL_ASE_CRC.
* doc/as.texinfo: Document -mcrc, -mno-crc.
* doc/c-mips.texi: Document -mcrc, -mno-crc, .set crc and
.set no-crc.
* testsuite/gas/mips/ase-errors-1.l: Add error checks for CRC
ASE.
* testsuite/gas/mips/ase-errors-2.l: Likewise.
* testsuite/gas/mips/ase-errors-1.s: Likewise.
* testsuite/gas/mips/ase-errors-2.s: Likewise.
* testsuite/gas/mips/crc.d: New test.
* testsuite/gas/mips/crc64.d: New test.
* testsuite/gas/mips/crc-err.d: New test.
* testsuite/gas/mips/crc64-err.d: New test.
* testsuite/gas/mips/crc-err.l: New test stderr output.
* testsuite/gas/mips/crc64-err.l: New test stderr output.
* testsuite/gas/mips/crc.s: New test source.
* testsuite/gas/mips/crc64.s: New test source.
* testsuite/gas/mips/crc-err.s: New test source.
* testsuite/gas/mips/crc64-err.s: New test source.
* testsuite/gas/mips/mips.exp: Run the new tests.
include/
2018-06-13 Scott Egerton <scott.egerton@imgtec.com>
Faraz Shahbazker <Faraz.Shahbazker@mips.com>
* elf/mips.h (AFL_ASE_CRC): New macro.
(AFL_ASE_MASK): Update to include AFL_ASE_CRC.
* opcode/mips.h (ASE_CRC): New macro.
* opcode/mips.h (ASE_CRC64): Likewise.
opcodes/
2018-06-13 Scott Egerton <scott.egerton@imgtec.com>
Faraz Shahbazker <Faraz.Shahbazker@mips.com>
* mips-dis.c (mips_arch_choices): Add CRC and CRC64 ASEs.
* mips-opc.c (CRC, CRC64): New macros.
(mips_builtin_opcodes): Define crc32b, crc32h, crc32w,
crc32cb, crc32ch and crc32cw for CRC. Define crc32d and
crc32cd for CRC64.
Tom de Vries [Sun, 10 Jun 2018 13:21:31 +0000 (15:21 +0200)]
[gdb/testsuite] Fix hang in fork-running-state.c
When I run make check:
...
$ cd build/gdb
$ make check 2>&1 | tee ../CHECKLOG.gdb
...
I see after ~30m the summary of the test run printed, but make still hangs.
This seems to be due to some sleeping processes:
...
$ ps fx | grep fork-run
6475 ? S 0:00 gdb.base/fork-running-state/fork-running-state
6451 ? S 0:00 gdb.base/fork-running-state/fork-running-state
6427 ? S 0:00 gdb.base/fork-running-state/fork-running-state
...
Killing the sleeping processes like this:
...
kill -9 $(ps -A | grep fork-running-st | awk '{print $1}')
...
allows make to finish.
If I isolate one debug session from fork-running-state.exp that causes one of
these sleeping processes, we get:
...
(gdb) set non-stop on
(gdb) break main
Breakpoint 1 at 0x400665: file src/gdb/testsuite/gdb.base/fork-running-state.c,
line 52.
(gdb) run
Starting program: build/gdb/testsuite/outputs/gdb.base/fork-running-state/
fork-running-state
Breakpoint 1, main () at src/gdb/testsuite/gdb.base/fork-running-state.c:52
52 save_parent = getpid ();
(gdb) set detach-on-fork on
(gdb) set follow-fork parent
(gdb) continue &
Continuing.
[Detaching after fork from child process 18797]
(gdb) info threads
Id Target Id Frame
* 1 process 18793 "fork-running-st" (running)
(gdb) set print inferior-events off
(gdb) kill inferior 1
...
So, AFAIU, the hanging process is the child process that gdb detaches from.
There's an alarm set in main before the fork, but alarms are not preserved in
the fork child:
...
$ man alarm
...
NOTES
Alarms created by alarm() are preserved across execve(2) and are not
inherited by children created via fork(2).
...
So, AFAIU, once the parent is killed, there's no alarm to terminate the child.
The patch fixes this by moving the setting of the alarm into the
fork_main/fork_child functions, making sure that an alarm will trigger for
the child.
Tested with make check on x86_64.
2018-06-13 Tom de Vries <tdevries@suse.de>
PR testsuite/23269
* gdb.base/fork-running-state.c (main): Move setting of alarm ...
(fork_child): ... here, and ...
(fork_parent): ... here.
Tom de Vries [Mon, 11 Jun 2018 13:35:54 +0000 (15:35 +0200)]
[gdb/testsuite] Update gdb startup text in selftest.exp
Atm selftest.exp fails for me.
One of the reasons is that in
c61b06a19a34baab66e3809c7b41b0c31009ed9f (Remove
some text from --version output) an eol was added after "There is NO
WARRANTY, to the extent permitted by law".
This patch updates the matching of the gdb startup message in selftest.exp
accordingly.
Tested selftest.exp (with two other selftest.exp related fixes applied).
2018-06-12 Tom de Vries <tdevries@suse.de>
* gdb.gdb/selftest.exp (test_with_self): Update gdb startup text.
Nick Clifton [Wed, 13 Jun 2018 10:51:15 +0000 (11:51 +0100)]
Fix problems with objdump.1: Unbalanced group in command synopsis. You probably forgot to open or close a [ ] or { } group properly.
* doc/binutils.texi (objdump): Add missing closing square
parenthesis to listing of objcopy's command line options.
Rainer Orth [Wed, 13 Jun 2018 09:05:51 +0000 (11:05 +0200)]
Fix procfs.c compilation
procfs.c currently doesn't compile on Solaris:
/vol/src/gnu/gdb/gdb/local/gdb/procfs.c: In function `void _initialize_procfs()':
/vol/src/gnu/gdb/gdb/local/gdb/procfs.c:3734:15: error: invalid initialization of reference of type `const target_info&' from expression of type `procfs_target*'
add_target (&the_procfs_target);
^~~~~~~~~~~~~~~~~~
In file included from /vol/src/gnu/gdb/gdb/local/gdb/inferior.h:40,
from /vol/src/gnu/gdb/gdb/local/gdb/procfs.c:24:
/vol/src/gnu/gdb/gdb/local/gdb/target.h:2305:13: note: in passing argument 1 of `void add_target(const target_info&, void (*)(const char*, int), void (*)(cmd_list_element*, completion_tracker&, const char*, const char*))'
extern void add_target (const target_info &info,
^~~~~~~~~~
/vol/src/gnu/gdb/gdb/local/gdb/procfs.c: In member function `virtual char* procfs_target::make_corefile_notes(bfd*, int*)':
/vol/src/gnu/gdb/gdb/local/gdb/procfs.c:3898:16: error: too many arguments to function `gdb::optional<std::vector<unsigned char, gdb::default_init_allocator<unsigned char, std::allocator<unsigned char> > > > target_read_alloc(target_ops*, target_object, const char*)'
NULL, &auxv);
^
In file included from /vol/src/gnu/gdb/gdb/local/gdb/inferior.h:40,
from /vol/src/gnu/gdb/gdb/local/gdb/procfs.c:24:
/vol/src/gnu/gdb/gdb/local/gdb/target.h:341:40: note: declared here
extern gdb::optional<gdb::byte_vector> target_read_alloc
^~~~~~~~~~~~~~~~~
/vol/src/gnu/gdb/gdb/local/gdb/procfs.c:3898:16: error: cannot convert `gdb::optional<std::vector<unsigned char, gdb::default_init_allocator<unsigned char, std::allocator<unsigned char> > > >' to `int' in assignment
NULL, &auxv);
^
Fixed as follows. Built and ran make check on 64-bit Solaris 11.5/x86
(amd64-pc-solaris2.11) only.
* procfs.c (_initialize_procfs): Use add_inf_child_target.
(procfs_target::make_corefile_notes): Adjust to new
target_read_alloc return type.
GDB Administrator [Wed, 13 Jun 2018 00:00:44 +0000 (00:00 +0000)]
Automatic date update in version.in
Andrew Burgess [Wed, 23 May 2018 16:06:02 +0000 (17:06 +0100)]
gdb: Run INF_EXEC_COMPLETE handler for additional cases
When making an inferior call, and non-stop mode is off, then, once the
inferior call is complete all threads will be stopped, and we should
run the INF_EXEC_COMPLETE handler. This will result in a call to
'target_async(0)' to remove the event handlers for the target.
This was discussed by Yao Qi in this mailing list thread:
https://sourceware.org/ml/gdb/2017-10/msg00032.html
Without this then the target event handlers are left in place even
when the target is stopped, which is different to what happens during
a standard stop proceedure (for example when one thread hits a
breakpoint).
gdb/ChangeLog:
PR gdb/22882
* infrun.c (fetch_inferior_event): If GDB is not proceeding then
run INF_EXEC_COMPLETE handler, even when not calling normal_stop.
Move should_notify_stop local into more inner scope.
Andrew Burgess [Wed, 23 May 2018 13:25:20 +0000 (14:25 +0100)]
gdb: Mark async event handler when event is already pending
In PR22882 inferior functions are called on different threads while
scheduler-locking is turned on. This results in a hang. This was
discussed in this mailing list thread:
https://sourceware.org/ml/gdb/2017-10/msg00032.html
The problem is that when the thread is set running in order to execute
the inferior call, a call to target_async is made. If the target is
not already registered as 'target_async' then this will install the
async event handler, AND unconditionally mark the handler as having an
event pending.
However, if the target is already registered as target_async then the
event handler is not installed (its already installed) and the
handler is NOT marked as having an event pending.
If we try to set running a thread that already has a pending event,
then we do want to set target_async, however, there will not be an
external event incoming (the thread is already stopped) so we rely on
manually marking the event handler as having a pending event in order
to see the threads pending stop event. This is fine, if, at the point
where we call target_async, the target is not already marked as async.
But, if it is, then the event handler will not be marked as ready, and
the threads pending stop event will never be processed.
A similar pattern of code can be seen in linux_nat_target::resume,
where, when a thread has a pending event, the call to target_async is
followed by a call to async_file_mark to ensure that the pending
thread event will be processed, even if target_async was already set.
gdb/ChangeLog:
PR gdb/22882
* infrun.c (resume_1): Add call to mark_async_event_handler.
gdb/testsuite/ChangeLog:
* gdb.threads/multiple-successive-infcall.exp: Remove kfail case,
rewrite test to describe action performed, rather than possible
failure.
Andrew Burgess [Wed, 23 May 2018 13:24:28 +0000 (14:24 +0100)]
gdb: Fix an infrun debug log message
Run the test gdb.threads/multiple-successive-infcall.exp by hand, if
you turn on 'debug infrun 1', you'll see that the debug line fixed in
this commit is printed and contains the wrong $pc value. Fixed in
this commit.
gdb/ChangeLog:
* infrun.c (do_target_wait): Change old version of $pc printed.
Hans-Peter Nilsson [Tue, 12 Jun 2018 16:37:19 +0000 (18:37 +0200)]
testsuite/ld-cris/libdso-1.d: Correct recent address pattern update.
Nick Clifton [Tue, 12 Jun 2018 12:22:24 +0000 (13:22 +0100)]
Fix the PR22983 test so that it will work regardless of the order of the symbols in the dynamic symbol table.
See email thread starting here for more details:
https://sourceware.org/ml/binutils/2018-06/msg00036.html
PR 22983
* testsuite/ld-plugin/lto.exp: Use individual tests to check for
the presence of each expected symbol.
* testsuite/ld-plugin/pr22983.1.d: New file.
* testsuite/ld-plugin/pr22983.2.d: New file.
* testsuite/ld-plugin/pr22983.3.d: New file.
* testsuite/ld-plugin/pr22983.4.d: New file.
Nick Clifton [Tue, 12 Jun 2018 11:45:49 +0000 (12:45 +0100)]
Fix syntax error in AArch64 default linker scripts when invoked with -shared.
* emulparams/aarch64elf.sh (OTHER_BSS_END_SYMBOLS): Make the
definition of the __bss_end__ symbol conditional upon CREATE_SHLIB.
Simon Marchi [Tue, 12 Jun 2018 01:51:25 +0000 (21:51 -0400)]
Rename some functions, index -> gdb_index
Since we now have two index formats, DWARF5/debug_names and gdb_index, I
wanted to rename some functions to make it clear that they deal with the
gdb_index format specifically.
gdb/ChangeLog:
* dwarf2read.c (read_index_from_section): Rename to...
(read_gdb_index_from_section): ... this, update all callers.
(dwarf2_read_index): Rename to...
(dwarf2_read_gdb_index): ... this, update all callers.
John David Anglin [Tue, 12 Jun 2018 01:15:32 +0000 (21:15 -0400)]
Fix gdb build on hppa-linux
Fixes:
CXX hppa-linux-nat.o
../../src/gdb/hppa-linux-nat.c:277:17: error: no 'void hppa_linux_nat_target::fetch_inferior_registers(regcache*, int)' member function declared in class 'hppa_linux_nat_target'
int regno)
^
../../src/gdb/hppa-linux-nat.c:224:1: error: 'void fetch_register(regcache*, int)' defined but not used [-Werror=unused-function]
fetch_register (struct regcache *regcache, int regno)
^~~~~~~~~~~~~~
gdb/ChangeLog:
* gdb/hppa-linux-nat.c
(hppa_linux_nat_target::fetch_inferior_registers): Rename to
hppa_linux_nat_target::fetch_registers.
GDB Administrator [Tue, 12 Jun 2018 00:00:49 +0000 (00:00 +0000)]
Automatic date update in version.in
Eli Zaretskii [Mon, 11 Jun 2018 17:30:11 +0000 (20:30 +0300)]
Fix build of GDB documentation.
gdb/doc/ChangeLog
2018-06-11 Eli Zaretskii <eliz@gnu.org>
* gdb.texinfo (Maintenance Commands): Add a missing @anchor.