Commit | Line | Data |
---|---|---|
618f726f | 1 | # Copyright 1999-2016 Free Software Foundation, Inc. |
1abaf70c BR |
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 | |
e22f8b7c | 5 | # the Free Software Foundation; either version 3 of the License, or |
1abaf70c | 6 | # (at your option) any later version. |
e22f8b7c | 7 | # |
1abaf70c BR |
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. | |
e22f8b7c | 12 | # |
1abaf70c | 13 | # You should have received a copy of the GNU General Public License |
e22f8b7c | 14 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
1abaf70c | 15 | |
17282693 | 16 | # Test -file-list-exec-source-files. |
1abaf70c BR |
17 | |
18 | load_lib mi-support.exp | |
19 | set MIFLAGS "-i=mi" | |
20 | ||
21 | gdb_exit | |
22 | if [mi_gdb_start] { | |
23 | continue | |
24 | } | |
25 | ||
298a9cf0 TT |
26 | standard_testfile basics.c |
27 | ||
9357e021 | 28 | if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } { |
b60f0898 JB |
29 | untested mi-file.exp |
30 | return -1 | |
1abaf70c BR |
31 | } |
32 | ||
33 | mi_delete_breakpoints | |
34 | mi_gdb_reinitialize_dir $srcdir/$subdir | |
2b70e4c6 | 35 | mi_gdb_file_cmd ${binfile} |
1abaf70c | 36 | |
bcc82369 | 37 | proc test_file_list_exec_source_file {} { |
1abaf70c BR |
38 | global srcfile |
39 | global srcdir | |
40 | global subdir | |
6006a3a1 | 41 | global fullname_syntax |
71a79f8c YQ |
42 | if { [is_remote host] } { |
43 | set srcfilepath ".*${srcfile}" | |
44 | } else { | |
45 | set srcfilepath [string_to_regexp ${srcdir}/${subdir}/${srcfile}] | |
46 | } | |
1abaf70c BR |
47 | |
48 | # get the path and absolute path to the current executable | |
45f07fef MC |
49 | # |
50 | # In gdb 6.2 (at least), the default line number is set by | |
51 | # select_source_symtab to the first line of "main" minus | |
52 | # the value of "lines_to_list" (which defaults to 10) plus one. | |
53 | # --chastain 2004-08-13 | |
54 | ||
55 | set line_main_head [gdb_get_line_number "main ("] | |
56 | set line_main_body [expr $line_main_head + 2] | |
57 | set gdb_lines_to_list 10 | |
58 | set line_default [expr $line_main_body - $gdb_lines_to_list + 1] | |
59 | ||
1abaf70c | 60 | mi_gdb_test "111-file-list-exec-source-file" \ |
f43691e3 | 61 | "111\\\^done,line=\"$line_default\",file=\"${srcfilepath}\",fullname=\"$fullname_syntax${srcfile}\",macro-info=\"0\"" \ |
1abaf70c BR |
62 | "request path info of current source file (${srcfile})" |
63 | } | |
64 | ||
bcc82369 BR |
65 | proc test_file_list_exec_source_files {} { |
66 | global srcfile | |
6006a3a1 | 67 | global fullname_syntax |
bcc82369 BR |
68 | |
69 | # get the path and absolute path to the current executable | |
70 | mi_gdb_test "222-file-list-exec-source-files" \ | |
71a79f8c | 71 | "222\\\^done,files=\\\[\{file=\".*${srcfile}\",fullname=\"$fullname_syntax${srcfile}\"\}.*]" \ |
bcc82369 BR |
72 | "Getting a list of source files." |
73 | } | |
74 | ||
75 | test_file_list_exec_source_file | |
76 | test_file_list_exec_source_files | |
1abaf70c BR |
77 | |
78 | mi_gdb_exit | |
79 | return 0 |