Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH v2] Add the "-info-os" command to MI
@ 2012-05-23  0:29 Stan Shebs
  2012-05-23 11:15 ` Pedro Alves
  0 siblings, 1 reply; 8+ messages in thread
From: Stan Shebs @ 2012-05-23  0:29 UTC (permalink / raw)
  To: gdb-patches

[-- Attachment #1: Type: text/plain, Size: 980 bytes --]

This patch is a minor rework/repost of 
http://sourceware.org/ml/gdb-patches/2011-11/msg00836.html , which Kwok 
got approved last November but then fell through the cracks.  I updated 
it, tweaked the docs per Eli, and add a simple sanity test.  It all 
seems pretty obvious, but on the off-chance that somebody sees something 
I missed, I'll wait a day to commit it.

Stan

2012-05-22  Stan Shebs <stan@codesourcery.com>
         Kwok Cheung Yeung <kcy@codesourcery.com>

     * Makefile.in (SUBDIR_MI_OBS): Add mi-cmd-info.o.
     (SUBDIR_MI_SRCS): Add mi-cmd-info.c.
     (mi-cmd-info.o): New rule.
     * osdata.h (info_osdata_command): New declaration.
     * osdata.c (info_osdata_command): Change to non-static.
     * mi/mi-cmds.h (mi_cmd_info_os): New declaration.
     * mi/mi-cmds.c (mi_cmds): Add -info-os MI command.
     * mi/mi-cmd-info.c: New file.

     * gdb.texinfo (Miscellaneous GDB/MI Commands): Document -info-os.

     * gdb.mi/mi-info-os.exp: New file.


[-- Attachment #2: miinfoos-patch-1 --]
[-- Type: text/plain, Size: 7114 bytes --]

Index: Makefile.in
===================================================================
RCS file: /cvs/src/src/gdb/Makefile.in,v
retrieving revision 1.1207
diff -u -p -r1.1207 Makefile.in
--- Makefile.in	27 Apr 2012 20:47:50 -0000	1.1207
+++ Makefile.in	23 May 2012 00:18:07 -0000
@@ -202,14 +202,14 @@ SUBDIR_MI_OBS = \
 	mi-out.o mi-console.o \
 	mi-cmds.o mi-cmd-env.o mi-cmd-var.o mi-cmd-break.o mi-cmd-stack.o \
 	mi-cmd-file.o mi-cmd-disas.o mi-symbol-cmds.o mi-cmd-target.o \
-	mi-interp.o \
+	mi-cmd-info.o mi-interp.o \
 	mi-main.o mi-parse.o mi-getopt.o
 SUBDIR_MI_SRCS = \
 	mi/mi-out.c mi/mi-console.c \
 	mi/mi-cmds.c mi/mi-cmd-env.c \
 	mi/mi-cmd-var.c mi/mi-cmd-break.c mi/mi-cmd-stack.c \
 	mi/mi-cmd-file.c mi/mi-cmd-disas.c mi/mi-symbol-cmds.c \
-	mi/mi-cmd-target.c mi/mi-interp.c \
+	mi/mi-cmd-target.c mi/mi-cmd-info.c mi/mi-interp.c \
 	mi/mi-main.c mi/mi-parse.c mi/mi-getopt.c
 SUBDIR_MI_DEPS =
 SUBDIR_MI_LDFLAGS=
@@ -1837,6 +1837,10 @@ mi-cmd-file.o: $(srcdir)/mi/mi-cmd-file.
 	$(COMPILE) $(srcdir)/mi/mi-cmd-file.c
 	$(POSTCOMPILE)
 
+mi-cmd-info.o: $(srcdir)/mi/mi-cmd-info.c
+	$(COMPILE) $(srcdir)/mi/mi-cmd-info.c
+	$(POSTCOMPILE)
+
 mi-cmds.o: $(srcdir)/mi/mi-cmds.c
 	$(COMPILE) $(srcdir)/mi/mi-cmds.c
 	$(POSTCOMPILE)
Index: NEWS
===================================================================
RCS file: /cvs/src/src/gdb/NEWS,v
retrieving revision 1.525
diff -u -p -r1.525 NEWS
--- NEWS	22 May 2012 17:12:07 -0000	1.525
+++ NEWS	23 May 2012 00:18:07 -0000
@@ -117,6 +117,10 @@
 * GDB can now support 'breakpoint always-inserted mode' in 'record'
   target.
 
+* MI changes
+
+  ** New command -info-os is the MI equivalent of "info os".
+
 * New commands
 
   ** "catch load" and "catch unload" can be used to stop when a shared
Index: osdata.c
===================================================================
RCS file: /cvs/src/src/gdb/osdata.c,v
retrieving revision 1.15
diff -u -p -r1.15 osdata.c
--- osdata.c	27 Mar 2012 19:08:36 -0000	1.15
+++ osdata.c	23 May 2012 00:18:07 -0000
@@ -288,7 +288,7 @@ get_osdata_column (struct osdata_item *i
   return NULL;
 }
 
-static void
+void
 info_osdata_command (char *type, int from_tty)
 {
   struct ui_out *uiout = current_uiout;
Index: osdata.h
===================================================================
RCS file: /cvs/src/src/gdb/osdata.h,v
retrieving revision 1.6
diff -u -p -r1.6 osdata.h
--- osdata.h	4 Jan 2012 08:17:09 -0000	1.6
+++ osdata.h	23 May 2012 00:18:07 -0000
@@ -49,5 +49,6 @@ void osdata_free (struct osdata *);
 struct cleanup *make_cleanup_osdata_free (struct osdata *data);
 struct osdata *get_osdata (const char *type);
 const char *get_osdata_column (struct osdata_item *item, const char *name);
+void info_osdata_command (char *type, int from_tty);
 
 #endif /* OSDATA_H */
Index: mi/mi-cmd-info.c
===================================================================
RCS file: mi/mi-cmd-info.c
diff -N mi/mi-cmd-info.c
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ mi/mi-cmd-info.c	23 May 2012 00:18:07 -0000
@@ -0,0 +1,38 @@
+/* MI Command Set - information commands.
+   Copyright (C) 2011-2012 Free Software Foundation, Inc.
+
+   This file is part of GDB.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+#include "defs.h"
+#include "osdata.h"
+#include "mi-cmds.h"
+
+void
+mi_cmd_info_os (char *command, char **argv, int argc)
+{
+  switch (argc)
+    {
+    case 0:
+      info_osdata_command ("", 0);
+      break;
+    case 1:
+      info_osdata_command (argv[0], 0);
+      break;
+    default:
+      error (_("Usage: -info-os [INFOTYPE]"));
+      break;
+    }
+}
Index: mi/mi-cmds.c
===================================================================
RCS file: /cvs/src/src/gdb/mi/mi-cmds.c,v
retrieving revision 1.59
diff -u -p -r1.59 mi-cmds.c
--- mi/mi-cmds.c	6 Mar 2012 22:48:53 -0000	1.59
+++ mi/mi-cmds.c	23 May 2012 00:18:07 -0000
@@ -89,6 +89,7 @@ struct mi_cmd mi_cmds[] =
   { "gdb-version", { "show version", 0 }, 0 },
   { "inferior-tty-set", { NULL, 0 }, mi_cmd_inferior_tty_set},
   { "inferior-tty-show", { NULL, 0 }, mi_cmd_inferior_tty_show},
+  { "info-os", { NULL, 0 }, mi_cmd_info_os},
   { "interpreter-exec", { NULL, 0 }, mi_cmd_interpreter_exec},
   { "list-features", { NULL, 0 }, mi_cmd_list_features},
   { "list-target-features", { NULL, 0 }, mi_cmd_list_target_features},
Index: mi/mi-cmds.h
===================================================================
RCS file: /cvs/src/src/gdb/mi/mi-cmds.h,v
retrieving revision 1.54
diff -u -p -r1.54 mi-cmds.h
--- mi/mi-cmds.h	6 Mar 2012 22:48:53 -0000	1.54
+++ mi/mi-cmds.h	23 May 2012 00:18:07 -0000
@@ -73,6 +73,7 @@ extern mi_cmd_argv_ftype mi_cmd_file_lis
 extern mi_cmd_argv_ftype mi_cmd_gdb_exit;
 extern mi_cmd_argv_ftype mi_cmd_inferior_tty_set;
 extern mi_cmd_argv_ftype mi_cmd_inferior_tty_show;
+extern mi_cmd_argv_ftype mi_cmd_info_os;
 extern mi_cmd_argv_ftype mi_cmd_interpreter_exec;
 extern mi_cmd_argv_ftype mi_cmd_list_features;
 extern mi_cmd_argv_ftype mi_cmd_list_target_features;
Index: testsuite/gdb.mi/mi-info-os.exp
===================================================================
RCS file: testsuite/gdb.mi/mi-info-os.exp
diff -N testsuite/gdb.mi/mi-info-os.exp
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ testsuite/gdb.mi/mi-info-os.exp	23 May 2012 00:18:07 -0000
@@ -0,0 +1,38 @@
+# Copyright 2012 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+load_lib mi-support.exp
+set MIFLAGS "-i=mi"
+
+# This test is Linux-only.
+if ![istarget *-*-linux*] then {
+    unsupported "mi-info-os.exp"
+    return -1
+}
+
+# Support for XML-output is needed to run this test.
+if [gdb_skip_xml_test] then {
+    unsupported "mi-info-os.exp"
+    return -1
+}
+
+gdb_exit
+if [mi_gdb_start] {
+    continue
+}
+
+# Try the argument-less form that lists all the types in a table.
+
+mi_gdb_test "-info-os" ".*\\^done,OSDataTable=.*" "-info-os"

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v2] Add the "-info-os" command to MI
  2012-05-23  0:29 [PATCH v2] Add the "-info-os" command to MI Stan Shebs
@ 2012-05-23 11:15 ` Pedro Alves
  2012-05-23 14:39   ` Stan Shebs
  0 siblings, 1 reply; 8+ messages in thread
From: Pedro Alves @ 2012-05-23 11:15 UTC (permalink / raw)
  To: Stan Shebs; +Cc: gdb-patches

On 05/23/2012 01:28 AM, Stan Shebs wrote:

> 2012-05-22  Stan Shebs <stan@codesourcery.com>
>         Kwok Cheung Yeung <kcy@codesourcery.com>


>     * gdb.texinfo (Miscellaneous GDB/MI Commands): Document -info-os.


This appears missing from the patch.

-- 
Pedro Alves


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v2] Add the "-info-os" command to MI
  2012-05-23 11:15 ` Pedro Alves
@ 2012-05-23 14:39   ` Stan Shebs
  2012-06-01 10:10     ` Vladimir Prus
  0 siblings, 1 reply; 8+ messages in thread
From: Stan Shebs @ 2012-05-23 14:39 UTC (permalink / raw)
  To: gdb-patches

[-- Attachment #1: Type: text/plain, Size: 343 bytes --]

On 5/23/12 4:15 AM, Pedro Alves wrote:
> On 05/23/2012 01:28 AM, Stan Shebs wrote:
>
>> 2012-05-22  Stan Shebs<stan@codesourcery.com>
>>          Kwok Cheung Yeung<kcy@codesourcery.com>
>
>>      * gdb.texinfo (Miscellaneous GDB/MI Commands): Document -info-os.
>
> This appears missing from the patch.
>
Argh!  OK, this one has it in.

Stan


[-- Attachment #2: miinfoos-patch-2 --]
[-- Type: text/plain, Size: 9896 bytes --]

Index: Makefile.in
===================================================================
RCS file: /cvs/src/src/gdb/Makefile.in,v
retrieving revision 1.1207
diff -u -p -r1.1207 Makefile.in
--- Makefile.in	27 Apr 2012 20:47:50 -0000	1.1207
+++ Makefile.in	23 May 2012 14:37:11 -0000
@@ -202,14 +202,14 @@ SUBDIR_MI_OBS = \
 	mi-out.o mi-console.o \
 	mi-cmds.o mi-cmd-env.o mi-cmd-var.o mi-cmd-break.o mi-cmd-stack.o \
 	mi-cmd-file.o mi-cmd-disas.o mi-symbol-cmds.o mi-cmd-target.o \
-	mi-interp.o \
+	mi-cmd-info.o mi-interp.o \
 	mi-main.o mi-parse.o mi-getopt.o
 SUBDIR_MI_SRCS = \
 	mi/mi-out.c mi/mi-console.c \
 	mi/mi-cmds.c mi/mi-cmd-env.c \
 	mi/mi-cmd-var.c mi/mi-cmd-break.c mi/mi-cmd-stack.c \
 	mi/mi-cmd-file.c mi/mi-cmd-disas.c mi/mi-symbol-cmds.c \
-	mi/mi-cmd-target.c mi/mi-interp.c \
+	mi/mi-cmd-target.c mi/mi-cmd-info.c mi/mi-interp.c \
 	mi/mi-main.c mi/mi-parse.c mi/mi-getopt.c
 SUBDIR_MI_DEPS =
 SUBDIR_MI_LDFLAGS=
@@ -1837,6 +1837,10 @@ mi-cmd-file.o: $(srcdir)/mi/mi-cmd-file.
 	$(COMPILE) $(srcdir)/mi/mi-cmd-file.c
 	$(POSTCOMPILE)
 
+mi-cmd-info.o: $(srcdir)/mi/mi-cmd-info.c
+	$(COMPILE) $(srcdir)/mi/mi-cmd-info.c
+	$(POSTCOMPILE)
+
 mi-cmds.o: $(srcdir)/mi/mi-cmds.c
 	$(COMPILE) $(srcdir)/mi/mi-cmds.c
 	$(POSTCOMPILE)
Index: NEWS
===================================================================
RCS file: /cvs/src/src/gdb/NEWS,v
retrieving revision 1.525
diff -u -p -r1.525 NEWS
--- NEWS	22 May 2012 17:12:07 -0000	1.525
+++ NEWS	23 May 2012 14:37:11 -0000
@@ -117,6 +117,10 @@
 * GDB can now support 'breakpoint always-inserted mode' in 'record'
   target.
 
+* MI changes
+
+  ** New command -info-os is the MI equivalent of "info os".
+
 * New commands
 
   ** "catch load" and "catch unload" can be used to stop when a shared
Index: osdata.c
===================================================================
RCS file: /cvs/src/src/gdb/osdata.c,v
retrieving revision 1.15
diff -u -p -r1.15 osdata.c
--- osdata.c	27 Mar 2012 19:08:36 -0000	1.15
+++ osdata.c	23 May 2012 14:37:11 -0000
@@ -288,7 +288,7 @@ get_osdata_column (struct osdata_item *i
   return NULL;
 }
 
-static void
+void
 info_osdata_command (char *type, int from_tty)
 {
   struct ui_out *uiout = current_uiout;
Index: osdata.h
===================================================================
RCS file: /cvs/src/src/gdb/osdata.h,v
retrieving revision 1.6
diff -u -p -r1.6 osdata.h
--- osdata.h	4 Jan 2012 08:17:09 -0000	1.6
+++ osdata.h	23 May 2012 14:37:11 -0000
@@ -49,5 +49,6 @@ void osdata_free (struct osdata *);
 struct cleanup *make_cleanup_osdata_free (struct osdata *data);
 struct osdata *get_osdata (const char *type);
 const char *get_osdata_column (struct osdata_item *item, const char *name);
+void info_osdata_command (char *type, int from_tty);
 
 #endif /* OSDATA_H */
Index: doc/gdb.texinfo
===================================================================
RCS file: /cvs/src/src/gdb/doc/gdb.texinfo,v
retrieving revision 1.970
diff -u -p -r1.970 gdb.texinfo
--- doc/gdb.texinfo	20 May 2012 20:35:19 -0000	1.970
+++ doc/gdb.texinfo	23 May 2012 14:37:12 -0000
@@ -32611,6 +32611,62 @@ and only if there is a corresponding exe
                         @{id="2",target-id="Thread 0xb7e14b90",cores=[2]@}]@},...]
 @end smallexample
 
+@subheading The @code{-info-os} Command
+@findex -info-os
+
+@subsubheading Synopsis
+
+@smallexample
+-info-os [ @var{type} ]
+@end smallexample
+
+If no argument is supplied, the command returns a table of available
+operating-system-specific information types.  If one of these types is
+supplied as an argument @var{type}, then the command returns a table
+of data of that type.
+
+The types of information available depend on the target operating
+system.
+
+@subsubheading @value{GDBN} Command
+
+The corresponding @value{GDBN} command is @samp{info os}.
+
+@subsubheading Example
+
+When run on a @sc{gnu}/Linux system, the output will look something
+like this:
+
+@smallexample
+@value{GDBP}
+-info-os
+^done,OSDataTable=@{nr_rows="9",nr_cols="2",
+hdr=[@{width="10",alignment="-1",col_name="col0",colhdr="Type"@},
+     @{width="10",alignment="-1",col_name="col1",colhdr="Description"@}],
+body=[item=@{col0="processes",col1="Listing of all processes"@},
+      item=@{col0="procgroups",col1="Listing of all process groups"@},
+      item=@{col0="threads",col1="Listing of all threads"@},
+      item=@{col0="files",col1="Listing of all file descriptors"@},
+      item=@{col0="sockets",col1="Listing of all internet-domain sockets"@},
+      item=@{col0="shm",col1="Listing of all shared-memory regions"@},
+      item=@{col0="semaphores",col1="Listing of all semaphores"@},
+      item=@{col0="msg",col1="Listing of all message queues"@},
+      item=@{col0="modules",col1="Listing of all loaded kernel modules"@}]@}
+@value{GDBP}
+-info-os processes
+^done,OSDataTable=@{nr_rows="190",nr_cols="4",
+hdr=[@{width="10",alignment="-1",col_name="col0",colhdr="pid"@},
+     @{width="10",alignment="-1",col_name="col1",colhdr="user"@},
+     @{width="10",alignment="-1",col_name="col2",colhdr="command"@},
+     @{width="10",alignment="-1",col_name="col3",colhdr="cores"@}],
+body=[item=@{col0="1",col1="root",col2="/sbin/init",col3="0"@},
+      item=@{col0="2",col1="root",col2="[kthreadd]",col3="1"@},
+      item=@{col0="3",col1="root",col2="[ksoftirqd/0]",col3="0"@},
+      ...
+      item=@{col0="26446",col1="stan",col2="bash",col3="0"@},
+      item=@{col0="28152",col1="stan",col2="bash",col3="1"@}]@}
+(gdb)
+@end smallexample
 
 @subheading The @code{-add-inferior} Command
 @findex -add-inferior
Index: mi/mi-cmd-info.c
===================================================================
RCS file: mi/mi-cmd-info.c
diff -N mi/mi-cmd-info.c
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ mi/mi-cmd-info.c	23 May 2012 14:37:12 -0000
@@ -0,0 +1,38 @@
+/* MI Command Set - information commands.
+   Copyright (C) 2011-2012 Free Software Foundation, Inc.
+
+   This file is part of GDB.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+#include "defs.h"
+#include "osdata.h"
+#include "mi-cmds.h"
+
+void
+mi_cmd_info_os (char *command, char **argv, int argc)
+{
+  switch (argc)
+    {
+    case 0:
+      info_osdata_command ("", 0);
+      break;
+    case 1:
+      info_osdata_command (argv[0], 0);
+      break;
+    default:
+      error (_("Usage: -info-os [INFOTYPE]"));
+      break;
+    }
+}
Index: mi/mi-cmds.c
===================================================================
RCS file: /cvs/src/src/gdb/mi/mi-cmds.c,v
retrieving revision 1.59
diff -u -p -r1.59 mi-cmds.c
--- mi/mi-cmds.c	6 Mar 2012 22:48:53 -0000	1.59
+++ mi/mi-cmds.c	23 May 2012 14:37:12 -0000
@@ -89,6 +89,7 @@ struct mi_cmd mi_cmds[] =
   { "gdb-version", { "show version", 0 }, 0 },
   { "inferior-tty-set", { NULL, 0 }, mi_cmd_inferior_tty_set},
   { "inferior-tty-show", { NULL, 0 }, mi_cmd_inferior_tty_show},
+  { "info-os", { NULL, 0 }, mi_cmd_info_os},
   { "interpreter-exec", { NULL, 0 }, mi_cmd_interpreter_exec},
   { "list-features", { NULL, 0 }, mi_cmd_list_features},
   { "list-target-features", { NULL, 0 }, mi_cmd_list_target_features},
Index: mi/mi-cmds.h
===================================================================
RCS file: /cvs/src/src/gdb/mi/mi-cmds.h,v
retrieving revision 1.54
diff -u -p -r1.54 mi-cmds.h
--- mi/mi-cmds.h	6 Mar 2012 22:48:53 -0000	1.54
+++ mi/mi-cmds.h	23 May 2012 14:37:12 -0000
@@ -73,6 +73,7 @@ extern mi_cmd_argv_ftype mi_cmd_file_lis
 extern mi_cmd_argv_ftype mi_cmd_gdb_exit;
 extern mi_cmd_argv_ftype mi_cmd_inferior_tty_set;
 extern mi_cmd_argv_ftype mi_cmd_inferior_tty_show;
+extern mi_cmd_argv_ftype mi_cmd_info_os;
 extern mi_cmd_argv_ftype mi_cmd_interpreter_exec;
 extern mi_cmd_argv_ftype mi_cmd_list_features;
 extern mi_cmd_argv_ftype mi_cmd_list_target_features;
Index: testsuite/gdb.mi/mi-info-os.exp
===================================================================
RCS file: testsuite/gdb.mi/mi-info-os.exp
diff -N testsuite/gdb.mi/mi-info-os.exp
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ testsuite/gdb.mi/mi-info-os.exp	23 May 2012 14:37:12 -0000
@@ -0,0 +1,38 @@
+# Copyright 2012 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+load_lib mi-support.exp
+set MIFLAGS "-i=mi"
+
+# This test is Linux-only.
+if ![istarget *-*-linux*] then {
+    unsupported "mi-info-os.exp"
+    return -1
+}
+
+# Support for XML-output is needed to run this test.
+if [gdb_skip_xml_test] then {
+    unsupported "mi-info-os.exp"
+    return -1
+}
+
+gdb_exit
+if [mi_gdb_start] {
+    continue
+}
+
+# Try the argument-less form that lists all the types in a table.
+
+mi_gdb_test "-info-os" ".*\\^done,OSDataTable=.*" "-info-os"

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v2] Add the "-info-os" command to MI
  2012-05-23 14:39   ` Stan Shebs
@ 2012-06-01 10:10     ` Vladimir Prus
  2012-06-08 22:58       ` Stan Shebs
  0 siblings, 1 reply; 8+ messages in thread
From: Vladimir Prus @ 2012-06-01 10:10 UTC (permalink / raw)
  To: gdb-patches

On 23/05/12 18:38, Stan Shebs wrote:
> @{width="10",alignment="-1",col_name="col1",colhdr="Description"@}],
> +body=[item=@{col0="processes",col1="Listing of all processes"@},
> +      item=@{col0="procgroups",col1="Listing of all process groups"@},
> +      item=@{col0="threads",col1="Listing of all threads"@},
> +      item=@{col0="files",col1="Listing of all file descriptors"@},
> +      item=@{col0="sockets",col1="Listing of all internet-domain sockets"@},
> +      item=@{col0="shm",col1="Listing of all shared-memory regions"@},
> +      item=@{col0="semaphores",col1="Listing of all semaphores"@},
> +      item=@{col0="msg",col1="Listing of all message queues"@},
> +      item=@{col0="modules",col1="Listing of all loaded kernel

Stan,

I am afraid this output is not really good enough. From MI consumer standpoint, we need a clear
and concise labels for each resource type. Unfortunately, "shm" is not acceptable at all.
"Listing of all shared-memory regions" is unacceptably long. Besides, this would make a good title
for a table with output, but not really good title for a menu used to specify what to show. For
the record, here's the labels I have to use in actual UI code:

	ResourceClassContributionItem_0=Processes
	ResourceClassContributionItem_10=Shared memory regions
	ResourceClassContributionItem_12=Semaphores
	ResourceClassContributionItem_14=Message queues
	ResourceClassContributionItem_16=Kernel modules
	ResourceClassContributionItem_2=Process groups
	ResourceClassContributionItem_4=Threads
	ResourceClassContributionItem_6=Files
	ResourceClassContributionItem_8=Sockets

Could GDB be made to output such labels?

Thanks,
Volodya




^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v2] Add the "-info-os" command to MI
  2012-06-01 10:10     ` Vladimir Prus
@ 2012-06-08 22:58       ` Stan Shebs
  2012-06-12  1:13         ` Stan Shebs
  0 siblings, 1 reply; 8+ messages in thread
From: Stan Shebs @ 2012-06-08 22:58 UTC (permalink / raw)
  To: gdb-patches

On 6/1/12 3:09 AM, Vladimir Prus wrote:
> On 23/05/12 18:38, Stan Shebs wrote:
>> @{width="10",alignment="-1",col_name="col1",colhdr="Description"@}],
>> +body=[item=@{col0="processes",col1="Listing of all processes"@},
>> +      item=@{col0="procgroups",col1="Listing of all process groups"@},
>> +      item=@{col0="threads",col1="Listing of all threads"@},
>> +      item=@{col0="files",col1="Listing of all file descriptors"@},
>> +      item=@{col0="sockets",col1="Listing of all internet-domain 
>> sockets"@},
>> +      item=@{col0="shm",col1="Listing of all shared-memory regions"@},
>> +      item=@{col0="semaphores",col1="Listing of all semaphores"@},
>> +      item=@{col0="msg",col1="Listing of all message queues"@},
>> +      item=@{col0="modules",col1="Listing of all loaded kernel
>
> Stan,
>
> I am afraid this output is not really good enough. From MI consumer 
> standpoint, we need a clear
> and concise labels for each resource type. Unfortunately, "shm" is not 
> acceptable at all.
> "Listing of all shared-memory regions" is unacceptably long. Besides, 
> this would make a good title
> for a table with output, but not really good title for a menu used to 
> specify what to show. For
> the record, here's the labels I have to use in actual UI code:
>
>     ResourceClassContributionItem_0=Processes
>     ResourceClassContributionItem_10=Shared memory regions
>     ResourceClassContributionItem_12=Semaphores
>     ResourceClassContributionItem_14=Message queues
>     ResourceClassContributionItem_16=Kernel modules
>     ResourceClassContributionItem_2=Process groups
>     ResourceClassContributionItem_4=Threads
>     ResourceClassContributionItem_6=Files
>     ResourceClassContributionItem_8=Sockets
>
> Could GDB be made to output such labels?

Thinking about this a bit, it would work to add a third column to the 
types listing, call it "Title", and define it as something like "short 
distinctive phrase using whole words" or something like that, and with a 
note in the manual that the title would ideally be phrased to be 
suitable for a menu of types.  This lets it occupy a middle ground 
between the ultra-short string that is suitable for a subcommand in the 
CLI, and the fully description that is suitable to head up a listing of 
objects.

I'll work up a patch along these lines.  In keeping with the apparent 
tradition of numbered columns in the listing of types :-), I'll supply 
titles as "col2".

Stan



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v2] Add the "-info-os" command to MI
  2012-06-08 22:58       ` Stan Shebs
@ 2012-06-12  1:13         ` Stan Shebs
  2012-06-12 14:51           ` Tom Tromey
  2012-06-25 12:28           ` Vladimir Prus
  0 siblings, 2 replies; 8+ messages in thread
From: Stan Shebs @ 2012-06-12  1:13 UTC (permalink / raw)
  To: gdb-patches

On 6/8/12 3:58 PM, Stan Shebs wrote:
> On 6/1/12 3:09 AM, Vladimir Prus wrote:
>> On 23/05/12 18:38, Stan Shebs wrote:
>>> @{width="10",alignment="-1",col_name="col1",colhdr="Description"@}],
>>> +body=[item=@{col0="processes",col1="Listing of all processes"@},
>>> +      item=@{col0="procgroups",col1="Listing of all process groups"@},
>>> +      item=@{col0="threads",col1="Listing of all threads"@},
>>> +      item=@{col0="files",col1="Listing of all file descriptors"@},
>>> +      item=@{col0="sockets",col1="Listing of all internet-domain 
>>> sockets"@},
>>> +      item=@{col0="shm",col1="Listing of all shared-memory regions"@},
>>> +      item=@{col0="semaphores",col1="Listing of all semaphores"@},
>>> +      item=@{col0="msg",col1="Listing of all message queues"@},
>>> +      item=@{col0="modules",col1="Listing of all loaded kernel
>>
>> Stan,
>>
>> I am afraid this output is not really good enough. From MI consumer 
>> standpoint, we need a clear
>> and concise labels for each resource type. Unfortunately, "shm" is 
>> not acceptable at all.
>> "Listing of all shared-memory regions" is unacceptably long. Besides, 
>> this would make a good title
>> for a table with output, but not really good title for a menu used to 
>> specify what to show. For
>> the record, here's the labels I have to use in actual UI code:
>>
>>     ResourceClassContributionItem_0=Processes
>>     ResourceClassContributionItem_10=Shared memory regions
>>     ResourceClassContributionItem_12=Semaphores
>>     ResourceClassContributionItem_14=Message queues
>>     ResourceClassContributionItem_16=Kernel modules
>>     ResourceClassContributionItem_2=Process groups
>>     ResourceClassContributionItem_4=Threads
>>     ResourceClassContributionItem_6=Files
>>     ResourceClassContributionItem_8=Sockets
>>
>> Could GDB be made to output such labels?
>
> Thinking about this a bit, it would work to add a third column to the 
> types listing, call it "Title", and define it as something like "short 
> distinctive phrase using whole words" or something like that, and with 
> a note in the manual that the title would ideally be phrased to be 
> suitable for a menu of types.  This lets it occupy a middle ground 
> between the ultra-short string that is suitable for a subcommand in 
> the CLI, and the fully description that is suitable to head up a 
> listing of objects.
>
> I'll work up a patch along these lines.  In keeping with the apparent 
> tradition of numbered columns in the listing of types :-), I'll supply 
> titles as "col2".

There is an unfortunate unexpected consequence to this, namely that CLI 
"info os" also puts out the titles (because both MI and CLI use the same 
code to format tables of data), and because of the way formatting works, 
the CLI output runs description and title together to create gems like 
"Listing of all process groups Process groups".  It's not unusable, just 
confusing.

The hack workaround is to use ui_out_is_mi_like_p, but that's only for 
absolutely necessary situations.  I'll look around a bit for other 
ideas, and welcome anybody's suggestions.

Stan


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v2] Add the "-info-os" command to MI
  2012-06-12  1:13         ` Stan Shebs
@ 2012-06-12 14:51           ` Tom Tromey
  2012-06-25 12:28           ` Vladimir Prus
  1 sibling, 0 replies; 8+ messages in thread
From: Tom Tromey @ 2012-06-12 14:51 UTC (permalink / raw)
  To: Stan Shebs; +Cc: gdb-patches

Stan> The hack workaround is to use ui_out_is_mi_like_p, but that's only for
Stan> absolutely necessary situations.

I think this is fine.  There are already many calls of this function.
One more isn't going to hurt.

Tom


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v2] Add the "-info-os" command to MI
  2012-06-12  1:13         ` Stan Shebs
  2012-06-12 14:51           ` Tom Tromey
@ 2012-06-25 12:28           ` Vladimir Prus
  1 sibling, 0 replies; 8+ messages in thread
From: Vladimir Prus @ 2012-06-25 12:28 UTC (permalink / raw)
  To: gdb-patches

On 12.06.2012 05:13, Stan Shebs wrote:
> On 6/8/12 3:58 PM, Stan Shebs wrote:
>> On 6/1/12 3:09 AM, Vladimir Prus wrote:
>>> On 23/05/12 18:38, Stan Shebs wrote:
>>>> @{width="10",alignment="-1",col_name="col1",colhdr="Description"@}],
>>>> +body=[item=@{col0="processes",col1="Listing of all processes"@},
>>>> +      item=@{col0="procgroups",col1="Listing of all process groups"@},
>>>> +      item=@{col0="threads",col1="Listing of all threads"@},
>>>> +      item=@{col0="files",col1="Listing of all file descriptors"@},
>>>> +      item=@{col0="sockets",col1="Listing of all internet-domain sockets"@},
>>>> +      item=@{col0="shm",col1="Listing of all shared-memory regions"@},
>>>> +      item=@{col0="semaphores",col1="Listing of all semaphores"@},
>>>> +      item=@{col0="msg",col1="Listing of all message queues"@},
>>>> +      item=@{col0="modules",col1="Listing of all loaded kernel
>>>
>>> Stan,
>>>
>>> I am afraid this output is not really good enough. From MI consumer standpoint, we need a clear
>>> and concise labels for each resource type. Unfortunately, "shm" is not acceptable at all.
>>> "Listing of all shared-memory regions" is unacceptably long. Besides, this would make a good title
>>> for a table with output, but not really good title for a menu used to specify what to show. For
>>> the record, here's the labels I have to use in actual UI code:
>>>
>>>     ResourceClassContributionItem_0=Processes
>>>     ResourceClassContributionItem_10=Shared memory regions
>>>     ResourceClassContributionItem_12=Semaphores
>>>     ResourceClassContributionItem_14=Message queues
>>>     ResourceClassContributionItem_16=Kernel modules
>>>     ResourceClassContributionItem_2=Process groups
>>>     ResourceClassContributionItem_4=Threads
>>>     ResourceClassContributionItem_6=Files
>>>     ResourceClassContributionItem_8=Sockets
>>>
>>> Could GDB be made to output such labels?
>>
>> Thinking about this a bit, it would work to add a third column to the types listing, call it "Title", and define it as something like
>> "short distinctive phrase using whole words" or something like that, and with a note in the manual that the title would ideally be phrased
>> to be suitable for a menu of types.  This lets it occupy a middle ground between the ultra-short string that is suitable for a subcommand
>> in the CLI, and the fully description that is suitable to head up a listing of objects.
>>
>> I'll work up a patch along these lines.  In keeping with the apparent tradition of numbered columns in the listing of types :-), I'll
>> supply titles as "col2".
>
> There is an unfortunate unexpected consequence to this, namely that CLI "info os" also puts out the titles (because both MI and CLI use the
> same code to format tables of data), and because of the way formatting works, the CLI output runs description and title together to create
> gems like "Listing of all process groups Process groups".  It's not unusable, just confusing.
>
> The hack workaround is to use ui_out_is_mi_like_p, but that's only for absolutely necessary situations.  I'll look around a bit for other
> ideas, and welcome anybody's suggestions.

I suggest not let perfect be the enemy of the good. ui_out_is_mi_like_p is perfectly acceptable solution.

The only alternative way I see would to be have the same titles for MI and CLI -- for example "Process groups". I should note that "Listing 
of all" prefix for every row of "info os" output is just as content free as it is content free in MI output, so it would be reasonable to 
only show that long form in output of "info os whatever" and not "info os".

- Volodya


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2012-06-25 12:28 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-05-23  0:29 [PATCH v2] Add the "-info-os" command to MI Stan Shebs
2012-05-23 11:15 ` Pedro Alves
2012-05-23 14:39   ` Stan Shebs
2012-06-01 10:10     ` Vladimir Prus
2012-06-08 22:58       ` Stan Shebs
2012-06-12  1:13         ` Stan Shebs
2012-06-12 14:51           ` Tom Tromey
2012-06-25 12:28           ` Vladimir Prus

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox