+ fprintf_filtered (gdb_stdout, "Defined at ");
+ show_pp_source_pos (gdb_stdout, file, line);
+
+ if (line != 0)
+ fprintf_filtered (gdb_stdout, "#define %s", name);
+ else
+ fprintf_filtered (gdb_stdout, "-D%s", name);
+
+ if (d->kind == macro_function_like)
+ {
+ int i;
+
+ fputs_filtered ("(", gdb_stdout);
+ for (i = 0; i < d->argc; i++)
+ {
+ fputs_filtered (d->argv[i], gdb_stdout);
+ if (i + 1 < d->argc)
+ fputs_filtered (", ", gdb_stdout);
+ }
+ fputs_filtered (")", gdb_stdout);
+ }
+
+ if (line != 0)
+ fprintf_filtered (gdb_stdout, " %s\n", d->replacement);
+ else
+ fprintf_filtered (gdb_stdout, "=%s\n", d->replacement);
+}
+
+/* The implementation of the `info macro' command. */
+static void
+info_macro_command (const char *args, int from_tty)
+{
+ gdb::unique_xmalloc_ptr<struct macro_scope> ms;
+ const char *name;
+ int show_all_macros_named = 0;
+ const char *arg_start = args;
+ int processing_args = 1;
+
+ while (processing_args
+ && arg_start && *arg_start == '-' && *arg_start != '\0')
+ {
+ const char *p = skip_to_space (arg_start);
+
+ if (strncmp (arg_start, "-a", p - arg_start) == 0
+ || strncmp (arg_start, "-all", p - arg_start) == 0)
+ show_all_macros_named = 1;
+ else if (strncmp (arg_start, "--", p - arg_start) == 0)
+ /* Our macro support seems rather C specific but this would
+ seem necessary for languages allowing - in macro names.
+ e.g. Scheme's (defmacro ->foo () "bar\n") */
+ processing_args = 0;
+ else
+ report_unrecognized_option_error ("info macro", arg_start);
+
+ arg_start = skip_spaces (p);
+ }
+
+ name = arg_start;
+