]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gdb/testsuite/gdb.base/include-main.exp
Update copyright year range in header of all files managed by GDB
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.base / include-main.exp
CommitLineData
213516ef 1# Copyright 2021-2023 Free Software Foundation, Inc.
f8080fb7
TV
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# C test-case that mimics gdb.ada/dgopt.exp.
17
18standard_testfile .c main.c
19
20if { [build_executable "failed to prepare" $testfile $srcfile {debug}] } {
21 return -1
22}
23
24clean_restart
25
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.
31gdb_test_no_output "set language c"
32
33gdb_load $binfile
34
fb44b079
TV
35if { ! [readnow] } {
36 # Verify that no CU was expanded.
37 gdb_test_no_output "maint info symtab"
38}
f8080fb7
TV
39
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.
43set line [gdb_get_line_number "include" $srcfile]
44gdb_test "list $srcfile:$line" "$line\[ \t\]*#include \"main.c\""
45
46# For completeness, also try to list a line in the file that does contain
47# code.
48set line [gdb_get_line_number "main" $srcfile2]
49gdb_test "list $srcfile2:$line" "$line\[ \t\]*main \\(void\\)\r\n.*"