]>
Commit | Line | Data |
---|---|---|
8acc9f48 | 1 | # Copyright 1999-2013 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 | |
1abaf70c BR |
16 | # |
17 | # Test essential Machine interface (MI) operations | |
18 | # | |
19 | # Verify that, using the MI, we can run a simple program and perform basic | |
20 | # debugging activities like: insert breakpoints, run the program, | |
21 | # step, next, continue until it ends and, last but not least, quit. | |
22 | # | |
23 | # The goal is not to test gdb functionality, which is done by other tests, | |
24 | # but to verify the correct output response to MI operations. | |
25 | # | |
26 | ||
27 | load_lib mi-support.exp | |
28 | set MIFLAGS "-i=mi" | |
29 | ||
30 | gdb_exit | |
31 | if [mi_gdb_start] { | |
32 | continue | |
33 | } | |
34 | ||
298a9cf0 TT |
35 | standard_testfile basics.c |
36 | ||
9357e021 | 37 | if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } { |
b60f0898 JB |
38 | untested mi-file.exp |
39 | return -1 | |
1abaf70c BR |
40 | } |
41 | ||
42 | mi_delete_breakpoints | |
43 | mi_gdb_reinitialize_dir $srcdir/$subdir | |
2b70e4c6 | 44 | mi_gdb_file_cmd ${binfile} |
1abaf70c | 45 | |
bcc82369 | 46 | proc test_file_list_exec_source_file {} { |
1abaf70c BR |
47 | global srcfile |
48 | global srcdir | |
49 | global subdir | |
6006a3a1 | 50 | global fullname_syntax |
1abaf70c BR |
51 | set srcfilepath [string_to_regexp ${srcdir}/${subdir}/${srcfile}] |
52 | ||
53 | # get the path and absolute path to the current executable | |
45f07fef MC |
54 | # |
55 | # In gdb 6.2 (at least), the default line number is set by | |
56 | # select_source_symtab to the first line of "main" minus | |
57 | # the value of "lines_to_list" (which defaults to 10) plus one. | |
58 | # --chastain 2004-08-13 | |
59 | ||
60 | set line_main_head [gdb_get_line_number "main ("] | |
61 | set line_main_body [expr $line_main_head + 2] | |
62 | set gdb_lines_to_list 10 | |
63 | set line_default [expr $line_main_body - $gdb_lines_to_list + 1] | |
64 | ||
1abaf70c | 65 | mi_gdb_test "111-file-list-exec-source-file" \ |
f43691e3 | 66 | "111\\\^done,line=\"$line_default\",file=\"${srcfilepath}\",fullname=\"$fullname_syntax${srcfile}\",macro-info=\"0\"" \ |
1abaf70c BR |
67 | "request path info of current source file (${srcfile})" |
68 | } | |
69 | ||
bcc82369 BR |
70 | proc test_file_list_exec_source_files {} { |
71 | global srcfile | |
6006a3a1 | 72 | global fullname_syntax |
bcc82369 BR |
73 | |
74 | # get the path and absolute path to the current executable | |
75 | mi_gdb_test "222-file-list-exec-source-files" \ | |
cd269619 | 76 | "222\\\^done,files=\\\[\{file=\".*/${srcfile}\",fullname=\"$fullname_syntax${srcfile}\"\}.*]" \ |
bcc82369 BR |
77 | "Getting a list of source files." |
78 | } | |
79 | ||
80 | test_file_list_exec_source_file | |
81 | test_file_list_exec_source_files | |
1abaf70c BR |
82 | |
83 | mi_gdb_exit | |
84 | return 0 |