* [PATCH] Add the "-info-os" command to MI
@ 2011-10-13 15:52 Kwok Cheung Yeung
2011-10-13 16:13 ` Eli Zaretskii
2011-10-21 20:53 ` Tom Tromey
0 siblings, 2 replies; 12+ messages in thread
From: Kwok Cheung Yeung @ 2011-10-13 15:52 UTC (permalink / raw)
To: gdb-patches
This patch adds the "-info-os" command to MI as the counterpart to the GDB "info
os" command. It behaves in the same way as "info os", only the output is
formatted according to MI conventions. I've also added an entry in the
documentation.
Kwok
ChangeLog:
gdb/
* mi/mi-cmds.c (mi_cmds): Add -info-os MI command.
gdb/doc/
* gdb.texinfo (Operating System Auxilliary Information): Change
the name of the information types anchor to be more readable.
(Miscellaneous gdb/mi Commands): Document the -info-os MI command.
--- src_old/gdb/mi/mi-cmds.c 2011-10-13 16:32:52.504656252 +0100
+++ src/gdb/mi/mi-cmds.c 2011-10-11 15:45:18.578784000 +0100
@@ -90,6 +90,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", { "info os", 1 }, NULL },
{ "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},
--- src_old/gdb/doc/gdb.texinfo 2011-10-13 16:31:49.537274871 +0100
+++ src/gdb/doc/gdb.texinfo 2011-10-13 16:30:07.534783331 +0100
@@ -8931,7 +8931,7 @@ Display OS information of the requested
On @sc{gnu}/Linux, the following values of INFOTYPE are valid:
-@anchor{linux info os infotypes}
+@anchor{Linux OS information types}
@table @code
@kindex info os processes
@item processes
@@ -30882,6 +30882,54 @@ default shows this information when you
(gdb)
@end smallexample
+@subheading The @code{-info-os} Command
+@findex -info-os
+
+@subsubheading Synopsis
+
+@smallexample
+ -info-os [ @var{type} ]
+@end smallexample
+
+Returns a table of supported OS-specific information types if no
+argument is supplied. If an argument is supplied, then a table of
+the requested information type is returned.
+
+The types of information available depend on the target operating
+system. The available types for @sc{gnu}/Linux are listed in
+@ref{Linux OS information types}.
+
+@subsubheading @value{GDBN} Command
+
+The corresponding @value{GDBN} command is @samp{info os}.
+
+@subsubheading Example
+
+@smallexample
+(gdb)
+-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_nam
+e="col1",colhdr="Description"@}],body=[item=@{col0="processes",col1="Lis
+ting of all processes"@},item=@{col0="procgroups",col1="Listing of all p
+rocess groups"@},item=@{col0="threads",col1="Listing of all threads"@},i
+tem=@{col0="files",col1="Listing of all file descriptors"@},item=@{col0=
+"sockets",col1="Listing of all internet-domain sockets"@},item=@{col0="s
+hm",col1="Listing of all shared-memory regions"@},item=@{col0="semaphore
+s",col1="Listing of all semaphores"@},item=@{col0="msg",col1="Listing of
+ all message queues"@},item=@{col0="modules",col1="Listing of all loaded
+ kernel modules"@}]@}
+(gdb)
+-info-os processes
+^done,OSDataTable=@{nr_rows="137",nr_cols="4",hdr=[@{width="10",alignmen
+t="-1",col_name="col0",colhdr="pid"@},@{width="10",alignment="-1",col_na
+me="col1",colhdr="user"@},@{width="10",alignment="-1",col_name="col2",co
+lhdr="command"@},@{width="10",alignment="-1",col_name="col3",colhdr="cor
+es"@}],body=[item=@{col0="1",col1="root",col2="/sbin/init",col3="0"@},it
+em=@{col0="2",col1="root",col2="[kthreadd]",col3="0"@}, ... ]@}
+(gdb)
+@end smallexample
+
@subheading The @code{-list-features} Command
@findex -list-features
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] Add the "-info-os" command to MI
2011-10-13 15:52 [PATCH] Add the "-info-os" command to MI Kwok Cheung Yeung
@ 2011-10-13 16:13 ` Eli Zaretskii
2011-11-23 23:37 ` Kwok Cheung Yeung
2011-10-21 20:53 ` Tom Tromey
1 sibling, 1 reply; 12+ messages in thread
From: Eli Zaretskii @ 2011-10-13 16:13 UTC (permalink / raw)
To: Kwok Cheung Yeung; +Cc: gdb-patches
> Date: Thu, 13 Oct 2011 16:51:49 +0100
> From: Kwok Cheung Yeung <kcy@codesourcery.com>
>
> This patch adds the "-info-os" command to MI as the counterpart to the GDB "info
> os" command. It behaves in the same way as "info os", only the output is
> formatted according to MI conventions. I've also added an entry in the
> documentation.
Thanks.
> On @sc{gnu}/Linux, the following values of INFOTYPE are valid:
>
> -@anchor{linux info os infotypes}
> +@anchor{Linux OS information types}
I don't see these lines in today's CVS version of gdb.texinfo. Does
your patch depend on some other patch?
Anyway, why is "info os processes" suddenly treated as a
Linux-specific command? "info os" is supposed to be
platform-agnostic; if it is a Linux-only feature, it will be more
appropriate to call it "info linux", like "info dos" and "info w32"
that we already have.
> +The types of information available depend on the target operating
> +system. The available types for @sc{gnu}/Linux are listed in
> +@ref{Linux OS information types}.
As I said above, the referenced section is not Linux-specific, and the
CVS version of the manual does not have any details there. So
something (perhaps in my brain) is missing.
> +@smallexample
> +(gdb)
> +-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_nam
> +e="col1",colhdr="Description"@}],body=[item=@{col0="processes",col1="Lis
> +ting of all processes"@},item=@{col0="procgroups",col1="Listing of all p
> +rocess groups"@},item=@{col0="threads",col1="Listing of all threads"@},i
> +tem=@{col0="files",col1="Listing of all file descriptors"@},item=@{col0=
> +"sockets",col1="Listing of all internet-domain sockets"@},item=@{col0="s
> +hm",col1="Listing of all shared-memory regions"@},item=@{col0="semaphore
> +s",col1="Listing of all semaphores"@},item=@{col0="msg",col1="Listing of
> + all message queues"@},item=@{col0="modules",col1="Listing of all loaded
> + kernel modules"@}]@}
The lines here are broken in arbitrary places, which will look
illegible in the manual. Please reformat the example so that the
output could be readable by humans.
Thanks.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] Add the "-info-os" command to MI
2011-10-13 15:52 [PATCH] Add the "-info-os" command to MI Kwok Cheung Yeung
2011-10-13 16:13 ` Eli Zaretskii
@ 2011-10-21 20:53 ` Tom Tromey
2011-10-27 0:24 ` Stan Shebs
2011-11-24 23:15 ` Kwok Cheung Yeung
1 sibling, 2 replies; 12+ messages in thread
From: Tom Tromey @ 2011-10-21 20:53 UTC (permalink / raw)
To: Kwok Cheung Yeung; +Cc: gdb-patches
>>>>> ">" == Kwok Cheung Yeung <kcy@codesourcery.com> writes:
>> + { "info-os", { "info os", 1 }, NULL },
I'd prefer a new function specific to MI to do the command-line parsing.
I think this approach should be deprecated and that no new instances go
into the tree. They unnecessarily link MI to the CLI, making it harder
to change the CLI.
Tom
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] Add the "-info-os" command to MI
2011-10-21 20:53 ` Tom Tromey
@ 2011-10-27 0:24 ` Stan Shebs
2011-10-27 16:45 ` Tom Tromey
2011-11-24 23:15 ` Kwok Cheung Yeung
1 sibling, 1 reply; 12+ messages in thread
From: Stan Shebs @ 2011-10-27 0:24 UTC (permalink / raw)
To: gdb-patches
On 10/21/11 1:39 PM, Tom Tromey wrote:
>>>>>> ">" == Kwok Cheung Yeung<kcy@codesourcery.com> writes:
>>> + { "info-os", { "info os", 1 }, NULL },
> I'd prefer a new function specific to MI to do the command-line parsing.
>
> I think this approach should be deprecated and that no new instances go
> into the tree. They unnecessarily link MI to the CLI, making it harder
> to change the CLI.
>
I can see the appeal of the decoupling, but we share argument parsing
like this because there's not a lot of practical purpose to having two
parsers - once the command is out there and being used, we're loath to
change it much anyway. To me, the MI's main value is in avoiding cases
where CLI ambiguity and elision makes for a better user experience, but
in this case the arguments are data-driven by platform-specific code,
not much ambiguity involved.
Stan
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] Add the "-info-os" command to MI
2011-10-27 0:24 ` Stan Shebs
@ 2011-10-27 16:45 ` Tom Tromey
0 siblings, 0 replies; 12+ messages in thread
From: Tom Tromey @ 2011-10-27 16:45 UTC (permalink / raw)
To: Stan Shebs; +Cc: gdb-patches
>>>>> "Stan" == Stan Shebs <stanshebs@earthlink.net> writes:
Stan> I can see the appeal of the decoupling, but we share argument parsing
Stan> like this because there's not a lot of practical purpose to having two
Stan> parsers - once the command is out there and being used, we're loath to
Stan> change it much anyway. To me, the MI's main value is in avoiding
Stan> cases where CLI ambiguity and elision makes for a better user
Stan> experience, but in this case the arguments are data-driven by
Stan> platform-specific code, not much ambiguity involved.
Ok, I won't insist on it.
I thought this had bit us before but I couldn't find a case in the
archives. So maybe my concerns are theoretical.
Tom
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] Add the "-info-os" command to MI
2011-10-13 16:13 ` Eli Zaretskii
@ 2011-11-23 23:37 ` Kwok Cheung Yeung
2011-12-06 18:53 ` Pedro Alves
0 siblings, 1 reply; 12+ messages in thread
From: Kwok Cheung Yeung @ 2011-11-23 23:37 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: gdb-patches
Hello
Sorry for taking so long to reply!
On 13/10/2011 5:12 PM, Eli Zaretskii wrote:
>> On @sc{gnu}/Linux, the following values of INFOTYPE are valid:
>>
>> -@anchor{linux info os infotypes}
>> +@anchor{Linux OS information types}
>
> I don't see these lines in today's CVS version of gdb.texinfo. Does
> your patch depend on some other patch?
>
This patch assumes that the patch from
http://sourceware.org/ml/gdb-patches/2011-10/msg00368.html has been applied.
That patch adds many extra types of OS info for Linux only.
> Anyway, why is "info os processes" suddenly treated as a
> Linux-specific command? "info os" is supposed to be
> platform-agnostic; if it is a Linux-only feature, it will be more
> appropriate to call it "info linux", like "info dos" and "info w32"
> that we already have.
>
>> +The types of information available depend on the target operating
>> +system. The available types for @sc{gnu}/Linux are listed in
>> +@ref{Linux OS information types}.
>
> As I said above, the referenced section is not Linux-specific, and the
> CVS version of the manual does not have any details there. So
> something (perhaps in my brain) is missing.
>
In the patch for extra Linux OS data types, I've tweaked the documentation so
that it says something on the lines of: 'info os INFOTYPE' displays OS
information of the requested type, types of INFOTYPE available depend on the OS,
and on Linux, the valid types of INFOTYPE happen to be... I've moved 'info os
processes' into that list because I've expanded on the information provided (and
while the processes INFOTYPE is not specific to Linux, I'm not sure that it is
universal either?). Anyway, could you take a look at the documentation changes
in that patch first please?
>> +@smallexample
>> +(gdb)
>> +-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_nam
>> +e="col1",colhdr="Description"@}],body=[item=@{col0="processes",col1="Lis
>> +ting of all processes"@},item=@{col0="procgroups",col1="Listing of all p
>> +rocess groups"@},item=@{col0="threads",col1="Listing of all threads"@},i
>> +tem=@{col0="files",col1="Listing of all file descriptors"@},item=@{col0=
>> +"sockets",col1="Listing of all internet-domain sockets"@},item=@{col0="s
>> +hm",col1="Listing of all shared-memory regions"@},item=@{col0="semaphore
>> +s",col1="Listing of all semaphores"@},item=@{col0="msg",col1="Listing of
>> + all message queues"@},item=@{col0="modules",col1="Listing of all loaded
>> + kernel modules"@}]@}
>
> The lines here are broken in arbitrary places, which will look
> illegible in the manual. Please reformat the example so that the
> output could be readable by humans.
>
Well, one could argue that MI wasn't meant to be easily human-readable :-) That
output is exactly how it would look if the command were issued by a human, and
it might be confusing if a user issues the command and doesn't get the nicely
formatted output shown in the manual. I'm happy to make the changes if you think
that is not an issue though.
Thanks,
Kwok
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] Add the "-info-os" command to MI
2011-10-21 20:53 ` Tom Tromey
2011-10-27 0:24 ` Stan Shebs
@ 2011-11-24 23:15 ` Kwok Cheung Yeung
2011-11-25 11:56 ` Eli Zaretskii
2011-11-29 19:01 ` Tom Tromey
1 sibling, 2 replies; 12+ messages in thread
From: Kwok Cheung Yeung @ 2011-11-24 23:15 UTC (permalink / raw)
To: Tom Tromey; +Cc: gdb-patches
[-- Attachment #1: Type: text/plain, Size: 1018 bytes --]
On 21/10/2011 9:39 PM, Tom Tromey wrote:
>>>>>> ">" == Kwok Cheung Yeung<kcy@codesourcery.com> writes:
>
>>> + { "info-os", { "info os", 1 }, NULL },
>
> I'd prefer a new function specific to MI to do the command-line parsing.
>
> I think this approach should be deprecated and that no new instances go
> into the tree. They unnecessarily link MI to the CLI, making it harder
> to change the CLI.
>
> Tom
I've now created a new mi_cmd_info_os function to service -info-os, which
delegates to info_osdata_command in osdata.c. This is the same backend that
'info os' in the CLI uses, but at least now we don't go through the CLI code.
info_osdata_command now needs to be non-static.
Kwok
ChangeLog:
gdb/
* 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: Add declaration for info_osdata_command.
* osdata.c (info_osdata_command): Change to non-static.
* mi/mi-cmds.c (mi_cmds): Add -info-os MI command.
* mi/mi-cmd-info.c: New.
[-- Attachment #2: mi_info-os.patch --]
[-- Type: text/plain, Size: 4467 bytes --]
Index: gdb/Makefile.in
===================================================================
RCS file: /cvs/src/src/gdb/Makefile.in,v
retrieving revision 1.1178
diff -u -p -r1.1178 Makefile.in
--- gdb/Makefile.in 20 Nov 2011 08:59:56 -0000 1.1178
+++ gdb/Makefile.in 24 Nov 2011 23:12:41 -0000
@@ -207,6 +207,7 @@ 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-cmd-info.o \
mi-interp.o \
mi-main.o mi-parse.o mi-getopt.o
SUBDIR_MI_SRCS = \
@@ -214,7 +215,8 @@ SUBDIR_MI_SRCS = \
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=
@@ -1896,6 +1898,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: gdb/osdata.c
===================================================================
RCS file: /cvs/src/src/gdb/osdata.c,v
retrieving revision 1.13
diff -u -p -r1.13 osdata.c
--- gdb/osdata.c 21 Nov 2011 16:54:28 -0000 1.13
+++ gdb/osdata.c 24 Nov 2011 23:12:41 -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: gdb/osdata.h
===================================================================
RCS file: /cvs/src/src/gdb/osdata.h,v
retrieving revision 1.5
diff -u -p -r1.5 osdata.h
--- gdb/osdata.h 1 Jan 2011 15:33:12 -0000 1.5
+++ gdb/osdata.h 24 Nov 2011 23:12:41 -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: gdb/mi/mi-cmds.c
===================================================================
RCS file: /cvs/src/src/gdb/mi/mi-cmds.c,v
retrieving revision 1.57
diff -u -p -r1.57 mi-cmds.c
--- gdb/mi/mi-cmds.c 3 Oct 2011 21:38:31 -0000 1.57
+++ gdb/mi/mi-cmds.c 24 Nov 2011 23:12:41 -0000
@@ -90,6 +90,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: gdb/mi/mi-cmd-info.c
===================================================================
RCS file: gdb/mi/mi-cmd-info.c
diff -N gdb/mi/mi-cmd-info.c
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gdb/mi/mi-cmd-info.c 24 Nov 2011 23:12:41 -0000
@@ -0,0 +1,37 @@
+/* MI Command Set - information commands.
+ Copyright (C) 2011 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"
+
+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 (_("-info-os: Usage: [INFOTYPE]"));
+ break;
+ }
+}
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] Add the "-info-os" command to MI
2011-11-24 23:15 ` Kwok Cheung Yeung
@ 2011-11-25 11:56 ` Eli Zaretskii
2011-11-29 19:01 ` Tom Tromey
1 sibling, 0 replies; 12+ messages in thread
From: Eli Zaretskii @ 2011-11-25 11:56 UTC (permalink / raw)
To: Kwok Cheung Yeung; +Cc: tromey, gdb-patches
> Date: Thu, 24 Nov 2011 23:14:51 +0000
> From: Kwok Cheung Yeung <kcy@codesourcery.com>
> CC: <gdb-patches@sourceware.org>
>
> I've now created a new mi_cmd_info_os function to service -info-os, which
> delegates to info_osdata_command in osdata.c.
Thanks, I think we need a NEWS entry for this.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] Add the "-info-os" command to MI
2011-11-24 23:15 ` Kwok Cheung Yeung
2011-11-25 11:56 ` Eli Zaretskii
@ 2011-11-29 19:01 ` Tom Tromey
2011-11-29 23:18 ` Kwok Cheung Yeung
1 sibling, 1 reply; 12+ messages in thread
From: Tom Tromey @ 2011-11-29 19:01 UTC (permalink / raw)
To: Kwok Cheung Yeung; +Cc: gdb-patches
>>>>> ">" == Kwok Cheung Yeung <kcy@codesourcery.com> writes:
>> I've now created a new mi_cmd_info_os function to service -info-os,
>> which delegates to info_osdata_command in osdata.c. This is the same
>> backend that 'info os' in the CLI uses, but at least now we don't go
>> through the CLI code.
>> info_osdata_command now needs to be non-static.
Thanks for doing this.
>> gdb/
>> * 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: Add declaration for info_osdata_command.
>> * osdata.c (info_osdata_command): Change to non-static.
>> * mi/mi-cmds.c (mi_cmds): Add -info-os MI command.
>> * mi/mi-cmd-info.c: New.
Two nits...
>> + { "info-os", { NULL, 0 }, mi_cmd_info_os},
mi_cmd_info_os doesn't seem to be declared anywhere.
I think this ought to cause a compilation error.
>> + info_osdata_command (argv [0], 0);
No space before the '['.
Tom
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] Add the "-info-os" command to MI
2011-11-29 19:01 ` Tom Tromey
@ 2011-11-29 23:18 ` Kwok Cheung Yeung
2011-11-30 14:47 ` Tom Tromey
0 siblings, 1 reply; 12+ messages in thread
From: Kwok Cheung Yeung @ 2011-11-29 23:18 UTC (permalink / raw)
To: Tom Tromey; +Cc: gdb-patches
[-- Attachment #1: Type: text/plain, Size: 775 bytes --]
On 29/11/2011 7:01 PM, Tom Tromey wrote:
> Two nits...
>
>>> + { "info-os", { NULL, 0 }, mi_cmd_info_os},
>
> mi_cmd_info_os doesn't seem to be declared anywhere.
> I think this ought to cause a compilation error.
>
Oops - I did add a declaration in mi/mi-cmds.h but forgot to include it in the
patch. :-)
>>> + info_osdata_command (argv [0], 0);
>
> No space before the '['.
>
Fixed.
Kwok
ChangeLog:
gdb/
* 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.
[-- Attachment #2: mi_info-os.patch --]
[-- Type: text/plain, Size: 5078 bytes --]
Index: Makefile.in
===================================================================
RCS file: /cvs/src/src/gdb/Makefile.in,v
retrieving revision 1.1178
diff -u -p -r1.1178 Makefile.in
--- Makefile.in 20 Nov 2011 08:59:56 -0000 1.1178
+++ Makefile.in 29 Nov 2011 23:04:39 -0000
@@ -207,6 +207,7 @@ 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-cmd-info.o \
mi-interp.o \
mi-main.o mi-parse.o mi-getopt.o
SUBDIR_MI_SRCS = \
@@ -214,7 +215,8 @@ SUBDIR_MI_SRCS = \
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=
@@ -1896,6 +1898,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: osdata.c
===================================================================
RCS file: /cvs/src/src/gdb/osdata.c,v
retrieving revision 1.13
diff -u -p -r1.13 osdata.c
--- osdata.c 21 Nov 2011 16:54:28 -0000 1.13
+++ osdata.c 29 Nov 2011 23:04:39 -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.5
diff -u -p -r1.5 osdata.h
--- osdata.h 1 Jan 2011 15:33:12 -0000 1.5
+++ osdata.h 29 Nov 2011 23:04:39 -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-cmds.c
===================================================================
RCS file: /cvs/src/src/gdb/mi/mi-cmds.c,v
retrieving revision 1.57
diff -u -p -r1.57 mi-cmds.c
--- mi/mi-cmds.c 3 Oct 2011 21:38:31 -0000 1.57
+++ mi/mi-cmds.c 29 Nov 2011 23:04:39 -0000
@@ -90,6 +90,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.52
diff -u -p -r1.52 mi-cmds.h
--- mi/mi-cmds.h 3 Oct 2011 21:38:31 -0000 1.52
+++ mi/mi-cmds.h 29 Nov 2011 23:04:39 -0000
@@ -72,6 +72,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: 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 29 Nov 2011 23:04:39 -0000
@@ -0,0 +1,37 @@
+/* MI Command Set - information commands.
+ Copyright (C) 2011 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"
+
+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 (_("-info-os: Usage: [INFOTYPE]"));
+ break;
+ }
+}
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] Add the "-info-os" command to MI
2011-11-29 23:18 ` Kwok Cheung Yeung
@ 2011-11-30 14:47 ` Tom Tromey
0 siblings, 0 replies; 12+ messages in thread
From: Tom Tromey @ 2011-11-30 14:47 UTC (permalink / raw)
To: Kwok Cheung Yeung; +Cc: gdb-patches
>>>>> ">" == Kwok Cheung Yeung <kcy@codesourcery.com> writes:
>> gdb/
>> * 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.
Ok. Thanks again for doing this.
Tom
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] Add the "-info-os" command to MI
2011-11-23 23:37 ` Kwok Cheung Yeung
@ 2011-12-06 18:53 ` Pedro Alves
0 siblings, 0 replies; 12+ messages in thread
From: Pedro Alves @ 2011-12-06 18:53 UTC (permalink / raw)
To: gdb-patches; +Cc: Kwok Cheung Yeung, Eli Zaretskii
On Wednesday 23 November 2011 23:37:22, Kwok Cheung Yeung wrote:
> >> +@smallexample
> >> +(gdb)
> >> +-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_nam
> >> +e="col1",colhdr="Description"@}],body=[item=@{col0="processes",col1="Lis
> >> +ting of all processes"@},item=@{col0="procgroups",col1="Listing of all p
> >> +rocess groups"@},item=@{col0="threads",col1="Listing of all threads"@},i
> >> +tem=@{col0="files",col1="Listing of all file descriptors"@},item=@{col0=
> >> +"sockets",col1="Listing of all internet-domain sockets"@},item=@{col0="s
> >> +hm",col1="Listing of all shared-memory regions"@},item=@{col0="semaphore
> >> +s",col1="Listing of all semaphores"@},item=@{col0="msg",col1="Listing of
> >> + all message queues"@},item=@{col0="modules",col1="Listing of all loaded
> >> + kernel modules"@}]@}
> >
> > The lines here are broken in arbitrary places, which will look
> > illegible in the manual. Please reformat the example so that the
> > output could be readable by humans.
> >
>
> Well, one could argue that MI wasn't meant to be easily human-readable :-) That
> output is exactly how it would look if the command were issued by a human, and
> it might be confusing if a user issues the command and doesn't get the nicely
> formatted output shown in the manual. I'm happy to make the changes if you think
> that is not an issue though.
Yes, that is not an issue. We have other examples of a putting breaks in place
to make it more readable. See e.g., the example of "-list-thread-groups".
--
Pedro Alves
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2011-12-06 18:45 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-10-13 15:52 [PATCH] Add the "-info-os" command to MI Kwok Cheung Yeung
2011-10-13 16:13 ` Eli Zaretskii
2011-11-23 23:37 ` Kwok Cheung Yeung
2011-12-06 18:53 ` Pedro Alves
2011-10-21 20:53 ` Tom Tromey
2011-10-27 0:24 ` Stan Shebs
2011-10-27 16:45 ` Tom Tromey
2011-11-24 23:15 ` Kwok Cheung Yeung
2011-11-25 11:56 ` Eli Zaretskii
2011-11-29 19:01 ` Tom Tromey
2011-11-29 23:18 ` Kwok Cheung Yeung
2011-11-30 14:47 ` Tom Tromey
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).