import gdb-1999-08-16 snapshot
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.hp / gdb.threads-hp / usrthcore.exp
1 # usrthcore.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 # bug-gdb@prep.ai.mit.edu
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 usrthcore
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 usrthcore -lcma usrthcore.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 -lcma" "${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 #=========================
52 #
53 # Test looking at threads in a core file
54 #
55
56 remote_exec build "rm -f core"
57 remote_exec build "${binfile}"
58
59 gdb_exit
60 gdb_start
61 gdb_reinitialize_dir $srcdir/$subdir
62 gdb_load ${binfile}
63 gdb_test "core-file core" \
64 ".*Core was generated by `usrthcore'.*in main.*usrthcore.c:170.*" \
65 "load corefile"
66
67 gdb_test "info thread" \
68 " 4 .*cma__dispatch.*\\* 1 .*in main.*usrthcore.c:170.*" \
69 "info thread on core file"
70 gdb_test "bt" "#0.*in main.*usrthcore.c:170" "backtrace on active thread"
71 gdb_test "thread 4" ".*Switching to thread 4.*cma__dispatch.*" \
72 "switch to thread 4 (thread2 procedure)"
73 gdb_test "bt" "#0.*cma__dispatch.*thread2.*usrthcore.c:99.*" \
74 "Backtrace on inactive thread (thread2 procedure)"
75 gdb_test "b thread1" "Breakpoint 1.*usrthcore.c, line 75.*" \
76 "break on thread1"
77 gdb_test "run" "Starting program.*Breakpoint 1, thread1.*usrthcore.c:75.*" \
78 "run program, get to thread1 procedure"
79 gdb_test "info threads" "\\* \[23\] .*thread1.* 1 .*cma__dispatch.*" \
80 "info threads after running core"
81
82
83 # Done!
84 #
85 gdb_exit
86
87 remote_exec build "rm -f core"
88
89 return 0
This page took 0.033647 seconds and 4 git commands to generate.