1 # Copyright 2024 Free Software Foundation, Inc.
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.
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.
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/>.
16 # Test-case that checks architecture-specific prologue analyzers.
20 if { [prepare_for_testing "failed to prepare" $testfile $srcfile \
27 gdb_test_multiple "break $f" "" {
28 -re -wrap "Breakpoint $::decimal at ($::hex)" {
29 set bp_addr $expect_out(1,string)
34 if { $bp_addr == "" } {
38 set prologue_end_addr ""
39 gdb_test_multiple "p /x &${f}_prologue_end" "" {
40 -re -wrap " = ($::hex)" {
41 set prologue_end_addr $expect_out(1,string)
46 if { $prologue_end_addr == "" } {
50 set test {$bp_addr == $prologue_end_addr}
53 } elseif { $bp_addr < $prologue_end_addr } {
54 # We'll allow this. For instance, amd64 has a prologue
55 # analyzer that doesn't skip the 3rd instruction here, which saves an
56 # argument register to stack:
58 # 00000000004004ae <f2>:
59 # 4004ae: 55 push %rbp
60 # 4004af: 48 89 e5 mov %rsp,%rbp
61 # 4004b2: 89 7d fc mov %edi,-0x4(%rbp)
62 # 00000000004004b5 <f2_prologue_end>:
64 pass "$test (skipped less than possible)"
65 } elseif { $bp_addr > $prologue_end_addr } {
66 fail "$test (skipped too much)"
72 foreach f { f1 f2 f3 f4 } {