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.arch/] [i386-prologue.exp] - Blame information for rev 341

Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

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