Commit | Line | Data |
---|---|---|
4c38e0a4 JB |
1 | # Copyright 1999, 2003, 2004, 2007, 2008, 2009, 2010 |
2 | # Free Software Foundation, Inc. | |
2fcf52f0 AC |
3 | |
4 | # This program is free software; you can redistribute it and/or modify | |
5 | # it under the terms of the GNU General Public License as published by | |
e22f8b7c | 6 | # the Free Software Foundation; either version 3 of the License, or |
2fcf52f0 | 7 | # (at your option) any later version. |
e22f8b7c | 8 | # |
2fcf52f0 AC |
9 | # This program is distributed in the hope that it will be useful, |
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | # GNU General Public License for more details. | |
e22f8b7c | 13 | # |
2fcf52f0 | 14 | # You should have received a copy of the GNU General Public License |
e22f8b7c | 15 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
2fcf52f0 | 16 | |
2fcf52f0 AC |
17 | # |
18 | # Test essential Machine interface (MI) operations | |
19 | # | |
20 | # Verify that, using the MI, we can run a simple program and perform basic | |
21 | # debugging activities like: insert breakpoints, run the program, | |
22 | # step, next, continue until it ends and, last but not least, quit. | |
23 | # | |
24 | # The goal is not to test gdb functionality, which is done by other tests, | |
25 | # but to verify the correct output response to MI operations. | |
26 | # | |
27 | ||
28 | load_lib mi-support.exp | |
29 | set MIFLAGS "-i=mi2" | |
30 | ||
31 | gdb_exit | |
32 | if [mi_gdb_start] { | |
33 | continue | |
34 | } | |
35 | ||
36 | set testfile "basics" | |
37 | set srcfile ${testfile}.c | |
3788363d | 38 | set binfile ${objdir}/${subdir}/mi2-file |
2fcf52f0 | 39 | if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-DFAKEARGV}] != "" } { |
b60f0898 JB |
40 | untested mi2-file.exp |
41 | return -1 | |
2fcf52f0 AC |
42 | } |
43 | ||
44 | mi_delete_breakpoints | |
45 | mi_gdb_reinitialize_dir $srcdir/$subdir | |
2b70e4c6 | 46 | mi_gdb_file_cmd ${binfile} |
2fcf52f0 | 47 | |
57c22c6c | 48 | proc test_file_list_exec_source_file {} { |
2fcf52f0 AC |
49 | global srcfile |
50 | global srcdir | |
51 | global subdir | |
6006a3a1 | 52 | global fullname_syntax |
2fcf52f0 AC |
53 | set srcfilepath [string_to_regexp ${srcdir}/${subdir}/${srcfile}] |
54 | ||
55 | # get the path and absolute path to the current executable | |
45f07fef MC |
56 | # |
57 | # In gdb 6.2 (at least), the default line number is set by | |
58 | # select_source_symtab to the first line of "main" minus | |
59 | # the value of "lines_to_list" (which defaults to 10) plus one. | |
60 | # --chastain 2004-08-13 | |
61 | ||
62 | set line_main_head [gdb_get_line_number "main ("] | |
63 | set line_main_body [expr $line_main_head + 2] | |
64 | set gdb_lines_to_list 10 | |
65 | set line_default [expr $line_main_body - $gdb_lines_to_list + 1] | |
66 | ||
2fcf52f0 | 67 | mi_gdb_test "111-file-list-exec-source-file" \ |
f43691e3 | 68 | "111\\\^done,line=\"$line_default\",file=\"${srcfilepath}\",fullname=\"$fullname_syntax${srcfile}\",macro-info=\"0\"" \ |
2fcf52f0 AC |
69 | "request path info of current source file (${srcfile})" |
70 | } | |
71 | ||
57c22c6c | 72 | test_file_list_exec_source_file |
2fcf52f0 AC |
73 | |
74 | mi_gdb_exit | |
75 | return 0 |