Output register-names as a list.

This commit is contained in:
Andrew Cagney 2001-06-25 19:02:18 +00:00
parent 40d5d7e983
commit 173d689456
5 changed files with 34 additions and 19 deletions

View File

@ -1,3 +1,12 @@
2001-06-25 Andrew Cagney <ac131313@redhat.com>
* mi-main.c (mi_cmd_data_list_register_names): Output a list of
register names.
(mi_cmd_data_list_register_names): Include the pseudo registers.
(mi_cmd_data_list_register_names): Don't leave holes in the list,
output "" for NULL registers.
* gdbmi.texinfo (data-list-register-names): Update documentation.
2001-06-23 Andrew Cagney <ac131313@redhat.com>
* mi-main.c (mi_cmd_data_list_changed_registers): Output a list of

View File

@ -1253,7 +1253,9 @@ args=@{@},file="try.c",line="5"@}
Show a list of register names for the current target. If no arguments
are given, it shows a list of the names of all the registers. If
integer numbers are given as arguments, it will print a list of the
names of the registers corresponding to the arguments.
names of the registers corresponding to the arguments. To ensure
consistency between a register name and its number, the output list may
include empty register names.
@subsubheading @value{GDBN} Command
@ -1267,16 +1269,16 @@ For the PPC MBX board:
@smallexample
(@value{GDBP})
-data-list-register-names
^done,register-names=@{"r0","r1","r2","r3","r4","r5","r6","r7",
^done,register-names=["r0","r1","r2","r3","r4","r5","r6","r7",
"r8","r9","r10","r11","r12","r13","r14","r15","r16","r17","r18",
"r19","r20","r21","r22","r23","r24","r25","r26","r27","r28","r29",
"r30","r31","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9",
"f10","f11","f12","f13","f14","f15","f16","f17","f18","f19","f20",
"f21","f22","f23","f24","f25","f26","f27","f28","f29","f30","f31",
"pc","ps","cr","lr","ctr","xer"@}
"", "pc","ps","cr","lr","ctr","xer"]
(@value{GDBP})
-data-list-register-names 1 2 3
^done,register-names=@{"r1","r2","r3"@}
^done,register-names=["r1","r2","r3"]
(@value{GDBP})
@end smallexample

View File

@ -271,9 +271,9 @@ mi_cmd_data_list_register_names (char *command, char **argv, int argc)
case, some entries of REGISTER_NAME will change depending upon
the particular processor being debugged. */
numregs = NUM_REGS;
numregs = NUM_REGS + NUM_PSEUDO_REGS;
ui_out_tuple_begin (uiout, "register-names");
ui_out_list_begin (uiout, "register-names");
if (argc == 0) /* No args, just do all the regs */
{
@ -283,9 +283,9 @@ mi_cmd_data_list_register_names (char *command, char **argv, int argc)
{
if (REGISTER_NAME (regnum) == NULL
|| *(REGISTER_NAME (regnum)) == '\0')
continue;
ui_out_field_string (uiout, NULL, REGISTER_NAME (regnum));
ui_out_field_string (uiout, NULL, "");
else
ui_out_field_string (uiout, NULL, REGISTER_NAME (regnum));
}
}
@ -293,19 +293,18 @@ mi_cmd_data_list_register_names (char *command, char **argv, int argc)
for (i = 0; i < argc; i++)
{
regnum = atoi (argv[i]);
if (regnum >= 0
&& regnum < numregs
&& REGISTER_NAME (regnum) != NULL
&& *REGISTER_NAME (regnum) != '\000')
ui_out_field_string (uiout, NULL, REGISTER_NAME (regnum));
else
if (regnum < 0 || regnum >= numregs)
{
xasprintf (&mi_error_message, "bad register number");
return MI_CMD_ERROR;
}
if (REGISTER_NAME (regnum) == NULL
|| *(REGISTER_NAME (regnum)) == '\0')
ui_out_field_string (uiout, NULL, "");
else
ui_out_field_string (uiout, NULL, REGISTER_NAME (regnum));
}
ui_out_tuple_end (uiout);
ui_out_list_end (uiout);
return MI_CMD_DONE;
}

View File

@ -1,3 +1,8 @@
2001-06-25 Andrew Cagney <ac131313@redhat.com>
* mi-regs.exp: Update patters matching register-names. Now
outputs a list.
2001-06-25 Andrew Cagney <ac131313@redhat.com>
* mi-regs.exp: Update patterns matching changed-registers. Now

View File

@ -116,7 +116,7 @@ proc sparc_register_tests { } {
set float2 "\-?\[0-9\]+"
mi_gdb_test "111-data-list-register-names" \
"111\\^done,register-names=\{\"g0\",\"g1\",\"g2\",\"g3\",\"g4\",\"g5\",\"g6\",\"g7\",\"o0\",\"o1\",\"o2\",\"o3\",\"o4\",\"o5\",\"sp\",\"o7\",\"l0\",\"l1\",\"l2\",\"l3\",\"l4\",\"l5\",\"l6\",\"l7\",\"i0\",\"i1\",\"i2\",\"i3\",\"i4\",\"i5\",\"fp\",\"i7\",\"f0\",\"f1\",\"f2\",\"f3\",\"f4\",\"f5\",\"f6\",\"f7\",\"f8\",\"f9\",\"f10\",\"f11\",\"f12\",\"f13\",\"f14\",\"f15\",\"f16\",\"f17\",\"f18\",\"f19\",\"f20\",\"f21\",\"f22\",\"f23\",\"f24\",\"f25\",\"f26\",\"f27\",\"f28\",\"f29\",\"f30\",\"f31\",\"y\",\"psr\",\"wim\",\"tbr\",\"pc\",\"npc\",\"fpsr\",\"cpsr\"\}" \
"111\\^done,register-names=\\\[\"g0\",\"g1\",\"g2\",\"g3\",\"g4\",\"g5\",\"g6\",\"g7\",\"o0\",\"o1\",\"o2\",\"o3\",\"o4\",\"o5\",\"sp\",\"o7\",\"l0\",\"l1\",\"l2\",\"l3\",\"l4\",\"l5\",\"l6\",\"l7\",\"i0\",\"i1\",\"i2\",\"i3\",\"i4\",\"i5\",\"fp\",\"i7\",\"f0\",\"f1\",\"f2\",\"f3\",\"f4\",\"f5\",\"f6\",\"f7\",\"f8\",\"f9\",\"f10\",\"f11\",\"f12\",\"f13\",\"f14\",\"f15\",\"f16\",\"f17\",\"f18\",\"f19\",\"f20\",\"f21\",\"f22\",\"f23\",\"f24\",\"f25\",\"f26\",\"f27\",\"f28\",\"f29\",\"f30\",\"f31\",\"y\",\"psr\",\"wim\",\"tbr\",\"pc\",\"npc\",\"fpsr\",\"cpsr\"\\\]" \
"list register names"
mi_gdb_test "222-data-list-register-values x" \
@ -150,7 +150,7 @@ proc sparc_register_tests { } {
"register values r"
mi_gdb_test "999-data-list-register-names 68 69 70 71" \
"999\\^done,register-names=\{\"pc\",\"npc\",\"fpsr\",\"cpsr\"\}" \
"999\\^done,register-names=\\\[\"pc\",\"npc\",\"fpsr\",\"cpsr\"\\\]" \
"list names of some regs"
mi_gdb_test "001-data-list-register-values x 68 69 70 71" \