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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gdb-7.1/] [gdb/] [testsuite/] [gdb.base/] [call-signal-resume.exp] - Blame information for rev 231

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

Line No. Rev Author Line
1 227 jeremybenn
# Copyright 2008, 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
# Test inferior resumption after discarding a hand-called function.
17
# There are two things to test.
18
# 1) Inferior stops normally.  Upon resumption it should continue normally,
19
#    regardless of whatever signal the hand-called function got.
20
# 2) Inferior is stopped at a signal.  Upon resumption it should continue
21
#    with that signal, regardless of whatever the hand-called function did.
22
 
23
if $tracelevel then {
24
        strace $tracelevel
25
}
26
 
27
if [target_info exists gdb,noinferiorio] {
28
    verbose "Skipping call-signal-resume.exp because of no fileio capabilities."
29
    continue
30
}
31
 
32
set prms_id 0
33
set bug_id 0
34
 
35
set testfile "call-signals"
36
set srcfile ${testfile}.c
37
set binfile ${objdir}/${subdir}/${testfile}
38
 
39
if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
40
     untested call-signal-resume.exp
41
     return -1
42
}
43
 
44
# Some targets can't do function calls, so don't even bother with this
45
# test.
46
if [target_info exists gdb,cannot_call_functions] {
47
    setup_xfail "*-*-*" 2416
48
    fail "This target can not call functions"
49
    continue
50
}
51
 
52
proc get_dummy_frame_number { } {
53
  global gdb_prompt
54
 
55
  send_gdb "bt\n"
56
  gdb_expect {
57
    -re "#(\[0-9\]*) *.*$gdb_prompt $"
58
      {
59
        return $expect_out(1,string)
60
      }
61
    -re "$gdb_prompt $"
62
      {
63
        return ""
64
      }
65
    timeout
66
      {
67
        return ""
68
      }
69
  }
70
  return ""
71
}
72
 
73
# Start with a fresh gdb.
74
 
75
gdb_exit
76
gdb_start
77
gdb_reinitialize_dir $srcdir/$subdir
78
gdb_load ${binfile}
79
 
80
if { ![runto_main] } {
81
    fail "Can't run to main"
82
    return 0
83
}
84
 
85
gdb_test "break stop_one" "Breakpoint \[0-9\]* at .*"
86
gdb_test "continue" "Continuing.*Breakpoint \[0-9\]*, stop_one.*" \
87
    "continue to breakpoint at stop_one"
88
 
89
# Call function (causing the program to get a signal), and see if gdb handles
90
# it properly.
91
gdb_test_multiple "call gen_signal ()" \
92
        "inferior function call signaled" {
93
    -re "\[\r\n\]*no signal\[\r\n\]+$gdb_prompt $" {
94
        unsupported "inferior function call signaled"
95
        return 0
96
    }
97
    -re "\[\r\n\]*The program being debugged was signaled.*\[\r\n\]+$gdb_prompt $" {
98
        pass "inferior function call signaled"
99
    }
100
}
101
 
102
set frame_number [get_dummy_frame_number]
103
if { "$frame_number" == "" } {
104
    fail "dummy stack frame number"
105
    setup_xfail "*-*-*"
106
} else {
107
    pass "dummy stack frame number"
108
}
109
 
110
# Pop the dummy frame.
111
gdb_test "frame $frame_number" ""
112
gdb_test "set confirm off" ""
113
gdb_test "return" ""
114
 
115
# Resume execution, the program should continue without any signal.
116
 
117
gdb_test "break stop_two" "Breakpoint \[0-9\]* at .*"
118
gdb_test "continue" "Breakpoint \[0-9\]*, stop_two.*" \
119
    "continue to breakpoint at stop_two"
120
 
121
# Continue again, we should get a signal.
122
 
123
gdb_test "continue" "Program received signal .*" \
124
    "continue to receipt of signal"
125
 
126
# Hand call another function that prematurely stops,
127
# then manually pop the dummy stack frame.
128
 
129
gdb_test "break null_hand_call" "Breakpoint \[0-9\]* at .*"
130
gdb_test "call null_hand_call ()" "Breakpoint \[0-9\]*, null_hand_call.*" \
131
    "null_hand_call"
132
 
133
set frame_number [get_dummy_frame_number]
134
if { "$frame_number" == "" } {
135
    fail "dummy stack frame number"
136
    setup_xfail "*-*-*"
137
    # Need something.
138
    set frame_number 0
139
} else {
140
    pass "dummy stack frame number"
141
}
142
 
143
# Pop the dummy frame.
144
gdb_test "frame $frame_number" ""
145
gdb_test "set confirm off" ""
146
gdb_test "return" ""
147
 
148
# Continue again, this time we should get to the signal handler.
149
 
150
gdb_test "break handle_signal" "Breakpoint \[0-9\]* at .*"
151
gdb_test "continue" "Breakpoint \[0-9\]*, handle_signal.*" \
152
    "continue to breakpoint at handle_signal"
153
 
154
# Continue one last time, the program should exit normally.
155
 
156
gdb_test "continue" "Program exited normally." \
157
    "continue to program exit"
158
 
159
return 0

powered by: WebSVN 2.1.0

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