]>
Commit | Line | Data |
---|---|---|
213516ef | 1 | # Copyright 2022-2023 Free Software Foundation, Inc. |
1fe84861 YY |
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 | ||
75b6f386 | 20 | if {![is_aarch64_target]} { |
1fe84861 YY |
21 | verbose "Skipping ${gdb_test_file_name}." |
22 | return | |
23 | } | |
24 | ||
25 | standard_testfile .S | |
26 | ||
27 | if { [prepare_for_testing "failed to prepare" $testfile $srcfile] } { | |
28 | return -1 | |
29 | } | |
30 | ||
31 | if ![runto_main] { | |
32 | return -1 | |
33 | } | |
34 | ||
35 | proc test_reg_vals {} { | |
36 | gdb_test "p \$pc - &main" "= 8" "p \$pc" | |
37 | gdb_test "p/x \$x30" "= 0x1234" "p \$x30" | |
38 | } | |
39 | ||
40 | proc test_unwind_pc { inst } { | |
41 | gdb_test "si" "$inst" "single step" | |
42 | gdb_test "backtrace" \ | |
43 | ".*#1.*in main ().*" \ | |
44 | "backtrace" | |
45 | gdb_test "up" "in main ().*" "parent frame" | |
46 | test_reg_vals | |
47 | } | |
48 | ||
49 | # Ready to enter the function | |
50 | gdb_test "si" "bl test_func" "call site" | |
51 | # Step through the 3 instructions in the function to make sure that | |
52 | # we have the same unwind info throughout. | |
53 | with_test_prefix "1st stepi" { | |
54 | test_unwind_pc "mov x0, x30" | |
55 | } | |
56 | with_test_prefix "2nd stepi" { | |
57 | test_unwind_pc "mov x30, 0x1234" | |
58 | } | |
59 | with_test_prefix "3rd stepi" { | |
60 | test_unwind_pc "ret x0" | |
61 | } | |
62 | # Check again after we returned | |
63 | with_test_prefix "final" { | |
64 | # Check that we've stepped out (si prints out the new function name) | |
65 | gdb_test "si" ".*main *().*" "single step out" | |
66 | gdb_test "backtrace" \ | |
67 | "#0\[\t \]+main ().*" \ | |
68 | "backtrace" | |
69 | test_reg_vals | |
70 | } |