[ARM] PR ld/21402, only override the symbol dynamic decision on undefined weak symbol.
[deliverable/binutils-gdb.git] / gdb / osdata.c
index d63ff5aac9c6bf1764957201f09b40ac022c7f1a..9da3d07cdb3098d42cf2cbb87f22f7ccdd0edc89 100644 (file)
@@ -287,7 +287,7 @@ get_osdata_column (struct osdata_item *item, const char *name)
 }
 
 void
-info_osdata_command (char *type, int from_tty)
+info_osdata (const char *type)
 {
   struct ui_out *uiout = current_uiout;
   struct osdata *osdata = NULL;
@@ -297,12 +297,15 @@ info_osdata_command (char *type, int from_tty)
   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))
@@ -315,7 +318,7 @@ info_osdata_command (char *type, int from_tty)
         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;
@@ -334,8 +337,7 @@ info_osdata_command (char *type, int from_tty)
        }
     }
 
-  make_cleanup_ui_out_table_begin_end (uiout, ncols, nrows,
-                                      "OSDataTable");
+  ui_out_emit_table table_emitter (uiout, ncols, nrows, "OSDataTable");
 
   /* With no columns/items, we just output an empty table, but we
      still output the table.  This matters for MI.  */
@@ -378,27 +380,26 @@ info_osdata_command (char *type, int from_tty)
                        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");
        }
@@ -407,7 +408,11 @@ info_osdata_command (char *type, int from_tty)
   do_cleanups (old_chain);
 }
 
-extern initialize_file_ftype _initialize_osdata; /* -Wmissing-prototypes */
+static void
+info_osdata_command (char *arg, int from_tty)
+{
+  info_osdata (arg);
+}
 
 void
 _initialize_osdata (void)
This page took 0.025437 seconds and 4 git commands to generate.