1*11efff7fSkettenis# Copyright 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
2b725ae77Skettenis
3b725ae77Skettenis# This program is free software; you can redistribute it and/or modify
4b725ae77Skettenis# it under the terms of the GNU General Public License as published by
5b725ae77Skettenis# the Free Software Foundation; either version 2 of the License, or
6b725ae77Skettenis# (at your option) any later version.
7b725ae77Skettenis#
8b725ae77Skettenis# This program is distributed in the hope that it will be useful,
9b725ae77Skettenis# but WITHOUT ANY WARRANTY; without even the implied warranty of
10b725ae77Skettenis# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11b725ae77Skettenis# GNU General Public License for more details.
12b725ae77Skettenis#
13b725ae77Skettenis# You should have received a copy of the GNU General Public License
14b725ae77Skettenis# along with this program; if not, write to the Free Software
15b725ae77Skettenis# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
16b725ae77Skettenis
17b725ae77Skettenis#
18b725ae77Skettenis# Test essential Machine interface (MI) operations
19b725ae77Skettenis#
20b725ae77Skettenis# Verify -data-evaluate-expression. There are really minimal tests.
21b725ae77Skettenis
22b725ae77Skettenis# The goal is not to test gdb functionality, which is done by other tests,
23b725ae77Skettenis# but to verify the correct output response to MI operations.
24b725ae77Skettenis#
25b725ae77Skettenis
26b725ae77Skettenisload_lib mi-support.exp
27b725ae77Skettenisset MIFLAGS "-i=mi2"
28b725ae77Skettenis
29b725ae77Skettenisgdb_exit
30b725ae77Skettenisif [mi_gdb_start] {
31b725ae77Skettenis    continue
32b725ae77Skettenis}
33b725ae77Skettenis
34b725ae77Skettenisset testfile "basics"
35b725ae77Skettenisset srcfile ${testfile}.c
36b725ae77Skettenisset binfile ${objdir}/${subdir}/${testfile}
37b725ae77Skettenisif  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-DFAKEARGV}] != "" } {
38b725ae77Skettenis     gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
39b725ae77Skettenis}
40b725ae77Skettenis
41b725ae77Skettenismi_delete_breakpoints
42b725ae77Skettenismi_gdb_reinitialize_dir $srcdir/$subdir
43b725ae77Skettenismi_gdb_reinitialize_dir $srcdir/$subdir
44b725ae77Skettenismi_gdb_load ${binfile}
45b725ae77Skettenis
46*11efff7fSkettenisset line_callee4_head [gdb_get_line_number "callee4 ("]
47*11efff7fSkettenisset line_callee4_body [expr $line_callee4_head + 2]
48*11efff7fSkettenis
49b725ae77Skettenismi_runto callee4
50*11efff7fSkettenismi_next_to "callee4" "" "basics.c" [expr $line_callee4_body + 1] "next at callee4"
51b725ae77Skettenis
52b725ae77Skettenismi_gdb_test "211-data-evaluate-expression A" "211\\^done,value=\"1\"" "eval A"
53b725ae77Skettenis
54b725ae77Skettenismi_gdb_test "311-data-evaluate-expression &A" "311\\^done,value=\"$hex\"" "eval &A"
55b725ae77Skettenis
56b725ae77Skettenismi_gdb_test "411-data-evaluate-expression A+3" "411\\^done,value=\"4\"" "eval A+3"
57b725ae77Skettenis
58b725ae77Skettenismi_gdb_test "511-data-evaluate-expression \"A + 3\"" "511\\^done,value=\"4\"" "eval A + 3"
59b725ae77Skettenis
60b725ae77Skettenis
61b725ae77Skettenismi_gdb_exit
62b725ae77Skettenisreturn 0
63