aboutsummaryrefslogtreecommitdiff
path: root/gdb/mi
diff options
context:
space:
mode:
authorAndrew Cagney <cagney@redhat.com>2001-06-25 19:02:18 +0000
committerAndrew Cagney <cagney@redhat.com>2001-06-25 19:02:18 +0000
commit173d689456fdc852c50bb57963c580db5da3eee3 (patch)
tree9ef807471b89316faff1e7724a9be231b2584649 /gdb/mi
parent40d5d7e983f35d344244ed0d8700e45b86b21adc (diff)
downloadfsf-binutils-gdb-173d689456fdc852c50bb57963c580db5da3eee3.zip
fsf-binutils-gdb-173d689456fdc852c50bb57963c580db5da3eee3.tar.gz
fsf-binutils-gdb-173d689456fdc852c50bb57963c580db5da3eee3.tar.bz2
Output register-names as a list.
Diffstat (limited to 'gdb/mi')
-rw-r--r--gdb/mi/ChangeLog9
-rw-r--r--gdb/mi/gdbmi.texinfo10
-rw-r--r--gdb/mi/mi-main.c25
3 files changed, 27 insertions, 17 deletions
diff --git a/gdb/mi/ChangeLog b/gdb/mi/ChangeLog
index 0f2ab50..06ed0a4 100644
--- a/gdb/mi/ChangeLog
+++ b/gdb/mi/ChangeLog
@@ -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
diff --git a/gdb/mi/gdbmi.texinfo b/gdb/mi/gdbmi.texinfo
index 3fdad0f..b5e9890 100644
--- a/gdb/mi/gdbmi.texinfo
+++ b/gdb/mi/gdbmi.texinfo
@@ -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
diff --git a/gdb/mi/mi-main.c b/gdb/mi/mi-main.c
index 4ef68a7..1342c21 100644
--- a/gdb/mi/mi-main.c
+++ b/gdb/mi/mi-main.c
@@ -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;
}