Make gdb.threads/step-over-trips-on-watchpoint.exp effective on !x86
authorPedro Alves <palves@redhat.com>
Fri, 10 Apr 2015 12:11:32 +0000 (13:11 +0100)
committerPedro Alves <palves@redhat.com>
Fri, 10 Apr 2015 12:11:32 +0000 (13:11 +0100)
commitebc90b50ce6377bf822c918eaf7c55bcd451ba45
treee61887b72f020e1f654648af4abc88a4e2ebea71
parent11e6e4c72cce2961f80e282cc4d859e7c266e17d
Make gdb.threads/step-over-trips-on-watchpoint.exp effective on !x86

This test is currently failing like this on (at least) PPC64 and s390x:

 FAIL: gdb.threads/step-over-trips-on-watchpoint.exp: no thread-specific bp: step: step
 FAIL: gdb.threads/step-over-trips-on-watchpoint.exp: no thread-specific bp: next: next
 FAIL: gdb.threads/step-over-trips-on-watchpoint.exp: with thread-specific bp: step: step
 FAIL: gdb.threads/step-over-trips-on-watchpoint.exp: with thread-specific bp: next: next

gdb.log:

 (gdb) PASS: gdb.threads/step-over-trips-on-watchpoint.exp: no thread-specific bp: step: set scheduler-locking off
 step
 wait_threads () at ../../../src/gdb/testsuite/gdb.threads/step-over-trips-on-watchpoint.c:49
 49        return 1; /* in wait_threads */
 (gdb) FAIL: gdb.threads/step-over-trips-on-watchpoint.exp: no thread-specific bp: step: step

The problem is that the test assumes that both the "watch_me = 1;" and
the "other = 1;" lines compile to a single instruction each, which
happens to be true on x86, but no necessarily true everywhere else.
The result is that the test doesn't really test what it wants to test.

Fix it by looking for the instruction that triggers the watchpoint.

gdb/ChangeLog:
2015-04-10  Pedro Alves  <palves@redhat.com>

* gdb.threads/step-over-trips-on-watchpoint.c (child_function):
Remove comment.
* gdb.threads/step-over-trips-on-watchpoint.exp (do_test): Find
both the address of the instruction that triggers the watchpoint
and the address of the instruction immediately after, and use
those addresses for the test.  Fix comment.
gdb/testsuite/ChangeLog
gdb/testsuite/gdb.threads/step-over-trips-on-watchpoint.c
gdb/testsuite/gdb.threads/step-over-trips-on-watchpoint.exp