]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - gdb/testsuite/gdb.arch/i386-gnu-cfi.exp
x86/APX: fix disassembly of byte register operands
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.arch / i386-gnu-cfi.exp
1 # Copyright 2007-2024 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 <http://www.gnu.org/licenses/>.
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
23 # Test i386 unwinder.
24
25
26 require is_x86_like_target
27
28 set testfile "i386-gnu-cfi"
29 set srcfilec ${testfile}.c
30 set srcfileasm ${testfile}-asm.S
31 set binfile [standard_output_file ${testfile}]
32
33 # some targets have leading underscores on assembly symbols.
34 set additional_flags [gdb_target_symbol_prefix_flags]
35
36 if { [gdb_compile "${srcdir}/${subdir}/${srcfilec} ${srcdir}/${subdir}/${srcfileasm}" "${binfile}" executable [list debug $additional_flags]] != "" } {
37 untested "failed to compile"
38 return -1
39 }
40
41 # Get things started.
42
43 clean_restart $binfile
44
45 # We should stop in abort(3).
46
47 gdb_run_cmd
48
49 gdb_test_multiple {} "continue to abort()" {
50 -re ".*Program received signal SIGABRT,.*$gdb_prompt $" {
51 pass "continue to abort()"
52 }
53 }
54
55 # Verify that the backtrace works (it would crash before). Use the backtrace
56 # output to find the frame number for function "gate".
57 set gate_n ""
58 set backtrace_re \
59 [multi_line \
60 "" \
61 "#($decimal) *$hex in gate \[^\r\n\]*" \
62 "#$decimal *$hex in main \\(\\) at .*${testfile}.c.*"]
63 gdb_test_multiple "backtrace" "" {
64 -re -wrap $backtrace_re {
65 set gate_n $expect_out(1,string)
66 pass $gdb_test_name
67 }
68 }
69 if { $gate_n == "" } {
70 return -1
71 }
72
73 # Check we see the inserted `DW_CFA_GNU_negative_offset_extended' CFI.
74 # We see there the original CFI-stored filename `gate.c'.
75
76 gdb_test "frame $gate_n" \
77 "gate \\(\[^()\]*\\) at .*gate.c.*" \
78 "shift up to the modified frame"
79
80 gdb_test_multiple "info frame" "existence of the CFI inserted register" {
81 -re "Stack level $gate_n, frame at (0x\[0-9a-f\]+):.*Saved registers:.* ecx at (0x\[0-9a-f\]+),.*" {
82 pass "existence of the CFI inserted register"
83 if {[string compare $expect_out(1,string) $expect_out(2,string)]} {
84 fail "value of the CFI inserted register"
85 } else {
86 pass "value of the CFI inserted register"
87 }
88 }
89 }