ebc90b50ce
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.
67 lines
1.5 KiB
C
67 lines
1.5 KiB
C
/* This testcase is part of GDB, the GNU debugger.
|
|
|
|
Copyright 2014-2015 Free Software Foundation, Inc.
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
it under the terms of the GNU General Public License as published by
|
|
the Free Software Foundation; either version 3 of the License, or
|
|
(at your option) any later version.
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
GNU General Public License for more details.
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
|
|
|
#include <pthread.h>
|
|
#include <unistd.h>
|
|
#include <stdlib.h>
|
|
|
|
pthread_barrier_t barrier;
|
|
pthread_t child_thread;
|
|
|
|
volatile unsigned int counter = 1;
|
|
volatile unsigned int watch_me;
|
|
volatile unsigned int other;
|
|
|
|
void *
|
|
child_function (void *arg)
|
|
{
|
|
pthread_barrier_wait (&barrier);
|
|
|
|
while (counter > 0)
|
|
{
|
|
counter++;
|
|
|
|
watch_me = 1; /* set breakpoint child here */
|
|
other = 1;
|
|
usleep (1);
|
|
}
|
|
|
|
pthread_exit (NULL);
|
|
}
|
|
|
|
static int
|
|
wait_threads (void)
|
|
{
|
|
return 1; /* in wait_threads */
|
|
}
|
|
|
|
int
|
|
main ()
|
|
{
|
|
int res;
|
|
long i;
|
|
|
|
pthread_barrier_init (&barrier, NULL, 2);
|
|
|
|
res = pthread_create (&child_thread, NULL, child_function, NULL);
|
|
pthread_barrier_wait (&barrier);
|
|
wait_threads (); /* set wait-thread breakpoint here */
|
|
|
|
pthread_join (child_thread, NULL);
|
|
|
|
exit (EXIT_SUCCESS);
|
|
}
|