]>
Commit | Line | Data |
---|---|---|
61baf725 | 1 | # Copyright 2015-2017 Free Software Foundation, Inc. |
63e43d3a PMR |
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 | # | |
19 | # Test nested functions related functionality. | |
20 | # | |
21 | ||
22 | standard_testfile | |
23 | ||
24 | ||
25 | set testcase "nested-subp2" | |
26 | ||
27 | if { [gdb_compile "${srcdir}/${subdir}/${testcase}.c" \ | |
28 | [standard_output_file "${testcase}"] \ | |
96161e25 | 29 | executable \ |
63e43d3a PMR |
30 | [list debug "additional_flags=-std=gnu99"]] != "" } { |
31 | return -1 | |
32 | } | |
33 | ||
34 | ||
35 | # Run until the variables we are interested in are visible. | |
36 | ||
37 | clean_restart "${testcase}" | |
38 | if ![runto_main] { | |
39 | perror "could not run to main" | |
40 | continue | |
41 | } | |
42 | ||
43 | set bp_location [gdb_get_line_number "STOP" "${testcase}.c"] | |
44 | gdb_test "break ${testcase}.c:${bp_location}" \ | |
45 | "Breakpoint \[0-9\]+ at 0x\[0-9a-fA-F\]+: .*" \ | |
46 | "breakpoint to the STOP marker" | |
47 | gdb_test "continue" \ | |
48 | "Breakpoint \[0-9\]+, increment .*" \ | |
49 | "continue to the STOP marker" | |
50 | ||
51 | ||
52 | # Check we get correct values for both local and non-local variable references. | |
53 | ||
54 | gdb_test "print c" "102 'f'" | |
55 | gdb_test "print count" "0" | |
56 | ||
57 | ||
58 | # Same but a little later: make sure we were looking at the proper places. | |
59 | ||
60 | gdb_test "continue" \ | |
61 | "Breakpoint \[0-9\]+, increment .*" \ | |
62 | "continue to the STOP marker" | |
63 | gdb_test "print c" "111 'o'" | |
64 | gdb_test "print count" "1" |