]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gdb/testsuite/gdb.arch/i386-gnu-cfi.exp
This commit was manufactured by cvs2svn to create branch
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.arch / i386-gnu-cfi.exp
CommitLineData
9b254dd1 1# Copyright 2007, 2008 Free Software Foundation, Inc.
43a9b631
JK
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
e22f8b7c 5# the Free Software Foundation; either version 3 of the License, or
43a9b631
JK
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
e22f8b7c 14# along with this program. If not, see <http://www.gnu.org/licenses/>.
43a9b631
JK
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# Unwinding of DW_CFA_GNU_negative_offset_extended test program.
22
23if $tracelevel {
24 strace $tracelevel
25}
26
27# Test i386 unwinder.
28
29set prms_id 0
30set bug_id 0
31
32if ![istarget "i?86-*-*"] then {
33 verbose "Skipping i386 unwinder tests."
34 return
35}
36
37set testfile "i386-gnu-cfi"
38set srcfilec ${testfile}.c
39set srcfileasm ${testfile}-asm.S
40set binfile ${objdir}/${subdir}/${testfile}
41
42# some targets have leading underscores on assembly symbols.
43# TODO: detect this automatically
44set additional_flags ""
45if [istarget "i?86-*-cygwin*"] then {
46 set additional_flags "additional_flags=-DSYMBOL_PREFIX=\"_\""
47}
48
49if { [gdb_compile "${srcdir}/${subdir}/${srcfilec} ${srcdir}/${subdir}/${srcfileasm}" "${binfile}" executable [list debug $additional_flags]] != "" } {
50 untested i386-gnu-cfi.exp
51 return -1
52}
53
54# Get things started.
55
56gdb_exit
57gdb_start
58gdb_reinitialize_dir $srcdir/$subdir
59gdb_load ${binfile}
60
61# We should stop in abort(3).
62
63gdb_run_cmd
64
65gdb_test_multiple {} "continue to abort()" {
66 -re ".*Program received signal SIGABRT,.*$gdb_prompt $" {
67 pass "continue to abort()"
68 }
69}
70
71# Backtrace would crash before.
72
73gdb_test "bt" \
74 "main \\(\\) at .*${testfile}.c.*" \
75 "backtrace"
76
77# Check we see the inserted `DW_CFA_GNU_negative_offset_extended' CFI.
78# We see there the original CFI-stored filename `gate.c'.
79
80gdb_test "up 3" \
81 "gate \\(\[^()\]*\\) at .*gate.c.*" \
82 "shift up to the modified frame"
83
84gdb_test_multiple "info frame" "Existence of the CFI inserted register" {
85 -re "Stack level 3, frame at (0x\[0-9a-f\]+):.*Saved registers:.* ecx at (0x\[0-9a-f\]+),.*" {
86 pass "Existence of the CFI inserted register"
87 if { [string compare $expect_out(1,string) $expect_out(2,string)] } then {
88 fail "Value of the CFI inserted register"
89 } else {
90 pass "Value of the CFI inserted register"
91 }
92 }
93}