From e92370774947104b7e6a7c19899d3489f898a74f Mon Sep 17 00:00:00 2001 From: Jan Kratochvil Date: Sun, 30 Mar 2008 22:15:14 +0000 Subject: [PATCH] - Fix a minor test race of the hardware watchpoints after the fork call. --- gdb-6.6-multifork-debugreg.patch | 27 +++++++++++++++++++++------ gdb.spec | 1 + 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/gdb-6.6-multifork-debugreg.patch b/gdb-6.6-multifork-debugreg.patch index 9e002a1..06270d5 100644 --- a/gdb-6.6-multifork-debugreg.patch +++ b/gdb-6.6-multifork-debugreg.patch @@ -18,6 +18,11 @@ http://sourceware.org/ml/gdb-patches/2008-01/msg00042.html Port to GDB-6.8pre. +2008-03-31 Jan Kratochvil + + * 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 =================================================================== --- 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. */ linux_nat_add_target (t); 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 1970-01-01 00:00:00.000000000 +0000 -+++ 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 @@ +--- /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 +@@ -0,0 +1,172 @@ +/* Test case for forgotten hw-watchpoints after fork()-off of a process. + + 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; + int exit_code = 42 + nr; -+ int status; ++ int status, i; + + child = fork (); + switch (child) @@ -749,6 +752,13 @@ Index: gdb-6.7.50.20080227/gdb/testsuite/gdb.threads/watchpoint-fork-forkoff.c + assert (0); + case 0: + 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). */ + var++; @@ -757,6 +767,11 @@ Index: gdb-6.7.50.20080227/gdb/testsuite/gdb.threads/watchpoint-fork-forkoff.c + _exit (exit_code); + default: + 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); + assert (pid_got == child); + assert (WIFEXITED (status)); diff --git a/gdb.spec b/gdb.spec index 952e339..34b1ae8 100644 --- a/gdb.spec +++ b/gdb.spec @@ -758,6 +758,7 @@ fi - New test of hiding unexpected breakpoints on intentional step commands. - New test of GCORE for shmid 0 shared memory mappings. - 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 - 6.8-1 - Upgrade to the latest upstream final release gdb-6.8.