1 # Copyright
2015-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 # This file is part of the gdb testsuite.
19 # Test nested functions related functionality.
25 set testcase
"nested-subp1"
27 if ![support_nested_function_tests
] {
28 untested
"compiler does not support nested functions"
32 if { [gdb_compile
"${srcdir}/${subdir}/${testcase}.c" \
33 [standard_output_file
"${testcase}"] \
35 [list debug
"additional_flags=-std=gnu99"]] != "" } {
40 # Run until the variables we are interested in are visible.
42 clean_restart
"${testcase}"
47 set bp_location
[gdb_get_line_number
"STOP" "${testcase}.c"]
48 gdb_test
"break ${testcase}.c:${bp_location}" \
49 "Breakpoint \[0-9\]+ at 0x\[0-9a-fA-F\]+: .*" \
50 "breakpoint to the STOP marker"
52 "Breakpoint \[0-9\]+, nested .*" \
53 "continue to the STOP marker"
56 # Check we
get correct
values for both local and non
-local
variable references.
58 gdb_test
"print i1" "1"
59 gdb_test
"print i2" "2"