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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gdb-6.8/] [gdb/] [testsuite/] [gdb.arch/] [i386-prologue.exp] - Blame information for rev 178

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

Line No. Rev Author Line
1 24 jeremybenn
# Copyright (C) 2003, 2004, 2006, 2007, 2008 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
# Please email any bugs, comments, and/or additions to this file to:
17
# bug-gdb@gnu.org
18
 
19
# This file is part of the gdb testsuite.
20
 
21
if $tracelevel {
22
    strace $tracelevel
23
}
24
 
25
# Test i386 prologue analyzer.
26
 
27
set prms_id 0
28
set bug_id 0
29
 
30
if ![istarget "i?86-*-*"] then {
31
    verbose "Skipping i386 prologue tests."
32
    return
33
}
34
 
35
set testfile "i386-prologue"
36
set srcfile ${testfile}.c
37
set binfile ${objdir}/${subdir}/${testfile}
38
 
39
# some targets have leading underscores on assembly symbols.
40
# TODO: detect this automatically
41
set additional_flags ""
42
if [istarget "i?86-*-cygwin*"] then {
43
  set additional_flags "additional_flags=-DSYMBOL_PREFIX=\"_\""
44
}
45
 
46
# Don't use "debug", so that we don't have line information for the assembly
47
# fragments.
48
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list $additional_flags]] != "" } {
49
    untested i386-prologue.exp
50
    return -1
51
}
52
 
53
 
54
# The code used by the tests here encodes some breakpoints by using
55
# inline assembler.  This will generate a SIGTRAP which will be caught
56
# by GDB.  At that point the instruction pointer will point at the
57
# next instruction, and execution can continue without any problems.
58
# Some systems however (QNX Neutrino, Solaris) will adjust the
59
# instruction pointer to point at the breakpoint instruction instead.
60
# On these systems we cannot continue unless we skip it.  This
61
# procedure takes care of that.
62
 
63
proc skip_breakpoint { msg } {
64
    gdb_test "if (*(unsigned char *)\$pc == 0xcc)\nset \$pc = \$pc + 1\nend" \
65
            "" "skip breakpoint in ${msg}"
66
}
67
 
68
 
69
gdb_exit
70
gdb_start
71
gdb_reinitialize_dir $srcdir/$subdir
72
gdb_load ${binfile}
73
 
74
#
75
# Run to `main' where we begin our tests.
76
#
77
 
78
if ![runto_main] then {
79
    gdb_suppress_tests
80
}
81
 
82
# Testcase for standard prologue.
83
 
84
gdb_test "continue" "Program received signal SIGTRAP.*" "continue to standard"
85
 
86
skip_breakpoint standard
87
 
88
gdb_test "backtrace 10" \
89
        "#0\[ \t\]*$hex in standard.*\r\n#1\[ \t\]*$hex in main.*" \
90
        "backtrace in standard"
91
 
92
gdb_test "info frame" \
93
        ".*Saved registers:.*ebp at.*edi at.*eip at.*" \
94
        "saved registers in standard"
95
 
96
 
97
# Testcase from breakpoints/2080 (when %ecx is used)
98
 
99
gdb_test "break *(stack_align_ecx + 7)" \
100
        "Breakpoint \[0-9\]* at $hex"
101
 
102
gdb_test "continue" \
103
        "Breakpoint \[0-9\]*.*stack_align_ecx.*" \
104
        "continue to stack_align_ecx + 7"
105
 
106
gdb_test "backtrace 10" \
107
        "#0\[ \t\]*$hex in stack_align_ecx.*\r\n#1\[ \t\]*$hex in main.*" \
108
        "first backtrace in stack_align_ecx"
109
 
110
gdb_test "continue" \
111
        "Program received signal SIGTRAP.*" \
112
        "continue in stack_align_ecx"
113
 
114
skip_breakpoint stack_align_ecx
115
 
116
gdb_test "backtrace 10" \
117
        "#0\[ \t\]*$hex in stack_align_ecx.*\r\n#1\[ \t\]*$hex in main.*" \
118
        "second backtrace in stack_align_ecx"
119
 
120
gdb_test "info frame" \
121
        ".*Saved registers:.*ecx at.*ebp at.*edi at.*eip at.*" \
122
        "saved registers in stack_align_ecx"
123
 
124
 
125
# Testcase from breakpoints/2080 (when %edx is used)
126
 
127
gdb_test "break *(stack_align_edx + 7)" \
128
        "Breakpoint \[0-9\]* at $hex"
129
 
130
gdb_test "continue" \
131
        "Breakpoint \[0-9\]*.*stack_align_edx.*" \
132
        "continue to stack_align_edx + 7"
133
 
134
gdb_test "backtrace 10" \
135
        "#0\[ \t\]*$hex in stack_align_edx.*\r\n#1\[ \t\]*$hex in main.*" \
136
        "first backtrace in stack_align_edx"
137
 
138
gdb_test "continue" \
139
        "Program received signal SIGTRAP.*" \
140
        "continue in stack_align_edx"
141
 
142
skip_breakpoint stack_align_edx
143
 
144
gdb_test "backtrace 10" \
145
        "#0\[ \t\]*$hex in stack_align_edx.*\r\n#1\[ \t\]*$hex in main.*" \
146
        "second backtrace in stack_align_edx"
147
 
148
gdb_test "info frame" \
149
        ".*Saved registers:.*ecx at.*ebp at.*edi at.*eip at.*" \
150
        "saved registers in stack_align_edx"
151
 
152
 
153
# Testcase from breakpoints/2080 (when %eax is used)
154
 
155
gdb_test "break *(stack_align_eax + 7)" \
156
        "Breakpoint \[0-9\]* at $hex"
157
 
158
gdb_test "continue" \
159
        "Breakpoint \[0-9\]*.*stack_align_eax.*" \
160
        "continue to stack_align_eax + 7"
161
 
162
gdb_test "backtrace 10" \
163
        "#0\[ \t\]*$hex in stack_align_eax.*\r\n#1\[ \t\]*$hex in main.*" \
164
        "first backtrace in stack_align_eax"
165
 
166
gdb_test "continue" \
167
        "Program received signal SIGTRAP.*" \
168
        "continue in stack_align_eax"
169
 
170
skip_breakpoint stack_align_eax
171
 
172
gdb_test "backtrace 10" \
173
        "#0\[ \t\]*$hex in stack_align_eax.*\r\n#1\[ \t\]*$hex in main.*" \
174
        "second backtrace in stack_align_eax"
175
 
176
gdb_test "info frame" \
177
        ".*Saved registers:.*ecx at.*ebp at.*edi at.*eip at.*" \
178
        "saved registers in stack_align_eax"
179
 
180
 
181
# Testcase from symtab/1253.
182
 
183
gdb_test "continue" "Program received signal SIGTRAP.*" "continue to gdb1253"
184
 
185
skip_breakpoint gdb1253
186
 
187
gdb_test "backtrace 10" \
188
        "#0\[ \t\]*$hex in gdb1253.*\r\n#1\[ \t\]*$hex in main.*" \
189
        "backtrace in gdb1253"
190
 
191
gdb_test "info frame" \
192
        ".*Saved registers:.*ebp at.*edi at.*eip at.*" \
193
        "saved registers in gdb1253"
194
 
195
 
196
# Testcase from backtrace/1718.
197
 
198
gdb_test "continue" "Program received signal SIGTRAP.*" "continue to gdb1718"
199
 
200
skip_breakpoint gdb1718
201
 
202
gdb_test "backtrace 10" \
203
        "#0\[ \t\]*$hex in gdb1718.*\r\n#1\[ \t\]*$hex in main.*" \
204
        "backtrace in gdb1718"
205
 
206
setup_kfail *-*-* gdb/1718
207
gdb_test "info frame" \
208
        ".*Saved registers:.*esi at.*ebx at.*eip at.*" \
209
        "saved registers in gdb1718"
210
 
211
 
212
# Testcase from backtrace/1338.
213
 
214
gdb_test "continue" "Program received signal SIGTRAP.*" "continue to gdb1338"
215
 
216
skip_breakpoint gdb1338
217
 
218
gdb_test "backtrace 10" \
219
        "#0\[ \t\]*$hex in gdb1338.*\r\n#1\[ \t\]*$hex in main.*" \
220
        "backtrace in gdb1338"
221
 
222
gdb_test "info frame" \
223
        ".*Saved registers:.*ebx at.*esi at.*edi at.*eip at.*" \
224
        "saved registers in gdb1338"
225
 
226
# Testcase jump_at_beginning.
227
gdb_test_multiple "break jump_at_beginning" \
228
        "set breakpoint in jump_at_beginning" {
229
    -re "Breakpoint \[0-9\]* at ($hex).*$gdb_prompt $" {
230
        gdb_test "x/i $expect_out(1,string)" \
231
                ".*:.*jmp.*" \
232
                "check jump_at_beginning prologue end"
233
    }
234
    default {
235
        fail "set breakpoint in jump_at_beginning"
236
    }
237
}

powered by: WebSVN 2.1.0

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