arm_hwcap is a global variable, and we should avoid using it as much
as we can. Instead of checking arm_hwcap, we can check whether
regcache->tdesc is a certain kind of target description. This is
what this patch does.
gdb/gdbserver:
2015-07-30 Yao Qi <yao.qi@linaro.org>
* linux-arm-low.c (arm_fill_wmmxregset): Don't use arm_hwcap.
Use regcache->tdesc instead.
(arm_store_wmmxregset): Likewise.
(arm_fill_vfpregset): Likewise.
(arm_store_vfpregset): Likewise.
In order to align with arm-linux-nat.c counterparts, we don't use
arm_num_regs and arm_regmap in functions arm_fill_gregset and
arm_store_gregset. Instead, we use register numbers. With this
patch applied, arm_fill_gregset and arm_store_gregset don't need
arm_num_regs and arm_regmap, and they will be moved to a separate
file shared for both arm and aarch64 in the following patch.
gdb/gdbserver:
2015-07-30 Yao Qi <yao.qi@linaro.org>
* linux-arm-low.c: Include arch/arm.h.
(arm_fill_gregset): Don't use arm_num_regs and arm_regmap.
(arm_store_gregset): Likewise.
This patch moves ARM register numbers enum to arch/arm.h, so that it
can used by GDBserver too.
This patch also creates a new directory gdb/arch in which arch-specific
or target-specific files are placed.
gdb:
2015-07-30 Yao Qi <yao.qi@linaro.org>
* arm-tdep.h (enum gdb_regnum): Move it to ...
* arch/arm.h: ... here. New file.
* Makefile.in (HFILES_NO_SRCDIR): Add arch/arm.h.
This patch cleans up the decoding functions using booleans when they can
decode two instructions. The boolean argument is used to know which of
the two instructions was decoded.
The instructions affected are BR/BLR, B/BL, CBZ/CBNZ and TBZ/TBNZ.
These arguments would be named after a named bit in the instruction
encoding, this patch renames them to 'is_XXX'. Furthermore, the
'unsigned' type would be used to describe a boolean while
aarch64_decode_cb would use 'int' (see the 'is64' argument). This patch
makes all booleans be 'int' and decoded bitfields be 'unsigned'.
gdb/ChangeLog:
* aarch64-tdep.c (decode_b): Rename link argument to is_bl.
Change its type to int *.
(decode_br): Rename link argument to is_blr. Change its type to
int *.
(decode_cb): Rename op argument to is_cbnz. Change its type to
int *.
(decode_tb): Rename op argument to is_tbnz. Change its type to
int *. Set is_tbnz to either 1 or 0.
(aarch64_analyze_prologue): Change type of is_link to int. Add
new variables is_cbnz and is_tbnz. Adjust call to
aarch64_decode_cb and aarch64_decode_tb.
Since Pedro's ptrace cleanups, the MIPS buildbot compilation fails.
Code in MIPS native uses ptrace with 3 arguments, where ptrace requires
4. When looking at the definition of ptrace in
/usr/include/sys/ptrace.h, it shows that it takes a variable number of
arguments. The wrapper macro in nat/gdb_ptrace.h takes a fixed number
of arguments (4). That would explain why it used to work and stopped.
I am pushing this as obvious, tell me if there is any problem.
I built-tested this with a MIPS toolchain (ct-ng), but I don't have any
setup to test it. At least it should put back the buildbot builder in a
better shape.
gdb/ChangeLog:
* mips-linux-nat.c (write_watchpoint_regs): Add NULL as ptrace's 4th
parameter.
(mips_linux_new_thread): Likewise.
* nat/mips-linux-watch.c (mips_linux_read_watch_registers): Likewise.
gdb/gdbserver/ChangeLog:
* linux-mips-low.c (mips_linux_prepare_to_resume): Add NULL as
ptrace's 4th parameter.
Just a slight cleanup. Committed as obvious.
gdb/testsuite/ChangeLog:
* gdb.base/batch-preserve-term-settings.exp
(test_terminal_settings_preserved_after_cli_exit): Use
send_quit_command.
Tested on x86_64 Debian Stretch, native, gdbserver and
extended-gdbserver. Also tested that the various error paths, like if
$PPID is empty or if SIGTERM did not not kill GDB, function correctly.
gdb/testsuite/ChangeLog:
* gdb.base/batch-preserve-term-settings.exp (send_quit_command):
New proc.
(test_terminal_settings_preserved_after_sigterm): New test.
Now that we can expect inferior output with the gdbserver boards, this
is all it takes to have the test pass against extended-remote
gdbserver.
Don Breazeal originally wrong something like this:
https://sourceware.org/ml/gdb-patches/2015-03/msg00506.html
which was what originally inspired the introduction of
$inferior_spawn_id.
gdb/testsuite/ChangeLog:
2015-07-29 Pedro Alves <palves@redhat.com>
Don Breazeal <donb@codesourcery.com>
* gdb.base/multi-forks.exp (continue_to_exit_bp_loc): Expect
output from both inferior_spawn_id and gdb_spawn_id.
Hi,
While examining BuildBot's logs, I noticed:
<https://sourceware.org/ml/gdb-testers/2015-q3/msg03767.html>
gdb.threads/attach-into-signal.exp has two nested loops and don't use
unique messages. This commit fixes that. Pushed under the obvious
rule.
gdb/testsuite/ChangeLog:
2015-07-29 Sergio Durigan Junior <sergiodj@redhat.com>
* gdb.threads/attach-into-signal.exp (corefunc): Use
with_test_prefix on nested loops, uniquefying the test messages.
My last commit d60a92216e introduced a
regression caused by a typo. This fixes it. Checked in as obvious.
Thanks to Pedro for reporting.
gdb/testsuite/ChangeLog:
2015-07-29 Sergio Durigan Junior <sergiodj@redhat.com>
* gdb.python/py-objfile.exp: Fix typo that snuck in from my last
commit.
When exiting GDB -- whether it's via the "quit" command, via a SIGTERM,
or otherwise -- we should leave the terminal in the state we acquired
it. To that end, we have to undo any modifications that may have been
made by the TUI (ncurses) or by the CLI (readline).
Tested on x86_64 Debian Stretch.
gdb/ChangeLog:
* top.c: Include "tui/tui.h".
(undo_terminal_modifications_before_exit): New static function.
(quit_force): Use it.
gdb/testsuite/ChangeLog:
* gdb.base/batch-preserve-term-settings.exp
(test_terminal_settings_preserved_after_cli_exit): New test.
Right now this variable is initialized to 0 i.e. terminal_is_inferior
and does not get set to terminal_is_ours until target_terminal_init() is
called. This function however only gets called when an inferior is
first created. In the meantime, terminal_state would wrongly remain set
to terminal_is_inferior.
Tested on x86_64 Debian Stretch -- native, gdbserver and
extended-gdbserver.
gdb/ChangeLog:
* target.c (terminal_state): Initialize to terminal_is_ours.
See ChangeLog for details. No functional change intended.
Tested on x86_64 Debian Stretch by verifying that the gdb.log output
remains unchanged for native, gdbserver and extended-gdbserver.
gdb/testsuite/ChangeLog:
* gdb.base/batch-preserve-term-settings.exp: Remove top-level
manipulation of saved_gdbflags.
(test_terminal_settings_preserved): Remove global declaration of
the unused variable pagination_prompt. Remove manipulation of
saved_gdbflags. Use a local variable EXTRA_GDBFLAGS instead of
GDBFLAGS.
We see the following regressions in testing on x86_64-linux,
reverse-step^M
Cannot access memory at address 0x2aaaaaed26c0^M
(gdb) FAIL: gdb.reverse/solib-precsave.exp: reverse-step into solib function one
when GDB reverse step into a function, GDB wants to skip prologue so
it requests TARGET_OBJECT_CODE_MEMORY to read some code memory in
memory_xfer_partial_1. However in dcache_read_memory_partial, the object
becomes TARGET_OBJECT_MEMORY
return ops->to_xfer_partial (ops, TARGET_OBJECT_MEMORY, NULL,
myaddr, NULL, memaddr, len,
xfered_len);
in reverse debugging, ops->to_xfer_partial is record_full_core_xfer_partial
and it will return TARGET_XFER_E_IO because it can't find any records.
The test fails.
At this moment, the delegate relationship is like
dcache -> record-core -> core -> exec
and we want to GDB read memory across targets, which means if the
requested memory isn't found in record-core, GDB can read memory from
core, and exec even further if needed. I find raw_memory_xfer_partial
is exactly what I want.
gdb:
2015-07-29 Yao Qi <yao.qi@linaro.org>
PR record/18691
* dcache.c (dcache_read_memory_partial): Call
raw_memory_xfer_partial.
* target.c (raw_memory_xfer_partial): Make it non-static.
* target.h (raw_memory_xfer_partial): Declare.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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".
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.
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.
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.
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.
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.