Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(101)

Side by Side Diff: gdb/testsuite/gdb.threads/step2.exp

Issue 11969036: Merge GDB 7.5.1 (Closed) Base URL: http://git.chromium.org/native_client/nacl-gdb.git@master
Patch Set: Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « gdb/testsuite/gdb.threads/step.exp ('k') | gdb/testsuite/gdb.threads/switch-threads.exp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 # step2.exp -- Expect script to test gdb step.c
2 # Copyright (C) 1992, 1997, 2007-2012 Free Software Foundation, Inc.
3
4 # This program is free software; you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation; either version 3 of the License, or
7 # (at your option) any later version.
8 #
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
13 #
14 # You should have received a copy of the GNU General Public License
15 # along with this program. If not, see <http://www.gnu.org/licenses/>.
16
17 # This file was written by Jeff Law. (law@cygnus.com)
18 #
19
20
21 if $tracelevel then {
22 strace $tracelevel
23 }
24
25 set program_exited 0
26
27 # A simple and crude test to see that we can step two threads independently
28 proc test_multi_threaded_stepping {} {
29 global gdb_prompt
30 global hex
31 global srcfile
32 global decimal
33
34 # Set breakpoints in code that we know is executed in only
35 # thread of control.
36 gdb_test "break thread1" \
37 "Break.* at $hex: file .*$srcfile, line $decimal\\."
38 gdb_test "break thread2" \
39 "Break.* at $hex: file .*$srcfile, line $decimal\\."
40
41 # the order in which things happen is indeterminate. So we basically
42 # look for a set of events and note that each one happens and that
43 # all of the required events have happened when we're done.
44 #
45 # Right now we only verify that both threads start and that they
46 # both call pthread_cond_wait twice.
47 set thread1started 0
48 set thread1condwait 0
49 set thread2started 0
50 set thread2condwait 0
51
52 send_gdb "run\n"
53 gdb_expect {
54 -re "The program .* has been started already.*y or n. $" {
55 send_gdb "y\n"
56 exp_continue
57 }
58 -re ".*Breakpoint \[0-9\]+,.*thread1.* at .*$srcfile:.*\[\t \].*$gdb_pro mpt $" {
59 if { $thread1started != 0 } then {
60 fail "thread1 started"
61 return
62 } else {
63 set thread1started 1
64 pass "thread1 started"
65 }
66 send_gdb "step\n"
67 exp_continue
68 }
69 -re ".*Breakpoint \[0-9\]+,.*thread2.* at .*$srcfile:.*\[\t \].*$gdb_pro mpt $" {
70 if { $thread2started != 0 } then {
71 fail "thread2 started"
72 return
73 } else {
74 set thread2started 1
75 pass "thread2 started"
76 }
77 send_gdb "step\n"
78 exp_continue
79 }
80 -re ".*pthread_cond_wait.*cv_a.*$gdb_prompt" {
81 if { $thread1started == 0 } then {
82 fail "thread1 condwait"
83 return
84 }
85 if { $thread1condwait < 2 } then {
86 pass "thread1 condwait"
87 incr thread1condwait
88 }
89 if { $thread2condwait == 2 } then {
90 pass "multi threaded stepping"
91 return
92 }
93 send_gdb "step\n"
94 exp_continue
95 }
96
97 -re ".*pthread_cond_wait.*cv_b.*$gdb_prompt" {
98 if { $thread2started == 0 } then {
99 fail "thread2 condwait"
100 return
101 }
102 if { $thread2condwait < 2 } then {
103 pass "thread2 condwait"
104 incr thread2condwait
105 }
106 if { $thread1condwait == 2 } then {
107 pass "multi threaded stepping"
108 return
109 }
110 send_gdb "step\n"
111 exp_continue
112 }
113
114 -re "$gdb_prompt" {
115 send_gdb "step\n"
116 exp_continue
117 }
118 default { fail "multi threaded stepping" }
119 }
120 }
121
122 # Check to see if we have an executable to test. If not, then either we
123 # haven't tried to compile one, or the compilation failed for some reason.
124 # In either case, just notify the user and skip the tests in this file.
125
126 set binfile "step"
127 set srcfile "step.c"
128
129 if ![file exists $objdir/$subdir/$binfile] then {
130 if $all_flag then {
131 warning "$binfile does not exist; tests suppressed."
132 }
133 return
134 }
135
136
137 # Start with a fresh gdb.
138
139 gdb_exit
140 gdb_start
141 gdb_reinitialize_dir $srcdir/$subdir
142 gdb_load $objdir/$subdir/$binfile
143
144 test_multi_threaded_stepping
OLDNEW
« no previous file with comments | « gdb/testsuite/gdb.threads/step.exp ('k') | gdb/testsuite/gdb.threads/switch-threads.exp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698