Commit | Line | Data |
---|---|---|
e2882c85 | 1 | # Copyright 1999-2018 Free Software Foundation, Inc. |
fb40c209 AC |
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 |
fb40c209 | 6 | # (at your option) any later version. |
e22f8b7c | 7 | # |
fb40c209 AC |
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 | # |
fb40c209 | 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/>. |
fb40c209 | 15 | |
17282693 | 16 | # Test -data-read-memory. |
fb40c209 AC |
17 | |
18 | load_lib mi-support.exp | |
b30bf9ee | 19 | set MIFLAGS "-i=mi" |
fb40c209 AC |
20 | |
21 | gdb_exit | |
22 | if [mi_gdb_start] { | |
23 | continue | |
24 | } | |
25 | ||
298a9cf0 TT |
26 | standard_testfile |
27 | ||
9357e021 | 28 | if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } { |
5b362f04 | 29 | untested "failed to compile" |
b60f0898 | 30 | return -1 |
fb40c209 AC |
31 | } |
32 | ||
33 | ||
34 | mi_run_to_main | |
6afa27b0 | 35 | mi_next_to "main" "" "mi-read-memory.c" "20" "next at main" |
fb40c209 AC |
36 | |
37 | mi_gdb_test "1-data-read-memory" \ | |
38 | "1\\^error,msg=\".*\"" \ | |
39 | "no arguments" | |
40 | ||
41 | ||
42 | mi_gdb_test "2-data-read-memory bytes x 1 3 2" \ | |
45399be4 | 43 | "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\"\\\]}\\\]" \ |
fb40c209 AC |
44 | "3x2, one byte" |
45 | ||
46 | ||
47 | mi_gdb_test "9-data-read-memory -o -6 -- -0+bytes+6 x 1 3 2" \ | |
45399be4 | 48 | "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\"\\\]}\\\]" \ |
fb40c209 AC |
49 | "3x2, one byte offset by -6" |
50 | ||
51 | ||
52 | mi_gdb_test "3-data-read-memory \"(shorts + 128)\" x 2 1 2" \ | |
45399be4 | 53 | "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\"\\\]}\\\]" \ |
fb40c209 AC |
54 | "expression in quotes" |
55 | ||
56 | ||
57 | mi_gdb_test "4-data-read-memory bytes+16 x 1 8 4 x" \ | |
45399be4 | 58 | "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=\",-\./\"}\\\]" \ |
fb40c209 AC |
59 | "ascii and data" |
60 | ||
61 | ||
62 | mi_gdb_test "5-data-read-memory shorts+64 d 2 1 1" \ | |
45399be4 | 63 | "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\"\\\]}\\\]" \ |
fb40c209 AC |
64 | "decimal" |
65 | ||
66 | mi_gdb_test "6-data-read-memory shorts+64 o 2 1 1" \ | |
45399be4 | 67 | "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\"\\\]}\\\]" \ |
fb40c209 AC |
68 | "octal" |
69 | ||
70 | ||
71 | mi_gdb_exit | |
72 | return 0 |