]>
Commit | Line | Data |
---|---|---|
7be570e7 JM |
1 | # usrthbasic.exp -- Expect script to test gdb with user threads |
2 | # Copyright (C) 1992 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 2 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, write to the Free Software | |
16 | # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ | |
17 | ||
18 | # Please email any bugs, comments, and/or additions to this file to: | |
19 | # [email protected] | |
20 | ||
21 | # use this to debug: | |
22 | # | |
23 | #log_user 1 | |
24 | ||
25 | if $tracelevel { | |
26 | strace $tracelevel | |
27 | } | |
28 | ||
29 | if { [skip_hp_tests] } { continue } | |
30 | ||
31 | if { ![istarget "hppa*-*-hpux*"] || [istarget "hppa2.0w-*-*"] } { | |
32 | verbose "HPUX thread test ignored for non-hppa or PA64 targets." | |
33 | return 0 | |
34 | } | |
35 | ||
36 | set testfile usrthbasic | |
37 | set srcfile ${srcdir}/${subdir}/${testfile}.c | |
38 | set binfile ${srcdir}/${subdir}/${testfile} | |
39 | ||
40 | # To build the executable we need to link against the thread library. | |
41 | # | |
42 | # /opt/ansic/bin/cc -Ae +DAportable -g -o usrthbasic -lcma usrthbasic.c | |
43 | # | |
44 | ## we have trouble building it on 11.0, so we use the prebuilt | |
45 | ## executable instead. | |
46 | ## | |
47 | ##if { [gdb_compile "${srcdir}/${subdir}/${testfile}.c" "${binfile}" executable {debug additional_flags=-Ae ldflags=-lcma}] != "" } { | |
48 | ## gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." | |
49 | ##} | |
50 | ||
51 | # We don't really seem to need longer waits. | |
52 | # | |
53 | ##set oldtimeout $timeout | |
54 | ##set timeout [expr "$timeout + 0"] | |
55 | ##set oldverbose $verbose | |
56 | ##set verbose 40 | |
57 | ||
58 | #========================= | |
59 | # | |
60 | # Test looking at threads. | |
61 | # | |
62 | gdb_exit | |
63 | gdb_start | |
64 | gdb_reinitialize_dir $srcdir/$subdir | |
65 | gdb_load ${binfile} | |
66 | ||
67 | gdb_test "b main" ".*Breakpoint 1.*" "b main" | |
68 | gdb_test "run" "Breakpoint 1, main.*:119.*" "run to main" | |
69 | gdb_test "b thread1" ".*Breakpoint 2.*" "b thread1" | |
70 | gdb_test "info threads" "\\* 1 system thread.*:119\[^(\]*" \ | |
71 | "info threads at main" | |
72 | gdb_test "c" "Breakpoint 2, thread1.*" "continue to thread1" | |
73 | gdb_test "info threads" \ | |
74 | "\\* 3 system thread.*thread1.*libcma.1.*libcma.1\[^(\]*" \ | |
75 | "info threads at main" | |
76 | gdb_test "b 165" "Breakpoint 3.*165.*" "break at main counter" | |
77 | gdb_test "c" "Breakpoint 3, main.*" "continue to main counter" | |
78 | gdb_test "info threads" " 4 system thread.*\\* 1 system thread.*main.*" \ | |
79 | "info threads at main counter" | |
80 | gdb_test "b 97" "Breakpoint 4.*97.*" "break at thread2 counter" | |
81 | gdb_test "b 81" "Breakpoint 5.*81.*" "break at thread1 counter" | |
82 | gdb_test "bt" "#0 main.* at \[^(\]*" "backtrace at main counter" | |
83 | ||
84 | # After switching to thread 4, the cma scheduler should schedule it next | |
85 | # and we should hit its breakpoint in thread2. | |
86 | gdb_test "thread 4" ".Switching to thread 4.*cma__dispatch.*" \ | |
87 | "switch to thread 4" | |
88 | gdb_test "bt" "#0 .*thread2.*" "backtrace at thread 4" | |
89 | sleep 1 | |
90 | gdb_test "c" ".*Breakpoint 4, thread2.*" "continue and get to thread 4" | |
91 | ||
92 | # After switching to thread 1, the cma scheduler should schedule it next | |
93 | # and we should hit its breakpoint (in main). | |
94 | gdb_test "thread 1" ".*Switching to thread 1.*cma__dispatch.*" \ | |
95 | "switch to thread 1" | |
96 | sleep 1 | |
97 | gdb_test "c" ".*Breakpoint 3, main.*usrthbasic.c:165.*" \ | |
98 | "continue and get to thread 1" | |
99 | ||
100 | # Done! | |
101 | # | |
102 | gdb_exit | |
103 | ||
104 | ##set timeout $oldtimeout | |
105 | ##set verbose $oldverbose | |
106 | ||
107 | return 0 |