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