binutils-gdb.git
9 years agoDon't set gdb,noinferiorio on gdbserver boards
Pedro Alves [Wed, 29 Jul 2015 10:09:46 +0000 (11:09 +0100)]
Don't set gdb,noinferiorio on gdbserver boards

As all tests that check gdb,noinferiorio have been adjusted to expect
inferior output with "-i $inferior_spawn_id", we can remove this now,
and thus enable those tests against gdbserver.

gdb/testsuite/ChangeLog:
2015-07-29  Pedro Alves  <palves@redhat.com>

* boards/gdbserver-base.exp: Don't set gdb,noinferiorio.

9 years agointerrupt.exp: Revert back to checking gdb,noinferiorio at the top
Pedro Alves [Wed, 29 Jul 2015 10:09:46 +0000 (11:09 +0100)]
interrupt.exp: Revert back to checking gdb,noinferiorio at the top

The following patch will remove the gdb,noinferiorio setting from the
gdbserver boards, so this bit can be reverted.

gdb/testsuite/ChangeLog:
2015-07-29  Pedro Alves  <palves@redhat.com>

* gdb.base/interrupt.exp: Revert back to checking gdb,noinferiorio
at the top.

9 years agoUnbuffer all tests that rely on stdio
Pedro Alves [Wed, 29 Jul 2015 10:09:45 +0000 (11:09 +0100)]
Unbuffer all tests that rely on stdio

This forces all tests that rely on stdio to be unbuffered, like
interrupt.exp was adjusted in 6f98576f.

To recap, in some scenarios, GDB or GDBserver can be spawned with
input _not_ connected to a tty, and then tests that rely on stdio fail
with timeouts, because the inferior's stdout and stderr streams end up
fully buffered.  Calling gdb_unbuffer_output forces output to be
unbuffered.

See https://sourceware.org/ml/gdb-patches/2015-02/msg00809.html and
https://sourceware.org/ml/gdb-patches/2015-02/msg00819.html.

Tested on x86_64 Fedora 20, native, and against a remote gdbserver
board file that connects to the target with ssh, with and without -t
(create pty).

gdb/testsuite/ChangeLog:
2015-07-29  Pedro Alves  <palves@redhat.com>

* gdb.base/call-ar-st.c: Include "../lib/unbuffer_output.c".
(main): Call gdb_unbuffer_output.
* gdb.base/call-rt-st.c: Include "../lib/unbuffer_output.c".
(main): Call gdb_unbuffer_output.
* gdb.base/call-strs.c: Include "../lib/unbuffer_output.c".
(main): Call gdb_unbuffer_output.
* gdb.base/call-strs.exp: Adjust to step over the
gdb_unbuffer_output call.
* gdb.base/catch-gdb-caused-signals.c: Include
"../lib/unbuffer_output.c".
(main): Call gdb_unbuffer_output.
* gdb.base/dprintf.c: Include "../lib/unbuffer_output.c".
(main): Call gdb_unbuffer_output.
* gdb.base/ending-run.c: Include "../lib/unbuffer_output.c".
(main): Call gdb_unbuffer_output.
* gdb.base/run.c: Include "../lib/unbuffer_output.c".
(main): Call gdb_unbuffer_output.
* gdb.base/shlib-call.exp: Adjust to step over the
gdb_unbuffer_output call.
* gdb.base/shmain.c: Include "../lib/unbuffer_output.c".
(main): Call gdb_unbuffer_output.
* gdb.base/sizeof.c: Include "../lib/unbuffer_output.c".
(main): Call gdb_unbuffer_output.
* gdb.base/varargs.c: Include "../lib/unbuffer_output.c".
(main): Rename to ...
(test): ... this.
(main): Reimplement.
* gdb.base/varargs.exp: Run to test instead of to main.
* gdb.mi/mi-dprintf.c: Include "../lib/unbuffer_output.c".
(main): Call gdb_unbuffer_output.

9 years agoMake gdb.mi/mi-dprintf.exp use $inferior_spawn_id
Pedro Alves [Wed, 29 Jul 2015 10:09:45 +0000 (11:09 +0100)]
Make gdb.mi/mi-dprintf.exp use $inferior_spawn_id

gdb/testsuite/ChangeLog:
2015-07-29  Pedro Alves  <palves@redhat.com>

* gdb.mi/mi-dprintf.exp (mi_expect_dprintf): New procedure,
factore out from mi_continue_dprintf.  For call-style dprintfs,
expect dprintf output out of $inferior_spawn_id.
(mi_continue_dprintf): Use mi_expect_dprintf.
* gdb.mi/mi-dprintf.c: Include "../lib/unbuffer_output.c".
(main): Call gdb_unbuffer_output.

9 years agoAdjust MI to $inferior_spawn_id
Pedro Alves [Wed, 29 Jul 2015 10:09:44 +0000 (11:09 +0100)]
Adjust MI to $inferior_spawn_id

Rather than trying to determine where (which spawn id) the inferior
output comes out from, which depends on e.g., remote that supports
file i/o remote protocol extension, vs remote that sends inferior
output through a separate $inferior_spawn_id, vs native debugging,
which sends output through $gdb_spawn_id, vs native debugging with a
test that uses "separate-inferior-tty" (like mi-console.exp does),
always expect inferior output from both $inferior_spawn_id and
$gdb_spawn_id.

mi-console.exp itself already copes with different possible outputs in
a similar way:

 # Combine both outputs in a single pattern.
 set output "($semihosted_output|$native_output)"

Fixes:

 FAIL: gdb.mi/mi-console.exp: Testing console output inferior output (timeout)

when testing against local gdbserver with gdb,noinferiorio removed
from the board file.

gdb/testsuite/ChangeLog:
2015-07-29  Pedro Alves  <palves@redhat.com>

* lib/mi-support.exp (mi_inferior_spawn_id): Delete.
(default_mi_gdb_start): Set inferior_spawn_id instead of
mi_inferior_spawn_id.  If $inferior_spawn_id is not set, set it to
gdb_spawn_id.
(mi_gdb_test): Always expect inferior output from both
$inferior_spawn_id and $gdb_spawn_id.

9 years agoMake gdb.gdb/selftest.exp use '-i $inferior_spawn_id'
Pedro Alves [Wed, 29 Jul 2015 10:09:44 +0000 (11:09 +0100)]
Make gdb.gdb/selftest.exp use '-i $inferior_spawn_id'

gdb/testsuite/ChangeLog:
2015-07-29  Pedro Alves  <palves@redhat.com>

* gdb.gdb/selftest.exp (test_with_self): Update comment.  Use
send_inferior and $inferior_spawn_id.

9 years agoMake gdb.gdb/complaints.exp use '-i $inferior_spawn_id' and gdb_test_stdio
Pedro Alves [Wed, 29 Jul 2015 10:09:43 +0000 (11:09 +0100)]
Make gdb.gdb/complaints.exp use '-i $inferior_spawn_id' and gdb_test_stdio

gdb/testsuite/ChangeLog:
2015-07-29  Pedro Alves  <palves@redhat.com>

* gdb.gdb/complaints.exp (test_initial_complaints)
(test_serial_complaints, test_short_complaints): Use
gdb_test_stdio.
(test_empty_complaint): Handle $inferior_spawn_id !=
$gdb_spawn_id.

9 years agoMake gdb.base/varargs.exp use gdb_test_stdio
Pedro Alves [Wed, 29 Jul 2015 10:09:43 +0000 (11:09 +0100)]
Make gdb.base/varargs.exp use gdb_test_stdio

gdb/testsuite/ChangeLog:
2015-07-29  Pedro Alves  <palves@redhat.com>

* gdb.base/varargs.exp: Use gdb_test_stdio.

9 years agoMake gdb.base/shlib-call.exp use gdb_test_stdio
Pedro Alves [Wed, 29 Jul 2015 10:09:42 +0000 (11:09 +0100)]
Make gdb.base/shlib-call.exp use gdb_test_stdio

gdb/testsuite/ChangeLog:
2015-07-29  Pedro Alves  <palves@redhat.com>

* gdb.base/shlib-call.exp: Use gdb_test_stdio.

9 years agoMake gdb.base/ending-run.exp use gdb_test_stdio
Pedro Alves [Wed, 29 Jul 2015 10:09:42 +0000 (11:09 +0100)]
Make gdb.base/ending-run.exp use gdb_test_stdio

gdb/testsuite/ChangeLog:
2015-07-29  Pedro Alves  <palves@redhat.com>

* gdb.base/ending-run.exp: Use gdb_test_stdio.

9 years agoMake gdb.base/call-rt-st.exp use $inferior_spawn_id
Pedro Alves [Wed, 29 Jul 2015 10:09:41 +0000 (11:09 +0100)]
Make gdb.base/call-rt-st.exp use $inferior_spawn_id

gdb/testsuite/ChangeLog:
2015-07-29  Pedro Alves  <palves@redhat.com>

* gdb.base/call-rt-st.exp (print_struct_call): Split "result"
parameter into two new parameters, "inf_result" and "gdb_result".
Expect inferior output and gdb output from $inferior_spawn_id and
$gdb_spawn_id, respectively.  Adjust all callers.

9 years agoMake gdb.base/call-ar-st.exp use gdb_test_stdio
Pedro Alves [Wed, 29 Jul 2015 10:09:40 +0000 (11:09 +0100)]
Make gdb.base/call-ar-st.exp use gdb_test_stdio

gdb/testsuite/ChangeLog:
2015-07-29  Pedro Alves  <palves@redhat.com>

* gdb.base/call-ar-st.exp: Use gdb_test_stdio+multi_line instead
of gdb_test_sequence.

9 years agoMake gdb.base/a2-run.exp use $inferior_spawn_id and gdb_test_stdio
Pedro Alves [Wed, 29 Jul 2015 10:09:40 +0000 (11:09 +0100)]
Make gdb.base/a2-run.exp use $inferior_spawn_id and gdb_test_stdio

This one is a little more complicated than the other patches in this
series, because of the exit status wrapper handling, requiring a
little state machine.

gdb/testsuite/ChangeLog:
2015-07-29  Pedro Alves  <palves@redhat.com>

* gdb.base/a2-run.exp (saw_usage, saw_exit_wrapper)
(saw_spurious_output): Expect inferior output from
$inferior_spawn_id.  Use gdb_test_stdio.

9 years agoMake gdb.base/dprintf.exp use gdb_test_stdio
Pedro Alves [Wed, 29 Jul 2015 10:09:39 +0000 (11:09 +0100)]
Make gdb.base/dprintf.exp use gdb_test_stdio

This one needed a larger revamp.  The issue is that the "info
breakpoints" test at the bottom of the file is broken on targets that
can do both server-side dprintf, and inferior I/O, because then
neither the breakpoint numbers match nor the "already hit N times"
output.

Address that by making the test restart gdb from scratch when
switching between dprintf styles.  Test groups are factored into
procedures, and we now use with_test_prefix.  While we're changing
test messages, lowercase a few test messages, and then while at it,
modernize a couple things here and there.

gdb/testsuite/ChangeLog:
2015-07-29  Pedro Alves  <palves@redhat.com>

* gdb.base/dprintf.exp: Use standard_testfile.  Change
prepare_for_testing call.
(srcfile): Don't set.
(restart): New procedure.
(test_dprintf): New procecure, use to continue over dprintfs.
(test_call, test_agent): New procedures, tests moved here.
Restart gdb and recreate dprintfs.  Adjust expected output.

9 years agoMake gdb.base/catch-gdb-caused-signals.exp use gdb_test_stdio
Pedro Alves [Wed, 29 Jul 2015 10:09:39 +0000 (11:09 +0100)]
Make gdb.base/catch-gdb-caused-signals.exp use gdb_test_stdio

gdb/testsuite/ChangeLog:
2015-07-29  Pedro Alves  <palves@redhat.com>

* gdb.base/catch-gdb-caused-signals.exp: Use gdb_test_stdio.

9 years agoMake gdb.base/call-strs.exp use gdb_test_stdio
Pedro Alves [Wed, 29 Jul 2015 10:09:38 +0000 (11:09 +0100)]
Make gdb.base/call-strs.exp use gdb_test_stdio

gdb/testsuite/ChangeLog:
2015-07-29  Pedro Alves  <palves@redhat.com>

* gdb.base/call-strs.exp: Use gdb_test_stdio instead of gdb_test.

9 years agoMake gdb.base/sizeof.exp use gdb_test_stdio
Pedro Alves [Wed, 29 Jul 2015 10:09:38 +0000 (11:09 +0100)]
Make gdb.base/sizeof.exp use gdb_test_stdio

gdb/testsuite/ChangeLog:
2015-07-29  Pedro Alves  <palves@redhat.com>

* gdb.base/sizeof.exp (check_sizeof, check_valueof): Use
gdb_test_stdio.

9 years agoIntroduce gdb_test_stdio
Pedro Alves [Wed, 29 Jul 2015 10:09:37 +0000 (11:09 +0100)]
Introduce gdb_test_stdio

This adds a new helper procedure to be used by tests that rely on
stdio.

gdb/testsuite/ChangeLog:
2015-07-29  Pedro Alves  <palves@redhat.com>

* lib/gdb.exp (gdb_test_stdio): New procedure.

9 years agoDon't rely on inferior I/O in gdb.base/restore.exp
Pedro Alves [Wed, 29 Jul 2015 10:09:37 +0000 (11:09 +0100)]
Don't rely on inferior I/O in gdb.base/restore.exp

There seems to be no point in relying on stdio here.  Simply use
gdb_continue_to_end instead.

(not removing the printf calls, as the .c file is half generated.)

gdb/testsuite/ChangeLog:
2015-07-29  Pedro Alves  <palves@redhat.com>

* gdb.base/restore.exp (restore_tests): Use gdb_continue_to_end.

9 years agoDon't rely on inferior I/O in {call-signal-resume, unwindonsignal}.exp
Pedro Alves [Wed, 29 Jul 2015 10:09:36 +0000 (11:09 +0100)]
Don't rely on inferior I/O in {call-signal-resume, unwindonsignal}.exp

These tests rely on inferior I/O, but that seems pointless and
unrelated here.  Simply remove the printf calls, and don't expect
them.

gdb/testsuite/ChangeLog:
2015-07-29  Pedro Alves  <palves@redhat.com>

* gdb.base/call-signal-resume.exp: Remove check for
gdb,noinferiorio.  Don't expect "no signal".  Use gdb_test.
* gdb.base/unwindonsignal.exp: Likewise.
* gdb.base/call-signals.c (gen_signal): Remove printf call.
* gdb.base/unwindonsignal.c (gen_signal): Likewise.

9 years agoDon't rely on inferior I/O in gdb.base/siginfo-addr.exp
Pedro Alves [Wed, 29 Jul 2015 10:09:36 +0000 (11:09 +0100)]
Don't rely on inferior I/O in gdb.base/siginfo-addr.exp

No point in relying on stdio in this test.  Simply run to a breakpoint
instead.

gdb/testsuite/ChangeLog:
2015-07-29  Pedro Alves  <palves@redhat.com>

* gdb.base/siginfo-addr.c (pass): New function.
(handler): Call it iff si_addr is correct.
* gdb.base/siginfo-addr.exp: Remove gdb_skip_stdio_test check.
Set a breakpoint at "pass" and continue to it.

9 years agobfd/mmo.c (MMIX): Fix massive gcc LTO testsuite failures.
Hans-Peter Nilsson [Wed, 29 Jul 2015 03:39:27 +0000 (05:39 +0200)]
bfd/mmo.c (MMIX): Fix massive gcc LTO testsuite failures.

* mmo.c (mmo_write_symbols_and_terminator): Skip symbol-type
assignment loop for bfd plugin objects.

9 years agoAutomatic date update in version.in
GDB Administrator [Wed, 29 Jul 2015 00:00:09 +0000 (00:00 +0000)]
Automatic date update in version.in

9 years agoUniquify test names from gdb.python/{py-objfile.exp,py-pp-registration.exp}
Sergio Durigan Junior [Tue, 28 Jul 2015 21:38:14 +0000 (17:38 -0400)]
Uniquify test names from gdb.python/{py-objfile.exp,py-pp-registration.exp}

While running some regression tests, I noticed that the two Python
tests mentioned in the $SUBJECT contain non-unique names.  This is a
violation of our guidelines:

  <https://sourceware.org/gdb/wiki/GDBTestcaseCookbook#Make_sure_test_messages_are_unique>

And also makes things harder for BuildBot.  So I hacked both testcases
and made every test name unique.  I guess this could be considered an
obvious patch, but I decided to post it before pushing because others
may have different opinions about the names.

OK to apply?

gdb/testsuite/ChangeLog:
2015-07-28  Sergio Durigan Junior  <sergiodj@redhat.com>

* gdb.python/py-objfile.exp: Make some tests have unique names.
* gdb.python/py-pp-registration.exp: Likewise.

9 years agoFix gdb.server/server-exec-info.exp with the extended-remote board
Pedro Alves [Tue, 28 Jul 2015 17:04:07 +0000 (18:04 +0100)]
Fix gdb.server/server-exec-info.exp with the extended-remote board

This test fails with --target_board=native-extended-gdbserver because
it misses the usual "disconnect":

 (gdb) spawn ../gdbserver/gdbserver --once :2347 /home/pedro/gdb/mygit/build/gdb/testsuite/gdb.server/server-exec-info
 Process /home/pedro/gdb/mygit/build/gdb/testsuite/gdb.server/server-exec-info created; pid = 4736
 Listening on port 2347
 target extended-remote localhost:2347
 Already connected to a remote target.  Disconnect? (y or n) ^CsQuit
 (gdb) et sysroot remote:
 Undefined command: "et".  Try "help".
 (gdb) n
 The program is not being run.
 (gdb) FAIL: gdb.server/server-exec-info.exp: set sysroot remote: (got interactive prompt)
 info files
 (gdb) FAIL: gdb.server/server-exec-info.exp: info files

gdb/testsuite/ChangeLog:
2015-07-28  Pedro Alves  <palves@redhat.com>

* gdb.server/server-exec-info.exp: Issue a "disconnect".

9 years agoConsider addressable memory unit size in various value functions
Simon Marchi [Tue, 28 Jul 2015 15:01:50 +0000 (11:01 -0400)]
Consider addressable memory unit size in various value functions

This patch updates various value handling functions to make them
consider the addressable memory unit size of the current architecture.
This allows to correctly extract and print values on architectures whose
addressable memory unit is not 8 bits.

The patch doesn't cover all the code that would ideally need to be
adjusted, only the code paths that we happen to use, plus a few obvious
ones.  Specifically, those areas are not covered by this patch:

 - Management of unavailable bits
 - Bitfields
 - C++ stuff

Regression-tested on x86-64 Ubuntu 14.04.  I saw no related test result
change.

gdb/ChangeLog:

* c-valprint.c (c_val_print_array): Consider addressable memory
unit size.
(c_val_print_ptr): Likewise.
(c_val_print_int): Likewise.
* findvar.c (read_frame_register_value): Likewise.
* valarith.c (find_size_for_pointer_math): Likewise.
(value_ptrdiff): Likewise.
(value_subscripted_rvalue): Likewise.
* valops.c (read_value_memory): Likewise (and rename variables).
(value_assign): Likewise.
(value_repeat): Likewise.
(value_array): Likewise.
(value_slice): Likewise.
* valprint.c (generic_val_print_ptr): Likewise.
(generic_val_print_enum): Likewise.
(generic_val_print_bool): Likewise.
(generic_val_print_int): Likewise.
(generic_val_print_char): Likewise.
(generic_val_print_float): Likewise.
(generic_val_print_decfloat): Likewise.
(generic_val_print_complex): Likewise.
(val_print_scalar_formatted): Likewise.
(val_print_array_elements): Likewise.
* value.c (set_value_parent): Likewise.
(value_contents_copy_raw): Likewise.
(set_internalvar_component): Likewise.
(value_primitive_field): Likewise.
(value_fetch_lazy): Likewise.
* value.h (read_value_memory): Update comment.

9 years agoIntroduce get_value_arch
Simon Marchi [Tue, 28 Jul 2015 15:01:50 +0000 (11:01 -0400)]
Introduce get_value_arch

Similar to get_type_arch, used to get the gdbarch associated to a
struct value.

gdb/ChangeLog:

* value.c (get_value_arch): New function.
* value.h (get_value_arch): New declaration.

9 years agoUpdate comments in struct value for non-8-bits architectures
Simon Marchi [Tue, 28 Jul 2015 15:01:49 +0000 (11:01 -0400)]
Update comments in struct value for non-8-bits architectures

gdb/ChangeLog:

* value.c (struct value): Update comments.

9 years agoUpdate comment for struct type's length field, introduce type_length_units
Simon Marchi [Tue, 28 Jul 2015 15:01:49 +0000 (11:01 -0400)]
Update comment for struct type's length field, introduce type_length_units

This patch tries to clean up a bit the blur around the length field in
struct type, regarding its use with architectures with non-8-bits
addressable memory.  It clarifies that the field is expressed in host
bytes, which is what is the closest to the current reality.

It also introduces a new function to get the length of the type in
target addressable memory units.

gdb/ChangeLog:

* gdbtypes.c (type_length_units): New function.
* gdbtypes.h (type_length_units): New declaration.
(struct type) <length>: Update comment.

9 years agoAdd cores for M5100 series
Robert Suchanek [Tue, 28 Jul 2015 10:26:39 +0000 (11:26 +0100)]
Add cores for M5100 series

gas/

* config/tc-mips.c (mips_cpu_info_table): Add m5100 and m5101 entries.
* doc/c-mips.texi: Document m5100 and m5101 for -march=.

9 years agoAdd -march=interaptiv
Robert Suchanek [Tue, 28 Jul 2015 10:26:31 +0000 (11:26 +0100)]
Add -march=interaptiv

gas/

* config/tc-mips.c (mips_cpu_info_table): Add interaptiv entry.
* doc/c-mips.text: Document -march=interaptiv.

9 years agoFallout from "Reorder more powerpc64 sections for -z relro"
Alan Modra [Tue, 28 Jul 2015 01:33:57 +0000 (11:03 +0930)]
Fallout from "Reorder more powerpc64 sections for -z relro"

Commit 23283c1b changed the layout of some bss style sections on
powerpc64, but neglected to add a page gap before the third PT_LOAD
segment created by this reording.  Without a page gap we get two
PT_LOAD headers that overlap by one page in memory.  That shouldn't be
allowed because the dynamic loader will load garbage from the first
page of the last segment over the last page of the previous segment.

bfd/
* elf.c (_bfd_elf_map_sections_to_segments): Do not make a new
segment for loaded sections after nonloaded sections if the
sections are on the same page.
ld/testsuite/
* ld-powerpc/elfv2so.d: Update

9 years agoCheck for asprintf and vasprintf during configure stage.
Iain Buclaw [Tue, 28 Jul 2015 07:57:32 +0000 (09:57 +0200)]
Check for asprintf and vasprintf during configure stage.

This should fix some build errors seen on AIX, MinGW, and possibly other
non-GNU systems too due to missing asprintf().

bfd/

* configure.in: Add asprintf and vasprintf to AC_CHECK_DECLS.
* config.in, configure: Regenerate.

9 years agoAutomatic date update in version.in
GDB Administrator [Tue, 28 Jul 2015 00:00:08 +0000 (00:00 +0000)]
Automatic date update in version.in

9 years agoSet NOPIE_CFLAGS and NOPIE_LDFLAGS
H.J. Lu [Mon, 27 Jul 2015 23:16:17 +0000 (16:16 -0700)]
Set NOPIE_CFLAGS and NOPIE_LDFLAGS

GCC 6 can be configured to generate PIE by default.  But some linker
size tests expect non-PIE.  This patch defines NOPIE_CFLAGS to
"-fno-PIE" and NOPIE_LDFLAGS to "-no-pie" if target compiler supports
them.  Add $NOPIE_CFLAGS and $NOPIE_LDFLAGS to linker size tests if
needed.

* config/default.exp (NOPIE_CFLAGS): New.
(NOPIE_LDFLAGS): Likewise.
* ld-size/size.exp (run_cc_link_tests): Add $NOPIE_CFLAGS and
$NOPIE_LDFLAGS if needed.
(run_ld_link_exec_tests): Add $NOPIE_CFLAGS if needed.

9 years agogdb.mi/mi-pending.c: Return NULL instead of nothing in thread function
Simon Marchi [Mon, 27 Jul 2015 19:49:24 +0000 (15:49 -0400)]
gdb.mi/mi-pending.c: Return NULL instead of nothing in thread function

Using gcc 5.2 (maybe other versions as well), building mi-pending.c gives
these warnings:

./gdb.mi/mi-pending.c: In function ‘thread_func’:
./gdb.mi/mi-pending.c:34:5: warning: ‘return’ with no value, in function returning non-void
     return;
     ^
./gdb.mi/mi-pending.c:38:5: warning: ‘return’ with no value, in function returning non-void
     return;
     ^
gdb_compile_pthreads assumes that the build was successful only if there
is no output. These warnings therefore make gdb_compile_pthreads think
that the build failed, and the test doesn't run.

The easy fix is to replace the "return" with "return NULL".  I am
pushing this as obvious.

gdb/testsuite/ChangeLog:

* gdb.mi/mi-pending.c (thread_func): Replace return with return
NULL.

9 years agoRemove xfail in gdb.mi/mi-watch.exp
Simon Marchi [Mon, 27 Jul 2015 19:02:10 +0000 (15:02 -0400)]
Remove xfail in gdb.mi/mi-watch.exp

I noticed there was an unexpected pass in mi-watch.exp when running on
x86_64.  Doing a bit of archeology shows that the xfail was added by
4a543da.  This particular test failed on the MIPS architecture, which
the original contributor was working with.  Here is the thread:

https://www.sourceware.org/ml/gdb-patches/2007-09/msg00151.html

Looking at the latest buildbot results for MIPS, it seems that it's also
an unexpected pass on that architecture.  Therefore, I see no reason to
leave the xfail in place.

gdb/testsuite/ChangeLog:

* gdb.mi/mi-watch.exp (test_watchpoint_triggering): Remove xfail.

9 years agoFactor out complex printing code from generic_val_print
Simon Marchi [Mon, 27 Jul 2015 18:11:26 +0000 (14:11 -0400)]
Factor out complex printing code from generic_val_print

gdb/ChangeLog:

* valprint.c (generic_val_print): Factor out complex
printing code to ...
(generic_val_print_complex): ... this new function.

9 years agoFactor out decfloat printing code from generic_val_print
Simon Marchi [Mon, 27 Jul 2015 18:11:25 +0000 (14:11 -0400)]
Factor out decfloat printing code from generic_val_print

gdb/ChangeLog:

* valprint.c (generic_val_print): Factor out decfloat
printing code to ...
(generic_val_print_decfloat): ... this new function.

9 years agoFactor out float printing code from generic_val_print
Simon Marchi [Mon, 27 Jul 2015 18:11:24 +0000 (14:11 -0400)]
Factor out float printing code from generic_val_print

gdb/ChangeLog:

* valprint.c (generic_val_print): Factor out float
printing code to ...
(generic_val_print_float): ... this new function.

9 years agoFactor out char printing code from generic_val_print
Simon Marchi [Mon, 27 Jul 2015 18:11:24 +0000 (14:11 -0400)]
Factor out char printing code from generic_val_print

gdb/ChangeLog:

* valprint.c (generic_val_print): Factor out char
printing code to ...
(generic_val_print_char): ... this new function.

9 years agoFactor out int printing code from generic_val_print
Simon Marchi [Mon, 27 Jul 2015 18:11:23 +0000 (14:11 -0400)]
Factor out int printing code from generic_val_print

gdb/ChangeLog:

* valprint.c (generic_val_print): Factor out integer
printing code to ...
(generic_val_print_int): ... this new function.

9 years agoFactor out bool printing code from generic_val_print
Simon Marchi [Mon, 27 Jul 2015 18:11:23 +0000 (14:11 -0400)]
Factor out bool printing code from generic_val_print

gdb/ChangeLog:

* valprint.c (generic_val_print): Factor out bool
printing code to ...
(generic_val_print_bool): ... this new function.

9 years agoFactor out function/method printing code from generic_val_print
Simon Marchi [Mon, 27 Jul 2015 18:11:22 +0000 (14:11 -0400)]
Factor out function/method printing code from generic_val_print

gdb/ChangeLog:

* valprint.c (generic_val_print): Factor out function/method
printing code to ...
(generic_val_print_func): ... this new function.

9 years agoFactor out flags printing code from generic_val_print
Simon Marchi [Mon, 27 Jul 2015 18:11:22 +0000 (14:11 -0400)]
Factor out flags printing code from generic_val_print

gdb/ChangeLog:

* valprint.c (generic_val_print): Factor out flags
printing code to ...
(generic_val_print_flags): ... this new function.

9 years agoFactor out enum printing code from generic_val_print
Simon Marchi [Mon, 27 Jul 2015 18:11:21 +0000 (14:11 -0400)]
Factor out enum printing code from generic_val_print

gdb/ChangeLog:

* valprint.c (generic_val_print): Factor out enum
printing code to ...
(generic_val_print_enum): ... this new function.

9 years agoFactor out reference printing code from generic_val_print
Simon Marchi [Mon, 27 Jul 2015 18:11:21 +0000 (14:11 -0400)]
Factor out reference printing code from generic_val_print

gdb/ChangeLog:

* valprint.c (generic_val_print): Factor out reference
printing code to ...
(generic_val_print_ref): ... this new function.

9 years agoFactor out memberptr printing code from generic_val_print
Simon Marchi [Mon, 27 Jul 2015 18:11:20 +0000 (14:11 -0400)]
Factor out memberptr printing code from generic_val_print

gdb/ChangeLog:

* valprint.c (generic_val_print): Factor out memberptr
printing code to ...
(generic_val_print_memberptr): ... this new function.

9 years agoFactor out pointer printing code from generic_val_print
Simon Marchi [Mon, 27 Jul 2015 18:11:19 +0000 (14:11 -0400)]
Factor out pointer printing code from generic_val_print

gdb/ChangeLog:

* valprint.c (generic_val_print): Factor out pointer
printing code to ...
(generic_val_print_ptr): ... this new function.

9 years agoFactor out array printing code from generic_val_print
Simon Marchi [Mon, 27 Jul 2015 18:11:19 +0000 (14:11 -0400)]
Factor out array printing code from generic_val_print

gdb/ChangeLog:

* valprint.c (generic_val_print): Factor out array
printing code to ...
(generic_val_print_array): ... this new function.

9 years agoFactor out print_unpacked_pointer from generic_val_print
Simon Marchi [Mon, 27 Jul 2015 18:11:18 +0000 (14:11 -0400)]
Factor out print_unpacked_pointer from generic_val_print

gdb/ChangeLog:

* valprint.c (generic_val_print): Factor out
print_unpacked_pointer code to ...
(print_unpacked_pointer): ... this new function.

9 years agoCheck address of versined symbol
H.J. Lu [Mon, 27 Jul 2015 17:04:31 +0000 (10:04 -0700)]
Check address of versined symbol

Since GCC 5 folds symbol address comparison, assuming each symbol has a
different address, &foo == &bar is always false for GCC 5.  This patch
adds check_ptr_eq if 2 addresses are the same and uses it to check the
address of versined symbol.

PR ld/18718
* ld-elf/check-ptr-eq.c: New file.
* ld-elf/pr18718.c (main): Call check_ptr_eq.
* ld-elf/shared.exp: Add check-ptr-eq.c to PR ld/18718 tests.

9 years agoHave SIGTERM promptly quit GDB even when the dummy target is active
Patrick Palka [Fri, 24 Jul 2015 17:58:47 +0000 (13:58 -0400)]
Have SIGTERM promptly quit GDB even when the dummy target is active

GDB currently does not promptly quit after receiving a SIGTERM while no
proper target is active.  This is because in handle_sigterm we currently
look at target_can_async_p to determine whether to asynchronously quit
GDB using an async signal handler or to asynchronously quit using the
quit flag.  However, target_can_async_p is always false under the dummy
target, so under this target we always use the quit flag and not the
async signal handler to signal that GDB should quit.  So GDB won't quit
until a code path that checks the quit flag is executed.

To fix this issue, this patch makes the SIGTERM handler no longer
inspect target_can_async_p, and instead makes the handler
unconditionally set the quit flag _and_ mark the corresponding async
signal handler, so that if the target is async (or if it's the dummy
target) then we will likely quit through the async signal handler, and
if it's not async then we will likely quit through the quit flag.  This
redundant approach is similar to how we handle SIGINT.

gdb/ChangeLog:

* event-top.c (handle_sigterm): Don't inspect
target_can_async_p.  Always set the quit flag and always mark
the async signal handler.

gdb/testsuite/ChangeLog:

* gdb.base/gdb-sigterm-2.exp: New test.

9 years ago[gdbserver] Don't set srv_linux_usrregs for aarch64*-*-linux*
Yao Qi [Mon, 27 Jul 2015 15:15:48 +0000 (16:15 +0100)]
[gdbserver] Don't set srv_linux_usrregs for aarch64*-*-linux*

We don't use PTRACE_PEEKUSR/PTRACE_POKEUSR on aarch64-linux, so don't
need to set srv_linux_usrregs.  This patch removes that line.

gdb/gdbserver:

2015-07-27  Yao Qi  <yao.qi@linaro.org>

* configure.srv (case aarch64*-*-linux*): Don't set
srv_linux_usrregs.

9 years agoFix ChangeLog entry
Yao Qi [Mon, 27 Jul 2015 15:12:31 +0000 (16:12 +0100)]
Fix ChangeLog entry

9 years agoRemove REMOTE_EXAMPLES from gdb/Makefile.in
Yao Qi [Thu, 23 Jul 2015 15:26:14 +0000 (16:26 +0100)]
Remove REMOTE_EXAMPLES from gdb/Makefile.in

I happen to see REMOTE_EXAMPLES isn't used anywhere, so this patch
removes it.

REMOTE_EXAMPLES was added in the following commit in 1991,

commit 86bbb439c8fa01fd55d6cbce102483a471ffd0c4
Author: John Gilmore <gnu@cygnus>
Date:   Fri May 3 19:57:13 1991 +0000

    There should be a Makefile in the cvs main directory, configured
    for "./config.gdb none", so that things like "make tags" and "make tar"
    will work.

and it was used like:

TARFILES = ${TAGFILES_MAINDIR} ${OTHERS} ${REMOTE_EXAMPLES}

However TARFILES was removed by the change latter in 1994,

Tue Aug 16 15:24:03 1994  Jim Kingdon  (kingdon@lioth.cygnus.com)

* symtab.c (decode_line_1): If funfirstline and we get a
non-LOC_BLOCK symbol (e.g. variable or type), then error().

* Makefile.in (TARFILES, NONSRC, SFILES_STAND, SFILES_KGDB):
Remove; unused.

Since then, REMOTE_EXAMPLES is not used any more.

gdb:

2015-07-27  Yao Qi  <yao.qi@linaro.org>

* Makefile.in (REMOTE_EXAMPLES): Remove it.

9 years agoRegenerate configure files
H.J. Lu [Mon, 27 Jul 2015 14:56:32 +0000 (07:56 -0700)]
Regenerate configure files

bfd/

* configure: Regenerated.

binutils/

* configure: Regenerated.

gas/

* configure: Regenerated.

gold/

* configure: Regenerated.

gprof/

* configure: Regenerated.

ld/

* configure: Regenerated.

opcodes/

* configure: Regenerated.

9 years agoSync toplevel files with GCC
H.J. Lu [Mon, 27 Jul 2015 14:49:05 +0000 (07:49 -0700)]
Sync toplevel files with GCC

Sync with GCC
2015-07-24  Michael Darling  <darlingm@gmail.com>

PR other/66259
* config-ml.in: Reflects renaming of configure.in to configure.ac
* configure: Likewise
* configure.ac: Likewise

9 years agoSync config with GCC
H.J. Lu [Mon, 27 Jul 2015 14:43:26 +0000 (07:43 -0700)]
Sync config with GCC

Sync with GCC
2015-07-24  Micahel Darling  <darlingm@gmail.com>

PR other/66259
* gettext.m4: Reflects renaming of configure.in to configure.ac
* po.m4: Likewise
* stdint.m4: Likewise
* tcl.m4: Likewise

9 years agoFix the address size computation for the MSP430 port.
Nick Clifton [Mon, 27 Jul 2015 14:15:28 +0000 (15:15 +0100)]
Fix the address size computation for the MSP430 port.

* elf32-msp430.c (uses_large_model): New function.
(msp430_elf_eh_frame_address_size): New function.
(elf_backend_eh_frame_address_size): Define.

9 years agoAppend $PLT_CFLAGS to CC/CXX for S-records tests
H.J. Lu [Mon, 27 Jul 2015 12:18:20 +0000 (05:18 -0700)]
Append $PLT_CFLAGS to CC/CXX for S-records tests

S-records tests don't work with -fno-plt.  This path appends $PLT_CFLAGS
to CC and CXX for S-records tests.

* ld-srec/srec.exp (CC): Save and restore.  Append $PLT_CFLAGS.
(CXX): Likewise.

9 years agoPass $PLT_CFLAGS to ld_compile
H.J. Lu [Mon, 27 Jul 2015 12:17:26 +0000 (05:17 -0700)]
Pass $PLT_CFLAGS to ld_compile

Some linker shard library tests without PIC expect PLT.  This patch
passes $PLT_CFLAGS to ld_compile.

* ld-shared/shared.exp: Pass $PLT_CFLAGS to ld_compile.

9 years agoAppend $PLT_CFLAGS to CC for NOCROSSREFS tests
H.J. Lu [Mon, 27 Jul 2015 12:16:38 +0000 (05:16 -0700)]
Append $PLT_CFLAGS to CC for NOCROSSREFS tests

NOCROSSREFS tests don't work with -fno-plt.  This path appends
$PLT_CFLAGS to CC for NOCROSSREFS tests.

* ld-scripts/crossref.exp (CC): Save and restore.  Append
$PLT_CFLAGS.

9 years agoAdd $PLT_CFLAGS to -fPIC for run_cc_link_tests
H.J. Lu [Mon, 27 Jul 2015 12:15:48 +0000 (05:15 -0700)]
Add $PLT_CFLAGS to -fPIC for run_cc_link_tests

Some x86 linker tests expect PLT.  This patch adds $PLT_CFLAGS to -fPIC
for run_cc_link_tests.

* ld-i386/i386.exp (run_cc_link_tests): Add $PLT_CFLAGS to
-fPIC if needed.
* ld-x86-64/mpx.exp (run_cc_link_tests): Likewise.
* ld-x86-64/x86-64.exp (run_cc_link_tests): Likewise.

9 years agoPass $PLT_CFLAGS to ld_compile
H.J. Lu [Mon, 27 Jul 2015 12:15:01 +0000 (05:15 -0700)]
Pass $PLT_CFLAGS to ld_compile

Some linker visibility tests without PIC expect PLT.  This patch passes
$PLT_CFLAGS to ld_compile.

* ld-elfvsb/elfvsb.exp (visibility_run): Pass $PLT_CFLAGS to
ld_compile.

9 years agoPass $PLT_CFLAGS to build_binary
H.J. Lu [Mon, 27 Jul 2015 12:13:55 +0000 (05:13 -0700)]
Pass $PLT_CFLAGS to build_binary

Some linker symbol version tests without PIC expect PLT.  This patch
adds $PLT_CFLAGS to CFLAGS.

* ld-elfvers/vers.exp (build_vers_lib_no_pic): Pass $PLT_CFLAGS
to build_binary.

9 years agoSet PLT_CFLAGS to "-fplt" if supported
H.J. Lu [Mon, 27 Jul 2015 10:42:39 +0000 (03:42 -0700)]
Set PLT_CFLAGS to "-fplt" if supported

GCC 6 supports -fno-plt.  But some linker tests expect PLT.  This patch
defines PLT_CFLAGS to "-fplt" if target compiler supports it.

* config/default.exp (PLT_CFLAGS): New.

9 years ago[AArch64] Fix extern protected data handling
Szabolcs Nagy [Mon, 27 Jul 2015 10:48:48 +0000 (11:48 +0100)]
[AArch64] Fix extern protected data handling

Emit *GLOB_DAT instead of *RELATIVE relocs for protected data
in shared objects.

This is needed for the fix of glibc bug 17711:
https://sourceware.org/bugzilla/show_bug.cgi?id=17711

bfd:
PR ld/18705
* elfnn-aarch64.c (elf_backend_extern_protected_data): Define.

ld/testsuite:
PR ld/18705
* ld-aarch64/protected-data.d: New.
* ld-aarch64/protected-data.s: New.
* ld-aarch64/aarch64-elf.exp: Add new test.

9 years ago[ARM] Fix extern protected data handling
Szabolcs Nagy [Mon, 27 Jul 2015 10:45:27 +0000 (11:45 +0100)]
[ARM] Fix extern protected data handling

Emit *GLOB_DAT instead of *RELATIVE relocs for protected data
in shared objects.

This is needed for the fix of glibc bug 17711:
https://sourceware.org/bugzilla/show_bug.cgi?id=17711

bfd:
PR ld/18705
* elf32-arm.c (elf_backend_extern_protected_data): Define.

ld/testsuite:
PR ld/18705
* ld-arm/protected-data.d: New.
* ld-arm/protected-data.s: New.
* ld-arm/arm-elf.exp: Add new test.

9 years agoAutomatic date update in version.in
GDB Administrator [Mon, 27 Jul 2015 00:00:08 +0000 (00:00 +0000)]
Automatic date update in version.in

9 years agoCompile PR ld/18718 tests with -O2
H.J. Lu [Sun, 26 Jul 2015 21:55:39 +0000 (14:55 -0700)]
Compile PR ld/18718 tests with -O2

PR ld/18718
* ld-elf/shared.exp: Compile PR ld/18718 tests with -O2.

9 years agoSet errcnt and warncnt to 0 in run_host_cmd_yesno
H.J. Lu [Sun, 26 Jul 2015 18:55:57 +0000 (11:55 -0700)]
Set errcnt and warncnt to 0 in run_host_cmd_yesno

run_host_cmd_yesno should set errcnt and warncnt to 0.  Otherwise, they
may leak to the next run.

* lib/ld-lib.exp (run_host_cmd_yesno): Set errcnt and warncnt
to 0.

9 years agoMake arm_unaligned_reloc test less sensitive to disassembler output format.
Doug Kwan [Sun, 26 Jul 2015 07:54:26 +0000 (00:54 -0700)]
Make arm_unaligned_reloc test less sensitive to disassembler output format.

9 years agoremote.c: Make read_ptid return a null value when no thread id is found.
Kevin Buettner [Fri, 10 Jul 2015 17:25:29 +0000 (10:25 -0700)]
remote.c: Make read_ptid return a null value when no thread id is found.

When using GDB to debug an RX target using the GDB remote protocol,
using a Renesas supplied debug agent, I encountered the following
assertion error:

thread.c:85: internal-error: inferior_thread: Assertion `tp' failed.
A problem internal to GDB has been detected,
further debugging may prove unreliable.
Create a core file of GDB? (y or n) n
Command aborted.

This assertion error occurs due to the fact that the value associated
with inferior_ptid is not on the thread list.

The remote debug output (obtained with "set debug remote 1") is fairly
short, so I will include it up to the point where things go wrong -
which is somewhat before the assertion failure:

    (gdb) target remote coyote.lan:61234
    Remote debugging using coyote.lan:61234
    Sending packet: $qSupported:multiprocess+;swbreak+;hwbreak+;qRelocInsn+#c9...Ack
    Packet received: PacketSize=c00;qXfer:memory-map:read-;qXfer:features:read-;QStartNoAckMode+;multiprocess+;QNonStop+
    Packet qSupported (supported-packets) is supported
    Sending packet: $QStartNoAckMode#b0...Ack
    Packet received: OK
    Sending packet: $Hgp0.0#ad...Packet received: OK
    Sending packet: $QNonStop:0#8c...Packet received: OK
    Sending packet: $qTStatus#49...Packet received:
    Packet qTStatus (trace-status) is NOT supported
    Sending packet: $?#3f...Packet received: S02
    Sending packet: $qfThreadInfo#bb...Packet received: m1
    Sending packet: $qsThreadInfo#c8...Packet received: l
    Sending packet: $qAttached:a410#bf...Packet received: 0
    Packet qAttached (query-attached) is supported
    Sending packet: $Hc-1#09...Packet received: OK
    Sending packet: $qC#b4...Packet received: QC not supported

Above is the trace starting from the invocation of "target remote"
through the call of get_current_thread() in remote_start_remote().
Below, I've pasted this line of code along with additional lines of
context.  The test following the call is especially important to
understanding both the problem and my patch.

          /* We have thread information; select the thread the target
             says should be current.  If we're reconnecting to a
             multi-threaded program, this will ideally be the thread
             that last reported an event before GDB disconnected.  */
          inferior_ptid = get_current_thread (wait_status);
          if (ptid_equal (inferior_ptid, null_ptid))
            {
              /* Odd... The target was able to list threads, but not
                 tell us which thread was current (no "thread"
                 register in T stop reply?).  Just pick the first
                 thread in the thread list then.  */
              inferior_ptid = thread_list->ptid;
            }
        }

Prior to getting to the code pasted above, remote_start_remote()
made a call to target_update_thread_list().  This corresponds to the
following lines from the above trace:

    Sending packet: $qfThreadInfo#bb...Packet received: m1
    Sending packet: $qsThreadInfo#c8...Packet received: l
    Sending packet: $qAttached:a410#bf...Packet received: 0
    Packet qAttached (query-attached) is supported

Once target_update_thread_list has completed, the thread list
contains a single entry: {pid = 42000, lwp = 1, tid = 0}.

remote_start_remote() then makes a call to set_continue_thread(),
accounting for this line of the trace:

    Sending packet: $Hc-1#09...Packet received: OK

Finally, the call to get_current_thread() is responsible for the last
line of the trace that I provided above:

    Sending packet: $qC#b4...Packet received: QC not supported

get_current_thread() calls stop_reply_extract_thread() with the wait
status. This returns null_ptid.

get_current_thread() then calls remote_current_thread with a null
inferior_ptid.  After the calls to putpkt() and getpkt(), rs->buf[0]
is 'Q', so read_ptid() is called and its result is returned.

The buffer passed to read_ptid() is " not supported".  read_ptid ultimately
returns a ptid of {pid = 4200, lwp = 0, tid = 0}.

However, this thread is not on the thread list.  As noted earlier, the
call to target_update_thread_list() had placed {pid = 42000, lwp = 1,
tid = 0} on the list.  This is the only thread in the list.

When these calls ultimately return to remote_start_remote(),
inferior_ptid gets set to {pid = 4200, lwp = 0, tid = 0}, which
(again) is not on the thread list.

It appears to me that the string " not supported" is coming from the
debug agent.  If so, it should be fixed, but I don't see a reason to
not consult the thread list in order to place a valid thread id in
inferior_ptid.

This (consultation of the thread list) is what is done when
inferior_ptid is null_ptid:

  if (ptid_equal (inferior_ptid, null_ptid))
    {
      /* Odd... The target was able to list threads, but not
 tell us which thread was current (no "thread"
 register in T stop reply?).  Just pick the first
 thread in the thread list then.  */
      inferior_ptid = thread_list->ptid;
    }

My patch causes a null inferior_ptid to be returned by read_ptid when
no thread id is found in the response from the debug agent.  This
return value ends up being returned by remote_current_thread() and
then by get_current_thread.  The assignment then places this null
value into inferior_ptid.  That, in turn, allows the ptid_equal test
(noted above) to fetch a valid thread from the thread list.  I no
longer see the assertion failure due a good value (which is on the
thread list) being placed in inferior_ptid.

This patch also adds two log warnings that may be output when "set
debug remote 1" is used.  When running against the Renesas debug agent
mentioned earlier, this is the relevant portion of the log output:

Sending packet: $qC#b4...Packet received: QC not supported
warning: garbage in qC reply
warning: couldn't determine remote current thread; picking first in list.

gdb/ChangeLog:

* remote.c (read_ptid): Return null_ptid when no thread id
is found.
(remote_current_thread): Add log warning for malformed
qC reply.
(remote_start_remote): Add log warning when current thread
not found.

9 years agoAutomatic date update in version.in
GDB Administrator [Sun, 26 Jul 2015 00:00:11 +0000 (00:00 +0000)]
Automatic date update in version.in

9 years agoRevert "Sync readline/ to version 7.0 alpha"
Patrick Palka [Sat, 25 Jul 2015 19:41:05 +0000 (15:41 -0400)]
Revert "Sync readline/ to version 7.0 alpha"

This reverts commit b558ff043d41ba8d17a82f5f9ae5f9dade66160e.
This reverts commit 4a11f2065906976675808364ddbd1c0f77eea41f.

The initial import commit failed to retain local changes made to
readline's configure.in (and the commit message erroneously stated that
there were no local changes that needed to be reapplied).  Also the
import caused a couple of build errors and a scattering of testsuite
regressions throughout many arches.  It's probably better to start over
with this import, hopefully more carefully next time.

9 years agoRevert: * Makefile.in (check/%.exp): Pass directory for GDB_PARALLEL.
Doug Evans [Sat, 25 Jul 2015 19:07:28 +0000 (12:07 -0700)]
Revert: * Makefile.in (check/%.exp): Pass directory for GDB_PARALLEL.

Regressions, e.g.,
http://gdb-build.sergiodj.net/builders/Fedora-x86_64-m32/builds/1501

gdb/testsuite/ChangeLog:

Revert:
* Makefile.in (check/%.exp): Pass directory for GDB_PARALLEL.
(workers/%.worker, build-perf): New rule.
(GDB_PERFTEST_MODE): New variable.
(check-perf): Use it.
(clean): Clean up gdb.perf parallel build subdirs.
* lib/build-piece.exp: New file.
* lib/cache.exp (gdb_do_cache): Include $GDB_PARALLEL in path name.
* lib/gdb.exp (standard_output_file): Include $GDB_PARALLEL in path
name.
(standard_temp_file): Ditto.
(GDB_PARALLEL handling): Make outputs,temp,cache directories as subdirs
of $GDB_PARALLEL.

9 years agoDon't build readline's shared libs by default
Patrick Palka [Sat, 25 Jul 2015 15:14:34 +0000 (11:14 -0400)]
Don't build readline's shared libs by default

Since the sync to version 7.0-alpho, readline now by default builds
(unused) shared libraries alongside static libraries, whereas before it
only built static libraries.  A couple of GDB buildbots were not happy
with this change:

  http://gdb-build.sergiodj.net/builders/AIX-POWER7-plain/builds/240
  http://gdb-build.sergiodj.net/builders/Fedora-i686/builds/1518

To get these buildbots building again, this patch alters readline's
configure.ac file to not build shared libraries by default, as was the
case with readline 6.2.  A more permanent fix may be to alter the
top-level Makefile.def to pass --disable-shared to readline, or to
investigate why these building these shared libraries are giving the
buildbots trouble.  (I think the proximate reason why the i686 buildbot
fails is because it passes CFLAGS=-m32 instead of CC="gcc -m32" to the
top-level configure script, and readline's linker commands don't inherit
CFLAGS.  Not sure about the AIX failure.)

readline/ChangeLog.gdb:

* configure.ac: Default opt_shared_libs to no.
* configure: Regenerate.

9 years agoAdd missing ChangeLog files
H.J. Lu [Sat, 25 Jul 2015 15:10:51 +0000 (08:10 -0700)]
Add missing ChangeLog files

9 years agoSkip missing symbol version section check for executable
H.J. Lu [Sat, 25 Jul 2015 14:56:18 +0000 (07:56 -0700)]
Skip missing symbol version section check for executable

Missing symbol version section is a run-time problem only if it will
be referenced dynamically at run-time.  We should skip the check for
locally defined symbol, which isn't referenced by shared library, when
linking executable.

bfd/

PR ld/18718
* elflink.c (elf_link_output_extsym): Check symbol version
section check only if not linking executable, the symbol is
referenced by shared library or not locally defined.

ld/testsuite/

PR ld/18718
* ld-elf/pr18718.c: New file.
* ld-elf/shared.exp: Run tests for PR ld/18718.

9 years agoSync readline/ to version 7.0 alpha
Patrick Palka [Wed, 15 Jul 2015 00:29:21 +0000 (20:29 -0400)]
Sync readline/ to version 7.0 alpha

This patch syncs our upstream copy of readline from version 6.2 to the
latest version, 7.0 alpha (released July 10 2015).

I essentially copied what was done the last time readline was synced,
when Jan updated to readline 6.2 in 2011:
http://sourceware.org/ml/gdb-patches/2011-05/msg00003.html

Procedure:

1. I extracted the readline-7.0-alpha tarball on top of readline/.
2. I deleted all the new files under doc/ that were deliberately omitted
   before.
3. I regenerated readline/configure and readline/examples/rlfe/configure
   using autoconf 2.64.  No other configure files need regenerating.
4. I updated the function gdb_printable_part in completer.c with a
   trivial change made to the readline function it is based off of,
   printable_part in readline/complete.c.  There is more work to be done in
   completer.c to sync it with readline/complete.c, but it is non-trivial
   and should probably be done separately anyway.

Local patches that had to be reapplied:

    None.  readline 7.0 alpha contains all of our local readline
    patches.

New files in readline/:

    colors.{c,h}
    examples/{hist_erasedups,hist_purgecmd,rl-callbacktest,rlbasic}.c
    parse-colors.{c,h}
    readline.pc.in
    configure.ac

Deleted files in readline/:

    configure.in

Regressions:

After the sync there is one testsuite regression, the test
"signal SIGINT" in gdb.gdb/selftest.exp which now FAILs.  Previously,
the readline 6.2 SIGINT handler would temporarily reinstall the
underlying application's SIGINT handler and immediately re-raise SIGINT
so that the orginal handler gets invoked.  But now (since readline 6.3)
its SIGINT handler does not re-raise SIGINT or directly invoke the
original handler; it now sets a flag marking that SIGINT was raised, and
waits until readline explicitly has control to call the application's
SIGINT handler.  Anyway, because SIGINT is no longer re-raised from
within readline's SIGINT handler, doing "signal SIGINT" with a stopped
inferior gdb process will no longer resume and then immediately stop the
process (since there is no 2nd SIGINT to immediately catch).  Instead,
the inferior gdb process will now just print "Quit" and continue to run.
So with this commit, this particular test case is adjusted to reflect
this change in behavior (we now have to send a 2nd SIGINT manually to
stop it).

Aside from this one testsuite regression, I personally noticed no
regression in user-visible behavior.  Though I only tested on x86_64
and on i686 Debian Stretch.

Getting this kind of change in at the start of the GDB 7.11 development
cycle will allow us to get a lot of passive testing from developers and
from bleeding-edge users.

readline/ChangeLog.gdb:

Import readline 7.0 alpha
* configure: Regenerate.
* examples/rlfe/configure: Regenerate.

gdb/ChangeLog:

* completer.c (gdb_printable_part): Sync with readline function
it is based off of.

gdb/testsuite/ChangeLog:

* gdb.gdb/selftest.exp (test_with_self): Update test to now
expect the GDB inferior to no longer immediately stop after
being resumed with "signal SIGINT".

9 years agoFix broken -Bsymbolic-functions
Alan Modra [Sat, 25 Jul 2015 07:08:42 +0000 (16:38 +0930)]
Fix broken -Bsymbolic-functions

For selected targets.  The testcase reveals a number of targets that
still need fixing.

bfd/
* elf32-arm.c (elf32_arm_final_link_relocate): Use SYMBOLIC_BIND to
check if a symbol should be bound symbolically.
* elf32-hppa.c (elf32_hppa_check_relocs,
elf32_hppa_adjust_dynamic_symbol, elf32_hppa_relocate_section,
elf32_hppa_finish_dynamic_symbol): Likewise.
* elf32-m68k.c (elf_m68k_check_relocs,
elf_m68k_relocate_section): Likewise.
* elf32-nios2.c (nios2_elf32_relocate_section,
nios2_elf32_check_relocs, allocate_dynrelocs): Likewise.
* elf32-tic6x.c (elf32_tic6x_finish_dynamic_symbol,
elf32_tic6x_relocate_section): Likewise.
ld/testsuite/
* ld-elf/symbolic-func.s,
* ld-elf/symbolic-func.r: New test.
* ld-elf/elf.exp: Run it.

9 years agoRevert 4fd4095a5ffe3d4e50e0dac5f8ad37b8478afa9d, log individual measurements.
Doug Evans [Sat, 25 Jul 2015 00:39:56 +0000 (17:39 -0700)]
Revert 4fd4095a5ffe3d4e50e0dac5f8ad37b8478afa9d, log individual measurements.

I think I lost a patch along the way, because I remember needing
something like this, but the reverted patch isn't the right way to
do this.  Removing ...

gdb/testsuite/ChangeLog:

* gdb.perf/lib/perftest/measure.py (MeasurementCpuTime::stop): Print
result.
(MeasurementWallTime::stop): Ditto.
(MeasurementVmSizeTime::stop): Ditto.

9 years agoAutomatic date update in version.in
GDB Administrator [Sat, 25 Jul 2015 00:00:08 +0000 (00:00 +0000)]
Automatic date update in version.in

9 years agoAdd gmonster-{1,2} perf testcases.
Doug Evans [Fri, 24 Jul 2015 22:46:31 +0000 (15:46 -0700)]
Add gmonster-{1,2} perf testcases.

These testcases are mocks of real programs.
GDB doesn't care what the programs do, they just have to look
and/or behave like the real program.
These testcases exercise gdb when debugging really large programs.
E.g., gmonster-1 has 10,000 CUs, and gmonster-2 has 1000 shared libs
(which is actually a little small, 5000 would be more accurate).

gdb/testsuite/ChangeLog:

* gdb.perf/lib/perftest/utils.py: New file.
* gdb.perf/gm-hello.cc: New file.
* gdb.perf/gm-pervasive-typedef.cc: New file.
* gdb.perf/gm-pervasive-typedef.h: New file.
* gdb.perf/gm-std.cc: New file.
* gdb.perf/gm-std.h: New file.
* gdb.perf/gm-use-cerr.cc: New file.
* gdb.perf/gm-utils.h: New file.
* gdb.perf/gmonster-null-lookup.py: New file.
* gdb.perf/gmonster-pervasive-typedef.py: New file.
* gdb.perf/gmonster-print-cerr.py: New file.
* gdb.perf/gmonster-ptype-string.py: New file.
* gdb.perf/gmonster-runto-main.py: New file.
* gdb.perf/gmonster-select-file.py: New file.
* gdb.perf/gmonster1-null-lookup.exp: New file.
* gdb.perf/gmonster1-pervasive-typedef.exp: New file.
* gdb.perf/gmonster1-print-cerr.exp: New file.
* gdb.perf/gmonster1-ptype-string.exp: New file.
* gdb.perf/gmonster1-runto-main.exp: New file.
* gdb.perf/gmonster1-select-file.exp: New file.
* gdb.perf/gmonster1.cc: New file.
* gdb.perf/gmonster1.exp: New file.
* gdb.perf/gmonster2-null-lookup.exp: New file.
* gdb.perf/gmonster2-pervasive-typedef.exp: New file.
* gdb.perf/gmonster2-print-cerr.exp: New file.
* gdb.perf/gmonster2-ptype-string.exp: New file.
* gdb.perf/gmonster2-runto-main.exp: New file.
* gdb.perf/gmonster2-select-file.exp: New file.
* gdb.perf/gmonster2.cc: New file.
* gdb.perf/gmonster2.exp: New file.

9 years agoAdd perf testcase generator.
Doug Evans [Fri, 24 Jul 2015 22:43:15 +0000 (15:43 -0700)]
Add perf testcase generator.

gdb/testsuite/ChangeLog:

* gdb.perf/README: New file.
* lib/perftest.exp (tcl_string_list_to_python_list): New function.
* lib/gen-perf-test.exp: New file.

9 years agoPerfTest::assemble functions return results.
Doug Evans [Fri, 24 Jul 2015 22:38:21 +0000 (15:38 -0700)]
PerfTest::assemble functions return results.

gdb/testsuite/ChangeLog:

* lib/perftest.exp (PerfTest::compile): Unconditionally call body.
(PerfTest::startup): New function.
(PerfTest::run): Return result of calling body.
(PerfTest::assemble): Rewrite.
* gdb.perf/backtrace.exp (PerfTest::assemble): Update function result.
* gdb.perf/disassemble.exp (PerfTest::assemble): Ditto.
* gdb.perf/single-step.exp (PerfTest::assemble): Ditto.
* gdb.perf/skip-prologue.exp (PerfTest::assemble): Ditto.
* gdb.perf/solib.exp (PerfTest::assemble): Ditto.

9 years agolib/gdb.exp (clean_restart): Make executable optional.
Doug Evans [Fri, 24 Jul 2015 22:35:12 +0000 (15:35 -0700)]
lib/gdb.exp (clean_restart): Make executable optional.

gdb/testsuite/ChangeLog:

* lib/gdb.exp (clean_restart): Make executable optional.

9 years agoClean up testsuite compiler_info support.
Doug Evans [Fri, 24 Jul 2015 22:32:45 +0000 (15:32 -0700)]
Clean up testsuite compiler_info support.

gdb/testsuite/ChangeLog:

* gdb.base/watchpoint.exp (test_complex_watchpoint): Remove
compiler_info references.
* gdb.cp/temargs.exp: Ditto.
* lib/gdb.exp: Unset compiler_info instead of setting to "unknown".
(get_compiler_info): Early exit if already computed.  Set compiler_info
to "unknown" if there was a problem.
(test_compiler_info): Add function comment.  Call get_compiler_info.

9 years agoAdd parallel build support for perf tests.
Doug Evans [Fri, 24 Jul 2015 22:28:46 +0000 (15:28 -0700)]
Add parallel build support for perf tests.

gdb/testsuite/ChangeLog:

* Makefile.in (check/%.exp): Pass directory for GDB_PARALLEL.
(workers/%.worker, build-perf): New rule.
(GDB_PERFTEST_MODE): New variable.
(check-perf): Use it.
(clean): Clean up gdb.perf parallel build subdirs.
* lib/build-piece.exp: New file.
* lib/cache.exp (gdb_do_cache): Include $GDB_PARALLEL in path name.
* lib/gdb.exp (standard_output_file): Include $GDB_PARALLEL in path
name.
(standard_temp_file): Ditto.
(GDB_PARALLEL handling): Make outputs,temp,cache directories as subdirs
of $GDB_PARALLEL.

9 years agoWorkaround debian change to default value of --as-needed.
Doug Evans [Fri, 24 Jul 2015 22:24:37 +0000 (15:24 -0700)]
Workaround debian change to default value of --as-needed.

gdb/testsuite/ChangeLog:

* lib/future.exp (gdb_default_target_compile): New option
"early_flags".
* lib/gdb.exp (gdb_compile): Undo debian's change in default of
--as-needed.

9 years agoPrint data from individual perf runs.
Doug Evans [Fri, 24 Jul 2015 22:11:07 +0000 (15:11 -0700)]
Print data from individual perf runs.

gdb/testsuite/ChangeLog:

* gdb.perf/lib/perftest/measure.py (MeasurementCpuTime::stop): Print
result.
(MeasurementWallTime::stop): Ditto.
(MeasurementVmSizeTime::stop): Ditto.

9 years agoCall gdb_exit before gdb_skip_xml_test on gdb.base/catch-syscall.exp
Sergio Durigan Junior [Fri, 24 Jul 2015 20:46:49 +0000 (16:46 -0400)]
Call gdb_exit before gdb_skip_xml_test on gdb.base/catch-syscall.exp

The gdb_skip_xml_test procedure explicitly says that it cannot be
invoked when GDB is running.  However, the testcase for "catch
syscall" is wrongly doing that, which is causing a failure on
native-extended-gdbserver tests:

  new FAIL: gdb.base/catch-syscall.exp: set tdesc filename /home/gdb-buildbot/fedora-x86-64-3/fedora-x86-64-native-extended-gdbserver-m32/build/gdb/testsuite/outputs/gdb.base/catch-syscall/trivial.xml (got interactive prompt)

This obvious commit fixes this, by calling gdb_exit before gdb_skip_xml_test.

Checked in as obvious.

gdb/testsuite/ChangeLog
2015-07-24  Sergio Durigan Junior  <sergiodj@redhat.com>

* gdb.base/catch-syscall.exp: Call gdb_exit before
gdb_skip_xml_test.

9 years agoFix s390 GNU/Linux build after enum __ptrace_request changes
Pedro Alves [Fri, 24 Jul 2015 19:29:53 +0000 (20:29 +0100)]
Fix s390 GNU/Linux build after enum __ptrace_request changes

The buildbot noticed that the enum __ptrace_request series broke the
s390 GNU/Linux build:

../../binutils-gdb/gdb/s390-linux-nat.c: In function 'fetch_regs':
../../binutils-gdb/gdb/s390-linux-nat.c:226:54: error: macro "ptrace" requires 4 arguments, but only 3 given
   if (ptrace (PTRACE_PEEKUSR_AREA, tid, (long) &parea) < 0)
                                                      ^
../../binutils-gdb/gdb/s390-linux-nat.c: In function 'store_regs':
../../binutils-gdb/gdb/s390-linux-nat.c:243:54: error: macro "ptrace" requires 4 arguments, but only 3 given
   if (ptrace (PTRACE_PEEKUSR_AREA, tid, (long) &parea) < 0)
                                                      ^

Fix this the same way it's handled everywhere else -- just pass 0 as
forth argument, which also handles non-varargs ptrace prototypes in
non-glibc libcs, e.g., Bionic (if it ever gets a s390 port...).

gdb/ChangeLog:
2015-07-24  Pedro Alves  <palves@redhat.com>

* s390-linux-nat.c (fetch_regs, store_regs, fetch_fpregs)
(s390_stopped_by_watchpoint, s390_prepare_to_resume): Pass 0 as
forth argument to ptrace PTRACE_PEEKUSR_AREA/PTRACE_POKEUSR_AREA.

9 years agogdb.python/py-events.exp and normal_stop observers ordering
Pedro Alves [Fri, 24 Jul 2015 18:34:17 +0000 (19:34 +0100)]
gdb.python/py-events.exp and normal_stop observers ordering

I have patches that:

 1 - make the CLI print stop info from a normal_stop observer, like MI
     does.

 2 - happen to change the order in which the Python and CLI/TUI
     normal_stop observers are installed.

With those in place, py-events.exp regresses like shown below [1],
because the Python stop events are output before CLI prints stop info,
instead of after, and the test doesn't expect that.

With the same Python hooks, the order in which MI and Python events is
emited today is already undefined, because MI also uses the
normal_stop observer for output.  I see no reason that we should in
general define the order observers, interpreters and scripting
languages get their turn at being notified of these events.  So this
patch makes the test cope with Python->CLI output order too.

Tested on x86_64 Fedora 20.

gdb/testsuite/
2015-07-24  Pedro Alves  <palves@redhat.com>

* gdb.python/py-events.exp: Accept output between the stop event
and the prompt.
* gdb.python/py-evsignal.exp: Likewise.
* gdb.python/py-evthreads.exp: Likewise.

[1] - The regressions in question look like:

Before said patches:
  (gdb) continue
  Continuing.
  event type: continue

  Breakpoint 2, first () at /home/pedro/gdb/mygit/build/../src/gdb/testsuite/gdb.python/py-events.c:30
  30   for (i = 0; i < 2; i++)
  event type: stop
  event type: stop
  stop reason: breakpoint
  first breakpoint number: 2
  breakpoint number: 2
  breakpoint number: 3
  all threads stopped
  (gdb) PASS: gdb.python/py-events.exp: continue

After said patches:
  (gdb) continue
  Continuing.
  event type: continue
  event type: stop
  event type: stop
  stop reason: breakpoint
  first breakpoint number: 2
  breakpoint number: 2
  breakpoint number: 3
  all threads stopped

  Breakpoint 2, first () at /home/pedro/gdb/mygit/build/../src/gdb/testsuite/gdb.python/py-events.c:30
  30   for (i = 0; i < 2; i++)
  (gdb) FAIL: gdb.python/py-events.exp: continue

9 years agoPR gdb/18717: internal error if non-leader thread exits process
Pedro Alves [Fri, 24 Jul 2015 18:18:44 +0000 (18:18 +0000)]
PR gdb/18717: internal error if non-leader thread exits process

If a non-leader thread exits the process while all other threads are
ptrace-stopped, native gdb fails an assertion.  The test added by this
commit catches it:

 /home/pedro/gdb/mygit/build/../src/gdb/linux-nat.c:3198: internal-error: linux_nat_filter_event: Assertion `lp->resumed' failed.
 A problem internal to GDB has been detected,
 further debugging may prove unreliable.
 Quit this debugging session? (y or n)
 FAIL: gdb.threads/non-leader-exit-process.exp: program exits normally (GDB internal error)

The fix is just to remove the assertion.

With that out of the way, neither GDB not GDBserver handle this
perfectly though, so I'm adding a KFAIL:

 (gdb) continue
 Continuing.
 [Thread 0x7ffff7fc0700 (LWP 15350) exited]
 No unwaited-for children left.
 Couldn't get registers: No such process.
 (gdb) KFAIL: gdb.threads/non-ldr-exit.exp: program exits normally (PRMS: gdb/18717)

gdb/ChangeLog:
2015-07-24  Pedro Alves  <palves@redhat.com>

PR gdb/18717
* linux-nat.c (linux_nat_filter_event): Don't assert that the lwp
is resumed, and extend the debug log.

gdb/testsuite/ChangeLog:
2015-07-24  Pedro Alves  <palves@redhat.com>

PR gdb/18717
* gdb.threads/non-ldr-exit.c: New file.
* gdb.threads/non-ldr-exit.exp: New file.

9 years agoFix failed exec error message
Pedro Alves [Fri, 24 Jul 2015 16:27:58 +0000 (17:27 +0100)]
Fix failed exec error message

Ref: https://sourceware.org/ml/gdb-patches/2015-07/msg00629.html

This fixes the bogus command line in the error message shown when the
SHELL environment variable points somewhere that's not something that
resembles a shell:

  $ SHELL=/nonexisting gdb /home/pedro/a.out
  (gdb) r
  Starting program: /home/pedro/a.out
 - Cannot exec /home/pedro/a.out -c exec /home/pedro/a.out .
 + Cannot exec /nonexisting -c exec /home/pedro/a.out .
  Error: No such file or directory
  During startup program exited with code 127.
  (gdb)

gdb/ChangeLog:
2015-07-24  Pedro Alves  <palves@redhat.com>

* fork-child.c (fork_inferior): Print argv[0] instead of exec_file.

9 years agoAdd 'U' suffix to silence GCC 6 warning
H.J. Lu [Fri, 24 Jul 2015 16:10:18 +0000 (09:10 -0700)]
Add 'U' suffix to silence GCC 6 warning

GCC 6 warns:

error: result of ‘63 << 26’ requires 33 bits to represent, but ‘int’ only has 32 bits [-Werror=shift-overflow=]

on 0x3f << 26.  This patch adds 'U' suffix to make integer constant
unsigned.

* alpha.c (OP_Jxx): Add 'U' suffix to make it unsigned.
(OP_BSR): Likewise.
(Jxx_FUNC_JMP): Likewise.
(Jxx_FUNC_JSR): Likewise.
(Jxx_FUNC_RET): Likewise.
(Jxx_FUNC_JSR_COROUTINE): Likewise.
(alpha_find_call): Replace 0x3f with 0x3fU.

9 years agoUse 0xffffffffffffffffLL to silence GCC 6 warning
H.J. Lu [Fri, 24 Jul 2015 16:05:33 +0000 (09:05 -0700)]
Use 0xffffffffffffffffLL to silence GCC 6 warning

GCC 6 warns:

error: result of ‘4294967295ll << 32’ requires 65 bits to represent, but ‘long long int’ only has 64 bits [-Werror=shift-overflow=]

on ((((bfd_signed_vma) 0xffffffff) << 32) | 0xffffffff).  This patch
replaces it with bfd_signed_vma) 0xffffffffffffffffLL.

* stabs.c (parse_stab_range_type): Use 0xffffffffffffffffLL.

9 years agoFix the evaluation of RL78 complex relocs, by making immediate values be computed...
Nick Clifton [Fri, 24 Jul 2015 15:44:27 +0000 (16:44 +0100)]
Fix the evaluation of RL78 complex relocs, by making immediate values be computed relative to a new absolute symbol.

gas * config/tc-rl78.c (rl78_abs_sym): New local variable.
(md_begin): Initialise the new symbol.
(OPIMM): Define the value to be relative to the new symbol and not
the absolute section symbol.

ld * emulparams/elf32rl78.sh (OTHER_SECTIONS): Provide a value for
the _-rl78_abs__ symbol.

tests * gas/all/struct.d: Allow for extra symbols in the output.
* gas/macros/test1.d: Likewise.
* gas/elf/elf.exp: Add an rl78 machine.
* gas/elf/sections2e-rl78: New file.

tests * binutils-all/localize-hidden-1.d: Allow for extra symbols in the
output.
        * binutils-all/strip-11.d: Skip for the RL78.