Output register-names as a list.
authorAndrew Cagney <cagney@redhat.com>
Mon, 25 Jun 2001 19:02:18 +0000 (19:02 +0000)
committerAndrew Cagney <cagney@redhat.com>
Mon, 25 Jun 2001 19:02:18 +0000 (19:02 +0000)
gdb/mi/ChangeLog
gdb/mi/gdbmi.texinfo
gdb/mi/mi-main.c
gdb/testsuite/gdb.mi/ChangeLog
gdb/testsuite/gdb.mi/mi-regs.exp

index 0f2ab50bc2a2af72651f76260f58c989979d56ff..06ed0a4fc49f5f25e2f86fd3b84b71eeeb6cd52e 100644 (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
index 3fdad0f98b9e9b42c1efd6c26c1e9cb4c31520a0..b5e9890ddd4ab4e0b22c5cdb55b5b7c20ec1a4df 100644 (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
 
index 4ef68a720e1b043c6e8b6063bea07180ac339dd6..1342c21df89f04f12f87c3f930ede48b8e077000 100644 (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;
 }
 
index d6a116232426c097941e707c98400ce58608b26a..7514836de46d75e4d5a3b5eab768fbb02e6fec8c 100644 (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
index 9a60f8de22be1318370548d3a7d8e34cb4cd814a..5fd6b08b44dd8ccd36b28173ea1110bcfa7146fb 100644 (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" \