+/* Outputs a macro for human consumption, detailing the include path
+ and macro definition. NAME is the name of the macro.
+ D the definition. FILE the start of the include path, and LINE the
+ line number in FILE.
+
+ Care should be taken that this function does not cause any lookups into
+ the splay tree so that it can be safely used while iterating. */
+static void
+print_macro_definition (const char *name,
+ const struct macro_definition *d,
+ struct macro_source_file *file,
+ int line)
+{
+ 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);
+ }