diff options
author | Andrew Burgess <aburgess@redhat.com> | 2024-11-09 15:02:15 +0000 |
---|---|---|
committer | Andrew Burgess <aburgess@redhat.com> | 2024-11-12 14:41:23 +0000 |
commit | 06b8b0ad976aa3ad5864bbe4b196ba737f677efb (patch) | |
tree | 635546e551d1d795aa859efba728aff0abb7bd35 /include/elf/.Sanitize | |
parent | 26885b2b6cad0294f867e46325127639cfbe4ce5 (diff) | |
download | binutils-master.zip binutils-master.tar.gz binutils-master.tar.bz2 |
Fedora GDB has, for years, carried an out of tree patch for the
gdb.base/annota{1,3}.exp tests. The patch simply adds a call to 'set
breakpoint pending off' near the start of each test.
Normally GDB tests are written using gdb_test or gdb_test_multiple,
with gdb_test being a wrapper around gdb_test_multiple. Inside
gdb_test_multiple we add a test pattern which detects if GDB offers
the user an interactive yes/no prompt and immediately fails the test.
What this means is that if something goes wrong with a test like:
gdb_test "break main" ".*"
and GDB ends up offering this prompt:
Make breakpoint pending on future shared library load? (y or [n])
then instead of hanging waiting for the test to timeout, DejaGNU will
spot the interactive prompt and immediately fail the test.
In the gdb.base/annota{1,3}.exp tests we turn on GDB's annotation
mode, and many of the tests in these scripts are written using
send_gdb and gdb_expect or gdb_expect_list. This is done because in
the past, gdb_test_multiple and friends were hard-coded to use the
"normal" GDB prompt, and these tests instead expect the annotated
prompt. Specifically, gdb_test_multiple expects '$gdb_prompt $' as
the full prompt, that is the value of $gdb_prompt followed by a single
white space. The annotation tests do update the value of $gdb_prompt,
but with annotations on there is no trailing whitespace, so
gdb_test_multiple's default behaviour doesn't work, which is why the
test scripts originally avoided using gdb_test_multiple.
As a result none of the tests in these files would early exit if we
got an interactive yes/no prompt, and instead we'd be relying on each
test to timeout, which could take a while.
However, gdb_test_multiple now accepts a -prompt argument, so we can
modify the prompt we are looking for, which is neat.
So, I started off by going through these tests an changing all of the
tests that create a breakpoint to use gdb_test, passing the -prompt
option to change the prompt.
While doing that I noticed some other things that I could improve in
these tests, I've cleaned up the use of standard_testfile, switched to
use prepare_for_testing, and removed some redundant clean_restart and
'set height 0' calls (set height 0 is done within clean_restart, which
is called by prepare_for_testing).
I've updated some comments which said "we can't use gdb_test" to say
"we can use gdb_test with -prompt option", and I've removed some
commented out debug code (e.g. setting 'exp_internal').
Finally, I ran these two tests through check-all-boards, and spotted
that annota1.exp failed when using a remote host. This is because one
test checks for a full path to the binary in some output, and with a
remote host the binary ends up being copied and the path is not as
expected.
I'm assuming that checking the full path is important, so I've
disabled this test on remote host boards.
After all these changes I checked using 'make check-all-boards' and
there are no unexpected results on either of these tests.
Tested-By: Tom de Vries <tdevries@suse.de>
Acked-By: Tom de Vries <tdevries@suse.de>
Diffstat (limited to 'include/elf/.Sanitize')
0 files changed, 0 insertions, 0 deletions