* ld-sh/sh.exp: Add missing newline.
[deliverable/binutils-gdb.git] / gdb / macrocmd.c
index 9d301e4473d409e488429b98fa0355a309c01b7e..74aa05221a6bb9cd17998f62b1dd9667d5b8edb1 100644 (file)
@@ -1,5 +1,5 @@
 /* C preprocessor macro expansion commands for GDB.
-   Copyright (C) 2002, 2007, 2008, 2009 Free Software Foundation, Inc.
+   Copyright (C) 2002, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
    Contributed by Red Hat, Inc.
 
    This file is part of GDB.
@@ -50,6 +50,7 @@ macro_expand_command (char *exp, int from_tty)
   struct macro_scope *ms = NULL;
   char *expanded = NULL;
   struct cleanup *cleanup_chain = make_cleanup (free_current_contents, &ms);
+
   make_cleanup (free_current_contents, &expanded);
 
   /* You know, when the user doesn't specify any expression, it would be
@@ -158,7 +159,10 @@ info_macro_command (char *name, int from_tty)
 
       fprintf_filtered (gdb_stdout, "Defined at ");
       show_pp_source_pos (gdb_stdout, file, line);
-      fprintf_filtered (gdb_stdout, "#define %s", name);
+      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;
@@ -172,7 +176,10 @@ info_macro_command (char *name, int from_tty)
             }
           fputs_filtered (")", gdb_stdout);
         }
-      fprintf_filtered (gdb_stdout, " %s\n", d->replacement);
+      if (line != 0)
+       fprintf_filtered (gdb_stdout, " %s\n", d->replacement);
+      else
+       fprintf_filtered (gdb_stdout, "=%s\n", d->replacement);
     }
   else
     {
@@ -243,6 +250,7 @@ free_macro_definition_ptr (void *ptr)
 {
   int i;
   struct macro_definition *loc = (struct macro_definition *) ptr;
+
   for (i = 0; i < loc->argc; ++i)
     xfree ((char *) loc->argv[i]);
   xfree ((char *) loc->argv);
@@ -356,6 +364,7 @@ print_one_macro (const char *name, const struct macro_definition *macro,
   if (macro->kind == macro_function_like)
     {
       int i;
+
       fprintf_filtered (gdb_stdout, "(");
       for (i = 0; i < macro->argc; ++i)
        fprintf_filtered (gdb_stdout, "%s%s", (i > 0) ? ", " : "",
@@ -381,8 +390,6 @@ extern initialize_file_ftype _initialize_macrocmd; /* -Wmissing-prototypes */
 void
 _initialize_macrocmd (void)
 {
-  struct cmd_list_element *c;
-
   /* We introduce a new command prefix, `macro', under which we'll put
      the various commands for working with preprocessor macros.  */
   add_prefix_cmd ("macro", class_info, macro_command,
This page took 0.025038 seconds and 4 git commands to generate.