]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - gdb/testsuite/gdb.mi/mi-file.exp
Update copyright year range in header of all files managed by GDB
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.mi / mi-file.exp
1 # Copyright 1999-2024 Free Software Foundation, Inc.
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 -file-list-exec-source-files.
17
18 load_lib mi-support.exp
19 set MIFLAGS "-i=mi"
20
21 standard_testfile basics.c
22
23 if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
24 untested "failed to compile"
25 return -1
26 }
27
28 if {[mi_clean_restart]} {
29 return
30 }
31 mi_gdb_file_cmd ${binfile}
32
33 proc test_file_list_exec_source_file {} {
34 global srcfile
35 global srcdir
36 global subdir
37 global fullname_syntax
38 if { [is_remote host] } {
39 set srcfilepath ".*${srcfile}"
40 } else {
41 set srcfilepath [string_to_regexp ${srcdir}/${subdir}/${srcfile}]
42 }
43
44 # get the path and absolute path to the current executable
45 #
46 # In gdb 6.2 (at least), the default line number is set by
47 # select_source_symtab to the first line of "main" minus
48 # the value of "lines_to_list" (which defaults to 10) plus one.
49 # --chastain 2004-08-13
50
51 set line_main_head [gdb_get_line_number "main ("]
52 set line_main_body [expr $line_main_head + 2]
53 set gdb_lines_to_list 10
54 set line_default [expr $line_main_body - $gdb_lines_to_list + 1]
55
56 mi_gdb_test "111-file-list-exec-source-file" \
57 "111\\\^done,line=\"$line_default\",file=\"${srcfilepath}\",fullname=\"$fullname_syntax${srcfile}\",macro-info=\"0\"" \
58 "request path info of current source file (${srcfile})"
59 }
60
61 proc test_file_list_exec_source_files {} {
62 global srcfile
63 global fullname_syntax
64
65 # get the path and absolute path to the current executable
66 mi_gdb_test "222-file-list-exec-source-files" \
67 "222\\\^done,files=\\\[\{file=\".*${srcfile}\",fullname=\"$fullname_syntax${srcfile}\",debug-fully-read=\"\[^\"\]+\"\}.*]" \
68 "Getting a list of source files."
69 }
70
71 test_file_list_exec_source_file
72 test_file_list_exec_source_files
73
74 mi_gdb_exit