From 2fe4e8d0d99f29e11a05ad589fc5fe78a1152da0 Mon Sep 17 00:00:00 2001 From: Michael Chastain Date: Thu, 6 Nov 2003 02:08:08 +0000 Subject: [PATCH] 2003-11-05 Michael Chastain * gdb.mi/pthreads.c (routine): Handle early return from sleep. --- gdb/testsuite/ChangeLog | 4 ++++ gdb/testsuite/gdb.mi/pthreads.c | 9 ++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 637d091..1106c49 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2003-11-05 Michael Chastain + + * gdb.mi/pthreads.c (routine): Handle early return from sleep. + 2003-11-03 Kris Warkentin * gdb.arch/gdb1291.c: New test file. diff --git a/gdb/testsuite/gdb.mi/pthreads.c b/gdb/testsuite/gdb.mi/pthreads.c index 801e013..b73b023 100644 --- a/gdb/testsuite/gdb.mi/pthreads.c +++ b/gdb/testsuite/gdb.mi/pthreads.c @@ -42,7 +42,14 @@ static pthread_attr_t null_attr; void * routine (void *arg) { - sleep (9); + /* When gdb is running, it sets hidden breakpoints in the thread + library. The signals caused by these hidden breakpoints can + cause system calls such as 'sleep' to return early. Pay attention + to the return value from 'sleep' to get the full sleep. */ + int unslept = 9; + while (unslept > 0) + unslept = sleep (unslept); + printf ("hello thread\n"); } -- 2.7.4