1 --- /dev/null 2009-09-25 12:44:54.497650251 +0200
2 +++ ./gdb/testsuite/gdb.threads/simultaneous-step-resume-breakpoint.exp 2009-09-25 17:27:12.000000000 +0200
4 +# Copyright (C) 2009 Free Software Foundation, Inc.
6 +# This program is free software; you can redistribute it and/or modify
7 +# it under the terms of the GNU General Public License as published by
8 +# the Free Software Foundation; either version 3 of the License, or
9 +# (at your option) any later version.
11 +# This program is distributed in the hope that it will be useful,
12 +# but WITHOUT ANY WARRANTY; without even the implied warranty of
13 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 +# GNU General Public License for more details.
16 +# You should have received a copy of the GNU General Public License
17 +# along with this program. If not, see <http://www.gnu.org/licenses/>. */
19 +# Test multiple threads stepping into a .debug_line-less function with
20 +# a breakpoint placed on its return-to-caller point.
22 +set testfile simultaneous-step-resume-breakpoint
23 +set srcfile ${testfile}.c
24 +set binfile ${objdir}/${subdir}/${testfile}
26 +if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
32 +gdb_reinitialize_dir $srcdir/$subdir
34 +# Ensure we have no debuginfo for the `sleep' call itself (=for libc).
35 +gdb_test "set debug-file-directory /DoesNotExist"
42 +# Red Hat vendor patch does set it to "step" by default.
43 +gdb_test "set scheduler-locking off"
45 +gdb_breakpoint [gdb_get_line_number "final-exit"]
47 +gdb_breakpoint [gdb_get_line_number "sleep-call"]
48 +gdb_continue_to_breakpoint "sleep-call"
50 +gdb_test "step" "sleep-call.*" "step thread 1"
51 +gdb_test "step" "sleep-call.*" "step thread 2"
52 +gdb_test "step" "sleep-after.*" "step thread 3"
54 +set test "first continue"
55 +gdb_test_multiple "continue" $test {
56 + -re "final-exit.*$gdb_prompt $" {
61 + -re "sleep-after.*$gdb_prompt $" {
62 + # Fedora/RHEL branch.
67 +gdb_test "continue" "sleep-after.*" "second continue"
68 +gdb_test "continue" "final-exit.*" "third continue"
69 --- /dev/null 2009-09-25 12:44:54.497650251 +0200
70 +++ ./gdb/testsuite/gdb.threads/simultaneous-step-resume-breakpoint.c 2009-09-25 17:29:42.000000000 +0200
72 +/* Copyright 2009 Free Software Foundation, Inc.
74 + Written by Fred Fish of Cygnus Support
75 + Contributed by Cygnus Support
77 + This file is part of GDB.
79 + This program is free software; you can redistribute it and/or modify
80 + it under the terms of the GNU General Public License as published by
81 + the Free Software Foundation; either version 3 of the License, or
82 + (at your option) any later version.
84 + This program is distributed in the hope that it will be useful,
85 + but WITHOUT ANY WARRANTY; without even the implied warranty of
86 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
87 + GNU General Public License for more details.
89 + You should have received a copy of the GNU General Public License
90 + along with this program. If not, see <http://www.gnu.org/licenses/>. */
92 +/* Test multiple threads stepping into a .debug_line-less function with
93 + a breakpoint placed on its return-to-caller point. */
110 + i = sleep (THREADS); /* sleep-call */
111 + if (errno != 0) /* sleep-after */
114 + /* The GDB bug with forgotten step-resume breakpoint could leave stale
115 + breakpoint on the I assignment making it a nop. */
116 + if (i == 0xdeadf00d)
121 + pthread_exit (NULL);
127 + pthread_t threads[THREADS];
130 + for (threadi = 0; threadi < THREADS; threadi++)
134 + i = pthread_create (&threads[threadi], NULL, func, NULL);
141 + for (threadi = 0; threadi < THREADS; threadi++)
145 + i = pthread_join (threads[threadi], NULL);
149 + return 0; /* final-exit */