1 |
1181 |
sfurman |
# Copyright 1999, 2000 Free Software Foundation, Inc.
|
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
|
5 |
|
|
# the Free Software Foundation; either version 2 of the License, or
|
6 |
|
|
# (at your option) any later version.
|
7 |
|
|
#
|
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.
|
12 |
|
|
#
|
13 |
|
|
# You should have received a copy of the GNU General Public License
|
14 |
|
|
# along with this program; if not, write to the Free Software
|
15 |
|
|
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
16 |
|
|
|
17 |
|
|
# Please email any bugs, comments, and/or additions to this file to:
|
18 |
|
|
# bug-gdb@prep.ai.mit.edu
|
19 |
|
|
|
20 |
|
|
#
|
21 |
|
|
# test basic Machine interface (MI) operations
|
22 |
|
|
#
|
23 |
|
|
# Verify that, using the MI, we can load a program and do
|
24 |
|
|
# other basic things that are used by all test files through mi_gdb_exit,
|
25 |
|
|
# mi_gdb_start, mi_delete_breakpoints, mi_gdb_reinitialize_dir and
|
26 |
|
|
# mi_gdb_load, so we can safely use those.
|
27 |
|
|
#
|
28 |
|
|
# The goal is not to test gdb functionality, which is done by other tests,
|
29 |
|
|
# but the command syntax and correct output response to MI operations.
|
30 |
|
|
#
|
31 |
|
|
|
32 |
|
|
load_lib mi-support.exp
|
33 |
|
|
set MIFLAGS "-i=mi"
|
34 |
|
|
|
35 |
|
|
gdb_exit
|
36 |
|
|
if [mi_gdb_start] {
|
37 |
|
|
continue
|
38 |
|
|
}
|
39 |
|
|
|
40 |
|
|
set testfile "mi-read-memory"
|
41 |
|
|
set srcfile ${testfile}.c
|
42 |
|
|
set binfile ${objdir}/${subdir}/${testfile}
|
43 |
|
|
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-DFAKEARGV}] != "" } {
|
44 |
|
|
gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
|
45 |
|
|
}
|
46 |
|
|
|
47 |
|
|
|
48 |
|
|
mi_run_to_main
|
49 |
|
|
|
50 |
|
|
#mi_next "do initialization"
|
51 |
|
|
send_gdb "101-exec-next\n"
|
52 |
|
|
gdb_expect {
|
53 |
|
|
-re "101\\^running\r\n$mi_gdb_prompt" {
|
54 |
|
|
gdb_expect {
|
55 |
|
|
-re "\[\r\n\]*101\\*stopped,reason=\"end-stepping-range\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"main\",args=\\\[\\\],file=\".*mi-read-memory.c\",line=\"20\"\}.*$mi_gdb_prompt$" \
|
56 |
|
|
{ pass "do initialization" }
|
57 |
|
|
-re ".*$mi_gdb_prompt$" {fail "do initialization (2)"}
|
58 |
|
|
timeout {fail "do initialization (timeout 2)"}
|
59 |
|
|
}
|
60 |
|
|
}
|
61 |
|
|
-re ".*$mi_gdb_prompt$" {fail "do initialization (1)"}
|
62 |
|
|
timeout {fail "do initialization (timeout 1)"}
|
63 |
|
|
}
|
64 |
|
|
|
65 |
|
|
mi_gdb_test "1-data-read-memory" \
|
66 |
|
|
"1\\^error,msg=\".*\"" \
|
67 |
|
|
"no arguments"
|
68 |
|
|
|
69 |
|
|
|
70 |
|
|
mi_gdb_test "2-data-read-memory bytes x 1 3 2" \
|
71 |
|
|
"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\"\\\]}\\\]" \
|
72 |
|
|
"3x2, one byte"
|
73 |
|
|
|
74 |
|
|
|
75 |
|
|
mi_gdb_test "9-data-read-memory -o -6 -- -0+bytes+6 x 1 3 2" \
|
76 |
|
|
"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\"\\\]}\\\]" \
|
77 |
|
|
"3x2, one byte offset by -6"
|
78 |
|
|
|
79 |
|
|
|
80 |
|
|
mi_gdb_test "3-data-read-memory \"(shorts + 128)\" x 2 1 2" \
|
81 |
|
|
"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\"\\\]}\\\]" \
|
82 |
|
|
"expression in quotes"
|
83 |
|
|
|
84 |
|
|
|
85 |
|
|
mi_gdb_test "4-data-read-memory bytes+16 x 1 8 4 x" \
|
86 |
|
|
"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=\",-\./\"}\\\]" \
|
87 |
|
|
"ascii and data"
|
88 |
|
|
|
89 |
|
|
|
90 |
|
|
mi_gdb_test "5-data-read-memory shorts+64 d 2 1 1" \
|
91 |
|
|
"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\"\\\]}\\\]" \
|
92 |
|
|
"decimal"
|
93 |
|
|
|
94 |
|
|
mi_gdb_test "6-data-read-memory shorts+64 o 2 1 1" \
|
95 |
|
|
"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\"\\\]}\\\]" \
|
96 |
|
|
"octal"
|
97 |
|
|
|
98 |
|
|
|
99 |
|
|
mi_gdb_exit
|
100 |
|
|
return 0
|