1 # Copyright 2023-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 # GDB expected PC should point right after the SVC instruction when the
17 # syscall is active. But some active syscalls keep PC pointing to the SVC
20 # Require an architecture with the SVC instruction.
21 require {is_any_target "aarch64*-*-*" "arm*-*-*"}
23 # See if we have target board readnow.exp or similar. We're using
24 # --readnever, which is not allowed in combination with --readnow.
29 if { [build_executable "failed to prepare" ${testfile} ${srcfile} \
34 save_vars { GDBFLAGS } {
35 append GDBFLAGS " --readnever"
36 if { [clean_restart ${binfile}] == -1 } {
41 if { ![runto_main] } {
45 gdb_test "advance breakhere" " in breakhere .*"
47 gdb_test "thread 2" "Switching to thread 2 .*" "thread 2 for svc check"
49 # GDB expected PC should point right after the SVC instruction when the syscall is active.
50 # But some active syscalls keep PC pointing to the SVC instruction itself.
51 set test "pc points to svc"
52 gdb_test_multiple {x/i $pc} $test {
53 -re ":\tsvc\t(0x00000000|0)\r\n$gdb_prompt $" {
56 -re "\r\n$gdb_prompt $" {
62 gdb_test "thread 1" "Switching to thread 1 .*"
63 gdb_test_no_output "set debug frame 1"
66 # [frame] frame_unwind_try_unwinder: trying unwinder "arm exidx"
67 # [frame] frame_unwind_register_value: enter
69 # [frame] frame_unwind_register_value: exit
70 # [frame] frame_unwind_try_unwinder: yes
72 # [frame] get_prev_frame_always_1: -> {level=0,type=NORMAL_FRAME,unwinder="arm exidx",pc=0xb6f8681c,id=<not computed>,func=<unknown>} // cached
75 # [frame] frame_unwind_try_unwinder: trying unwinder "arm exidx"
76 # [frame] frame_unwind_register_value: enter
78 # [frame] frame_unwind_register_value: exit
79 # [frame] frame_unwind_try_unwinder: no
80 # [frame] frame_unwind_try_unwinder: trying unwinder "arm epilogue"
81 # [frame] frame_unwind_register_value: enter
83 # [frame] frame_unwind_register_value: exit
84 # [frame] frame_unwind_try_unwinder: no
85 # [frame] frame_unwind_try_unwinder: trying unwinder "arm prologue"
86 # [frame] frame_unwind_try_unwinder: yes
88 # [frame] get_prev_frame_always_1: -> {level=0,type=NORMAL_FRAME,unwinder="arm prologue",pc=0xb6f8681c,id=<not computed>,func=<unknown>} // cached
90 set test "unwinder is arm exidx"
91 # Switch the threads to reset frame cache.
92 gdb_test_multiple {thread 2} $test {
93 -re "\{level=0,type=NORMAL_FRAME,unwinder=\"arm exidx\",pc=.*\r\n$gdb_prompt $" {
96 -re "\{level=0,type=NORMAL_FRAME,unwinder=\"arm prologue\",pc=.*\r\n$gdb_prompt $" {
99 -re "\r\n$gdb_prompt $" {
105 gdb_test "thread 2" "Switching to thread 2 .*" "thread 2 for debug frame check"
107 gdb_test_no_output "set debug frame 0"
110 # #0 0xb6f8681c in pthread_cond_timedwait@@GLIBC_2.4 () from /lib/arm-linux-gnueabihf/libpthread.so.0
111 # #1 0x00010648 in fun (arg=0x0) at .../gdb/testsuite/gdb.arch/arm-pthread_cond_timedwait-bt.c:38
115 # #0 0xb6f8681c in pthread_cond_timedwait@@GLIBC_2.4 () from /lib/arm-linux-gnueabihf/libpthread.so.0
116 # #1 0xb6e21f80 in ?? ()
117 # Backtrace stopped: previous frame identical to this frame (corrupt stack?)
119 gdb_test "bt" { in fun \(\).*} "unwind of pthread_cond_timedwait"