]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - gdb/testsuite/gdb.arch/aarch64-unwind-pc.exp
Update copyright year range in header of all files managed by GDB
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.arch / aarch64-unwind-pc.exp
1 # Copyright 2022-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 # This file is part of the gdb testsuite.
17
18 # Test explicitly unwinding the PC DWARF register on aarch64
19
20 require is_aarch64_target
21
22 standard_testfile .S
23
24 if { [prepare_for_testing "failed to prepare" $testfile $srcfile] } {
25 return -1
26 }
27
28 if ![runto_main] {
29 return -1
30 }
31
32 proc test_reg_vals {} {
33 gdb_test "p \$pc - &main" "= 8" "p \$pc"
34 gdb_test "p/x \$x30" "= 0x1234" "p \$x30"
35 }
36
37 proc test_unwind_pc { inst } {
38 gdb_test "si" "$inst" "single step"
39 gdb_test "backtrace" \
40 ".*#1.*in main ().*" \
41 "backtrace"
42 gdb_test "up" "in main ().*" "parent frame"
43 test_reg_vals
44 }
45
46 # Ready to enter the function
47 gdb_test "si" "bl test_func" "call site"
48 # Step through the 3 instructions in the function to make sure that
49 # we have the same unwind info throughout.
50 with_test_prefix "1st stepi" {
51 test_unwind_pc "mov x0, x30"
52 }
53 with_test_prefix "2nd stepi" {
54 test_unwind_pc "mov x30, 0x1234"
55 }
56 with_test_prefix "3rd stepi" {
57 test_unwind_pc "ret x0"
58 }
59 # Check again after we returned
60 with_test_prefix "final" {
61 # Check that we've stepped out (si prints out the new function name)
62 gdb_test "si" ".*main *().*" "single step out"
63 gdb_test "backtrace" \
64 "#0\[\t \]+main ().*" \
65 "backtrace"
66 test_reg_vals
67 }