/* Routines for handling XML generic OS data provided by target.
- Copyright (C) 2008-2016 Free Software Foundation, Inc.
+ Copyright (C) 2008-2017 Free Software Foundation, Inc.
This file is part of GDB.
}
void
-info_osdata_command (char *type, int from_tty)
+info_osdata (const char *type)
{
struct ui_out *uiout = current_uiout;
struct osdata *osdata = NULL;
int nrows;
int col_to_skip = -1;
+ if (type == NULL)
+ type = "";
+
osdata = get_osdata (type);
old_chain = make_cleanup_osdata_free (osdata);
nrows = VEC_length (osdata_item_s, osdata->items);
- if (!type && nrows == 0)
+ if (*type == '\0' && nrows == 0)
error (_("Available types of OS data not reported."));
if (!VEC_empty (osdata_item_s, osdata->items))
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 && !uiout->is_mi_like_p ())
+ if (*type == '\0' && !uiout->is_mi_like_p ())
{
struct osdata_column *col;
int ix;
ix_items, item);
ix_items++)
{
- struct cleanup *old_chain;
int ix_cols;
struct osdata_column *col;
- old_chain = make_cleanup_ui_out_tuple_begin_end (uiout, "item");
+ {
+ ui_out_emit_tuple tuple_emitter (uiout, "item");
- for (ix_cols = 0;
- VEC_iterate (osdata_column_s, item->columns,
- ix_cols, col);
- ix_cols++)
- {
- char col_name[32];
+ for (ix_cols = 0;
+ VEC_iterate (osdata_column_s, item->columns,
+ ix_cols, col);
+ ix_cols++)
+ {
+ char col_name[32];
- if (ix_cols == col_to_skip)
- continue;
+ if (ix_cols == col_to_skip)
+ continue;
- snprintf (col_name, 32, "col%d", ix_cols);
- uiout->field_string (col_name, col->value);
- }
-
- do_cleanups (old_chain);
+ snprintf (col_name, 32, "col%d", ix_cols);
+ uiout->field_string (col_name, col->value);
+ }
+ }
uiout->text ("\n");
}
do_cleanups (old_chain);
}
+static void
+info_osdata_command (char *arg, int from_tty)
+{
+ info_osdata (arg);
+}
+
extern initialize_file_ftype _initialize_osdata; /* -Wmissing-prototypes */
void