OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [trunk/] [gnu-src/] [gdb-7.2/] [gdb/] [testsuite/] [gdb.threads/] [manythreads.exp] - Blame information for rev 357

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 330 jeremybenn
# manythreads.exp -- Expect script to test stopping many threads
2
# Copyright (C) 2004, 2006, 2007, 2008, 2009, 2010
3
# Free Software Foundation, Inc.
4
 
5
# This program is free software; you can redistribute it and/or modify
6
# it under the terms of the GNU General Public License as published by
7
# the Free Software Foundation; either version 3 of the License, or
8
# (at your option) any later version.
9
#
10
# This program is distributed in the hope that it will be useful,
11
# but WITHOUT ANY WARRANTY; without even the implied warranty of
12
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
# GNU General Public License for more details.
14
#
15
# You should have received a copy of the GNU General Public License
16
# along with this program.  If not, see .
17
 
18
# This file was written by Jeff Johnston. (jjohnstn@redhat.com)
19
 
20
if $tracelevel then {
21
        strace $tracelevel
22
}
23
 
24
 
25
set testfile "manythreads"
26
set srcfile ${testfile}.c
27
set binfile ${objdir}/${subdir}/${testfile}
28
 
29
if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list debug "incdir=${objdir}"]] != "" } {
30
    return -1
31
}
32
 
33
gdb_start
34
gdb_reinitialize_dir $srcdir/$subdir
35
gdb_load ${binfile}
36
gdb_test_no_output "set print sevenbit-strings"
37
runto_main
38
 
39
# We'll need this when we send_gdb a ^C to GDB.  Need to do it before we
40
# run the program and gdb starts saving and restoring tty states.
41
# On Ultrix, we don't need it and it is really slow (because shell_escape
42
# doesn't use vfork).
43
if ![istarget "*-*-ultrix*"] then {
44
    gdb_test "shell stty intr '^C'" ".*"
45
}
46
 
47
set message "first continue"
48
gdb_test_multiple "continue" "first continue" {
49
  -re "error:.*$gdb_prompt $" {
50
    fail "$message"
51
  }
52
  -re "Continuing" {
53
    pass "$message"
54
  }
55
}
56
 
57
# Wait one second.  This is better than the TCL "after" command, because
58
# we don't lose GDB's output while we do it.
59
remote_expect host 1 { timeout { } }
60
 
61
# Send a Ctrl-C and verify that we can do info threads and continue
62
send_gdb "\003"
63
set message "stop threads 1"
64
gdb_test_multiple "" "stop threads 1" {
65
  -re "\\\[New \[^\]\]*\\\]\r\n" {
66
    exp_continue
67
  }
68
  -re "\\\[\[^\]\]* exited\\\]\r\n" {
69
    exp_continue
70
  }
71
  -re "Thread \[^\n\]* executing\r\n" {
72
    exp_continue
73
  }
74
  -re "Program received signal SIGINT.*$gdb_prompt $" {
75
    pass "$message"
76
  }
77
  timeout {
78
    fail "$message (timeout)"
79
  }
80
}
81
 
82
set cmd "info threads"
83
set ok 0
84
gdb_test_multiple $cmd $cmd {
85
    -re " 1 Thread " {
86
        set ok 1
87
        exp_continue
88
    }
89
    -re ".*\r\n" {
90
        # Eat this line and continue, to prevent the buffer overflowing.
91
        exp_continue
92
    }
93
    -re "$gdb_prompt $" {
94
        if { $ok } {
95
            pass $cmd
96
        } else {
97
            fail $cmd
98
        }
99
    }
100
}
101
 
102
set message "second continue"
103
gdb_test_multiple "continue" "second continue" {
104
  -re "error:.*$gdb_prompt $" {
105
    fail "$message"
106
  }
107
  -re "Continuing" {
108
    pass "$message"
109
  }
110
}
111
 
112
# Wait another second.  If the program stops on its own, GDB has failed
113
# to handle duplicate SIGINTs sent to multiple threads.
114
set failed 0
115
remote_expect host 1 {
116
  -re "\\\[New \[^\]\]*\\\]\r\n" {
117
    exp_continue -continue_timer
118
  }
119
  -re "\\\[\[^\]\]* exited\\\]\r\n" {
120
    exp_continue -continue_timer
121
  }
122
  -re "Thread \[^\n\]* executing\r\n" {
123
    exp_continue -continue_timer
124
  }
125
  -re "Program received signal SIGINT.*$gdb_prompt $" {
126
    if { $failed == 0 } {
127
      fail "check for duplicate SIGINT"
128
    }
129
    send_gdb "continue\n"
130
    set failed 1
131
    exp_continue
132
  }
133
  timeout {
134
    if { $failed == 0 } {
135
      pass "check for duplicate SIGINT"
136
    }
137
  }
138
}
139
 
140
# Send another Ctrl-C and verify that we can do info threads and quit
141
send_gdb "\003"
142
set message "stop threads 2"
143
gdb_test_multiple "" "stop threads 2" {
144
  -re "\\\[New \[^\]\]*\\\]\r\n" {
145
    exp_continue
146
  }
147
  -re "\\\[\[^\]\]* exited\\\]\r\n" {
148
    exp_continue
149
  }
150
  -re "Thread \[^\n\]* executing\r\n" {
151
    exp_continue
152
  }
153
  -re "Program received signal SIGINT.*$gdb_prompt $" {
154
    pass "$message"
155
  }
156
  timeout {
157
    fail "$message (timeout)"
158
  }
159
}
160
 
161
gdb_test_multiple "quit" "GDB exits after stopping multithreaded program" {
162
    -re "Quit anyway\\? \\(y or n\\) $" {
163
        send_gdb "y\n"
164
        exp_continue
165
    }
166
    eof {
167
        pass "GDB exits after stopping multithreaded program"
168
    }
169
    timeout {
170
        fail "GDB exits after stopping multithreaded program (timeout)"
171
    }
172
}
173
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.