Update copyright year range in header of all files managed by GDB
[binutils-gdb.git] / gdb / testsuite / gdb.base / include-main.exp
blob31fe6adf2f8cbfed8359ea2abc499bc286dc6802
1 # Copyright 2021-2023 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 # C test-case that mimics gdb.ada/dgopt.exp.
18 standard_testfile .c main.c
20 if { [build_executable "failed to prepare" $testfile $srcfile {debug}] } {
21     return -1
24 clean_restart
26 # Set language explicitly, to avoid expanding the include-main.c CU for the
27 # language lookup (this is currently not required, but may be after
28 # integration of the no-more-psym branch).
29 # This to make sure that the source file lookup we do later triggers the
30 # symtab expansion.
31 gdb_test_no_output "set language c"
33 gdb_load $binfile
35 if { ! [readnow] } {
36     # Verify that no CU was expanded.
37     gdb_test_no_output "maint info symtab"
40 # List a line in include-main.c.  The tricky bit is that there's no code in
41 # include-main.c, so the file should not occur in the .debug_line info.
42 # GDB needs to find the file based on the CU's DW_AT_name/DW_AT_comp_dir.
43 set line [gdb_get_line_number "include" $srcfile]
44 gdb_test "list $srcfile:$line" "$line\[ \t\]*#include \"main.c\""
46 # For completeness, also try to list a line in the file that does contain
47 # code.
48 set line [gdb_get_line_number "main" $srcfile2]
49 gdb_test "list $srcfile2:$line" "$line\[ \t\]*main \\(void\\)\r\n.*"