1 # Copyright
2017-2019 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 # This file is part of the gdb testsuite.
18 if {![is_aarch64_target
]} {
19 verbose
"Skipping ${gdb_test_file_name}."
24 if { [prepare_for_testing
"failed to prepare" ${testfile} ${srcfile}] } {
29 untested
"could not run to main"
33 gdb_breakpoint
[gdb_get_line_number
"breakpoint here"]
34 gdb_continue_to_breakpoint
"breakpoint here"
36 # Test that GDB manages caches correctly
for tagged address.
38 gdb_test
"x p2" "$hex:\[\t \]+0x000004d2"
39 gdb_test_no_output
"set variable i = 5678"
40 # Test that
*P2 is updated.
41 gdb_test
"x p2" "$hex:\[\t \]+0x0000162e"
44 gdb_test
"print sp1->i" " = 1234"
46 gdb_test_no_output
"set variable sp2->i = 5678"
47 # Test that SP1
->i is updated.
48 gdb_test
"print sp1->i" " = 5678"
50 gdb_test
"x/d &sp2->i" "$hex:\[\t \]+5678"
51 gdb_test
"x/d &sp1->i" "$hex:\[\t \]+5678"
53 # Test that the same disassembly is got when disassembling function vs
54 # tagged function pointer.
57 set test
"disassemble foo,+8"
58 gdb_test_multiple $test $test
{
59 -re
":\[\t \]+(\[a-z\]*)\[ \r\n\]+.*:\[\t \]+(\[a-z\]*).*$gdb_prompt $" {
60 set insn1 $expect_out
(1,string
)
61 set insn2 $expect_out
(2,string
)
66 gdb_test
"disassemble func_ptr,+8" \
67 ":\[\t \]+$insn1\[ \r\n\]+.*:\[\t \]+$insn2.*"
69 foreach_with_prefix bptype
{"hbreak" "break"} {
71 #
Set a breakpoint
on a tagged address
, func_ptr
,
72 gdb_test
"$bptype *func_ptr" \
73 "warning: Breakpoint address adjusted from .*reakpoint $decimal at .*" \
74 "breakpoint at *func_ptr"
75 # Resume the
program and expect it hits foo
,
77 "Continuing\\..*Breakpoint \[0-9\]+, foo \\(\\) at .*" \
78 "run until breakpoint set *func_ptr"
79 gdb_test
"up" "foo \\(\\).*" "caller is foo"
82 #
Set a breakpoint
on normal function
, call it through tagged
84 gdb_test
"$bptype foo" "reakpoint $decimal at .*" \
85 "hardware breakpoint at foo"
87 "Continuing\\..*Breakpoint \[0-9\]+, foo \\(\\) at .*" \
88 "run until breakpoint set foo"
89 gdb_test
"up" "\\(\*func_ptr\\) \\(\\).*" "caller is *func_ptr"
95 #
Watch on tagged pointer.
98 "Continuing\\..*Hardware watchpoint \[0-9\]+.*" \
99 "run until watchpoint on s1"
103 gdb_test
"continue" \
104 "Continuing\\..*Hardware watchpoint \[0-9\]+.*" \
105 "run until watchpoint on i"