diff options
author | Andrew Cagney <cagney@redhat.com> | 2001-06-25 19:02:18 +0000 |
---|---|---|
committer | Andrew Cagney <cagney@redhat.com> | 2001-06-25 19:02:18 +0000 |
commit | 173d689456fdc852c50bb57963c580db5da3eee3 (patch) | |
tree | 9ef807471b89316faff1e7724a9be231b2584649 | |
parent | 40d5d7e983f35d344244ed0d8700e45b86b21adc (diff) | |
download | ppe42-binutils-173d689456fdc852c50bb57963c580db5da3eee3.tar.gz ppe42-binutils-173d689456fdc852c50bb57963c580db5da3eee3.zip |
Output register-names as a list.
-rw-r--r-- | gdb/mi/ChangeLog | 9 | ||||
-rw-r--r-- | gdb/mi/gdbmi.texinfo | 10 | ||||
-rw-r--r-- | gdb/mi/mi-main.c | 25 | ||||
-rw-r--r-- | gdb/testsuite/gdb.mi/ChangeLog | 5 | ||||
-rw-r--r-- | gdb/testsuite/gdb.mi/mi-regs.exp | 4 |
5 files changed, 34 insertions, 19 deletions
diff --git a/gdb/mi/ChangeLog b/gdb/mi/ChangeLog index 0f2ab50bc2..06ed0a4fc4 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 3fdad0f98b..b5e9890ddd 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 4ef68a720e..1342c21df8 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; } diff --git a/gdb/testsuite/gdb.mi/ChangeLog b/gdb/testsuite/gdb.mi/ChangeLog index d6a1162324..7514836de4 100644 --- a/gdb/testsuite/gdb.mi/ChangeLog +++ b/gdb/testsuite/gdb.mi/ChangeLog @@ -1,5 +1,10 @@ 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 outputs a list. diff --git a/gdb/testsuite/gdb.mi/mi-regs.exp b/gdb/testsuite/gdb.mi/mi-regs.exp index 9a60f8de22..5fd6b08b44 100644 --- a/gdb/testsuite/gdb.mi/mi-regs.exp +++ b/gdb/testsuite/gdb.mi/mi-regs.exp @@ -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" \ |