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

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [tags/] [gnu-src/] [gdb-7.2/] [gdb-7.2-or32-1.0rc1/] [gdb/] [testsuite/] [gdb.mi/] [mi-nsmoribund.exp] - Blame information for rev 341

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 330 jeremybenn
# Copyright 2008, 2009, 2010 Free Software Foundation, Inc.
2
 
3
# This program is free software; you can redistribute it and/or modify
4
# it under the terms of the GNU General Public License as published by
5
# the Free Software Foundation; either version 3 of the License, or
6
# (at your option) any later version.
7
#
8
# This program is distributed in the hope that it will be useful,
9
# but WITHOUT ANY WARRANTY; without even the implied warranty of
10
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11
# GNU General Public License for more details.
12
#
13
# You should have received a copy of the GNU General Public License
14
# along with this program.  If not, see .
15
 
16
load_lib mi-support.exp
17
set MIFLAGS "-i=mi"
18
 
19
gdb_exit
20
if {[mi_gdb_start]} {
21
    continue
22
}
23
 
24
#
25
# Start here
26
#
27
set testfile "nsmoribund"
28
set srcfile "$testfile.c"
29
set binfile "$objdir/$subdir/mi-$testfile"
30
 
31
set options [list debug incdir=$objdir]
32
if {[gdb_compile_pthreads "$srcdir/$subdir/$srcfile" $binfile executable $options] != "" } {
33
    return -1
34
}
35
 
36
mi_gdb_reinitialize_dir $srcdir/$subdir
37
mi_gdb_load $binfile
38
 
39
set supported 0
40
gdb_test_multiple "-gdb-show non-stop" "" {
41
    -re ".*\\^done,value=\"off\",supported=\"(\[^\"\]+)\"\r\n$mi_gdb_prompt$" {
42
        if { $expect_out(1,string) == "1" } {
43
            set supported 1
44
        }
45
    }
46
    -re ".*$mi_gdb_prompt$" {
47
    }
48
}
49
 
50
mi_gdb_test "-gdb-set non-stop 1" ".*"
51
mi_gdb_test "-gdb-set target-async 1" ".*"
52
detect_async
53
 
54
if { [mi_run_to_main] < 0 } {
55
    continue
56
}
57
 
58
# Keep this in sync with THREADS in the the $srcfile.
59
set nthreads 10
60
 
61
# Set a breakpoint and let all threads hit it (except the main
62
# thread).
63
 
64
set bkpt_line [gdb_get_line_number "set breakpoint here"]
65
 
66
mi_create_breakpoint "$srcfile:$bkpt_line" 2 keep thread_function .* .* .* \
67
    "breakpoint at thread_function"
68
 
69
mi_send_resuming_command "exec-continue --all" "resume all"
70
for {set i 0} {$i < $nthreads} {incr i} {
71
    mi_expect_stop "breakpoint-hit" "thread_function" "\[^\n\]*" "$srcfile" \
72
        "\[0-9\]*" {"" "disp=\"keep\""} "stop $i"
73
}
74
 
75
# All but the main thread should have hit it.
76
 
77
mi_check_thread_states \
78
    {"running" "stopped" "stopped" "stopped" "stopped" "stopped" "stopped" "stopped" "stopped" "stopped" "stopped"} \
79
    "thread state: all stopped except the main thread"
80
 
81
# Select a stopped thread to make sure we're able to delete
82
# breakpoints
83
mi_gdb_test "-thread-select 5" "\\^done.*" "select thread 5"
84
 
85
# Now that we know about all the threads, we can get rid of
86
# breakpoint.
87
mi_delete_breakpoints
88
 
89
# Recreate the same breakpoint, but this time, specific to thread 5.
90
mi_create_breakpoint "-p 5 $srcfile:$bkpt_line" 3 keep thread_function .* .* .* \
91
    "thread specific breakpoint at thread_function"
92
 
93
# Resume all threads.  Only thread 5 should report a stop.
94
 
95
set running_re ""
96
for {set i $nthreads} {$i > 0} {incr i -1} {
97
    set running_re "$running_re\\*running,thread-id=\"$decimal\"\r\n"
98
}
99
 
100
gdb_test_multiple "-exec-continue --all" "resume all, thread specific breakpoint" {
101
    -re ".*$running_re$mi_gdb_prompt" {
102
        pass "resume all, thread specific breakpoint"
103
    }
104
}
105
 
106
mi_expect_stop "breakpoint-hit" "thread_function" "\[^\n\]*" "$srcfile" \
107
    "\[0-9\]*" {"" "disp=\"keep\""} "hit thread specific breakpoint"
108
 
109
# All threads except both thread 5 (and the main thread) should now be
110
# repeatedly hitting the thread specific breakpoint and stepping over
111
# it transparently.  These are internal events, so the frontend should
112
# see those threads as running.
113
 
114
mi_check_thread_states \
115
    {"running" "running" "running" "running" "stopped" "running" "running" "running" "running"} \
116
    "thread state: all running except the breakpoint thread"
117
 
118
# Get rid of the breakpoint while the other threads are stepping over
119
# it, and tell all threads to exit.  The program should exit
120
# gracefully shortly.  Send all commands in a row, since if something
121
# goes wrong with moribund locations support or displaced stepping (or
122
# a target bug if it can step over breakpoints itself), a spurious
123
# SIGTRAP/SIGSEGV can come at any time after deleting the breakpoint.
124
 
125
gdb_test_multiple "102-break-delete\nprint done = 1\n103-exec-continue --all" \
126
    "resume all, program exited normally" {
127
        -re "\\*stopped,reason=\"exited-normally\"" {
128
            pass "resume all, program exited normally"
129
        }
130
        -re "\\*stopped" {
131
            fail "unexpected stop"
132
        }
133
    }
134
 
135
mi_gdb_exit

powered by: WebSVN 2.1.0

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