Commit Graph

84715 Commits

Author SHA1 Message Date
Pedro Alves 58789a917b 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.
2015-07-29 11:09:45 +01:00
Pedro Alves e8376742bd 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.
2015-07-29 11:09:44 +01:00
Pedro Alves 0828001082 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.
2015-07-29 11:09:44 +01:00
Pedro Alves 4d30e4328f 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.
2015-07-29 11:09:43 +01:00
Pedro Alves 0d30a335a6 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.
2015-07-29 11:09:43 +01:00
Pedro Alves 39413b296f 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.
2015-07-29 11:09:42 +01:00
Pedro Alves 7cb000a97e 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.
2015-07-29 11:09:42 +01:00
Pedro Alves d7b8ac8297 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.
2015-07-29 11:09:41 +01:00
Pedro Alves 789c3a0cc3 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.
2015-07-29 11:09:40 +01:00
Pedro Alves 77e760c3aa 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.
2015-07-29 11:09:40 +01:00
Pedro Alves 8396d2cdf4 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.
2015-07-29 11:09:39 +01:00
Pedro Alves 2051d61f76 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.
2015-07-29 11:09:39 +01:00
Pedro Alves 452397af30 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.
2015-07-29 11:09:38 +01:00
Pedro Alves 8aed9555b2 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.
2015-07-29 11:09:38 +01:00
Pedro Alves 188a61b440 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.
2015-07-29 11:09:37 +01:00
Pedro Alves 12264a451d 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.
2015-07-29 11:09:37 +01:00
Pedro Alves 23ffc893f5 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.
2015-07-29 11:09:36 +01:00
Pedro Alves 6556691831 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.
2015-07-29 11:09:36 +01:00
Hans-Peter Nilsson 11509220a0 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.
2015-07-29 05:40:30 +02:00
GDB Administrator a66f09dd91 Automatic date update in version.in 2015-07-29 00:00:09 +00:00
Sergio Durigan Junior d60a92216e 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.
2015-07-28 17:39:16 -04:00
Pedro Alves bde40b8f56 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".
2015-07-28 18:04:07 +01:00
Simon Marchi 3ae385afe1 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.
2015-07-28 11:01:50 -04:00
Simon Marchi e512cdbdff 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.
2015-07-28 11:01:50 -04:00
Simon Marchi 3723fda829 Update comments in struct value for non-8-bits architectures
gdb/ChangeLog:

	* value.c (struct value): Update comments.
2015-07-28 11:01:49 -04:00
Simon Marchi 2e0569314c 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.
2015-07-28 11:01:49 -04:00
Robert Suchanek c6e5c03a2c 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=.
2015-07-28 11:26:39 +01:00
Robert Suchanek 77403ce966 Add -march=interaptiv
gas/

	* config/tc-mips.c (mips_cpu_info_table): Add interaptiv entry.
	* doc/c-mips.text: Document -march=interaptiv.
2015-07-28 11:26:31 +01:00
Alan Modra e5654c0f84 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
2015-07-28 18:42:43 +09:30
Iain Buclaw d6f1bafa2c 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.
2015-07-28 09:57:32 +02:00
GDB Administrator 671c4e31fb Automatic date update in version.in 2015-07-28 00:00:08 +00:00
H.J. Lu 6f8ea6c424 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.
2015-07-27 16:20:49 -07:00
Simon Marchi 13e1dec896 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.
2015-07-27 15:49:24 -04:00
Simon Marchi da33c9a7bf 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.
2015-07-27 15:02:37 -04:00
Simon Marchi 0c87c0bfdf 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.
2015-07-27 14:11:26 -04:00
Simon Marchi 9550ae5e54 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.
2015-07-27 14:11:25 -04:00
Simon Marchi 7784724bb1 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.
2015-07-27 14:11:24 -04:00
Simon Marchi 385f5affc0 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.
2015-07-27 14:11:24 -04:00
Simon Marchi b21b63420b 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.
2015-07-27 14:11:23 -04:00
Simon Marchi e5bead4b23 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.
2015-07-27 14:11:23 -04:00
Simon Marchi 4a8c372f1f 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.
2015-07-27 14:11:22 -04:00
Simon Marchi d93880bd1c 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.
2015-07-27 14:11:22 -04:00
Simon Marchi ef0bc0dd96 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.
2015-07-27 14:11:21 -04:00
Simon Marchi fe43fede47 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.
2015-07-27 14:11:21 -04:00
Simon Marchi 45000ea2f3 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.
2015-07-27 14:11:20 -04:00
Simon Marchi 81eb921ae1 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.
2015-07-27 14:11:19 -04:00
Simon Marchi 557dbe8a5e 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.
2015-07-27 14:11:19 -04:00
Simon Marchi 9f436164d5 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.
2015-07-27 14:11:18 -04:00
H.J. Lu c45bd4fd43 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.
2015-07-27 10:11:33 -07:00
Patrick Palka 077836f7cf 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.
2015-07-27 12:44:12 -04:00