]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gdb/testsuite/gdb.dap/bt-nodebug.exp
Update copyright year range in header of all files managed by GDB
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.dap / bt-nodebug.exp
CommitLineData
1d506c26 1# Copyright 2023-2024 Free Software Foundation, Inc.
68ca7890
TT
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# Test DAP 'bt' through a function without debuginfo.
17
95e592d9
TV
18require allow_dap_tests
19
68ca7890
TT
20load_lib dap-support.exp
21
22standard_testfile bt-main.c bt-inner.c
23
24if {[build_executable_from_specs $testfile.exp $testfile {} \
25 $srcfile debug \
26 $srcfile2 {}] == -1} {
27 return
28}
29
30if {[dap_launch $testfile] == ""} {
31 return
32}
33
34set obj [dap_check_request_and_response "set breakpoint on inner" \
35 setFunctionBreakpoints \
36 {o breakpoints [a [o name [s function_breakpoint_here]]]}]
37set fn_bpno [dap_get_breakpoint_number $obj]
38
39dap_check_request_and_response "start inferior" configurationDone
40dap_wait_for_event_and_check "inferior started" thread "body reason" started
41
42lassign [dap_wait_for_event_and_check "stopped at function breakpoint" stopped \
43 "body reason" breakpoint \
44 "body hitBreakpointIds" $fn_bpno] unused objs
45
46# The bug was that this request would fail.
30baee68
TT
47set obj [dap_check_request_and_response "backtrace" \
48 stackTrace {o threadId [i 1]}]
49set frames [dict get [lindex $obj 0] body stackFrames]
50
51gdb_assert {[llength $frames] == 3} "three frames"
52
53gdb_assert {[dict get [lindex $frames 1] name] == "no_debug_info"} \
54 "name of no-debug frame"
68ca7890 55
155f5df5
GA
56# Breakpoint can be set without source file information
57set obj [dap_check_request_and_response "set breakpoint on no_debug_info" \
58 setFunctionBreakpoints \
59 {o breakpoints [a [o name [s no_debug_info]]]}]
60set breakpoints [dict get [lindex $obj 0] body breakpoints]
57c69939
TT
61gdb_assert {[dict exists [lindex $breakpoints 0] instructionReference]} \
62 "breakpoint has instructionReference"
63
64# instructionReference is specified as a string, but it's form is not
65# otherwise given in the spec. gdb always emits it as hex. A bug
66# slipped in that caused this to be incorrect, so we test both parts
67# here; to test whether a string was given, we have to reach into the
68# TON form.
69set list_form [namespace eval ton::2list $last_ton]
70set ref [namespace eval ton::2list {
71 get $list_form body breakpoints 0 instructionReference
72}]
73gdb_assert {[regexp "^$hex\$" $ref]} \
74 "instructionReference is a hex string"
155f5df5 75
68ca7890 76dap_shutdown