- SAVED_F77_COMMON_PTR tmp;
-
- tmp = head_common_list;
-
- printf_filtered (_("All COMMON blocks visible at this level:\n\n"));
-
- while (tmp != NULL)
- {
- if (strcmp (tmp->owning_function, funname) == 0)
- printf_filtered ("%s\n", tmp->name);
-
- tmp = tmp->next;
- }
+ struct block_iterator iter;
+ struct symbol *sym;
+ const char *name;
+ struct value_print_options opts;
+
+ get_user_print_options (&opts);
+
+ ALL_BLOCK_SYMBOLS (block, iter, sym)
+ if (SYMBOL_DOMAIN (sym) == COMMON_BLOCK_DOMAIN)
+ {
+ const struct common_block *common = SYMBOL_VALUE_COMMON_BLOCK (sym);
+ size_t index;
+
+ gdb_assert (SYMBOL_CLASS (sym) == LOC_COMMON_BLOCK);
+
+ if (comname && (!SYMBOL_LINKAGE_NAME (sym)
+ || strcmp (comname, SYMBOL_LINKAGE_NAME (sym)) != 0))
+ continue;
+
+ if (*any_printed)
+ putchar_filtered ('\n');
+ else
+ *any_printed = 1;
+ if (SYMBOL_PRINT_NAME (sym))
+ printf_filtered (_("Contents of F77 COMMON block '%s':\n"),
+ SYMBOL_PRINT_NAME (sym));
+ else
+ printf_filtered (_("Contents of blank COMMON block:\n"));
+
+ for (index = 0; index < common->n_entries; index++)
+ {
+ struct value *val = NULL;
+ volatile struct gdb_exception except;
+
+ printf_filtered ("%s = ",
+ SYMBOL_PRINT_NAME (common->contents[index]));
+
+ TRY_CATCH (except, RETURN_MASK_ERROR)
+ {
+ val = value_of_variable (common->contents[index], block);
+ value_print (val, gdb_stdout, &opts);
+ }
+
+ if (except.reason < 0)
+ printf_filtered ("<error reading variable: %s>", except.message);
+ putchar_filtered ('\n');
+ }
+ }