external/binutils.git
6 years agolibiberty: Sync with GCC
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.

6 years agoconfig: Sync with GCC
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.

6 years agoBuild ifunc tests when non-native
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.

6 years agoAdd support for the TLV relocation generated by LLVM for x86_64 MACH-O targets.
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.

6 years agoPtrace support for AArch64 SVE gdbserver
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.

6 years agoPtrace support for Aarch64 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.

6 years agoAdd Aarch64 SVE compatibility macros
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.

6 years ago[gdb/testsuite/ada] Fix number-of-bp test in bp_inlined_func.exp
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.

6 years agoAutomatic date update in version.in
GDB Administrator [Mon, 18 Jun 2018 00:01:09 +0000 (00:01 +0000)]
Automatic date update in version.in

6 years agoAutomatic date update in version.in
GDB Administrator [Sun, 17 Jun 2018 00:00:41 +0000 (00:00 +0000)]
Automatic date update in version.in

6 years agogdb: Don't drop SIGSTOP during stop_all_threads
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.

6 years agoAutomatic date update in version.in
GDB Administrator [Sat, 16 Jun 2018 00:00:56 +0000 (00:00 +0000)]
Automatic date update in version.in

6 years ago[gdb] Add me to write-after-approval section in MAINTAINERS
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.

6 years agoAutomatic date update in version.in
GDB Administrator [Fri, 15 Jun 2018 00:00:48 +0000 (00:00 +0000)]
Automatic date update in version.in

6 years agoupdate-gnulib.sh: Report required versions of autoconf/aclocal
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.

6 years agotype alignment: Use type_length_units
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.

6 years agoFix "beneath" conversion on AIX
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.

6 years agoMIPS: Add Global INValidate ASE support
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.

6 years agoMIPS: Add CRC ASE support (ChangeLog)
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").

6 years ago[gdb] Fixup incomplete patch 0dbfed25e9
Tom de Vries [Thu, 14 Jun 2018 20:25:38 +0000 (22:25 +0200)]
[gdb] Fixup incomplete patch 0dbfed25e9

6 years agoFix/improve on-line help of 'define' command.
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.

6 years ago[gdb] Add 'Concept Index' entry '&' for background execution
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 '&'.

6 years agoAvoid gdb.base/fork-running-state.exp lingering processes
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.

6 years ago[gdb/cli] Honour 'print pretty' when printing result of finish command
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.

6 years agoelf: Check if the first symbol version is base version
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.

6 years agoRevert accidental push of "Inline breakpoints" commit
Pedro Alves [Thu, 14 Jun 2018 11:54:09 +0000 (12:54 +0100)]
Revert accidental push of "Inline breakpoints" commit

6 years agogdb.gdb/selftest.exp, Use multi_line to build gdb's expected startup output
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.

6 years agoInline breakpoints
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.

6 years agoRemove stale inline function handling from selftest_setup
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.

6 years ago[gdb] Allow function arguments in bp print match in selftest_setup
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.

6 years ago[gdb/testsuite] Add missing ChangeLog entries
Tom de Vries [Thu, 14 Jun 2018 09:08:32 +0000 (11:08 +0200)]
[gdb/testsuite] Add missing ChangeLog entries

6 years agoELF dynsyms
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.

6 years agoPR23282, Reinstate seek optimization
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.

6 years agoFix GDB sparc build
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.

6 years agoAutomatic date update in version.in
GDB Administrator [Thu, 14 Jun 2018 00:00:36 +0000 (00:00 +0000)]
Automatic date update in version.in

6 years agoMIPS: Add CRC ASE support
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.

6 years ago[gdb/testsuite] Fix hang in fork-running-state.c
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.

6 years ago[gdb/testsuite] Update gdb startup text in selftest.exp
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.

6 years agoFix problems with objdump.1: Unbalanced group in command synopsis. You probably forgo...
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.

6 years agoFix procfs.c compilation
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.

6 years agoAutomatic date update in version.in
GDB Administrator [Wed, 13 Jun 2018 00:00:44 +0000 (00:00 +0000)]
Automatic date update in version.in

6 years agogdb: Run INF_EXEC_COMPLETE handler for additional cases
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.

6 years agogdb: Mark async event handler when event is already pending
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.

6 years agogdb: Fix an infrun debug log message
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.

6 years agotestsuite/ld-cris/libdso-1.d: Correct recent address pattern update.
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.

6 years agoFix the PR22983 test so that it will work regardless of the order of the symbols...
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.

6 years agoFix syntax error in AArch64 default linker scripts when invoked with -shared.
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.

6 years agoRename some functions, index -> gdb_index
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.

6 years agoFix gdb build on hppa-linux
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.

6 years agoAutomatic date update in version.in
GDB Administrator [Tue, 12 Jun 2018 00:00:49 +0000 (00:00 +0000)]
Automatic date update in version.in

6 years agoFix build of GDB documentation.
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.

6 years agoMIPS/GAS: Correct `-O0' and `-O' option help, add `-O1' and `-O2'
Maciej W. Rozycki [Mon, 11 Jun 2018 14:27:42 +0000 (15:27 +0100)]
MIPS/GAS: Correct `-O0' and `-O' option help, add `-O1' and `-O2'

Match commit 4ffff32f75b1 ("Match mips_optimize to the -O option
supplied") and adjust `--help' output for `-O0', `-O', `-O1' and `-O2'
options.

gas/
* config/tc-mips.c (md_show_usage): Correct help text for `-O0'
and `-O'.  Mention `-O1'.  Add `-O2' and its description.

6 years agoEnable Aarch64 SVE for gdbserver
Alan Hayward [Mon, 11 Jun 2018 09:32:52 +0000 (10:32 +0100)]
Enable Aarch64 SVE for gdbserver

gdbserver/
* linux-aarch64-ipa.c (get_ipa_tdesc): Add null VQ param.
(initialize_low_tracepoint): Likewise
* linux-aarch64-low.c (aarch64_arch_setup): Get VQ.
* linux-aarch64-tdesc-selftest.c (aarch64_tdesc_test): Add null VQ
param.
* linux-aarch64-tdesc.c (aarch64_linux_read_description): Add VQ
checks.
* linux-aarch64-tdesc.h (aarch64_linux_read_description): Add VQ.

6 years agoUpdated Spanish translations for the binutils/ and ld/ subdirectories.
Nick Clifton [Mon, 11 Jun 2018 09:51:16 +0000 (10:51 +0100)]
Updated Spanish translations for the binutils/ and ld/ subdirectories.

* po/es.po: Updated Spanish translation.

6 years agoIncrease gdbsever PBUFSIZ
Alan Hayward [Mon, 11 Jun 2018 09:29:20 +0000 (10:29 +0100)]
Increase gdbsever PBUFSIZ

PBUFSIZ is no longer big enough for SVE. Increase accordingly.

gdbserver/
            * server.h (PBUFSIZ): Increase size

6 years agoAdd Aarch64 SVE dwarf regnums
Alan Hayward [Mon, 11 Jun 2018 09:24:20 +0000 (10:24 +0100)]
Add Aarch64 SVE dwarf regnums

This is as per the spec:
https://developer.arm.com/products/architecture/a-profile/docs/100985/0000

gdb/
* aarch64-tdep.c (aarch64_dwarf_reg_to_regnum): Add mappings.
* aarch64-tdep.h (AARCH64_DWARF_SVE_VG): Add define.
(AARCH64_DWARF_SVE_FFR): Likewise.
(AARCH64_DWARF_SVE_P0): Likewise.
(AARCH64_DWARF_SVE_Z0): Likewise.

6 years agoAdd regcache raw_compare method
Alan Hayward [Mon, 11 Jun 2018 09:09:30 +0000 (10:09 +0100)]
Add regcache raw_compare method

gdb/
* common/common-regcache.h (raw_compare): New function.
* regcache.c (regcache::raw_compare): Likewise.
* regcache.h (regcache::raw_compare): New declaration.

gdbserver/
* regcache.c (regcache::raw_compare): New function.
* regcache.h (regcache::raw_compare): New declaration.

6 years agoAdd reg_buffer_common
Alan Hayward [Mon, 11 Jun 2018 09:09:16 +0000 (10:09 +0100)]
Add reg_buffer_common

A purely virtual class containing functions from gdb/regcache.h

Both the gdb regcache structures and gdbserver regcache inherit
directly from reg_buffer_common. This will allow for common
functions which require the use of a regcache.

gdb/
* common/common-regcache.h (reg_buffer_common): New structure.
* regcache.c (reg_buffer::invalidate): Move from detached_regcache.
(reg_buffer::raw_supply): Likewise.
(reg_buffer::raw_supply_integer): Likewise.
(reg_buffer::raw_supply_zeroed): Likewise.
(reg_buffer::raw_collect): Likewise.
(reg_buffer::raw_collect_integer): Likewise.
* regcache.h (reg_buffer::invalidate): Move from detached_regcache.
(reg_buffer::raw_supply): Likewise.
(reg_buffer::raw_supply_integer): Likewise.
(reg_buffer::raw_supply_zeroed): Likewise.
(reg_buffer::raw_collect): Likewise.
(reg_buffer::raw_collect_integer): Likewise.

gdbserver/
* regcache.c (new_register_cache): Use new.
(free_register_cache): Use delete.
(register_data): Use const.
(supply_register): Move body inside regcache.
(regcache::raw_supply): New override function.
(collect_register): Move body inside regcache.
(regcache::raw_collect): New override function.
(regcache::get_register_status): New override function.
* regcache.h (struct regcache): Inherit from reg_buffer_common.

6 years agoRemove use of queue from remote.c
Tom Tromey [Thu, 7 Jun 2018 12:26:55 +0000 (06:26 -0600)]
Remove use of queue from remote.c

This removes a use of the queue data structure (common/queue.h) from
remote.c.

The queue is replaced with a std::vector.  A queue was not needed, as
the code never de-queued items.

This removes quite a bit of boilerplate code, mostly involved with
marshalling arguments to be passed through the queue iterator.

Tested by the buildbot.

gdb/ChangeLog
2018-06-10  Tom Tromey  <tom@tromey.com>

* remote.c (stop_reply_p): Remove typedef.  Don't declare queue.
(class remote_state) <stop_reply_queue>: Now std::vector.
(remote_state::~remote_state)
(remote_target::stop_reply_queue_length): Update.
(struct queue_iter_param, remove_child_of_pending_fork)
(struct check_pending_event_prevents_wildcard_vcont_callback_data)
(check_pending_event_prevents_wildcard_vcont_callback)
(remove_stop_reply_for_inferior)
(remove_stop_reply_of_remote_state)
(remote_notif_remove_once_on_match)
(stop_reply_match_ptid_and_ws)
(remote_kill_child_of_pending_fork): Remove.
(remote_target::remove_new_fork_children)
(remote_target::check_pending_events_prevent_wildcard_vcont)
(remote_target::discard_pending_stop_replies)
(remote_target::discard_pending_stop_replies_in_queue)
(remote_target::remote_notif_remove_queued_reply)
(remote_target::queued_stop_reply)
(remote_target::push_stop_reply, remote_target::peek_stop_reply)
(remote_target::wait, remote_target::kill_new_fork_children)
(remote_target::async): Update.

6 years agoRemove cleanups from record-full.c
Tom Tromey [Thu, 7 Jun 2018 21:56:37 +0000 (15:56 -0600)]
Remove cleanups from record-full.c

This removes cleanups from record-full.c.  In this case, the cleanups
were only ever run when an exception was thrown.  So, I replaced these
with try/catch, rather than introduce a new specialized RAII type.

Tested by the buildbot.

gdb/ChangeLog
2018-06-10  Tom Tromey  <tom@tromey.com>

* record-full.c (record_full_arch_list_cleanups): Remove.
(record_full_message): Use try/catch.
(record_full_wait_cleanups): Remove.
(record_full_wait_1): Use try/catch.
(record_full_restore): Likewise.

6 years agoRemove a VEC from record-full.c
Tom Tromey [Thu, 7 Jun 2018 23:22:49 +0000 (17:22 -0600)]
Remove a VEC from record-full.c

This replaces a VEC in record-full.c with a std::vector.  This version
of the patch also catches a memory leak in the original code noticed
by Simon.

Tested by the buildbot.

gdb/ChangeLog
2018-06-10  Tom Tromey  <tom@tromey.com>

* record-full.c (record_full_breakpoint_p): Remove typedef.  Don't
declare VEC.  Add constructor.
<in_target_beneath>: Now bool.
(record_full_breakpoints): Now a std::vector, static.
(record_full_sync_record_breakpoints)
(record_full_init_record_breakpoints)
(record_full_target::insert_breakpoint)
(record_full_target::remove_breakpoint): Update.  Don't use XNEW.

6 years agoRemove more "struct" keywords in range-based for loops
Simon Marchi [Mon, 11 Jun 2018 02:33:37 +0000 (22:33 -0400)]
Remove more "struct" keywords in range-based for loops

GCC 6.3.0 produces this kind of errors:

  CXX    dwarf2read.o
/home/simark/src/binutils-gdb/gdb/dwarf2read.c: In function 'void process_cu_includes(dwarf2_per_objfile*)':
/home/simark/src/binutils-gdb/gdb/dwarf2read.c:10220:8: error: types may not be defined in a for-range-declaration [-Werror]
   for (struct dwarf2_per_cu_data *iter : dwarf2_per_objfile->just_read_cus)
        ^~~~~~

Removing the struct keyword makes it happy.

gdb/ChangeLog:

* dwarf2read.c (process_cu_includes): Remove struct keyword.
* serial.c (serial_interface_lookup): Remove struct keyword.

6 years agoAutomatic date update in version.in
GDB Administrator [Mon, 11 Jun 2018 00:01:03 +0000 (00:01 +0000)]
Automatic date update in version.in

6 years agoFix some missed "beneath" conversions
Tom Tromey [Sun, 10 Jun 2018 14:24:04 +0000 (08:24 -0600)]
Fix some missed "beneath" conversions

The buildbot pointed out that arm-linux-nat.c was not properly using
"beneath" as a method.  A search showed a few more places with this
issue.

Tested by the buildbot, though of course this only checked
arm-linux-nat.c.  Nevertheless I'm checking this in under the obvious
rule.

gdb/ChangeLog
2018-06-10  Tom Tromey  <tom@tromey.com>

* procfs.c (procfs_target::xfer_partial): Use "beneath" as a
method.
* nto-procfs.c (nto_procfs_target::xfer_partial): Use "beneath" as
a method.
* go32-nat.c (go32_nat_target::xfer_partial): Use "beneath" as a
method.
* arm-linux-nat.c (arm_linux_nat_target::read_description): Use
"beneath" as a method.
* arm-fbsd-nat.c (arm_fbsd_nat_target::read_description):
Use "beneath" as a method.

6 years agoRemove cleanups from tracefile.c
Tom Tromey [Thu, 7 Jun 2018 22:06:41 +0000 (16:06 -0600)]
Remove cleanups from tracefile.c

This removes cleanups from tracefile.c, by introducing a unique_ptr
specialization.

This code could be made even simpler via a deeper C++-ification, but I
have not attempted that.

Tested by the buildbot.

gdb/ChangeLog
2018-06-10  Tom Tromey  <tom@tromey.com>

* tracefile.c (struct trace_file_writer_deleter): New.
<operator()>: Rename from trace_file_writer_xfree.
(trace_file_writer_up): New typedef.
(tsave_command, trace_save_tfile, trace_save_ctf): Update.

6 years agoUse std::unique_ptr in reg_buffer
Simon Marchi [Sun, 10 Jun 2018 02:30:34 +0000 (22:30 -0400)]
Use std::unique_ptr in reg_buffer

Using std::unique_ptr allows to remove the manual xfree in the
destructor.

If I understand correctly, using the () after the new operator will make
sure the allocated objects will be value initialized, which for scalars
means they are zero-initialized.  So it should have the same behavior as
XCNEWVEC.

gdb/ChangeLog:

* regcache.h (reg_buffer) <~reg_buffer>: Use default destructor.
<m_registers, m_register_status>: Change type to
std::unique_ptr.
* regcache.c (reg_buffer::reg_buffer): Use new instead of
XCNEWVEC.

6 years agoChange type of reg_buffer::m_register_status to register_status
Simon Marchi [Sun, 10 Jun 2018 02:08:06 +0000 (22:08 -0400)]
Change type of reg_buffer::m_register_status to register_status

The type of reg_buffer::m_register_status is an array of signed char,
probably to ensure that each element takes up only one byte.  Instead,
since we use C++11, we can force the underlying type of register_status
to be signed char and use the enum type.

gdb/ChangeLog:

* common/common-regcache.h (enum register_status): Add
underlying type "signed char".
* regcache.h (reg_buffer) <m_register_status>: Change type to
register_status *.
* regcache.c (reg_buffer::reg_buffer): Alocate arrays of
register_status instead of signed char.
(reg_buffer::save): Use REG_UNKNOWN instead of 0.
(reg_buffer::get_register_status): Remove cast.
(readable_regcache::raw_read): Remove cast.
(readable_regcache::cooked_read): Remove cast.

6 years agoAutomatic date update in version.in
GDB Administrator [Sun, 10 Jun 2018 00:01:24 +0000 (00:01 +0000)]
Automatic date update in version.in

6 years agoRemove use of queue.h from gdbserver/event-loop.c
Tom Tromey [Thu, 7 Jun 2018 22:28:22 +0000 (16:28 -0600)]
Remove use of queue.h from gdbserver/event-loop.c

This removes a use of queue.h from gdbserver/event-loop.c, replacing
it with std::queue.

I was not completely sure whether std::queue is even that useful.
Perhaps plain std::list could be used just as easily.

Tested by the buildbot.

gdb/gdbserver/ChangeLog
2018-06-09  Tom Tromey  <tom@tromey.com>

* event-loop.c (gdb_event, gdb_event_p): Remove typedefs.  Don't
declare queue.
(event_queue): Use std::queue.
(gdb_event_xfree): Remove.
(initialize_event_loop, process_event, wait_for_event): Update.

6 years agoRemove two more uses of make_cleanup_close
Tom Tromey [Thu, 7 Jun 2018 22:20:12 +0000 (16:20 -0600)]
Remove two more uses of make_cleanup_close

This removes two more uses of make_cleanup_close, replacing them with
relatively straightforward uses of scoped_fd.

Tested by the buildbot.

gdb/ChangeLog
2018-06-09  Tom Tromey  <tom@tromey.com>

* source.c (reverse_search_command, forward_search_command): Use
scoped_fd.

6 years agoRemove a VEC from serial.c
Tom Tromey [Thu, 7 Jun 2018 23:25:41 +0000 (17:25 -0600)]
Remove a VEC from serial.c

This replaces a VEC in serial.c with a std::vector.

Tested by the buildbot.

gdb/ChangeLog
2018-06-09  Tom Tromey  <tom@tromey.com>

* serial.c (serial_ops_p): Remove typedef.  Don't declare VEC.
(serial_ops_list): Now static, std::vector.
(serial_interface_lookup, serial_add_interface): Update.

6 years agoRemove a VEC from dwarf2read.c
Tom Tromey [Fri, 8 Jun 2018 04:11:47 +0000 (22:11 -0600)]
Remove a VEC from dwarf2read.c

This removes a VEC from dwarf2read.c, replacing it with a std::vector.

Tested by the buildbot.

gdb/ChangeLog
2018-06-09  Tom Tromey  <tom@tromey.com>

* dwarf2read.c (process_cu_includes): Update.
(process_full_comp_unit): Update.
* dwarf2read.h (struct dwarf2_per_objfile) <just_read_cus>: Now a
std::vector.

6 years agoMIPS/LD/testsuite: Add microMIPS lazy binding stub tests
Maciej W. Rozycki [Sat, 9 Jun 2018 00:09:23 +0000 (01:09 +0100)]
MIPS/LD/testsuite: Add microMIPS lazy binding stub tests

Adapt the existing regular MIPS lazy binding stub tests for microMIPS
code verification.  Check both regular and `--insn32' variants.

Correct indentation issues in the conditional updated.

ld/
* testsuite/ld-mips-elf/stub-dynsym-micromips-1-7fff.d: New
test.
* testsuite/ld-mips-elf/stub-dynsym-micromips-1-8000.d: New
test.
* testsuite/ld-mips-elf/stub-dynsym-micromips-1-fff0.d: New
test.
* testsuite/ld-mips-elf/stub-dynsym-micromips-1-10000.d: New
test.
* testsuite/ld-mips-elf/stub-dynsym-micromips-1-2fe80.d: New
test.
* testsuite/ld-mips-elf/stub-dynsym-micromips-insn32-1-7fff.d:
New test.
* testsuite/ld-mips-elf/stub-dynsym-micromips-insn32-1-8000.d:
New test.
* testsuite/ld-mips-elf/stub-dynsym-micromips-insn32-1-fff0.d:
New test.
* testsuite/ld-mips-elf/stub-dynsym-micromips-insn32-1-10000.d:
New test.
* testsuite/ld-mips-elf/stub-dynsym-micromips-insn32-1-2fe80.d:
New test.
* testsuite/ld-mips-elf/mips-elf.exp: Run the new tests.  Fix
indentation.

6 years agoMIPS/LD/testsuite: Fix lazy binding stub test symbol count comment
Maciej W. Rozycki [Sat, 9 Jun 2018 00:09:23 +0000 (01:09 +0100)]
MIPS/LD/testsuite: Fix lazy binding stub test symbol count comment

Update the symbol count in the comment associated with lazy binding stub
tests to match `base_syms', complementing commit 889acb80acd5
("MIPS/Linux/LD/testsuite: Linker script _gp scope updates"),
<https://sourceware.org/ml/binutils/2012-08/msg00066.html>, and commit
2f9efdfcdbf1 ("mips/bfd/ld: Fix --as-needed on mips and update related
ld tests"), <https://sourceware.org/ml/binutils/2013-09/msg00131.html>.

ld/
* testsuite/ld-mips-elf/mips-elf.exp: Update symbol count in the
comment associated with lazy binding stub tests.

6 years agoMIPS/LD: Add missing `mips-*-windiss' target emulation dependency
Maciej W. Rozycki [Sat, 9 Jun 2018 00:09:22 +0000 (01:09 +0100)]
MIPS/LD: Add missing `mips-*-windiss' target emulation dependency

As from commit 2ebd05b80b22 ("MIPS/LD: Correct `mips-*-windiss' target
emulation configuration") we have:

EXTRA_EM_FILE=mipself

in `emulparams/elf32mipswindiss.sh', however no corresponding Makefile
`mipself.em' dependency for `eelf32mipswindiss.c'.  Add it.

ld/
* Makefile.am (eelf32mipswindiss.c): Add `mipself.em' dependency.
* Makefile.in: Regenerate.

6 years agoAutomatic date update in version.in
GDB Administrator [Sat, 9 Jun 2018 00:00:45 +0000 (00:00 +0000)]
Automatic date update in version.in

6 years agoAdd missing client_state struct references to win target.
Stan Cox [Fri, 8 Jun 2018 20:40:52 +0000 (16:40 -0400)]
Add missing client_state struct references to win target.

gdbserver/ChangeLog
* win32-low.c (win32_create_inferior):  last_ptid and last_status
moved to client_state.

6 years agoMake gdbreplay use more common routines
Pedro Alves [Fri, 8 Jun 2018 19:48:28 +0000 (20:48 +0100)]
Make gdbreplay use more common routines

This makes gdbreplay share a bit more code with gdbserver, and paves
the way to share more in future.  Including common-defs.h pulls in
defines and headers that gdb and gdbserver assume are always
defined/available too, such as for example _(), ansidecl.h or a set of
system headers.  Including that revealed (static vs extern conflict)
gdbreplay had a local copy of perror_with_name (which exited directly
instead of throwing an error).  So I removed gdbreplay's local copy,
and then added enough .o files until gdbreplay linked successfully.

Also, use xstrdup instead of strdup.

gdb/gdbserver/ChangeLog:
2018-06-08  Pedro Alves  <palves@redhat.com>

* Makefile.in (GDBREPLAY_OBS): Add common/cleanups.o,
common/common-exceptions.o, common/common-utils.o,
common/errors.o, common/print-utils.o and utils.o.
* gdbreplay.c: Include "common-defs.h" instead of the two
'config.h's here.  Don't include stdio.h, errno.h, stdlib.h,
string.h or alloca.h.
(perror_with_name): Delete.
(remote_open): Use xstrdup instead of strdup.
(main): Rename to ...
(captured_main): ... this.
(main): New.

6 years agold/x86: Remove hidden _edata, __bss_start, and _end
H.J. Lu [Fri, 8 Jun 2018 19:41:31 +0000 (12:41 -0700)]
ld/x86: Remove hidden _edata, __bss_start, and _end

There is no need to put hidden _edata, __bss_start, and _end in dynamic
symbol table in shared libraries.

bfd/

PR ld/23161
* elfxx-x86.c (elf_x86_hide_linker_defined): New function.
(_bfd_x86_elf_link_check_relocs): Use it to hide hidden
__bss_start, _end and _edata in shared libraries.

ld/

PR ld/23161
* testsuite/ld-elf/pr23161d.rd: Remove local _edata, __bss_start,
and _end from dynamic symbol table.

6 years agoFix build issue with Python 3.7
Paul Koning [Fri, 8 Jun 2018 17:26:36 +0000 (13:26 -0400)]
Fix build issue with Python 3.7

Originally reported in
https://bugzilla.redhat.com/show_bug.cgi?id=1577396 -- gdb build fails
with Python 3.7 due to references to a Python internal function whose
declaration changed in 3.7.

gdb/ChangeLog
2018-06-08  Paul Koning  <paul_koning@dell.com>

    PR gdb/23252

    * python/python.c (do_start_initialization):
    Avoid call to internal Python API.
    (init__gdb_module): New function.

6 years agolinux: Add maintenance commands to test libthread_db
Gary Benson [Fri, 8 Jun 2018 17:06:46 +0000 (18:06 +0100)]
linux: Add maintenance commands to test libthread_db

This commit adds two new commands which may be used to test thread
debugging libraries used by GDB:

  * "maint check libthread-db" tests the thread debugging library GDB
     is using for the current inferior.

  * "maint set/show check-libthread-db" selects whether libthread_db
     tests should be run automatically as libthread_db is auto-loaded.
     The default is to not run tests automatically.

The test itself is a basic integrity check exercising all libthread_db
functions used by GDB on GNU/Linux systems.  By extension this also
exercises the proc_service functions provided by GDB that libthread_db
uses.

This functionality is useful for NPTL developers and libthread_db
developers.  It could also prove useful investigating bugs reported
against GDB where the thread debugging library or GDB's proc_service
layer is suspect.

gdb/ChangeLog:

* linux-thread-db.c (valprint.h): New include.
(struct check_thread_db_info): New structure.
(check_thread_db_on_load, tdb_testinfo): New static globals.
(check_thread_db, check_thread_db_callback): New functions.
(try_thread_db_load_1): Run integrity checks if requested.
(maintenance_check_libthread_db): New function.
(_initialize_thread_db): Register "maint check libthread-db"
and "maint set/show check-libthread-db".
* NEWS: Mention the above new commands.

gdb/doc/ChangeLog:

* gdb.texinfo (Maintenance Commands): Document "maint check
libthread-db" and "maint set/show check-libthread-db".

gdb/testsuite/ChangeLog:

* gdb.threads/check-libthread-db.exp: New file.
* gdb.threads/check-libthread-db.c: Likewise.

6 years agoFix gdb mingw build
Tom Tromey [Fri, 8 Jun 2018 16:06:43 +0000 (10:06 -0600)]
Fix gdb mingw build

I noticed that the mingw build was failing in the buildbot.  This
patch fixes the problem.  I'm checking it in as obvious.

gdb/ChangeLog
2018-06-08  Tom Tromey  <tom@tromey.com>

* windows-nat.c (windows_nat_target::xfer_partial): "beneath" is
now a method.

6 years ago[arm][gas] Add support for Arm Cortex-A76
kyrtka01 [Fri, 8 Jun 2018 14:40:39 +0000 (15:40 +0100)]
[arm][gas] Add support for Arm Cortex-A76

This patch adds support to gas for -mcpu=cortex-a76 in the usual way.
make check-gas passes without problems.

2018-06-08  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>

    * config/tc-arm.c (arm_cpus): Add Cortex-A76 entry.
    * doc/c-arm.texi (-mcpu): Document cortex-a76.

6 years ago[AArch64][gas] Add support for Arm Cortex-A76
kyrtka01 [Fri, 8 Jun 2018 14:39:47 +0000 (15:39 +0100)]
[AArch64][gas] Add support for Arm Cortex-A76

This patch adds support to gas for -mcpu=cortex-a76 in the usual way.
make check-gas passes without problems.

2018-06-08  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>

    * config/tc-aarch64.c (aarch64_cpus): Add Cortex-A76 entry.
    * doc/c-aarch64.texi (-mcpu): Document cortex-a76.

6 years agoRemove last cleanup from btrace code
Tom Tromey [Thu, 7 Jun 2018 21:38:25 +0000 (15:38 -0600)]
Remove last cleanup from btrace code

This removes the last cleanup from btrace.c, replacing it with a use
of unique_xmalloc_ptr.

gdb/ChangeLog
2018-06-08  Tom Tromey  <tom@tromey.com>

* btrace.c (parse_xml_raw): Use gdb::unique_xmalloc_ptr.

6 years agoRemove cleanups from btrace code
Tom Tromey [Thu, 7 Jun 2018 21:34:36 +0000 (15:34 -0600)]
Remove cleanups from btrace code

This removes some cleanups from the btrace code by minorly C++-ifying
struct btrace_data.

gdb/ChangeLog
2018-06-08  Tom Tromey  <tom@tromey.com>

* common/btrace-common.h (struct btrace_data): Add constructor,
destructor, move assignment operator.
<empty, clear, fini>: New methods.
<format>: Initialize.
(btrace_data_init, btrace_data_fini, btrace_data_clear)
(btrace_data_empty): Don't declare.
* common/btrace-common.c (btrace_data_init): Remove.
(btrace_data::fini): Rename from btrace_data_fini.
(btrace_data::empty): Rename from btrace_data_empty.
(btrace_data::clear): Rename from btrace_data_clear.  Return
bool.
* btrace.h (make_cleanup_btrace_data): Don't declare.
* btrace.c (btrace_add_pc, btrace_stitch_trace, btrace_clear)
(parse_xml_btrace): Update.
(do_btrace_data_cleanup, make_cleanup_btrace_data): Remove.
(maint_btrace_clear_packet_history_cmd): Update.

gdb/gdbserver/ChangeLog
2018-06-08  Tom Tromey  <tom@tromey.com>

* linux-low.c (linux_low_read_btrace): Update.

6 years agoPrevent undefined FMOV instructions being accepted by the AArch64 assembler.
Egeyar Bagcioglu [Fri, 8 Jun 2018 13:02:52 +0000 (14:02 +0100)]
Prevent undefined FMOV instructions being accepted by the AArch64 assembler.

    Detect illegal FMOV instructions that changes the size from 32 bits to 64
    bits and vice versa. Add tests for these and other undefined FMOV
    instructions.

        PR 20319
gas     * testsuite/gas/aarch64/illegal-3.s: Test if unallocated FMOV encodings
        are detected as undefined.
        * testsuite/gas/aarch64/illegal-3.d: Likewise.
        * testsuite/gas/aarch64/illegal.s: Test if FMOV instructions that are
        changing the size from 32 bits to 64 bits and vice versa trigger an
        error.
        * testsuite/gas/aarch64/illegal.l: Likewise.

opcodes * aarch64-tbl.h: Introduce QL_INT2FP_FMOV and QL_FP2INT_FMOV.
        (aarch64_opcode_table) : Use QL_INT2FP_FMOV and QL_FP2INT_FMOV.

6 years agoDefine various symbols conditionally in shared libraries
Alan Modra [Fri, 8 Jun 2018 10:47:34 +0000 (20:17 +0930)]
Define various symbols conditionally in shared libraries

The values of symbols in shared libraries like _end, _edata, and
__bss_start are generally not that useful outside of the shared
library.  This patch defines them conditionally with PROVIDE, since a
shared library might need the local value.  An example is glibc ld.so
local access to "_begin", "_etext" and "_end".  (ld.so gains access to
the local values by making the references using hidden visibility.
That makes the definitions hidden too.)

We can't use PROVIDE_HIDDEN in the linker scripts because the shared
library might need the value of the symbol in the executable.  An
example is freebsd libc dynamic access to "_end".

PR ld/23161
* emulparams/aarch64cloudabi.sh: PROVIDE __bss_start__, _bss_end__,
and __end__ in shared libraries.
* emulparams/aarch64fbsd.sh: Likewise.
* emulparams/aarch64linux.sh: Likewise.
* emulparams/aarch64linux32.sh: Likewise.
* emulparams/armelf_fuchsia.sh: Likewise.
* emulparams/armelf_linux.sh: Likewise.
* emulparams/armelf_phoenix.sh: Likewise.
* emulparams/aarch64elf.sh: Likewise, and __data_start
* emulparams/aarch64elf32.sh: Likewise.
* emulparams/armelf.sh: Likewise.
* emulparams/armnto.sh: Likewise.
* emulparams/elf32bmip.sh: Remove duplicate ". = ." from
OTHER_GOT_SYMBOLS.  PROVIDE _ftext, _fdata, and _fbss in shared libs.
* emulparams/elf32bmipn32-defs.sh: Likewise.
* emulparams/elf32frv.sh: PROVIDE __end and __data_start in shared libs.
* emulparams/elf32lriscv-defs.sh: Tidy.
* emulparams/elf32mcore.sh: PROVIDE __bss_start and _bss_end in
shared libs
* emulparams/elf32ppccommon.sh: PROVIDE __end in shared libs.
* emulparams/elf32rl78.sh: Tidy.
* emulparams/i386nto.sh: PROVIDE _btext in shared libs.
* emulparams/shelf_nto.sh: Likewise.
* emulparams/shlelf_nto.sh: Likewise.
* emulparams/score3_elf.sh: PROVIDE _gp, _bss_start__, _bss_end__,
__bss_end__, __end__, _fdata, _sdata_begin, and _bss_start in
shared libs.
* scripttempl/elf.sc: Don't use EXECUTABLE_SYMBOLS for shared
libraries.  PROVIDE _edata, edata, __bss_start, and _end in shared
libraries.
* testsuite/ld-elf/pr23161.map,
* testsuite/ld-elf/pr23161a.c,
* testsuite/ld-elf/pr23161b.c,
* testsuite/ld-elf/pr23161c.c,
* testsuite/ld-elf/pr23161a.rd,
* testsuite/ld-elf/pr23161b.rd,
* testsuite/ld-elf/pr23161c.rd,
* testsuite/ld-elf/pr23161d.rd: New tests.
* testsuite/ld-elf/shared.exp: Run ld/23161 tests.
* testsuite/ld-elf/pr23162.rd,
* 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-alpha/tlsbin.rd,
* testsuite/ld-alpha/tlsbin.sd,
* testsuite/ld-alpha/tlsbinr.rd,
* testsuite/ld-alpha/tlspic.rd,
* testsuite/ld-alpha/tlspic.sd,
* testsuite/ld-cris/dso-pltdis1.d,
* testsuite/ld-cris/dso-pltdis2.d,
* testsuite/ld-cris/dso12-pltdis.d,
* testsuite/ld-cris/gotplt1.d,
* testsuite/ld-cris/gotplt2.d,
* testsuite/ld-cris/gotplt3.d,
* testsuite/ld-cris/hiddef1.d,
* testsuite/ld-cris/libdso-1.d,
* testsuite/ld-cris/libdso-10.d,
* testsuite/ld-cris/libdso-11.d,
* testsuite/ld-cris/libdso-12.d,
* testsuite/ld-cris/libdso-12b.d,
* testsuite/ld-cris/libdso-12c.d,
* testsuite/ld-cris/libdso-13.d,
* testsuite/ld-cris/libdso-13b.d,
* testsuite/ld-cris/libdso-14.d,
* testsuite/ld-cris/libdso-15.d,
* testsuite/ld-cris/libdso-15b.d,
* testsuite/ld-cris/libdso-1c.d,
* testsuite/ld-cris/libdso-1d.d,
* testsuite/ld-cris/libdso-2.d,
* testsuite/ld-cris/pic-gc-72.d,
* testsuite/ld-cris/pic-gc-73.d,
* testsuite/ld-cris/pr16044.d,
* testsuite/ld-cris/pv32-1.d,
* testsuite/ld-cris/tls-dso-dtpoffd2.d,
* testsuite/ld-cris/tls-dso-dtpoffd4.d,
* testsuite/ld-cris/tls-dso-tpoffgotcomm1.d,
* testsuite/ld-cris/tls-gc-71.d,
* testsuite/ld-cris/tls-gd-1.d,
* testsuite/ld-cris/tls-gd-1h.d,
* testsuite/ld-cris/tls-gd-2.d,
* testsuite/ld-cris/tls-gd-2h.d,
* testsuite/ld-cris/tls-ie-10.d,
* testsuite/ld-cris/tls-ie-11.d,
* testsuite/ld-cris/tls-ie-78.d,
* testsuite/ld-cris/tls-ie-8.d,
* testsuite/ld-cris/tls-ie-9.d,
* testsuite/ld-cris/tls-js1.d,
* testsuite/ld-cris/tls-ld-4.d,
* testsuite/ld-cris/tls-ld-5.d,
* testsuite/ld-cris/tls-ld-6.d,
* testsuite/ld-cris/tls-ld-7.d,
* testsuite/ld-cris/tls-ldgd-14.d,
* testsuite/ld-cris/tls-ldgd-15.d,
* testsuite/ld-cris/tls-ldgdex-14.d,
* testsuite/ld-cris/tls-ldgdex-15.d,
* testsuite/ld-cris/tls-ldgdx-14.d,
* testsuite/ld-cris/tls-ldgdx-15.d,
* testsuite/ld-cris/tls-legdx-16.d,
* testsuite/ld-cris/tls-legdx-17.d,
* testsuite/ld-cris/tls-local-54.d,
* testsuite/ld-cris/tls-local-60.d,
* testsuite/ld-cris/tls-local-61.d,
* testsuite/ld-cris/tls-local-63.d,
* testsuite/ld-cris/tls-local-64.d,
* testsuite/ld-cris/tls-ok-30.d,
* testsuite/ld-cris/tls-ok-32.d,
* testsuite/ld-cris/tls-ok-34.d,
* testsuite/ld-cris/tls-und-38.d,
* testsuite/ld-cris/tls-und-42.d,
* testsuite/ld-cris/tls-und-46.d,
* testsuite/ld-cris/tls-und-50.d,
* testsuite/ld-cris/weakhiddso.d,
* testsuite/ld-cris/weakref2.d,
* testsuite/ld-frv/fdpic-shared-1.d,
* testsuite/ld-frv/fdpic-shared-2.d,
* testsuite/ld-frv/fdpic-shared-3.d,
* testsuite/ld-frv/fdpic-shared-4.d,
* testsuite/ld-frv/fdpic-shared-5.d,
* testsuite/ld-frv/fdpic-shared-7.d,
* testsuite/ld-frv/fdpic-shared-8.d,
* testsuite/ld-frv/tls-dynamic-2.d,
* testsuite/ld-i386/ibt-plt-1.d,
* testsuite/ld-i386/ibt-plt-2a.d,
* testsuite/ld-i386/ibt-plt-2b.d,
* testsuite/ld-i386/ibt-plt-2c.d,
* testsuite/ld-i386/ibt-plt-2d.d,
* testsuite/ld-i386/ibt-plt-3a.d,
* testsuite/ld-i386/ibt-plt-3b.d,
* testsuite/ld-i386/ibt-plt-3c.d,
* testsuite/ld-i386/ibt-plt-3d.d,
* testsuite/ld-i386/plt2.dd,
* testsuite/ld-i386/pr20830.d,
* testsuite/ld-i386/tlsbin-nacl.rd,
* testsuite/ld-i386/tlsbin.rd,
* testsuite/ld-i386/tlsbin2-nacl.rd,
* testsuite/ld-i386/tlsbin2.rd,
* testsuite/ld-i386/tlsbindesc-nacl.rd,
* testsuite/ld-i386/tlsbindesc.rd,
* testsuite/ld-i386/tlsdesc-nacl.rd,
* testsuite/ld-i386/tlsdesc.rd,
* testsuite/ld-i386/tlsgdesc-nacl.rd,
* testsuite/ld-i386/tlsgdesc.rd,
* testsuite/ld-i386/tlsnopic-nacl.rd,
* testsuite/ld-i386/tlsnopic.dd,
* testsuite/ld-i386/tlsnopic.rd,
* testsuite/ld-i386/tlsnopic.sd,
* testsuite/ld-i386/tlspic-nacl.rd,
* testsuite/ld-i386/tlspic.rd,
* testsuite/ld-i386/tlspic2-nacl.rd,
* testsuite/ld-i386/tlspic2.rd,
* testsuite/ld-ia64/merge1.d,
* testsuite/ld-ia64/merge2.d,
* testsuite/ld-ia64/merge3.d,
* testsuite/ld-ia64/merge4.d,
* testsuite/ld-ia64/merge5.d,
* testsuite/ld-ia64/tlsbin.rd,
* testsuite/ld-ia64/tlspic.rd,
* testsuite/ld-ifunc/ifunc-2-i386-now.d,
* testsuite/ld-ifunc/ifunc-2-local-i386-now.d,
* testsuite/ld-ifunc/ifunc-2-local-x86-64-now.d,
* testsuite/ld-ifunc/ifunc-2-local-x86-64.d,
* testsuite/ld-ifunc/ifunc-2-x86-64-now.d,
* testsuite/ld-ifunc/ifunc-2-x86-64.d,
* testsuite/ld-ifunc/pr17154-i386-now.d,
* testsuite/ld-ifunc/pr17154-i386.d,
* testsuite/ld-ifunc/pr17154-x86-64-now.d,
* testsuite/ld-ifunc/pr17154-x86-64.d,
* testsuite/ld-m68k/tls-def-1.d,
* testsuite/ld-m68k/tls-gd-1.d2,
* testsuite/ld-metag/shared.d,
* testsuite/ld-metag/stub_pic_app.d,
* testsuite/ld-mips-elf/rel32-n32.d,
* testsuite/ld-mips-elf/rel32-o32.d,
* testsuite/ld-mips-elf/rel64.d,
* testsuite/ld-powerpc/ambiguousv1.d,
* testsuite/ld-powerpc/ambiguousv1b.d,
* testsuite/ld-powerpc/ambiguousv2.d,
* testsuite/ld-powerpc/ambiguousv2b.d,
* testsuite/ld-powerpc/tlsexe.d,
* testsuite/ld-powerpc/tlsexe.r,
* testsuite/ld-powerpc/tlsexe32.d,
* testsuite/ld-powerpc/tlsexe32.g,
* testsuite/ld-powerpc/tlsexe32.r,
* testsuite/ld-powerpc/tlsexetoc.d,
* testsuite/ld-powerpc/tlsexetoc.r,
* testsuite/ld-powerpc/tlsso.d,
* testsuite/ld-powerpc/tlsso.r,
* testsuite/ld-powerpc/tlsso32.g,
* testsuite/ld-powerpc/tlsso32.r,
* testsuite/ld-powerpc/tlstocso.d,
* testsuite/ld-powerpc/tlstocso.g,
* testsuite/ld-powerpc/tlstocso.r,
* testsuite/ld-s390/gotreloc_31-1.dd,
* testsuite/ld-s390/tlsbin.dd,
* testsuite/ld-s390/tlsbin.rd,
* testsuite/ld-s390/tlsbin_64.dd,
* testsuite/ld-s390/tlsbin_64.rd,
* testsuite/ld-s390/tlspic.rd,
* testsuite/ld-s390/tlspic_64.rd,
* testsuite/ld-sh/tlsbin-2.d,
* testsuite/ld-sh/tlspic-2.d,
* testsuite/ld-sparc/gotop32.rd,
* testsuite/ld-sparc/gotop64.rd,
* testsuite/ld-sparc/tlssunbin32.rd,
* testsuite/ld-sparc/tlssunbin64.rd,
* testsuite/ld-sparc/tlssunnopic32.rd,
* testsuite/ld-sparc/tlssunnopic64.rd,
* testsuite/ld-sparc/tlssunpic32.rd,
* testsuite/ld-sparc/tlssunpic64.rd,
* testsuite/ld-x86-64/bnd-branch-1-now.d,
* testsuite/ld-x86-64/bnd-ifunc-1-now.d,
* testsuite/ld-x86-64/bnd-ifunc-2-now.d,
* testsuite/ld-x86-64/bnd-ifunc-2.d,
* testsuite/ld-x86-64/bnd-plt-1-now.d,
* testsuite/ld-x86-64/bnd-plt-1.d,
* testsuite/ld-x86-64/ibt-plt-1-x32.d,
* testsuite/ld-x86-64/ibt-plt-1.d,
* testsuite/ld-x86-64/ibt-plt-2a-x32.d,
* testsuite/ld-x86-64/ibt-plt-2a.d,
* testsuite/ld-x86-64/ibt-plt-2b-x32.d,
* testsuite/ld-x86-64/ibt-plt-2b.d,
* testsuite/ld-x86-64/ibt-plt-2c-x32.d,
* testsuite/ld-x86-64/ibt-plt-2c.d,
* testsuite/ld-x86-64/ibt-plt-2d-x32.d,
* testsuite/ld-x86-64/ibt-plt-2d.d,
* testsuite/ld-x86-64/ibt-plt-3a-x32.d,
* testsuite/ld-x86-64/ibt-plt-3a.d,
* testsuite/ld-x86-64/ibt-plt-3b-x32.d,
* testsuite/ld-x86-64/ibt-plt-3b.d,
* testsuite/ld-x86-64/ibt-plt-3c-x32.d,
* testsuite/ld-x86-64/ibt-plt-3c.d,
* testsuite/ld-x86-64/ibt-plt-3d-x32.d,
* testsuite/ld-x86-64/ibt-plt-3d.d,
* testsuite/ld-x86-64/ilp32-4-nacl.d,
* testsuite/ld-x86-64/ilp32-4.d,
* testsuite/ld-x86-64/load1c-nacl.d,
* testsuite/ld-x86-64/load1c.d,
* testsuite/ld-x86-64/load1d-nacl.d,
* testsuite/ld-x86-64/load1d.d,
* testsuite/ld-x86-64/mpx3n.dd,
* testsuite/ld-x86-64/mpx4.dd,
* testsuite/ld-x86-64/mpx4n.dd,
* testsuite/ld-x86-64/plt2.dd,
* testsuite/ld-x86-64/pr14207.d,
* testsuite/ld-x86-64/pr19162.d,
* testsuite/ld-x86-64/pr20253-1f.d,
* testsuite/ld-x86-64/pr20253-1l.d,
* testsuite/ld-x86-64/pr20830a-now.d,
* testsuite/ld-x86-64/pr20830a.d,
* testsuite/ld-x86-64/pr20830b-now.d,
* testsuite/ld-x86-64/pr20830b.d,
* testsuite/ld-x86-64/pr21038a-now.d,
* testsuite/ld-x86-64/pr21038a.d,
* testsuite/ld-x86-64/pr21038b-now.d,
* testsuite/ld-x86-64/pr21038b.d,
* testsuite/ld-x86-64/pr21038c-now.d,
* testsuite/ld-x86-64/pr21038c.d,
* testsuite/ld-x86-64/tlsbin-nacl.rd,
* testsuite/ld-x86-64/tlsbin.rd,
* testsuite/ld-x86-64/tlsbin2-nacl.rd,
* testsuite/ld-x86-64/tlsbin2.rd,
* testsuite/ld-x86-64/tlsbindesc-nacl.rd,
* testsuite/ld-x86-64/tlsbindesc.rd,
* testsuite/ld-x86-64/tlsdesc-nacl.rd,
* testsuite/ld-x86-64/tlsdesc.rd,
* testsuite/ld-x86-64/tlsgdesc-nacl.rd,
* testsuite/ld-x86-64/tlsgdesc.rd,
* testsuite/ld-x86-64/tlspic-nacl.rd,
* testsuite/ld-x86-64/tlspic.rd,
* testsuite/ld-x86-64/tlspic2-nacl.rd,
* testsuite/ld-x86-64/tlspic2.rd: Update.

6 years agoAutomatic date update in version.in
GDB Administrator [Fri, 8 Jun 2018 00:00:43 +0000 (00:00 +0000)]
Automatic date update in version.in

6 years agoAdd ChangeLog entry for e5a77256e8961294b3ea7d483124834311ca363b
Sergio Durigan Junior [Thu, 7 Jun 2018 18:17:53 +0000 (14:17 -0400)]
Add ChangeLog entry for e5a77256e8961294b3ea7d483124834311ca363b

I forgot to add a ChangeLog entry for my previous commit:

commit e5a77256e8961294b3ea7d483124834311ca363b
Author: Sergio Durigan Junior <sergiodj@redhat.com>
Date:   Tue Jun 5 17:55:39 2018 -0400

    Guard declarations of 'sve_{vq,vl}_from_{vl,vq}' macros on Aarch64 (and unbreak build)

This commit fixes that.

6 years agoIntroduce class target_stack
Pedro Alves [Thu, 7 Jun 2018 16:27:48 +0000 (17:27 +0100)]
Introduce class target_stack

Currently, the target stack is represented by a singly linked list,
with target_ops having a pointer to the target beneath.  This poses a
problem for multi-process / multi-target debugging.  In that case, we
will naturally want multiple instances of target stacks.  E.g., one
stack for inferior 1 which is debugging a core file, and another
target stack for inferior 2 which is debugging a remote process.  The
problem then is in finding a target's "beneath" target, if we consider
that for some target_ops types, we'll be sharing a single target_ops
instance between several inferiors.  For example, so far, I found no
need to have multiple instances of the spu_multiarch_target /
exec_target / dummy_target targets.

Thus this patch, which changes the target stack representation to an
array of pointers.  For now, there's still a single global instance of
this new target_stack class, though further down in the multi-target
work, each inferior will have its own instance.

gdb/ChangeLog:
2018-06-07  Pedro Alves  <palves@redhat.com>

* target.h (target_ops) <beneath>: Now a method.  All references
updated.
(class target_stack): New.
* target.c (g_target_stack): New.
(g_current_top_target): Delete.
(current_top_target): Get the top target out of g_target_stack.
(target_stack::push, target_stack::unpush): New.
(push_target, unpush_target): Reimplement.
(target_is_pushed): Reimplement in terms of g_target_stack.
(target_ops::beneath, target_stack::find_beneath): New.

6 years agoEliminate find_target_beneath
Pedro Alves [Thu, 7 Jun 2018 16:27:47 +0000 (17:27 +0100)]
Eliminate find_target_beneath

Call target_ops::beneath() throughout instead.

gdb/ChangeLog:
2018-06-07  Pedro Alves  <palves@redhat.com>

* target.h (find_target_beneath): Delete declaration.
* target.c (find_target_beneath): Delete definition.
* aix-thread.c: All callers of find_target_beneath adjusted to
call target_ops::beneath instead.
* bsd-uthread.c: Likewise.
* linux-thread-db.c: Likewise.
* ravenscar-thread.c: Likewise.
* sol-thread.c: Likewise.
* spu-multiarch.c: Likewise.

6 years agotarget_ops::beneath -> target_ops::beneath()
Pedro Alves [Thu, 7 Jun 2018 16:27:47 +0000 (17:27 +0100)]
target_ops::beneath -> target_ops::beneath()

This changes target_ops::beneath from a pointer to a method, and
adjusts all references throughout.  The idea here is to make it easier
to change the target stack representation from an intrusive singly
linked list to something else without leaking implementation details
throughout.

The commit does not change the representation yet, that will be done
in a following patch.  That is why a new target_ops::m_beneath field
appears here.  That new field isn't really documented properly or made
private, simply because it will be removed shortly.

Note that target_ops::beneath() is essentially the same as the current
find_target_beneath routine.  The following patch will eliminate the
latter.

gdb/ChangeLog:
2018-06-07  Pedro Alves  <palves@redhat.com>

* target.h (target_ops) <beneath>: Now a method.  All references
updated.
(target_ops) <m_beneath>: New.
* target.c (target_ops::beneath): New.
* corelow.c: Adjust all references to target_ops::beneath.
* linux-thread-db.c: Likewise.
* make-target-delegates: Likewise.
* record-btrace.c: Likewise.
* record-full.c: Likewise.
* remote.c: Likewise.
* target.c: Likewise.
* target-delegates.c: Regenerate.

6 years agotarget_stack -> current_top_target() throughout
Pedro Alves [Thu, 7 Jun 2018 16:27:46 +0000 (17:27 +0100)]
target_stack -> current_top_target() throughout

The recent C++ification of target_ops replaced references to the old
"current_target" squashed target throughout with references to a
"target_stack" pointer.  I had picked the "target_stack" name very
early in the multi-target work, and managed to stick with it, even
though it's a bit of a misnomer, since it isn't really a "target
stack" object, but a pointer into the current top target in the stack.
As I'm splitting more pieces off of the multi-target branch, I've come
to think that it's better to rename it now.  A following patch will
introduce a new class to represent a target stack, and "target_stack"
would be _its_ ideal name.  (In the branch, the class is called
a_target_stack to work around the clash.)

Thus this commit renames target_stack to current_top_target and
replaces all references throughout.  Also, while at it,
current_top_target is made a function instead of a pointer, to make it
possible to change its internal implementation without leaking
implementation details out.  In a couple patches, the implementation
of the function will change to refer to a target stack object, and
then further down the multi-target work, it'll change again to find
the right target stack for the current inferior.

gdb/ChangeLog:
2018-06-07  Pedro Alves  <palves@redhat.com>

* target.h (target_stack): Delete.
(current_top_target): Declare function.
* target.c (target_stack): Delete.
(g_current_top_target): New.
(current_top_target): New function.
* auxv.c: Use current_top_target instead of target_stack
throughout.
* avr-tdep.c: Likewise.
* breakpoint.c: Likewise.
* corefile.c: Likewise.
* elfread.c: Likewise.
* eval.c: Likewise.
* exceptions.c: Likewise.
* frame.c: Likewise.
* gdbarch-selftests.c: Likewise.
* gnu-v3-abi.c: Likewise.
* ia64-tdep.c: Likewise.
* ia64-vms-tdep.c: Likewise.
* infcall.c: Likewise.
* infcmd.c: Likewise.
* infrun.c: Likewise.
* linespec.c: Likewise.
* linux-tdep.c: Likewise.
* minsyms.c: Likewise.
* ppc-linux-nat.c: Likewise.
* ppc-linux-tdep.c: Likewise.
* procfs.c: Likewise.
* regcache.c: Likewise.
* remote.c: Likewise.
* rs6000-tdep.c: Likewise.
* s390-linux-nat.c: Likewise.
* s390-tdep.c: Likewise.
* solib-aix.c: Likewise.
* solib-darwin.c: Likewise.
* solib-dsbt.c: Likewise.
* solib-spu.c: Likewise.
* solib-svr4.c: Likewise.
* solib-target.c: Likewise.
* sparc-tdep.c: Likewise.
* sparc64-tdep.c: Likewise.
* spu-tdep.c: Likewise.
* symfile.c: Likewise.
* symtab.c: Likewise.
* target-descriptions.c: Likewise.
* target-memory.c: Likewise.
* target.c: Likewise.
* target.h: Likewise.
* tracefile-tfile.c: Likewise.
* tracepoint.c: Likewise.
* valops.c: Likewise.
* valprint.c: Likewise.
* value.c: Likewise.
* windows-tdep.c: Likewise.
* mi/mi-main.c: Likewise.

6 years agoChange build_address_symbolic to return std::string
Tom Tromey [Sat, 5 May 2018 16:24:54 +0000 (10:24 -0600)]
Change build_address_symbolic to return std::string

This changes two out parameters of build_address_symbolic to be
std::string, and updates the callers.  This allows removing some
cleanups.

This patch also moves the declaration of build_address_symbolic out of
defs.h.  I think that many things in defs.h should be elsewhere
instead.  In this case, I moved the declaration to valprint.h, becuase
there is no "printcmd.h" -- but perhaps it would be better to
introduce that instead.

Tested by the buildbot.

gdb/ChangeLog
2018-06-07  Tom Tromey  <tom@tromey.com>

* valprint.h (build_address_symbolic): Declare.
* printcmd.c (print_address_symbolic): Update.
(build_address_symbolic): Change "name" and "filename" to
std::string.
* disasm.c (gdb_pretty_print_disassembler::pretty_print_insn):
Update.
* defs.h (build_address_symbolic): Remove declaration.

6 years agoFix AArch64 unintialized variable which can cause diagnostic failures.
Tamar Christina [Thu, 7 Jun 2018 10:53:13 +0000 (11:53 +0100)]
Fix AArch64 unintialized variable which can cause diagnostic failures.

This patch fixes an uninitialized memory issue that can under certain
circumstances turn an error into a warning because non_fatal was not initialised
in all cases.

Verified using valgrind.

gas/config/tc-aarch64.c

PR binutils/21446
* tc-aarch64.c (record_operand_error, record_operand_error_with_data):
  Initialize non_fatal.

6 years agoAarch64 SVE pseudo register support
Alan Hayward [Thu, 19 Oct 2017 15:35:35 +0000 (16:35 +0100)]
Aarch64 SVE pseudo register support

Add the functionality for reading/writing pseudo registers.

On SVE the V registers are pseudo registers. This is supported
by adding AARCH64_SVE_V0_REGNUM.

* aarch64-tdep.c (AARCH64_SVE_V0_REGNUM): Add define.
(aarch64_vnv_type): Add function.
(aarch64_pseudo_register_name): Add V regs for SVE.
(aarch64_pseudo_register_type): Likewise.
(aarch64_pseudo_register_reggroup_p): Likewise.
(aarch64_pseudo_read_value_2): Use V0 offset for SVE
(aarch64_pseudo_read_value): Add V regs for SVE.
(aarch64_pseudo_write_2): Use V0 offset for SVE
(aarch64_pseudo_write): Add V regs for SVE.
* aarch64-tdep.h (struct gdbarch_tdep): Add vnv_type.

6 years agoAutomatic date update in version.in
GDB Administrator [Thu, 7 Jun 2018 00:00:50 +0000 (00:00 +0000)]
Automatic date update in version.in

6 years agoEXECUTABLE_SYMBOLS -> OTHER_SYMBOLS
Alan Modra [Sat, 2 Jun 2018 09:16:03 +0000 (18:46 +0930)]
EXECUTABLE_SYMBOLS -> OTHER_SYMBOLS

EXECUTABLE_SYMBOLS is supposed to be true to its name, only defining
symbols for the executable.

* emulparams/elf64bmip.sh (EXECUTABLE_SYMBOLS): Don't define.
(OTHER_SYMBOLS): Define this instead.
* emulparams/elf32bmipn32.sh (EXECUTABLE_SYMBOLS): Don't define.
(OTHER_SYMBOLS): Define similarly to elf64bmip.sh.
* emulparams/elf64hppa.sh (EXECUTABLE_SYMBOLS): Don't define.
(OTHER_SYMBOLS): Define instead.

6 years agoTIC6X __c6xabi_DSBT_BASE
Alan Modra [Sat, 2 Jun 2018 08:35:24 +0000 (18:05 +0930)]
TIC6X __c6xabi_DSBT_BASE

Adding an undefined __c6xabi_DSBT_BASE via an EXTERN in the linker
script isn't ideal, as the symbol is not always needed.  This patch
adds the undefined symbol on encountering relocations where it is
implicitly referenced.

bfd/
* elf32-tic6x.c (elf32_tic6x_check_relocs): Reference
__c6xabi_DSBT_BASE explicitly for R_C6000_SBR_* relocs.
ld/
* emulparams/elf32_tic6x_le.sh (EXECUTABLE_SYMBOLS): Don't define.