This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
[patch/mi] Output data-read-memory as a list
- To: gdb-patches at sources dot redhat dot com
- Subject: [patch/mi] Output data-read-memory as a list
- From: Andrew Cagney <ac131313 at cygnus dot com>
- Date: Mon, 25 Jun 2001 17:00:22 -0400
Hello,
This one updates data-read-memory. It is slightly more complex than
some of the others as there is a list within a list:
memory=[ { ..., data=[ value ... ] } ]
Andrew
Index: mi/ChangeLog
2001-06-25 Andrew Cagney <ac131313@redhat.com>
* mi-main.c (mi_cmd_data_read_memory): Output the memory contents
- memory and data - as a list.
* gdbmi.texinfo (data-read-memory): Update documentation.
Index: testsuite/gdb.mi/ChangeLog
2001-06-25 Andrew Cagney <ac131313@redhat.com>
* mi-read-memory.exp: Update patterns matching data-read-memory.
Outputs a list.
Index: mi/gdbmi.texinfo
===================================================================
RCS file: /cvs/src/src/gdb/mi/gdbmi.texinfo,v
retrieving revision 1.16
diff -p -r1.16 gdbmi.texinfo
*** gdbmi.texinfo 2001/06/25 20:08:52 1.16
--- gdbmi.texinfo 2001/06/25 20:54:56
*************** word. Display each word in hex.
*** 1443,1452 ****
9-data-read-memory -o -6 -- bytes+6 x 1 3 2
9^done,addr="0x00001390",nr-bytes="6",total-bytes="6",
next-row="0x00001396",prev-row="0x0000138e",next-page="0x00001396",
! prev-page="0x0000138a",memory=@{
! @{addr="0x00001390",data=@{"0x00","0x01"@}@},
! @{addr="0x00001392",data=@{"0x02","0x03"@}@},
! @{addr="0x00001394",data=@{"0x04","0x05"@}@}@}
(@value{GDBP})
@end smallexample
--- 1443,1452 ----
9-data-read-memory -o -6 -- bytes+6 x 1 3 2
9^done,addr="0x00001390",nr-bytes="6",total-bytes="6",
next-row="0x00001396",prev-row="0x0000138e",next-page="0x00001396",
! prev-page="0x0000138a",memory=[
! @{addr="0x00001390",data=["0x00","0x01"]@},
! @{addr="0x00001392",data=["0x02","0x03"]@},
! @{addr="0x00001394",data=["0x04","0x05"]@}]
(@value{GDBP})
@end smallexample
*************** display as a single word formatted in de
*** 1458,1465 ****
5-data-read-memory shorts+64 d 2 1 1
5^done,addr="0x00001510",nr-bytes="2",total-bytes="2",
next-row="0x00001512",prev-row="0x0000150e",
! next-page="0x00001512",prev-page="0x0000150e",memory=@{
! @{addr="0x00001510",data=@{"128"@}@}@}
(@value{GDBP})
@end smallexample
--- 1458,1465 ----
5-data-read-memory shorts+64 d 2 1 1
5^done,addr="0x00001510",nr-bytes="2",total-bytes="2",
next-row="0x00001512",prev-row="0x0000150e",
! next-page="0x00001512",prev-page="0x0000150e",memory=[
! @{addr="0x00001510",data=["128"]@}]
(@value{GDBP})
@end smallexample
*************** used as the non-printable character.
*** 1472,1486 ****
4-data-read-memory bytes+16 x 1 8 4 x
4^done,addr="0x000013a0",nr-bytes="32",total-bytes="32",
next-row="0x000013c0",prev-row="0x0000139c",
! next-page="0x000013c0",prev-page="0x00001380",memory=@{
! @{addr="0x000013a0",data=@{"0x10","0x11","0x12","0x13"@},ascii="xxxx"@},
! @{addr="0x000013a4",data=@{"0x14","0x15","0x16","0x17"@},ascii="xxxx"@},
! @{addr="0x000013a8",data=@{"0x18","0x19","0x1a","0x1b"@},ascii="xxxx"@},
! @{addr="0x000013ac",data=@{"0x1c","0x1d","0x1e","0x1f"@},ascii="xxxx"@},
! @{addr="0x000013b0",data=@{"0x20","0x21","0x22","0x23"@},ascii=" !\"#"@},
! @{addr="0x000013b4",data=@{"0x24","0x25","0x26","0x27"@},ascii="$%&'"@},
! @{addr="0x000013b8",data=@{"0x28","0x29","0x2a","0x2b"@},ascii="()*+"@},
! @{addr="0x000013bc",data=@{"0x2c","0x2d","0x2e","0x2f"@},ascii=",-./"@}@}
(@value{GDBP})
@end smallexample
--- 1472,1486 ----
4-data-read-memory bytes+16 x 1 8 4 x
4^done,addr="0x000013a0",nr-bytes="32",total-bytes="32",
next-row="0x000013c0",prev-row="0x0000139c",
! next-page="0x000013c0",prev-page="0x00001380",memory=[
! @{addr="0x000013a0",data=["0x10","0x11","0x12","0x13"],ascii="xxxx"@},
! @{addr="0x000013a4",data=["0x14","0x15","0x16","0x17"],ascii="xxxx"@},
! @{addr="0x000013a8",data=["0x18","0x19","0x1a","0x1b"],ascii="xxxx"@},
! @{addr="0x000013ac",data=["0x1c","0x1d","0x1e","0x1f"],ascii="xxxx"@},
! @{addr="0x000013b0",data=["0x20","0x21","0x22","0x23"],ascii=" !\"#"@},
! @{addr="0x000013b4",data=["0x24","0x25","0x26","0x27"],ascii="$%&'"@},
! @{addr="0x000013b8",data=["0x28","0x29","0x2a","0x2b"],ascii="()*+"@},
! @{addr="0x000013bc",data=["0x2c","0x2d","0x2e","0x2f"],ascii=",-./"@}]
(@value{GDBP})
@end smallexample
Index: mi/mi-main.c
===================================================================
RCS file: /cvs/src/src/gdb/mi/mi-main.c,v
retrieving revision 1.18
diff -p -r1.18 mi-main.c
*** mi-main.c 2001/06/25 20:08:52 1.18
--- mi-main.c 2001/06/25 20:54:57
*************** mi_cmd_data_read_memory (char *command,
*** 892,898 ****
struct ui_stream *stream = ui_out_stream_new (uiout);
int row;
int row_byte;
! ui_out_tuple_begin (uiout, "memory");
for (row = 0, row_byte = 0;
row < nr_rows;
row++, row_byte += nr_cols * word_size)
--- 892,898 ----
struct ui_stream *stream = ui_out_stream_new (uiout);
int row;
int row_byte;
! ui_out_list_begin (uiout, "memory");
for (row = 0, row_byte = 0;
row < nr_rows;
row++, row_byte += nr_cols * word_size)
*************** mi_cmd_data_read_memory (char *command,
*** 902,908 ****
ui_out_tuple_begin (uiout, NULL);
ui_out_field_core_addr (uiout, "addr", addr + row_byte);
/* ui_out_field_core_addr_symbolic (uiout, "saddr", addr + row_byte); */
! ui_out_tuple_begin (uiout, "data");
for (col = 0, col_byte = row_byte;
col < nr_cols;
col++, col_byte += word_size)
--- 902,908 ----
ui_out_tuple_begin (uiout, NULL);
ui_out_field_core_addr (uiout, "addr", addr + row_byte);
/* ui_out_field_core_addr_symbolic (uiout, "saddr", addr + row_byte); */
! ui_out_list_begin (uiout, "data");
for (col = 0, col_byte = row_byte;
col < nr_cols;
col++, col_byte += word_size)
*************** mi_cmd_data_read_memory (char *command,
*** 919,925 ****
ui_out_field_stream (uiout, NULL, stream);
}
}
! ui_out_tuple_end (uiout);
if (aschar)
{
int byte;
--- 919,925 ----
ui_out_field_stream (uiout, NULL, stream);
}
}
! ui_out_list_end (uiout);
if (aschar)
{
int byte;
*************** mi_cmd_data_read_memory (char *command,
*** 942,948 ****
ui_out_tuple_end (uiout);
}
ui_out_stream_delete (stream);
! ui_out_tuple_end (uiout);
}
do_cleanups (cleanups);
return MI_CMD_DONE;
--- 942,948 ----
ui_out_tuple_end (uiout);
}
ui_out_stream_delete (stream);
! ui_out_list_end (uiout);
}
do_cleanups (cleanups);
return MI_CMD_DONE;
Index: testsuite/gdb.mi/mi-read-memory.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.mi/mi-read-memory.exp,v
retrieving revision 1.4
diff -p -r1.4 mi-read-memory.exp
*** mi-read-memory.exp 2001/06/23 21:47:09 1.4
--- mi-read-memory.exp 2001/06/25 20:54:57
*************** mi_gdb_test "1-data-read-memory" \
*** 68,98 ****
mi_gdb_test "2-data-read-memory bytes x 1 3 2" \
! "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\"}}}" \
"3x2, one byte"
mi_gdb_test "9-data-read-memory -o -6 -- -0+bytes+6 x 1 3 2" \
! "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\"}}}" \
"3x2, one byte offset by -6"
mi_gdb_test "3-data-read-memory \"(shorts + 128)\" x 2 1 2" \
! "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\"}}}" \
"expression in quotes"
mi_gdb_test "4-data-read-memory bytes+16 x 1 8 4 x" \
! "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=\",-\./\"}}" \
"ascii and data"
mi_gdb_test "5-data-read-memory shorts+64 d 2 1 1" \
! "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\"}}}" \
"decimal"
mi_gdb_test "6-data-read-memory shorts+64 o 2 1 1" \
! "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\"}}}" \
"octal"
--- 68,98 ----
mi_gdb_test "2-data-read-memory bytes x 1 3 2" \
! "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\"\\\]}\\\]" \
"3x2, one byte"
mi_gdb_test "9-data-read-memory -o -6 -- -0+bytes+6 x 1 3 2" \
! "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\"\\\]}\\\]" \
"3x2, one byte offset by -6"
mi_gdb_test "3-data-read-memory \"(shorts + 128)\" x 2 1 2" \
! "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\"\\\]}\\\]" \
"expression in quotes"
mi_gdb_test "4-data-read-memory bytes+16 x 1 8 4 x" \
! "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=\",-\./\"}\\\]" \
"ascii and data"
mi_gdb_test "5-data-read-memory shorts+64 d 2 1 1" \
! "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\"\\\]}\\\]" \
"decimal"
mi_gdb_test "6-data-read-memory shorts+64 o 2 1 1" \
! "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\"\\\]}\\\]" \
"octal"