aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gdb/ChangeLog12
-rw-r--r--gdb/Makefile.in8
-rw-r--r--gdb/NEWS4
-rw-r--r--gdb/doc/ChangeLog5
-rw-r--r--gdb/doc/gdb.texinfo56
-rw-r--r--gdb/mi/mi-cmd-info.c38
-rw-r--r--gdb/mi/mi-cmds.c1
-rw-r--r--gdb/mi/mi-cmds.h1
-rw-r--r--gdb/osdata.c2
-rw-r--r--gdb/osdata.h1
-rw-r--r--gdb/testsuite/ChangeLog4
-rw-r--r--gdb/testsuite/gdb.mi/mi-info-os.exp38
12 files changed, 167 insertions, 3 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 5aa5b11..335450e 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,15 @@
+2012-05-23 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.
+
2012-05-23 Doug Evans <dje@google.com>
* symtab.c (search_symbols): Pass NULL for file_matcher to
diff --git a/gdb/Makefile.in b/gdb/Makefile.in
index 4368f07..b636045 100644
--- a/gdb/Makefile.in
+++ b/gdb/Makefile.in
@@ -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.c
$(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)
diff --git a/gdb/NEWS b/gdb/NEWS
index 92cb2ba..476e5a0 100644
--- a/gdb/NEWS
+++ b/gdb/NEWS
@@ -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
diff --git a/gdb/doc/ChangeLog b/gdb/doc/ChangeLog
index 70e4e41..85e5b6e 100644
--- a/gdb/doc/ChangeLog
+++ b/gdb/doc/ChangeLog
@@ -1,3 +1,8 @@
+2012-05-23 Stan Shebs <stan@codesourcery.com>
+ Kwok Cheung Yeung <kcy@codesourcery.com>
+
+ * gdb.texinfo (Miscellaneous GDB/MI Commands): Document -info-os.
+
2012-05-20 Jan Kratochvil <jan.kratochvil@redhat.com>
* gdb.texinfo (Separate Debug Files): New anchor debug-file-directory.
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
index c12f976..014cfd8 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -32611,6 +32611,62 @@ and only if there is a corresponding executable file.
@{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
diff --git a/gdb/mi/mi-cmd-info.c b/gdb/mi/mi-cmd-info.c
new file mode 100644
index 0000000..ffda52f
--- /dev/null
+++ b/gdb/mi/mi-cmd-info.c
@@ -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;
+ }
+}
diff --git a/gdb/mi/mi-cmds.c b/gdb/mi/mi-cmds.c
index 9152489..79fbba1 100644
--- a/gdb/mi/mi-cmds.c
+++ b/gdb/mi/mi-cmds.c
@@ -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},
diff --git a/gdb/mi/mi-cmds.h b/gdb/mi/mi-cmds.h
index c8465f0..4d0fc9d 100644
--- a/gdb/mi/mi-cmds.h
+++ b/gdb/mi/mi-cmds.h
@@ -73,6 +73,7 @@ extern mi_cmd_argv_ftype mi_cmd_file_list_exec_source_files;
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;
diff --git a/gdb/osdata.c b/gdb/osdata.c
index 67dbb4b..066d47f 100644
--- a/gdb/osdata.c
+++ b/gdb/osdata.c
@@ -288,7 +288,7 @@ get_osdata_column (struct osdata_item *item, const char *name)
return NULL;
}
-static void
+void
info_osdata_command (char *type, int from_tty)
{
struct ui_out *uiout = current_uiout;
diff --git a/gdb/osdata.h b/gdb/osdata.h
index f63b0f3..4cfb3f8 100644
--- a/gdb/osdata.h
+++ b/gdb/osdata.h
@@ -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 */
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 3f76a1b..5a0d71d 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,7 @@
+2012-05-23 Stan Shebs <stan@codesourcery.com>
+
+ * gdb.mi/mi-info-os.exp: New file.
+
2012-05-23 Keith Seitz <keiths@redhat.com>
* gdb.trace/stap-trace.exp: If compile_stap_bin fails,
diff --git a/gdb/testsuite/gdb.mi/mi-info-os.exp b/gdb/testsuite/gdb.mi/mi-info-os.exp
new file mode 100644
index 0000000..2fff688
--- /dev/null
+++ b/gdb/testsuite/gdb.mi/mi-info-os.exp
@@ -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"