gdb_curses.h: Undefine KEY_EVENT before including curses
[deliverable/binutils-gdb.git] / gdb / symmisc.c
index b292c3b6850264901f046aa44acdff94850774ba..b0ab29b6c7d35dc24108ec14d5019a05d8151d29 100644 (file)
@@ -1,8 +1,7 @@
 /* Do various things to symbol tables (other than lookup), for GDB.
 
-   Copyright (C) 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995,
-   1996, 1997, 1998, 1999, 2000, 2002, 2003, 2004, 2007, 2008, 2009, 2010,
-   2011 Free Software Foundation, Inc.
+   Copyright (C) 1986-2000, 2002-2004, 2007-2012 Free Software
+   Foundation, Inc.
 
    This file is part of GDB.
 
@@ -23,6 +22,7 @@
 #include "symtab.h"
 #include "gdbtypes.h"
 #include "bfd.h"
+#include "filenames.h"
 #include "symfile.h"
 #include "objfiles.h"
 #include "breakpoint.h"
@@ -78,46 +78,6 @@ struct print_symbol_args
 
 static int print_symbol (void *);
 \f
-/* Free all the storage associated with the struct symtab <- S.
-   Note that some symtabs have contents that all live inside one big block of
-   memory, and some share the contents of another symbol table and so you
-   should not free the contents on their behalf (except sometimes the
-   linetable, which maybe per symtab even when the rest is not).
-   It is s->free_code that says which alternative to use.  */
-
-void
-free_symtab (struct symtab *s)
-{
-  switch (s->free_code)
-    {
-    case free_nothing:
-      /* All the contents are part of a big block of memory (an obstack),
-         and some other symtab is in charge of freeing that block.
-         Therefore, do nothing.  */
-      break;
-
-    case free_linetable:
-      /* Everything will be freed either by our `free_func'
-         or by some other symtab, except for our linetable.
-         Free that now.  */
-      if (LINETABLE (s))
-       xfree (LINETABLE (s));
-      break;
-    }
-
-  /* If there is a single block of memory to free, free it.  */
-  if (s->free_func != NULL)
-    s->free_func (s);
-
-  /* Free source-related stuff */
-  if (s->line_charpos != NULL)
-    xfree (s->line_charpos);
-  if (s->fullname != NULL)
-    xfree (s->fullname);
-  if (s->debugformat != NULL)
-    xfree (s->debugformat);
-  xfree (s);
-}
 
 void
 print_symbol_bcache_statistics (void)
@@ -264,6 +224,9 @@ dump_msymbols (struct objfile *objfile, struct ui_file *outfile)
        case mst_text:
          ms_type = 'T';
          break;
+       case mst_text_gnu_ifunc:
+         ms_type = 'i';
+         break;
        case mst_solib_trampoline:
          ms_type = 'S';
          break;
@@ -335,7 +298,8 @@ dump_symtab_1 (struct objfile *objfile, struct symtab *symtab,
   fprintf_filtered (outfile, "Read from object file %s (", objfile->name);
   gdb_print_host_address (objfile, outfile);
   fprintf_filtered (outfile, ")\n");
-  fprintf_filtered (outfile, "Language: %s\n", language_str (symtab->language));
+  fprintf_filtered (outfile, "Language: %s\n",
+                   language_str (symtab->language));
 
   /* First print the line table.  */
   l = LINETABLE (symtab);
@@ -351,7 +315,7 @@ dump_symtab_1 (struct objfile *objfile, struct symtab *symtab,
        }
     }
   /* Now print the block info, but only for primary symtabs since we will
-     print lots of duplicate info otherwise. */
+     print lots of duplicate info otherwise.  */
   if (symtab->primary)
     {
       fprintf_filtered (outfile, "\nBlockvector:\n\n");
@@ -448,8 +412,8 @@ maintenance_print_symbols (char *args, int from_tty)
 
   if (args == NULL)
     {
-      error (_("\
-Arguments missing: an output file name and an optional symbol file name"));
+      error (_("Arguments missing: an output file name "
+              "and an optional symbol file name"));
     }
   argv = gdb_buildargv (args);
   cleanups = make_cleanup_freeargv (argv);
@@ -457,7 +421,7 @@ Arguments missing: an output file name and an optional symbol file name"));
   if (argv[0] != NULL)
     {
       filename = argv[0];
-      /* If a second arg is supplied, it is a source file name to match on */
+      /* If a second arg is supplied, it is a source file name to match on */
       if (argv[1] != NULL)
        {
          symname = argv[1];
@@ -474,7 +438,7 @@ Arguments missing: an output file name and an optional symbol file name"));
 
   immediate_quit++;
   ALL_SYMTABS (objfile, s)
-    if (symname == NULL || strcmp (symname, s->filename) == 0)
+    if (symname == NULL || filename_cmp (symname, s->filename) == 0)
     dump_symtab (objfile, s, outfile);
   immediate_quit--;
   do_cleanups (cleanups);
@@ -545,9 +509,9 @@ print_symbol (void *args)
       switch (SYMBOL_CLASS (symbol))
        {
        case LOC_CONST:
-         fprintf_filtered (outfile, "const %ld (0x%lx)",
-                           SYMBOL_VALUE (symbol),
-                           SYMBOL_VALUE (symbol));
+         fprintf_filtered (outfile, "const %s (%s)",
+                           plongest (SYMBOL_VALUE (symbol)),
+                           hex_string (SYMBOL_VALUE (symbol)));
          break;
 
        case LOC_CONST_BYTES:
@@ -575,28 +539,31 @@ print_symbol (void *args)
 
        case LOC_REGISTER:
          if (SYMBOL_IS_ARGUMENT (symbol))
-           fprintf_filtered (outfile, "parameter register %ld",
-                             SYMBOL_VALUE (symbol));
+           fprintf_filtered (outfile, "parameter register %s",
+                             plongest (SYMBOL_VALUE (symbol)));
          else
-           fprintf_filtered (outfile, "register %ld", SYMBOL_VALUE (symbol));
+           fprintf_filtered (outfile, "register %s",
+                             plongest (SYMBOL_VALUE (symbol)));
          break;
 
        case LOC_ARG:
-         fprintf_filtered (outfile, "arg at offset 0x%lx",
-                           SYMBOL_VALUE (symbol));
+         fprintf_filtered (outfile, "arg at offset %s",
+                           hex_string (SYMBOL_VALUE (symbol)));
          break;
 
        case LOC_REF_ARG:
-         fprintf_filtered (outfile, "reference arg at 0x%lx", SYMBOL_VALUE (symbol));
+         fprintf_filtered (outfile, "reference arg at %s",
+                           hex_string (SYMBOL_VALUE (symbol)));
          break;
 
        case LOC_REGPARM_ADDR:
-         fprintf_filtered (outfile, "address parameter register %ld", SYMBOL_VALUE (symbol));
+         fprintf_filtered (outfile, "address parameter register %s",
+                           plongest (SYMBOL_VALUE (symbol)));
          break;
 
        case LOC_LOCAL:
-         fprintf_filtered (outfile, "local at offset 0x%lx",
-                           SYMBOL_VALUE (symbol));
+         fprintf_filtered (outfile, "local at offset %s",
+                           hex_string (SYMBOL_VALUE (symbol)));
          break;
 
        case LOC_TYPEDEF:
@@ -668,7 +635,8 @@ maintenance_print_msymbols (char *args, int from_tty)
 
   if (args == NULL)
     {
-      error (_("print-msymbols takes an output file name and optional symbol file name"));
+      error (_("print-msymbols takes an output file "
+              "name and optional symbol file name"));
     }
   argv = gdb_buildargv (args);
   cleanups = make_cleanup_freeargv (argv);
@@ -676,7 +644,7 @@ maintenance_print_msymbols (char *args, int from_tty)
   if (argv[0] != NULL)
     {
       filename = argv[0];
-      /* If a second arg is supplied, it is a source file name to match on */
+      /* If a second arg is supplied, it is a source file name to match on */
       if (argv[1] != NULL)
        {
          symname = xfullpath (argv[1]);
@@ -697,8 +665,8 @@ maintenance_print_msymbols (char *args, int from_tty)
   immediate_quit++;
   ALL_PSPACES (pspace)
     ALL_PSPACE_OBJFILES (pspace, objfile)
-      if (symname == NULL
-         || (!stat (objfile->name, &obj_st) && sym_st.st_ino == obj_st.st_ino))
+      if (symname == NULL || (!stat (objfile->name, &obj_st)
+                             && sym_st.st_ino == obj_st.st_ino))
        dump_msymbols (objfile, outfile);
   immediate_quit--;
   fprintf_filtered (outfile, "\n\n");
@@ -764,12 +732,15 @@ maintenance_info_symtabs (char *regexp, int from_tty)
                               symtab->dirname ? symtab->dirname : "(null)");
              printf_filtered ("          fullname %s\n",
                               symtab->fullname ? symtab->fullname : "(null)");
-             printf_filtered ("          blockvector ((struct blockvector *) %s)%s\n",
+             printf_filtered ("          "
+                              "blockvector ((struct blockvector *) %s)%s\n",
                               host_address_to_string (symtab->blockvector),
                               symtab->primary ? " (primary)" : "");
-             printf_filtered ("          linetable ((struct linetable *) %s)\n",
+             printf_filtered ("          "
+                              "linetable ((struct linetable *) %s)\n",
                               host_address_to_string (symtab->linetable));
-             printf_filtered ("          debugformat %s\n", symtab->debugformat);
+             printf_filtered ("          debugformat %s\n",
+                              symtab->debugformat);
              printf_filtered ("        }\n");
            }
        }
@@ -795,7 +766,7 @@ block_depth (struct block *block)
 }
 \f
 
-/* Do early runtime initializations. */
+/* Do early runtime initializations.  */
 void
 _initialize_symmisc (void)
 {
This page took 0.027712 seconds and 4 git commands to generate.