Update copyright year in most headers.
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.mi / mi2-read-memory.exp
CommitLineData
4c38e0a4 1# Copyright 1999, 2000, 2001, 2002, 2003, 2007, 2008, 2009, 2010
9b254dd1 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 basic Machine interface (MI) operations
19#
20# Verify that, using the MI, we can load a program and do
21# other basic things that are used by all test files through mi_gdb_exit,
22# mi_gdb_start, mi_delete_breakpoints, mi_gdb_reinitialize_dir and
23# mi_gdb_load, so we can safely use those.
24#
25# The goal is not to test gdb functionality, which is done by other tests,
26# but the command syntax and correct output response to MI operations.
27#
28
29load_lib mi-support.exp
30set MIFLAGS "-i=mi2"
31
32gdb_exit
33if [mi_gdb_start] {
34 continue
35}
36
37set testfile "mi-read-memory"
38set srcfile ${testfile}.c
39set binfile ${objdir}/${subdir}/${testfile}
40if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-DFAKEARGV}] != "" } {
b60f0898
JB
41 untested mi2-read-memory.exp
42 return -1
2fcf52f0
AC
43}
44
45
46mi_run_to_main
47mi_next_to "main" "" "mi-read-memory.c" "20" "next at main"
48
49mi_gdb_test "1-data-read-memory" \
50 "1\\^error,msg=\".*\"" \
51 "no arguments"
52
53
54mi_gdb_test "2-data-read-memory bytes x 1 3 2" \
55 "2\\^done,addr=\"$hex\",nr-bytes=\"6\",total-bytes=\"6\",next-row=\"$hex\",prev-row=\"$hex\",next-page=\"$hex\",prev-page=\"$hex\",memory=\\\[{addr=\"$hex\",data=\\\[\"0x00\",\"0x01\"\\\]},{addr=\"$hex\",data=\\\[\"0x02\",\"0x03\"\\\]},{addr=\"$hex\",data=\\\[\"0x04\",\"0x05\"\\\]}\\\]" \
56 "3x2, one byte"
57
58
59mi_gdb_test "9-data-read-memory -o -6 -- -0+bytes+6 x 1 3 2" \
60 "9\\^done,addr=\"$hex\",nr-bytes=\"6\",total-bytes=\"6\",next-row=\"$hex\",prev-row=\"$hex\",next-page=\"$hex\",prev-page=\"$hex\",memory=\\\[{addr=\"$hex\",data=\\\[\"0x00\",\"0x01\"\\\]},{addr=\"$hex\",data=\\\[\"0x02\",\"0x03\"\\\]},{addr=\"$hex\",data=\\\[\"0x04\",\"0x05\"\\\]}\\\]" \
61 "3x2, one byte offset by -6"
62
63
64mi_gdb_test "3-data-read-memory \"(shorts + 128)\" x 2 1 2" \
65 "3\\^done,addr=\"$hex\",nr-bytes=\"4\",total-bytes=\"4\",next-row=\"$hex\",prev-row=\"$hex\",next-page=\"$hex\",prev-page=\"$hex\",memory=\\\[{addr=\"$hex\",data=\\\[\"0x0100\",\"0x0102\"\\\]}\\\]" \
66 "expression in quotes"
67
68
69mi_gdb_test "4-data-read-memory bytes+16 x 1 8 4 x" \
70 "4\\^done,addr=\"$hex\",nr-bytes=\"32\",total-bytes=\"32\",next-row=\"$hex\",prev-row=\"$hex\",next-page=\"$hex\",prev-page=\"$hex\",memory=\\\[{addr=\"$hex\",data=\\\[\"0x10\",\"0x11\",\"0x12\",\"0x13\"\\\],ascii=\"xxxx\"},{addr=\"$hex\",data=\\\[\"0x14\",\"0x15\",\"0x16\",\"0x17\"\\\],ascii=\"xxxx\"},{addr=\"$hex\",data=\\\[\"0x18\",\"0x19\",\"0x1a\",\"0x1b\"\\\],ascii=\"xxxx\"},{addr=\"$hex\",data=\\\[\"0x1c\",\"0x1d\",\"0x1e\",\"0x1f\"\\\],ascii=\"xxxx\"},{addr=\"$hex\",data=\\\[\"0x20\",\"0x21\",\"0x22\",\"0x23\"\\\],ascii=\" !\\\\\"#\"},{addr=\"$hex\",data=\\\[\"0x24\",\"0x25\",\"0x26\",\"0x27\"\\\],ascii=\"\\$%&'\"},{addr=\"$hex\",data=\\\[\"0x28\",\"0x29\",\"0x2a\",\"0x2b\"\\\],ascii=\"().+\"},{addr=\"$hex\",data=\\\[\"0x2c\",\"0x2d\",\"0x2e\",\"0x2f\"\\\],ascii=\",-\./\"}\\\]" \
71 "ascii and data"
72
73
74mi_gdb_test "5-data-read-memory shorts+64 d 2 1 1" \
75 "5\\^done,addr=\"$hex\",nr-bytes=\"2\",total-bytes=\"2\",next-row=\"$hex\",prev-row=\"$hex\",next-page=\"$hex\",prev-page=\"$hex\",memory=\\\[{addr=\"$hex\",data=\\\[\"128\"\\\]}\\\]" \
76 "decimal"
77
78mi_gdb_test "6-data-read-memory shorts+64 o 2 1 1" \
79 "6\\^done,addr=\"$hex\",nr-bytes=\"2\",total-bytes=\"2\",next-row=\"$hex\",prev-row=\"$hex\",next-page=\"$hex\",prev-page=\"$hex\",memory=\\\[{addr=\"$hex\",data=\\\[\"0200\"\\\]}\\\]" \
80 "octal"
81
82
83mi_gdb_exit
84return 0
This page took 0.614529 seconds and 4 git commands to generate.