* osdata.c (info_osdata_command): Filter out "Title" columns
from non-MI uses. * common/linux-osdata.c (struct osdata_type): Add title field. (osdata_table): Add titles to each entry. (linux_command_xfer_osdata): Add a column for title data. * gdb.texinfo (Miscellaneous GDB/MI Commands): Update -info-os example, add note about title column.
This commit is contained in:
parent
37ce89ebb2
commit
71caed8383
@ -1,3 +1,11 @@
|
||||
2012-06-28 Stan Shebs <stan@codesourcery.com>
|
||||
|
||||
* osdata.c (info_osdata_command): Filter out "Title" columns
|
||||
from non-MI uses.
|
||||
* common/linux-osdata.c (struct osdata_type): Add title field.
|
||||
(osdata_table): Add titles to each entry.
|
||||
(linux_command_xfer_osdata): Add a column for title data.
|
||||
|
||||
2012-06-28 Stan Shebs <stan@codesourcery.com>
|
||||
|
||||
Make logging work for MI.
|
||||
|
@ -1543,26 +1543,27 @@ linux_xfer_osdata_modules (gdb_byte *readbuf,
|
||||
|
||||
struct osdata_type {
|
||||
char *type;
|
||||
char *title;
|
||||
char *description;
|
||||
LONGEST (*getter) (gdb_byte *readbuf, ULONGEST offset, LONGEST len);
|
||||
} osdata_table[] = {
|
||||
{ "processes", "Listing of all processes",
|
||||
{ "processes", "Processes", "Listing of all processes",
|
||||
linux_xfer_osdata_processes },
|
||||
{ "procgroups", "Listing of all process groups",
|
||||
{ "procgroups", "Process groups", "Listing of all process groups",
|
||||
linux_xfer_osdata_processgroups },
|
||||
{ "threads", "Listing of all threads",
|
||||
{ "threads", "Threads", "Listing of all threads",
|
||||
linux_xfer_osdata_threads },
|
||||
{ "files", "Listing of all file descriptors",
|
||||
{ "files", "File descriptors", "Listing of all file descriptors",
|
||||
linux_xfer_osdata_fds },
|
||||
{ "sockets", "Listing of all internet-domain sockets",
|
||||
{ "sockets", "Sockets", "Listing of all internet-domain sockets",
|
||||
linux_xfer_osdata_isockets },
|
||||
{ "shm", "Listing of all shared-memory regions",
|
||||
{ "shm", "Shared-memory regions", "Listing of all shared-memory regions",
|
||||
linux_xfer_osdata_shm },
|
||||
{ "semaphores", "Listing of all semaphores",
|
||||
{ "semaphores", "Semaphores", "Listing of all semaphores",
|
||||
linux_xfer_osdata_sem },
|
||||
{ "msg", "Listing of all message queues",
|
||||
{ "msg", "Message queues", "Listing of all message queues",
|
||||
linux_xfer_osdata_msg },
|
||||
{ "modules", "Listing of all loaded kernel modules",
|
||||
{ "modules", "Kernel modules", "Listing of all loaded kernel modules",
|
||||
linux_xfer_osdata_modules },
|
||||
{ NULL, NULL, NULL }
|
||||
};
|
||||
@ -1594,9 +1595,11 @@ linux_common_xfer_osdata (const char *annex, gdb_byte *readbuf,
|
||||
"<item>"
|
||||
"<column name=\"Type\">%s</column>"
|
||||
"<column name=\"Description\">%s</column>"
|
||||
"<column name=\"Title\">%s</column>"
|
||||
"</item>",
|
||||
osdata_table[i].type,
|
||||
osdata_table[i].description);
|
||||
osdata_table[i].description,
|
||||
osdata_table[i].title);
|
||||
|
||||
buffer_grow_str0 (&buffer, "</osdata>\n");
|
||||
buf = buffer_finish (&buffer);
|
||||
|
@ -1,3 +1,8 @@
|
||||
2012-06-28 Stan Shebs <stan@codesourcery.com>
|
||||
|
||||
* gdb.texinfo (Miscellaneous GDB/MI Commands): Update -info-os
|
||||
example, add note about title column.
|
||||
|
||||
2012-06-26 Siva Chandra Reddy <sivachandra@google.com>
|
||||
|
||||
* gdb.texinfo (Symbol Tables In Python): Add description about
|
||||
|
@ -32665,18 +32665,28 @@ like this:
|
||||
@smallexample
|
||||
@value{GDBP}
|
||||
-info-os
|
||||
^done,OSDataTable=@{nr_rows="9",nr_cols="2",
|
||||
^done,OSDataTable=@{nr_rows="9",nr_cols="3",
|
||||
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"@}]@}
|
||||
@{width="10",alignment="-1",col_name="col1",colhdr="Description"@},
|
||||
@{width="10",alignment="-1",col_name="col2",colhdr="Title"@}],
|
||||
body=[item=@{col0="processes",col1="Listing of all processes",
|
||||
col2="Processes"@},
|
||||
item=@{col0="procgroups",col1="Listing of all process groups",
|
||||
col2="Process groups"@},
|
||||
item=@{col0="threads",col1="Listing of all threads",
|
||||
col2="Threads"@},
|
||||
item=@{col0="files",col1="Listing of all file descriptors",
|
||||
col2="File descriptors"@},
|
||||
item=@{col0="sockets",col1="Listing of all internet-domain sockets",
|
||||
col2="Sockets"@},
|
||||
item=@{col0="shm",col1="Listing of all shared-memory regions",
|
||||
col2="Shared-memory regions"@},
|
||||
item=@{col0="semaphores",col1="Listing of all semaphores",
|
||||
col2="Semaphores"@},
|
||||
item=@{col0="msg",col1="Listing of all message queues",
|
||||
col2="Message queues"@},
|
||||
item=@{col0="modules",col1="Listing of all loaded kernel modules",
|
||||
col2="Kernel modules"@}]@}
|
||||
@value{GDBP}
|
||||
-info-os processes
|
||||
^done,OSDataTable=@{nr_rows="190",nr_cols="4",
|
||||
@ -32693,6 +32703,12 @@ body=[item=@{col0="1",col1="root",col2="/sbin/init",col3="0"@},
|
||||
(gdb)
|
||||
@end smallexample
|
||||
|
||||
(Note that the MI output here includes a @code{"Title"} column that
|
||||
does not appear in command-line @code{info os}; this column is useful
|
||||
for MI clients that want to enumerate the types of data, such as in a
|
||||
popup menu, but is needless clutter on the command line, and
|
||||
@code{info os} omits it.)
|
||||
|
||||
@subheading The @code{-add-inferior} Command
|
||||
@findex -add-inferior
|
||||
|
||||
|
33
gdb/osdata.c
33
gdb/osdata.c
@ -297,6 +297,7 @@ info_osdata_command (char *type, int from_tty)
|
||||
struct cleanup *old_chain;
|
||||
int ncols = 0;
|
||||
int nrows;
|
||||
int col_to_skip = -1;
|
||||
|
||||
osdata = get_osdata (type);
|
||||
old_chain = make_cleanup_osdata_free (osdata);
|
||||
@ -311,6 +312,28 @@ info_osdata_command (char *type, int from_tty)
|
||||
last = VEC_last (osdata_item_s, osdata->items);
|
||||
if (last->columns)
|
||||
ncols = VEC_length (osdata_column_s, last->columns);
|
||||
|
||||
/* As a special case, scan the listing of available data types
|
||||
for a column named "Title", and only include it with MI
|
||||
output; this column's normal use is for titles for interface
|
||||
elements like menus, and it clutters up CLI output. */
|
||||
if (!type && !ui_out_is_mi_like_p (uiout))
|
||||
{
|
||||
struct osdata_column *col;
|
||||
int ix;
|
||||
|
||||
for (ix = 0;
|
||||
VEC_iterate (osdata_column_s, last->columns, ix, col);
|
||||
ix++)
|
||||
{
|
||||
if (strcmp (col->name, "Title") == 0)
|
||||
col_to_skip = ix;
|
||||
}
|
||||
/* Be sure to reduce the total column count, otherwise
|
||||
internal errors ensue. */
|
||||
if (col_to_skip >= 0)
|
||||
--ncols;
|
||||
}
|
||||
}
|
||||
|
||||
make_cleanup_ui_out_table_begin_end (uiout, ncols, nrows,
|
||||
@ -335,7 +358,10 @@ info_osdata_command (char *type, int from_tty)
|
||||
ix++)
|
||||
{
|
||||
char col_name[32];
|
||||
|
||||
|
||||
if (ix == col_to_skip)
|
||||
continue;
|
||||
|
||||
snprintf (col_name, 32, "col%d", ix);
|
||||
ui_out_table_header (uiout, 10, ui_left,
|
||||
col_name, col->name);
|
||||
@ -366,7 +392,10 @@ info_osdata_command (char *type, int from_tty)
|
||||
ix_cols++)
|
||||
{
|
||||
char col_name[32];
|
||||
|
||||
|
||||
if (ix_cols == col_to_skip)
|
||||
continue;
|
||||
|
||||
snprintf (col_name, 32, "col%d", ix_cols);
|
||||
ui_out_field_string (uiout, col_name, col->value);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user