15796c8dcSSimon Schubert /* Routines for handling XML generic OS data provided by target.
25796c8dcSSimon Schubert
3*ef5ccd6cSJohn Marino Copyright (C) 2008-2013 Free Software Foundation, Inc.
45796c8dcSSimon Schubert
55796c8dcSSimon Schubert This file is part of GDB.
65796c8dcSSimon Schubert
75796c8dcSSimon Schubert This program is free software; you can redistribute it and/or modify
85796c8dcSSimon Schubert it under the terms of the GNU General Public License as published by
95796c8dcSSimon Schubert the Free Software Foundation; either version 3 of the License, or
105796c8dcSSimon Schubert (at your option) any later version.
115796c8dcSSimon Schubert
125796c8dcSSimon Schubert This program is distributed in the hope that it will be useful,
135796c8dcSSimon Schubert but WITHOUT ANY WARRANTY; without even the implied warranty of
145796c8dcSSimon Schubert MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
155796c8dcSSimon Schubert GNU General Public License for more details.
165796c8dcSSimon Schubert
175796c8dcSSimon Schubert You should have received a copy of the GNU General Public License
185796c8dcSSimon Schubert along with this program. If not, see <http://www.gnu.org/licenses/>. */
195796c8dcSSimon Schubert
205796c8dcSSimon Schubert #include "defs.h"
215796c8dcSSimon Schubert #include "target.h"
225796c8dcSSimon Schubert #include "vec.h"
235796c8dcSSimon Schubert #include "xml-support.h"
245796c8dcSSimon Schubert #include "osdata.h"
255796c8dcSSimon Schubert #include "gdb_string.h"
265796c8dcSSimon Schubert #include "ui-out.h"
275796c8dcSSimon Schubert #include "gdbcmd.h"
285796c8dcSSimon Schubert
295796c8dcSSimon Schubert #if !defined(HAVE_LIBEXPAT)
305796c8dcSSimon Schubert
315796c8dcSSimon Schubert struct osdata *
osdata_parse(const char * xml)325796c8dcSSimon Schubert osdata_parse (const char *xml)
335796c8dcSSimon Schubert {
345796c8dcSSimon Schubert static int have_warned;
355796c8dcSSimon Schubert
365796c8dcSSimon Schubert if (!have_warned)
375796c8dcSSimon Schubert {
385796c8dcSSimon Schubert have_warned = 1;
395796c8dcSSimon Schubert warning (_("Can not parse XML OS data; XML support was disabled "
405796c8dcSSimon Schubert "at compile time"));
415796c8dcSSimon Schubert }
425796c8dcSSimon Schubert
435796c8dcSSimon Schubert return NULL;
445796c8dcSSimon Schubert }
455796c8dcSSimon Schubert
465796c8dcSSimon Schubert #else /* HAVE_LIBEXPAT */
475796c8dcSSimon Schubert
485796c8dcSSimon Schubert #include "xml-support.h"
495796c8dcSSimon Schubert
505796c8dcSSimon Schubert /* Internal parsing data passed to all XML callbacks. */
515796c8dcSSimon Schubert struct osdata_parsing_data
525796c8dcSSimon Schubert {
535796c8dcSSimon Schubert struct osdata *osdata;
545796c8dcSSimon Schubert char *property_name;
555796c8dcSSimon Schubert };
565796c8dcSSimon Schubert
575796c8dcSSimon Schubert /* Handle the start of a <osdata> element. */
585796c8dcSSimon Schubert
595796c8dcSSimon Schubert static void
osdata_start_osdata(struct gdb_xml_parser * parser,const struct gdb_xml_element * element,void * user_data,VEC (gdb_xml_value_s)* attributes)605796c8dcSSimon Schubert osdata_start_osdata (struct gdb_xml_parser *parser,
615796c8dcSSimon Schubert const struct gdb_xml_element *element,
625796c8dcSSimon Schubert void *user_data, VEC(gdb_xml_value_s) *attributes)
635796c8dcSSimon Schubert {
645796c8dcSSimon Schubert struct osdata_parsing_data *data = user_data;
655796c8dcSSimon Schubert char *type;
665796c8dcSSimon Schubert struct osdata *osdata;
675796c8dcSSimon Schubert
685796c8dcSSimon Schubert if (data->osdata)
695796c8dcSSimon Schubert gdb_xml_error (parser, _("Seen more than on osdata element"));
705796c8dcSSimon Schubert
71c50c785cSJohn Marino type = xml_find_attribute (attributes, "type")->value;
725796c8dcSSimon Schubert osdata = XZALLOC (struct osdata);
735796c8dcSSimon Schubert osdata->type = xstrdup (type);
745796c8dcSSimon Schubert data->osdata = osdata;
755796c8dcSSimon Schubert }
765796c8dcSSimon Schubert
775796c8dcSSimon Schubert /* Handle the start of a <item> element. */
785796c8dcSSimon Schubert
795796c8dcSSimon Schubert static void
osdata_start_item(struct gdb_xml_parser * parser,const struct gdb_xml_element * element,void * user_data,VEC (gdb_xml_value_s)* attributes)805796c8dcSSimon Schubert osdata_start_item (struct gdb_xml_parser *parser,
815796c8dcSSimon Schubert const struct gdb_xml_element *element,
825796c8dcSSimon Schubert void *user_data, VEC(gdb_xml_value_s) *attributes)
835796c8dcSSimon Schubert {
845796c8dcSSimon Schubert struct osdata_parsing_data *data = user_data;
855796c8dcSSimon Schubert struct osdata_item item = { NULL };
86cf7f2e2dSJohn Marino
875796c8dcSSimon Schubert VEC_safe_push (osdata_item_s, data->osdata->items, &item);
885796c8dcSSimon Schubert }
895796c8dcSSimon Schubert
905796c8dcSSimon Schubert /* Handle the start of a <column> element. */
915796c8dcSSimon Schubert
925796c8dcSSimon Schubert static void
osdata_start_column(struct gdb_xml_parser * parser,const struct gdb_xml_element * element,void * user_data,VEC (gdb_xml_value_s)* attributes)935796c8dcSSimon Schubert osdata_start_column (struct gdb_xml_parser *parser,
945796c8dcSSimon Schubert const struct gdb_xml_element *element,
955796c8dcSSimon Schubert void *user_data, VEC(gdb_xml_value_s) *attributes)
965796c8dcSSimon Schubert {
975796c8dcSSimon Schubert struct osdata_parsing_data *data = user_data;
98c50c785cSJohn Marino const char *name = xml_find_attribute (attributes, "name")->value;
99cf7f2e2dSJohn Marino
1005796c8dcSSimon Schubert data->property_name = xstrdup (name);
1015796c8dcSSimon Schubert }
1025796c8dcSSimon Schubert
1035796c8dcSSimon Schubert /* Handle the end of a <column> element. */
1045796c8dcSSimon Schubert
1055796c8dcSSimon Schubert static void
osdata_end_column(struct gdb_xml_parser * parser,const struct gdb_xml_element * element,void * user_data,const char * body_text)1065796c8dcSSimon Schubert osdata_end_column (struct gdb_xml_parser *parser,
1075796c8dcSSimon Schubert const struct gdb_xml_element *element,
1085796c8dcSSimon Schubert void *user_data, const char *body_text)
1095796c8dcSSimon Schubert {
1105796c8dcSSimon Schubert struct osdata_parsing_data *data = user_data;
1115796c8dcSSimon Schubert struct osdata *osdata = data->osdata;
1125796c8dcSSimon Schubert struct osdata_item *item = VEC_last (osdata_item_s, osdata->items);
1135796c8dcSSimon Schubert struct osdata_column *col = VEC_safe_push (osdata_column_s,
1145796c8dcSSimon Schubert item->columns, NULL);
1155796c8dcSSimon Schubert
1165796c8dcSSimon Schubert /* Transfer memory ownership. NAME was already strdup'ed. */
1175796c8dcSSimon Schubert col->name = data->property_name;
1185796c8dcSSimon Schubert col->value = xstrdup (body_text);
1195796c8dcSSimon Schubert data->property_name = NULL;
1205796c8dcSSimon Schubert }
1215796c8dcSSimon Schubert
1225796c8dcSSimon Schubert /* Discard the constructed osdata (if an error occurs). */
1235796c8dcSSimon Schubert
1245796c8dcSSimon Schubert static void
clear_parsing_data(void * p)1255796c8dcSSimon Schubert clear_parsing_data (void *p)
1265796c8dcSSimon Schubert {
1275796c8dcSSimon Schubert struct osdata_parsing_data *data = p;
128cf7f2e2dSJohn Marino
1295796c8dcSSimon Schubert osdata_free (data->osdata);
1305796c8dcSSimon Schubert data->osdata = NULL;
1315796c8dcSSimon Schubert xfree (data->property_name);
1325796c8dcSSimon Schubert data->property_name = NULL;
1335796c8dcSSimon Schubert }
1345796c8dcSSimon Schubert
1355796c8dcSSimon Schubert /* The allowed elements and attributes for OS data object.
1365796c8dcSSimon Schubert The root element is a <osdata>. */
1375796c8dcSSimon Schubert
1385796c8dcSSimon Schubert const struct gdb_xml_attribute column_attributes[] = {
1395796c8dcSSimon Schubert { "name", GDB_XML_AF_NONE, NULL, NULL },
1405796c8dcSSimon Schubert { NULL, GDB_XML_AF_NONE, NULL, NULL }
1415796c8dcSSimon Schubert };
1425796c8dcSSimon Schubert
1435796c8dcSSimon Schubert const struct gdb_xml_element item_children[] = {
1445796c8dcSSimon Schubert { "column", column_attributes, NULL,
1455796c8dcSSimon Schubert GDB_XML_EF_REPEATABLE | GDB_XML_EF_OPTIONAL,
1465796c8dcSSimon Schubert osdata_start_column, osdata_end_column },
1475796c8dcSSimon Schubert { NULL, NULL, NULL, GDB_XML_EF_NONE, NULL, NULL }
1485796c8dcSSimon Schubert };
1495796c8dcSSimon Schubert
1505796c8dcSSimon Schubert const struct gdb_xml_attribute osdata_attributes[] = {
1515796c8dcSSimon Schubert { "type", GDB_XML_AF_NONE, NULL, NULL },
1525796c8dcSSimon Schubert { NULL, GDB_XML_AF_NONE, NULL, NULL }
1535796c8dcSSimon Schubert };
1545796c8dcSSimon Schubert
1555796c8dcSSimon Schubert const struct gdb_xml_element osdata_children[] = {
1565796c8dcSSimon Schubert { "item", NULL, item_children,
1575796c8dcSSimon Schubert GDB_XML_EF_REPEATABLE | GDB_XML_EF_OPTIONAL,
1585796c8dcSSimon Schubert osdata_start_item, NULL },
1595796c8dcSSimon Schubert { NULL, NULL, NULL, GDB_XML_EF_NONE, NULL, NULL }
1605796c8dcSSimon Schubert };
1615796c8dcSSimon Schubert
1625796c8dcSSimon Schubert const struct gdb_xml_element osdata_elements[] = {
1635796c8dcSSimon Schubert { "osdata", osdata_attributes, osdata_children,
1645796c8dcSSimon Schubert GDB_XML_EF_NONE, osdata_start_osdata, NULL },
1655796c8dcSSimon Schubert { NULL, NULL, NULL, GDB_XML_EF_NONE, NULL, NULL }
1665796c8dcSSimon Schubert };
1675796c8dcSSimon Schubert
1685796c8dcSSimon Schubert struct osdata *
osdata_parse(const char * xml)1695796c8dcSSimon Schubert osdata_parse (const char *xml)
1705796c8dcSSimon Schubert {
171c50c785cSJohn Marino struct cleanup *back_to;
1725796c8dcSSimon Schubert struct osdata_parsing_data data = { NULL };
1735796c8dcSSimon Schubert
174c50c785cSJohn Marino back_to = make_cleanup (clear_parsing_data, &data);
1755796c8dcSSimon Schubert
176c50c785cSJohn Marino if (gdb_xml_parse_quick (_("osdata"), "osdata.dtd",
177c50c785cSJohn Marino osdata_elements, xml, &data) == 0)
178c50c785cSJohn Marino {
1795796c8dcSSimon Schubert /* Parsed successfully, don't need to delete the result. */
180c50c785cSJohn Marino discard_cleanups (back_to);
181c50c785cSJohn Marino return data.osdata;
182c50c785cSJohn Marino }
1835796c8dcSSimon Schubert
1845796c8dcSSimon Schubert do_cleanups (back_to);
185c50c785cSJohn Marino return NULL;
1865796c8dcSSimon Schubert }
1875796c8dcSSimon Schubert #endif
1885796c8dcSSimon Schubert
1895796c8dcSSimon Schubert static void
osdata_item_clear(struct osdata_item * item)1905796c8dcSSimon Schubert osdata_item_clear (struct osdata_item *item)
1915796c8dcSSimon Schubert {
1925796c8dcSSimon Schubert if (item->columns != NULL)
1935796c8dcSSimon Schubert {
1945796c8dcSSimon Schubert struct osdata_column *col;
1955796c8dcSSimon Schubert int ix;
196cf7f2e2dSJohn Marino
1975796c8dcSSimon Schubert for (ix = 0;
1985796c8dcSSimon Schubert VEC_iterate (osdata_column_s, item->columns,
1995796c8dcSSimon Schubert ix, col);
2005796c8dcSSimon Schubert ix++)
2015796c8dcSSimon Schubert {
2025796c8dcSSimon Schubert xfree (col->name);
2035796c8dcSSimon Schubert xfree (col->value);
2045796c8dcSSimon Schubert }
2055796c8dcSSimon Schubert VEC_free (osdata_column_s, item->columns);
2065796c8dcSSimon Schubert item->columns = NULL;
2075796c8dcSSimon Schubert }
2085796c8dcSSimon Schubert }
2095796c8dcSSimon Schubert
2105796c8dcSSimon Schubert void
osdata_free(struct osdata * osdata)2115796c8dcSSimon Schubert osdata_free (struct osdata *osdata)
2125796c8dcSSimon Schubert {
2135796c8dcSSimon Schubert if (osdata == NULL)
2145796c8dcSSimon Schubert return;
2155796c8dcSSimon Schubert
2165796c8dcSSimon Schubert if (osdata->items != NULL)
2175796c8dcSSimon Schubert {
2185796c8dcSSimon Schubert struct osdata_item *item;
2195796c8dcSSimon Schubert int ix;
220cf7f2e2dSJohn Marino
2215796c8dcSSimon Schubert for (ix = 0;
2225796c8dcSSimon Schubert VEC_iterate (osdata_item_s, osdata->items,
2235796c8dcSSimon Schubert ix, item);
2245796c8dcSSimon Schubert ix++)
2255796c8dcSSimon Schubert osdata_item_clear (item);
2265796c8dcSSimon Schubert VEC_free (osdata_item_s, osdata->items);
2275796c8dcSSimon Schubert }
2285796c8dcSSimon Schubert
2295796c8dcSSimon Schubert xfree (osdata);
2305796c8dcSSimon Schubert }
2315796c8dcSSimon Schubert
2325796c8dcSSimon Schubert static void
osdata_free_cleanup(void * arg)2335796c8dcSSimon Schubert osdata_free_cleanup (void *arg)
2345796c8dcSSimon Schubert {
2355796c8dcSSimon Schubert struct osdata *osdata = arg;
236cf7f2e2dSJohn Marino
2375796c8dcSSimon Schubert osdata_free (osdata);
2385796c8dcSSimon Schubert }
2395796c8dcSSimon Schubert
2405796c8dcSSimon Schubert struct cleanup *
make_cleanup_osdata_free(struct osdata * data)2415796c8dcSSimon Schubert make_cleanup_osdata_free (struct osdata *data)
2425796c8dcSSimon Schubert {
2435796c8dcSSimon Schubert return make_cleanup (osdata_free_cleanup, data);
2445796c8dcSSimon Schubert }
2455796c8dcSSimon Schubert
2465796c8dcSSimon Schubert struct osdata *
get_osdata(const char * type)2475796c8dcSSimon Schubert get_osdata (const char *type)
2485796c8dcSSimon Schubert {
2495796c8dcSSimon Schubert struct osdata *osdata = NULL;
2505796c8dcSSimon Schubert char *xml = target_get_osdata (type);
251cf7f2e2dSJohn Marino
2525796c8dcSSimon Schubert if (xml)
2535796c8dcSSimon Schubert {
2545796c8dcSSimon Schubert struct cleanup *old_chain = make_cleanup (xfree, xml);
2555796c8dcSSimon Schubert
2565796c8dcSSimon Schubert if (xml[0] == '\0')
257cf7f2e2dSJohn Marino {
258cf7f2e2dSJohn Marino if (type)
2595796c8dcSSimon Schubert warning (_("Empty data returned by target. Wrong osdata type?"));
2605796c8dcSSimon Schubert else
261cf7f2e2dSJohn Marino warning (_("Empty type list returned by target. No type data?"));
262cf7f2e2dSJohn Marino }
263cf7f2e2dSJohn Marino else
2645796c8dcSSimon Schubert osdata = osdata_parse (xml);
2655796c8dcSSimon Schubert
2665796c8dcSSimon Schubert do_cleanups (old_chain);
2675796c8dcSSimon Schubert }
2685796c8dcSSimon Schubert
2695796c8dcSSimon Schubert if (!osdata)
270c50c785cSJohn Marino error (_("Can not fetch data now."));
2715796c8dcSSimon Schubert
2725796c8dcSSimon Schubert return osdata;
2735796c8dcSSimon Schubert }
2745796c8dcSSimon Schubert
2755796c8dcSSimon Schubert const char *
get_osdata_column(struct osdata_item * item,const char * name)2765796c8dcSSimon Schubert get_osdata_column (struct osdata_item *item, const char *name)
2775796c8dcSSimon Schubert {
2785796c8dcSSimon Schubert struct osdata_column *col;
2795796c8dcSSimon Schubert int ix_cols;
2805796c8dcSSimon Schubert
2815796c8dcSSimon Schubert for (ix_cols = 0;
2825796c8dcSSimon Schubert VEC_iterate (osdata_column_s, item->columns,
2835796c8dcSSimon Schubert ix_cols, col);
2845796c8dcSSimon Schubert ix_cols++)
2855796c8dcSSimon Schubert if (strcmp (col->name, name) == 0)
2865796c8dcSSimon Schubert return col->value;
2875796c8dcSSimon Schubert
2885796c8dcSSimon Schubert return NULL;
2895796c8dcSSimon Schubert }
2905796c8dcSSimon Schubert
291*ef5ccd6cSJohn Marino void
info_osdata_command(char * type,int from_tty)2925796c8dcSSimon Schubert info_osdata_command (char *type, int from_tty)
2935796c8dcSSimon Schubert {
294a45ae5f8SJohn Marino struct ui_out *uiout = current_uiout;
2955796c8dcSSimon Schubert struct osdata *osdata = NULL;
296a45ae5f8SJohn Marino struct osdata_item *last = NULL;
2975796c8dcSSimon Schubert struct cleanup *old_chain;
298a45ae5f8SJohn Marino int ncols = 0;
299a45ae5f8SJohn Marino int nrows;
300*ef5ccd6cSJohn Marino int col_to_skip = -1;
3015796c8dcSSimon Schubert
3025796c8dcSSimon Schubert osdata = get_osdata (type);
3035796c8dcSSimon Schubert old_chain = make_cleanup_osdata_free (osdata);
3045796c8dcSSimon Schubert
305a45ae5f8SJohn Marino nrows = VEC_length (osdata_item_s, osdata->items);
3065796c8dcSSimon Schubert
307a45ae5f8SJohn Marino if (!type && nrows == 0)
308cf7f2e2dSJohn Marino error (_("Available types of OS data not reported."));
309cf7f2e2dSJohn Marino
310a45ae5f8SJohn Marino if (!VEC_empty (osdata_item_s, osdata->items))
311a45ae5f8SJohn Marino {
3125796c8dcSSimon Schubert last = VEC_last (osdata_item_s, osdata->items);
313a45ae5f8SJohn Marino if (last->columns)
3145796c8dcSSimon Schubert ncols = VEC_length (osdata_column_s, last->columns);
315*ef5ccd6cSJohn Marino
316*ef5ccd6cSJohn Marino /* As a special case, scan the listing of available data types
317*ef5ccd6cSJohn Marino for a column named "Title", and only include it with MI
318*ef5ccd6cSJohn Marino output; this column's normal use is for titles for interface
319*ef5ccd6cSJohn Marino elements like menus, and it clutters up CLI output. */
320*ef5ccd6cSJohn Marino if (!type && !ui_out_is_mi_like_p (uiout))
321*ef5ccd6cSJohn Marino {
322*ef5ccd6cSJohn Marino struct osdata_column *col;
323*ef5ccd6cSJohn Marino int ix;
324*ef5ccd6cSJohn Marino
325*ef5ccd6cSJohn Marino for (ix = 0;
326*ef5ccd6cSJohn Marino VEC_iterate (osdata_column_s, last->columns, ix, col);
327*ef5ccd6cSJohn Marino ix++)
328*ef5ccd6cSJohn Marino {
329*ef5ccd6cSJohn Marino if (strcmp (col->name, "Title") == 0)
330*ef5ccd6cSJohn Marino col_to_skip = ix;
331*ef5ccd6cSJohn Marino }
332*ef5ccd6cSJohn Marino /* Be sure to reduce the total column count, otherwise
333*ef5ccd6cSJohn Marino internal errors ensue. */
334*ef5ccd6cSJohn Marino if (col_to_skip >= 0)
335*ef5ccd6cSJohn Marino --ncols;
336*ef5ccd6cSJohn Marino }
337a45ae5f8SJohn Marino }
3385796c8dcSSimon Schubert
339a45ae5f8SJohn Marino make_cleanup_ui_out_table_begin_end (uiout, ncols, nrows,
3405796c8dcSSimon Schubert "OSDataTable");
3415796c8dcSSimon Schubert
342a45ae5f8SJohn Marino /* With no columns/items, we just output an empty table, but we
343a45ae5f8SJohn Marino still output the table. This matters for MI. */
344a45ae5f8SJohn Marino if (ncols == 0)
345a45ae5f8SJohn Marino {
346a45ae5f8SJohn Marino do_cleanups (old_chain);
347a45ae5f8SJohn Marino return;
348a45ae5f8SJohn Marino }
349a45ae5f8SJohn Marino
3505796c8dcSSimon Schubert if (last && last->columns)
3515796c8dcSSimon Schubert {
3525796c8dcSSimon Schubert struct osdata_column *col;
3535796c8dcSSimon Schubert int ix;
354cf7f2e2dSJohn Marino
3555796c8dcSSimon Schubert for (ix = 0;
3565796c8dcSSimon Schubert VEC_iterate (osdata_column_s, last->columns,
3575796c8dcSSimon Schubert ix, col);
3585796c8dcSSimon Schubert ix++)
359a45ae5f8SJohn Marino {
360a45ae5f8SJohn Marino char col_name[32];
361a45ae5f8SJohn Marino
362*ef5ccd6cSJohn Marino if (ix == col_to_skip)
363*ef5ccd6cSJohn Marino continue;
364*ef5ccd6cSJohn Marino
365a45ae5f8SJohn Marino snprintf (col_name, 32, "col%d", ix);
3665796c8dcSSimon Schubert ui_out_table_header (uiout, 10, ui_left,
367a45ae5f8SJohn Marino col_name, col->name);
368a45ae5f8SJohn Marino }
3695796c8dcSSimon Schubert }
3705796c8dcSSimon Schubert
3715796c8dcSSimon Schubert ui_out_table_body (uiout);
3725796c8dcSSimon Schubert
373a45ae5f8SJohn Marino if (nrows != 0)
3745796c8dcSSimon Schubert {
3755796c8dcSSimon Schubert struct osdata_item *item;
3765796c8dcSSimon Schubert int ix_items;
377cf7f2e2dSJohn Marino
3785796c8dcSSimon Schubert for (ix_items = 0;
3795796c8dcSSimon Schubert VEC_iterate (osdata_item_s, osdata->items,
3805796c8dcSSimon Schubert ix_items, item);
3815796c8dcSSimon Schubert ix_items++)
3825796c8dcSSimon Schubert {
3835796c8dcSSimon Schubert struct cleanup *old_chain;
3845796c8dcSSimon Schubert int ix_cols;
3855796c8dcSSimon Schubert struct osdata_column *col;
3865796c8dcSSimon Schubert
387*ef5ccd6cSJohn Marino old_chain = make_cleanup_ui_out_tuple_begin_end (uiout, "item");
3885796c8dcSSimon Schubert
3895796c8dcSSimon Schubert for (ix_cols = 0;
3905796c8dcSSimon Schubert VEC_iterate (osdata_column_s, item->columns,
3915796c8dcSSimon Schubert ix_cols, col);
3925796c8dcSSimon Schubert ix_cols++)
393a45ae5f8SJohn Marino {
394a45ae5f8SJohn Marino char col_name[32];
395a45ae5f8SJohn Marino
396*ef5ccd6cSJohn Marino if (ix_cols == col_to_skip)
397*ef5ccd6cSJohn Marino continue;
398*ef5ccd6cSJohn Marino
399a45ae5f8SJohn Marino snprintf (col_name, 32, "col%d", ix_cols);
400a45ae5f8SJohn Marino ui_out_field_string (uiout, col_name, col->value);
401a45ae5f8SJohn Marino }
4025796c8dcSSimon Schubert
4035796c8dcSSimon Schubert do_cleanups (old_chain);
4045796c8dcSSimon Schubert
4055796c8dcSSimon Schubert ui_out_text (uiout, "\n");
4065796c8dcSSimon Schubert }
4075796c8dcSSimon Schubert }
4085796c8dcSSimon Schubert
4095796c8dcSSimon Schubert do_cleanups (old_chain);
4105796c8dcSSimon Schubert }
4115796c8dcSSimon Schubert
4125796c8dcSSimon Schubert extern initialize_file_ftype _initialize_osdata; /* -Wmissing-prototypes */
4135796c8dcSSimon Schubert
4145796c8dcSSimon Schubert void
_initialize_osdata(void)4155796c8dcSSimon Schubert _initialize_osdata (void)
4165796c8dcSSimon Schubert {
4175796c8dcSSimon Schubert add_info ("os", info_osdata_command,
4185796c8dcSSimon Schubert _("Show OS data ARG."));
4195796c8dcSSimon Schubert }
420