]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
[gdb/testsuite] Require hw watchpoint in gdb.ada/task_watch.exp
authorTom de Vries <tdevries@suse.de>
Mon, 28 Nov 2022 17:07:12 +0000 (18:07 +0100)
committerTom de Vries <tdevries@suse.de>
Mon, 28 Nov 2022 17:07:12 +0000 (18:07 +0100)
commit149700668dca44a0f8e1b0aab1711901935c5bd8
treef9f5a2c1e78a8acafd6d692d05b22cf2eab82fac
parentb4bb9faa78c7454e9aafa4fbdbf76e4206acd14a
[gdb/testsuite] Require hw watchpoint in gdb.ada/task_watch.exp

On powerpc64le-linux I run into:
...
(gdb) PASS: gdb.ada/task_watch.exp: info tasks before inserting breakpoint
watch -location value task 3^M
Watchpoint 2: -location value^M
(gdb) PASS: gdb.ada/task_watch.exp: watch -location value task 3
continue^M
Continuing.^M
[Thread 0x7ffff7ccf170 (LWP 65550) exited]^M
[Thread 0x7ffff7abf170 (LWP 65551) exited]^M
FAIL: gdb.ada/task_watch.exp: continue to watchpoint (timeout)
...

On x86_64-linux (where the test-case passes), a hardware watchpoint is used:
...
(gdb) PASS: gdb.ada/task_watch.exp: info tasks before inserting breakpoint
watch -location value task 3^M
Hardware watchpoint 2: -location value^M
...
and after forcing "set can-use-hw-watchpoints 0" we can intermittently
reproduce the same failure.

In the gdb documentation related to watchpoints in multi-threaded programs, we
read:
...
Warning: In multi-threaded programs, software watchpoints have only limited
usefulness.  If GDB creates a software watchpoint, it can only watch the value
of an expression in a single thread.  If you are confident that the expression
can only change due to the current thread’s activity (and if you are also
confident that no other thread can become current), then you can use software
watchpoints as usual.  However, GDB may not notice when a non-current thread’s
activity changes the expression.  (Hardware watchpoints, in contrast, watch an
expression in all threads.)
...

Since the ada task construct is mapped onto threads, it seems that the
same limitation holds for tasks.

Fix this by using skip_hw_watchpoint_tests.

Tested on powerpc64-linux.
Tested-By: Carl Love <cel@us.ibm.com>
gdb/testsuite/gdb.ada/task_watch.exp