aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2012-06-26 19:46:30 +0000
committerTom Tromey <tromey@redhat.com>2012-06-26 19:46:30 +0000
commit14fcc022f2df20273ad517caea2234fd830b9d26 (patch)
tree5a65c674bfef3168d02e73125f7e46a21f0f1cd0 /gdb
parent0efbbabc9c1075209244805e34b46db646d95bf3 (diff)
downloadgdb-14fcc022f2df20273ad517caea2234fd830b9d26.zip
gdb-14fcc022f2df20273ad517caea2234fd830b9d26.tar.gz
gdb-14fcc022f2df20273ad517caea2234fd830b9d26.tar.bz2
* gdb.threads/step.c: Remove.
* gdb.threads/step.exp: Remove. * gdb.threads/step2.exp: Remove.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/testsuite/ChangeLog6
-rw-r--r--gdb/testsuite/gdb.threads/step.c221
-rw-r--r--gdb/testsuite/gdb.threads/step.exp190
-rw-r--r--gdb/testsuite/gdb.threads/step2.exp140
4 files changed, 6 insertions, 551 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 4e73971..23e1965 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,5 +1,11 @@
2012-06-26 Tom Tromey <tromey@redhat.com>
+ * gdb.threads/step.c: Remove.
+ * gdb.threads/step.exp: Remove.
+ * gdb.threads/step2.exp: Remove.
+
+2012-06-26 Tom Tromey <tromey@redhat.com>
+
* gdb.threads/watchpoint-fork.exp (test): Use
standard_output_file. Don't declare objdir.
* gdb.threads/attach-into-signal.exp: Use standard_testfile,
diff --git a/gdb/testsuite/gdb.threads/step.c b/gdb/testsuite/gdb.threads/step.c
deleted file mode 100644
index 1b18a4b..0000000
--- a/gdb/testsuite/gdb.threads/step.c
+++ /dev/null
@@ -1,221 +0,0 @@
-/* step.c for step.exp */
-#include <ipc.h>
-#include <pthread.h>
-#include <st.h>
-#include <signal.h>
-#include <stdio.h>
-
-void alarm_handler ();
-void alarm_handler1 ();
-void alarm_handler2 ();
-void thread1 ();
-void thread2 ();
-
-#define TIME_LIMIT 30
-
-
-int count1 = 0;
-int count2 = 0;
-
-pthread_t tid1, tid2;
-pthread_attr_t attr1, attr2;
-
-pthread_mutex_t mut;
-pthread_mutexattr_t mut_attr;
-
-pthread_condattr_t cv_attr_a, cv_attr_b;
-pthread_cond_t cv_a, cv_b;
-
-struct cv_struct
- {
- char a;
- char b;
- }
-test_struct;
-
-main ()
-{
- /*init la struct */
- test_struct.a = 0;
- test_struct.b = 1;
-
- /* create le mutex */
- if (pthread_mutexattr_create (&mut_attr) == -1)
- {
- perror ("mutexattr_create");
- exit (1);
- }
-
-
- if (pthread_mutex_init (&mut, mut_attr) == -1)
- {
- perror ("mutex_init");
- exit (1);
- }
-
- /* create 2 cv */
- if (pthread_condattr_create (&cv_attr_a) == -1)
- {
- perror ("condattr_create(1)");
- exit (1);
- }
-
- if (pthread_cond_init (&cv_a, cv_attr_a) == -1)
- {
- perror ("cond_init(1)");
- exit (1);
- }
-
- if (pthread_condattr_create (&cv_attr_b) == -1)
- {
- perror ("condattr_create(2)");
- exit (1);
- }
-
- if (pthread_cond_init (&cv_b, cv_attr_b) == -1)
- {
- perror ("cond_init(2)");
- exit (1);
- }
-
- /* create 2 threads of execution */
- if (pthread_attr_create (&attr1) == -1)
- {
- perror ("attr_create(1)");
- exit (1);
- }
-
- if (pthread_create (&tid1, attr1, thread1, &count1) == -1)
- {
- perror ("pthread_create(1)");
- exit (1);
- }
-
- if (pthread_attr_create (&attr2) == -1)
- {
- perror ("attr_create(2)");
- exit (1);
- }
-
- if (pthread_create (&tid2, attr2, thread2, &count2) == -1)
- {
- perror ("pthread_create(2)");
- exit (1);
- }
-
- /* set alarm to print out data and exit */
- signal (SIGALRM, alarm_handler);
- alarm (TIME_LIMIT);
-
- for (;;)
- pause ();
-}
-
-void
-thread1 (count)
- int *count;
-{
- tid_t tid;
-
- tid = getstid ();
- printf ("Thread1 tid 0x%x (%d) \n", tid, tid);
- printf ("Thread1 @tid=0x%x \n", &tid);
- signal (SIGALRM, alarm_handler1);
-
- for (;;)
- {
- if (pthread_mutex_lock (&mut) == -1)
- {
- perror ("pthread_mutex_lock(1)");
- pthread_exit ((void *) 0);
- }
-
- while (test_struct.a == 0)
- {
- if (pthread_cond_wait (&cv_a, &mut) == -1)
- {
- perror ("pthread_cond_wait(1)");
- pthread_exit ((void *) -1);
- }
- }
-
- (*count)++;
- printf ("*******thread1 count %d\n", *count);
-
- test_struct.a = 0;
-
- test_struct.b = 1;
- pthread_cond_signal (&cv_b);
-
- if (pthread_mutex_unlock (&mut) == -1)
- {
- perror ("pthread_mutex_unlock(1)");
- pthread_exit ((void *) -1);
- }
- }
-}
-
-void
-thread2 (count)
- int *count;
-{
- tid_t tid;
-
- tid = getstid ();
- printf ("Thread2 tid 0x%x (%d) \n", tid, tid);
- printf ("Thread1 @tid=0x%x \n", &tid);
- signal (SIGALRM, alarm_handler2);
-
- for (;;)
- {
- if (pthread_mutex_lock (&mut) == -1)
- {
- perror ("pthread_mutex_lock(2)");
- pthread_exit ((void *) 0);
- }
-
- while (test_struct.b == 0)
- {
- if (pthread_cond_wait (&cv_b, &mut) == -1)
- {
- perror ("pthread_cond_wait(2)");
- pthread_exit ((void *) -1);
- }
- }
-
- (*count)++;
- printf ("*******thread2 count %d\n", *count);
-
- test_struct.b = 0;
-
- test_struct.a = 1;
- pthread_cond_signal (&cv_a);
-
- if (pthread_mutex_unlock (&mut) == -1)
- {
- perror ("pthread_mutex_unlock(2)");
- pthread_exit ((void *) -1);
- }
- }
-}
-
-
-void
-alarm_handler ()
-{
- printf ("\tcount1 (%d) \n\tcount2 (%d)\n", count1, count2);
- exit (0);
-}
-
-void
-alarm_handler1 ()
-{
- printf ("ALARM thread 1\n");
-}
-
-void
-alarm_handler2 ()
-{
- printf ("ALARM thread 2\n");
- pthread_exit ((void *) 0);
-}
diff --git a/gdb/testsuite/gdb.threads/step.exp b/gdb/testsuite/gdb.threads/step.exp
deleted file mode 100644
index 1f370f0..0000000
--- a/gdb/testsuite/gdb.threads/step.exp
+++ /dev/null
@@ -1,190 +0,0 @@
-# step.exp -- Expect script to test gdb with step.c
-# Copyright (C) 1992, 1997, 2007-2012 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/>.
-
-# This file was written by Hiro Sugawara. (hiro@lynx.com)
-#
-# This test really needs some major surgery to be acceptable, but
-# I'm just about burnt out on lynx work, so I'm not doing it now.
-#
-# * The test has an indeterminate number of pass/fails
-# for each run (it runs a small group of tests until
-# it's timer kicks off). This is very bad for nightly
-# automated regression testing.
-#
-# * It tries to "step" from withint he prologue of a
-# function. This isn't support in gdb (it's going
-# to act like a continue).
-#
-# * This test rarely check that it stopped in sensible
-# places. (see previous bullet -- this test doesn't
-# catch the fact it continued rather than stepped)
-
-
-set program_exited 0
-
-proc set_bp { where } {
- global gdb_prompt
-
- send_gdb "break $where\n"
- # The first regexp is what we get with -g, the second without -g.
- gdb_expect {
- -re "Break.* at .*: file .*, line \[0-9\]*.*$gdb_prompt $" {}
- -re "Breakpoint \[0-9\]* at 0x\[0-9a-f\]*.*$gdb_prompt $" {}
- -re "$gdb_prompt $" { fail "setting breakpoint at $where" ; return 0 }
- timeout { fail "setting breakpoint at $where (timeout)" ; return 0 }
- }
- pass "set_bp"
-}
-
-proc step_it { cmd } {
- global gdb_prompt
- global program_exited
- global inferior_exited_re
-
- send_gdb "$cmd\n"
- gdb_expect {
- -re "0x\[0-9A-Fa-f\]* *in.*\r\n$gdb_prompt $" { pass "step_it"; return 0 }
- -re "0x\[0-9A-Fa-f\]* *\[0-9\]*.*\r\n$gdb_prompt $" { pass "step_it"; return 1 }
- -re "$inferior_exited_re .*\n$gdb_prompt $" {
- set program_exited 1
- return -1
- }
- -re "$gdb_prompt $" { fail "single-stepping ($cmd).\n" ; return -1 }
- timeout { fail "single-stepping ($cmd) timout.\n" ; return -1 }
- }
-}
-
-proc step_inst {} {
- step_it "stepi"
-}
-
-proc step_source {} {
- step_it "step"
-}
-
-proc continue_all {} {
- global gdb_prompt
- global inferior_exited_re
-
- send_gdb "continue\n"
- gdb_expect {
- -re "Breakpoint \[0-9\]*, thread\[0-9\]* .*$gdb_prompt $" {
- pass "continue_all"
- return 0
- }
- -re "$inferior_exited_re .*\n$gdb_prompt $" {
- set program_exited 1
- return 1;
- }
- -re "$gdb_prompt $" { fail "continue" ; return -1 }
- timeout { fail "continue (timeout)" ; return -1 }
- }
-}
-
-proc check_threads { num_threads } {
- global gdb_prompt
-
- set curr_thread 0
- send_gdb "info threads\n"
- while { $num_threads > 0 } {
- gdb_expect {
- -re "\\* *\[0-9\]* process \[0-9\]* thread \[0-9\]* .*\n" {
- incr curr_thread
- set num_threads [expr $num_threads - 1]
- }
- -re " *\[0-9\]* process \[0-9\]* thread \[0-9\]* .*\n" {
- set num_threads [expr $num_threads - 1]
- }
- -re "$gdb_prompt $" {
- if { $num_threads < 0 } {
- fail "check_threads (too many)" ; return -1
- }
- break
- }
- timeout { fail "check_threads (timeout)" ; return -1 }
- }
- }
-
- if { $curr_thread == 0 } {
- fail "check_threads (no current thread)\n"
- return -1
- }
- if { $curr_thread > 1 } {
- fail "check_threads (more than one current thread)\n"
- return -1
- }
- return 0
-}
-
-proc test_cond_wait {} {
- global program_exited
-
- set_bp 135
- runto 179
- while { 1 } {
- set stepi_counter 0
- while { [step_inst] } {
- if { $program_exited } { break }
- incr stepi_counter
- if { $stepi_counter > 30 } {
- fail "too many stepi's per line\n"
- return -1
- }
- }
- if { $program_exited } { break }
- step_source
- if { $program_exited } { break }
- continue_all
- if { $program_exited } { break }
- check_threads 3
- }
-}
-
-proc do_tests {} {
- global subdir
- global objdir
- global srcdir
- global binfile
- global gdb_prompt
-
-
- # Start with a fresh gdb.
-
- gdb_exit
- gdb_start
- gdb_reinitialize_dir $srcdir/$subdir
- gdb_load $objdir/$subdir/$binfile
-
- send_gdb "set width 0\n"
- gdb_expect -re "$gdb_prompt $"
-
- test_cond_wait
-}
-
-# Check to see if we have an executable to test. If not, then either we
-# haven't tried to compile one, or the compilation failed for some reason.
-# In either case, just notify the user and skip the tests in this file.
-
-set binfile "step"
-set srcfile "step.c"
-
-if ![file exists $objdir/$subdir/$binfile] then {
- if $all_flag then {
- warning "$binfile does not exist; tests suppressed."
- }
-} else {
- do_tests
-}
diff --git a/gdb/testsuite/gdb.threads/step2.exp b/gdb/testsuite/gdb.threads/step2.exp
deleted file mode 100644
index 811f95a..0000000
--- a/gdb/testsuite/gdb.threads/step2.exp
+++ /dev/null
@@ -1,140 +0,0 @@
-# step2.exp -- Expect script to test gdb step.c
-# Copyright (C) 1992, 1997, 2007-2012 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/>.
-
-# This file was written by Jeff Law. (law@cygnus.com)
-#
-
-
-set program_exited 0
-
-# A simple and crude test to see that we can step two threads independently
-proc test_multi_threaded_stepping {} {
- global gdb_prompt
- global hex
- global srcfile
- global decimal
-
- # Set breakpoints in code that we know is executed in only
- # thread of control.
- gdb_test "break thread1" \
- "Break.* at $hex: file .*$srcfile, line $decimal\\."
- gdb_test "break thread2" \
- "Break.* at $hex: file .*$srcfile, line $decimal\\."
-
- # the order in which things happen is indeterminate. So we basically
- # look for a set of events and note that each one happens and that
- # all of the required events have happened when we're done.
- #
- # Right now we only verify that both threads start and that they
- # both call pthread_cond_wait twice.
- set thread1started 0
- set thread1condwait 0
- set thread2started 0
- set thread2condwait 0
-
- send_gdb "run\n"
- gdb_expect {
- -re "The program .* has been started already.*y or n. $" {
- send_gdb "y\n"
- exp_continue
- }
- -re ".*Breakpoint \[0-9\]+,.*thread1.* at .*$srcfile:.*\[\t \].*$gdb_prompt $" {
- if { $thread1started != 0 } then {
- fail "thread1 started"
- return
- } else {
- set thread1started 1
- pass "thread1 started"
- }
- send_gdb "step\n"
- exp_continue
- }
- -re ".*Breakpoint \[0-9\]+,.*thread2.* at .*$srcfile:.*\[\t \].*$gdb_prompt $" {
- if { $thread2started != 0 } then {
- fail "thread2 started"
- return
- } else {
- set thread2started 1
- pass "thread2 started"
- }
- send_gdb "step\n"
- exp_continue
- }
- -re ".*pthread_cond_wait.*cv_a.*$gdb_prompt" {
- if { $thread1started == 0 } then {
- fail "thread1 condwait"
- return
- }
- if { $thread1condwait < 2 } then {
- pass "thread1 condwait"
- incr thread1condwait
- }
- if { $thread2condwait == 2 } then {
- pass "multi threaded stepping"
- return
- }
- send_gdb "step\n"
- exp_continue
- }
-
- -re ".*pthread_cond_wait.*cv_b.*$gdb_prompt" {
- if { $thread2started == 0 } then {
- fail "thread2 condwait"
- return
- }
- if { $thread2condwait < 2 } then {
- pass "thread2 condwait"
- incr thread2condwait
- }
- if { $thread1condwait == 2 } then {
- pass "multi threaded stepping"
- return
- }
- send_gdb "step\n"
- exp_continue
- }
-
- -re "$gdb_prompt" {
- send_gdb "step\n"
- exp_continue
- }
- default { fail "multi threaded stepping" }
- }
-}
-
-# Check to see if we have an executable to test. If not, then either we
-# haven't tried to compile one, or the compilation failed for some reason.
-# In either case, just notify the user and skip the tests in this file.
-
-set binfile "step"
-set srcfile "step.c"
-
-if ![file exists $objdir/$subdir/$binfile] then {
- if $all_flag then {
- warning "$binfile does not exist; tests suppressed."
- }
- return
-}
-
-
-# Start with a fresh gdb.
-
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load $objdir/$subdir/$binfile
-
-test_multi_threaded_stepping