OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gdb-6.8/] [gdb/] [testsuite/] [gdb.threads/] [manythreads.exp] - Blame information for rev 816

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

Line No. Rev Author Line
1 24 jeremybenn
# manythreads.exp -- Expect script to test stopping many threads
2
# Copyright (C) 2004, 2006, 2007, 2008 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 .
16
 
17
# Please email any bugs, comments, and/or additions to this file to:
18
# bug-gdb@prep.ai.mit.edu
19
 
20
# This file was written by Jeff Johnston. (jjohnstn@redhat.com)
21
 
22
if $tracelevel then {
23
        strace $tracelevel
24
}
25
 
26
set prms_id 0
27
set bug_id 0
28
 
29
set testfile "manythreads"
30
set srcfile ${testfile}.c
31
set binfile ${objdir}/${subdir}/${testfile}
32
 
33
if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list debug "incdir=${objdir}"]] != "" } {
34
    return -1
35
}
36
 
37
gdb_start
38
gdb_reinitialize_dir $srcdir/$subdir
39
gdb_load ${binfile}
40
gdb_test "set print sevenbit-strings" ""
41
runto_main
42
 
43
# We'll need this when we send_gdb a ^C to GDB.  Need to do it before we
44
# run the program and gdb starts saving and restoring tty states.
45
# On Ultrix, we don't need it and it is really slow (because shell_escape
46
# doesn't use vfork).
47
if ![istarget "*-*-ultrix*"] then {
48
    gdb_test "shell stty intr '^C'" ""
49
}
50
 
51
set message "first continue"
52
gdb_test_multiple "continue" "first continue" {
53
  -re "error:.*$gdb_prompt $" {
54
    fail "$message"
55
  }
56
  -re "Continuing" {
57
    pass "$message"
58
  }
59
}
60
 
61
# Send a Ctrl-C and verify that we can do info threads and continue
62
after 1000
63
send_gdb "\003"
64
set message "stop threads 1"
65
gdb_test_multiple "" "stop threads 1" {
66
  -re "\\\[New \[^\]\]*\\\]\r\n" {
67
    exp_continue
68
  }
69
  -re "\\\[\[^\]\]* exited\\\]\r\n" {
70
    exp_continue
71
  }
72
  -re "Thread \[^\n\]* executing\r\n" {
73
    exp_continue
74
  }
75
  -re "Program received signal SIGINT.*$gdb_prompt $" {
76
    pass "$message"
77
  }
78
  timeout {
79
    fail "$message (timeout)"
80
  }
81
}
82
 
83
set cmd "info threads"
84
set ok 0
85
gdb_test_multiple $cmd $cmd {
86
    -re " 1 Thread " {
87
        set ok 1
88
        exp_continue
89
    }
90
    -re ".*\r\n" {
91
        # Eat this line and continue, to prevent the buffer overflowing.
92
        exp_continue
93
    }
94
    -re "$gdb_prompt $" {
95
        if { $ok } {
96
            pass $cmd
97
        } else {
98
            fail $cmd
99
        }
100
    }
101
}
102
 
103
set message "second continue"
104
gdb_test_multiple "continue" "second continue" {
105
  -re "error:.*$gdb_prompt $" {
106
    fail "$message"
107
  }
108
  -re "Continuing" {
109
    pass "$message"
110
  }
111
}
112
 
113
# Send another Ctrl-C and verify that we can do info threads and quit
114
after 1000
115
send_gdb "\003"
116
set message "stop threads 2"
117
gdb_test_multiple "" "stop threads 2" {
118
  -re "\\\[New \[^\]\]*\\\]\r\n" {
119
    exp_continue
120
  }
121
  -re "\\\[\[^\]\]* exited\\\]\r\n" {
122
    exp_continue
123
  }
124
  -re "Thread \[^\n\]* executing\r\n" {
125
    exp_continue
126
  }
127
  -re "Program received signal SIGINT.*$gdb_prompt $" {
128
    pass "$message"
129
  }
130
  timeout {
131
    fail "$message (timeout)"
132
  }
133
}
134
 
135
gdb_test_multiple "quit" "GDB exits after stopping multithreaded program" {
136
    -re "The program is running.  Exit anyway\\? \\(y or n\\) $" {
137
        send_gdb "y\n"
138
        exp_continue
139
    }
140
    eof {
141
        pass "GDB exits after stopping multithreaded program"
142
    }
143
    timeout {
144
        fail "GDB exits after stopping multithreaded program (timeout)"
145
    }
146
}
147
 

powered by: WebSVN 2.1.0

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