- Fix a minor test race of the hardware watchpoints after the fork call.

This commit is contained in:
Jan Kratochvil 2008-03-30 22:15:14 +00:00
parent ed268f2814
commit e923707749
2 changed files with 22 additions and 6 deletions

View File

@ -18,6 +18,11 @@ http://sourceware.org/ml/gdb-patches/2008-01/msg00042.html
Port to GDB-6.8pre. Port to GDB-6.8pre.
2008-03-31 Jan Kratochvil <jan.kratochvil@redhat.com>
* gdb.threads/watchpoint-fork-forkoff.c (forkoff): New delay after the
parent/child messages to fix a race.
Index: gdb-6.7.50.20080227/gdb/amd64-linux-nat.c Index: gdb-6.7.50.20080227/gdb/amd64-linux-nat.c
=================================================================== ===================================================================
--- gdb-6.7.50.20080227.orig/gdb/amd64-linux-nat.c 2008-03-01 10:38:02.000000000 +0100 --- gdb-6.7.50.20080227.orig/gdb/amd64-linux-nat.c 2008-03-01 10:38:02.000000000 +0100
@ -698,11 +703,9 @@ Index: gdb-6.7.50.20080227/gdb/s390-nat.c
/* Register the target. */ /* Register the target. */
linux_nat_add_target (t); linux_nat_add_target (t);
linux_nat_set_new_thread (t, s390_fix_watch_points); linux_nat_set_new_thread (t, s390_fix_watch_points);
Index: gdb-6.7.50.20080227/gdb/testsuite/gdb.threads/watchpoint-fork-forkoff.c --- /dev/null 2008-03-30 17:41:11.547000906 -0400
=================================================================== +++ gdb-6.8-patched/gdb/testsuite/gdb.threads/watchpoint-fork-forkoff.c 2008-03-30 18:09:25.000000000 -0400
--- /dev/null 1970-01-01 00:00:00.000000000 +0000 @@ -0,0 +1,172 @@
+++ gdb-6.7.50.20080227/gdb/testsuite/gdb.threads/watchpoint-fork-forkoff.c 2008-03-01 15:18:13.000000000 +0100
@@ -0,0 +1,160 @@
+/* Test case for forgotten hw-watchpoints after fork()-off of a process. +/* Test case for forgotten hw-watchpoints after fork()-off of a process.
+ +
+ Copyright 2008 + Copyright 2008
@ -740,7 +743,7 @@ Index: gdb-6.7.50.20080227/gdb/testsuite/gdb.threads/watchpoint-fork-forkoff.c
+{ +{
+ pid_t child, pid_got; + pid_t child, pid_got;
+ int exit_code = 42 + nr; + int exit_code = 42 + nr;
+ int status; + int status, i;
+ +
+ child = fork (); + child = fork ();
+ switch (child) + switch (child)
@ -749,6 +752,13 @@ Index: gdb-6.7.50.20080227/gdb/testsuite/gdb.threads/watchpoint-fork-forkoff.c
+ assert (0); + assert (0);
+ case 0: + case 0:
+ printf ("child%d: %d\n", nr, (int) getpid ()); + printf ("child%d: %d\n", nr, (int) getpid ());
+ /* Delay to get both the "child%d" and "parent%d" message printed without
+ a race breaking expect by its endless wait on `$gdb_prompt$':
+ Breakpoint 3, breakpoint () at ../../../gdb/testsuite/gdb.threads/watchpoint-fork.c:33
+ 33 }
+ (gdb) parent2: 14223 */
+ i = sleep (1);
+ assert (i == 0);
+ +
+ /* We must not get caught here (against a forgotten breakpoint). */ + /* We must not get caught here (against a forgotten breakpoint). */
+ var++; + var++;
@ -757,6 +767,11 @@ Index: gdb-6.7.50.20080227/gdb/testsuite/gdb.threads/watchpoint-fork-forkoff.c
+ _exit (exit_code); + _exit (exit_code);
+ default: + default:
+ printf ("parent%d: %d\n", nr, (int) child); + printf ("parent%d: %d\n", nr, (int) child);
+ /* Delay to get both the "child%d" and "parent%d" message printed, see
+ above. */
+ i = sleep (1);
+ assert (i == 0);
+
+ pid_got = wait (&status); + pid_got = wait (&status);
+ assert (pid_got == child); + assert (pid_got == child);
+ assert (WIFEXITED (status)); + assert (WIFEXITED (status));

View File

@ -758,6 +758,7 @@ fi
- New test of hiding unexpected breakpoints on intentional step commands. - New test of hiding unexpected breakpoints on intentional step commands.
- New test of GCORE for shmid 0 shared memory mappings. - New test of GCORE for shmid 0 shared memory mappings.
- New test of a crash on `focus cmd', `focus prev' commands. - New test of a crash on `focus cmd', `focus prev' commands.
- Fix a minor test race of the hardware watchpoints after the fork call.
* Fri Mar 28 2008 Jan Kratochvil <jan.kratochvil@redhat.com> - 6.8-1 * Fri Mar 28 2008 Jan Kratochvil <jan.kratochvil@redhat.com> - 6.8-1
- Upgrade to the latest upstream final release gdb-6.8. - Upgrade to the latest upstream final release gdb-6.8.