2002-04-24 Michael Snyder <msnyder@redhat.com>
[deliverable/binutils-gdb.git] / gdb / symtab.h
index 7fb78db3ea73c10bd3db39f3f23363c70adddeee..231364ed0236c3f8c894b59cc29a7ef0b6ac8a3c 100644 (file)
@@ -1,5 +1,6 @@
 /* Symbol table definitions for GDB.
-   Copyright 1986, 89, 91, 92, 93, 94, 95, 96, 1998
+   Copyright 1986, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996,
+   1997, 1998, 1999, 2000, 2001
    Free Software Foundation, Inc.
 
    This file is part of GDB.
@@ -26,7 +27,7 @@
 
 #include "obstack.h"
 #define obstack_chunk_alloc xmalloc
-#define obstack_chunk_free free
+#define obstack_chunk_free xfree
 #include "bcache.h"
 
 /* Don't do this; it means that if some .o's are compiled with GNU C
@@ -158,76 +159,12 @@ extern CORE_ADDR symbol_overlayed_address (CORE_ADDR, asection *);
       }                                                                        \
   } while (0)
 
-/* Macro that attempts to initialize the demangled name for a symbol,
-   based on the language of that symbol.  If the language is set to
-   language_auto, it will attempt to find any demangling algorithm
-   that works and then set the language appropriately.  If no demangling
-   of any kind is found, the language is set back to language_unknown,
-   so we can avoid doing this work again the next time we encounter
-   the symbol.  Any required space to store the name is obtained from the
-   specified obstack. */
-
-#define SYMBOL_INIT_DEMANGLED_NAME(symbol,obstack)                     \
-  do {                                                                 \
-    char *demangled = NULL;                                            \
-    if (SYMBOL_LANGUAGE (symbol) == language_cplus                     \
-       || SYMBOL_LANGUAGE (symbol) == language_auto)                   \
-      {                                                                        \
-       demangled =                                                     \
-         cplus_demangle (SYMBOL_NAME (symbol), DMGL_PARAMS | DMGL_ANSI);\
-       if (demangled != NULL)                                          \
-         {                                                             \
-           SYMBOL_LANGUAGE (symbol) = language_cplus;                  \
-           SYMBOL_CPLUS_DEMANGLED_NAME (symbol) =                      \
-             obsavestring (demangled, strlen (demangled), (obstack));  \
-           free (demangled);                                           \
-         }                                                             \
-       else                                                            \
-         {                                                             \
-           SYMBOL_CPLUS_DEMANGLED_NAME (symbol) = NULL;                \
-         }                                                             \
-      }                                                                        \
-    if (SYMBOL_LANGUAGE (symbol) == language_java)                     \
-      {                                                                        \
-       demangled =                                                     \
-         cplus_demangle (SYMBOL_NAME (symbol),                         \
-                         DMGL_PARAMS | DMGL_ANSI | DMGL_JAVA);         \
-       if (demangled != NULL)                                          \
-         {                                                             \
-           SYMBOL_LANGUAGE (symbol) = language_java;                   \
-           SYMBOL_CPLUS_DEMANGLED_NAME (symbol) =                      \
-             obsavestring (demangled, strlen (demangled), (obstack));  \
-           free (demangled);                                           \
-         }                                                             \
-       else                                                            \
-         {                                                             \
-           SYMBOL_CPLUS_DEMANGLED_NAME (symbol) = NULL;                \
-         }                                                             \
-      }                                                                        \
-    if (demangled == NULL                                              \
-       && (SYMBOL_LANGUAGE (symbol) == language_chill                  \
-           || SYMBOL_LANGUAGE (symbol) == language_auto))              \
-      {                                                                        \
-       demangled =                                                     \
-         chill_demangle (SYMBOL_NAME (symbol));                        \
-       if (demangled != NULL)                                          \
-         {                                                             \
-           SYMBOL_LANGUAGE (symbol) = language_chill;                  \
-           SYMBOL_CHILL_DEMANGLED_NAME (symbol) =                      \
-             obsavestring (demangled, strlen (demangled), (obstack));  \
-           free (demangled);                                           \
-         }                                                             \
-       else                                                            \
-         {                                                             \
-           SYMBOL_CHILL_DEMANGLED_NAME (symbol) = NULL;                \
-         }                                                             \
-      }                                                                        \
-    if (SYMBOL_LANGUAGE (symbol) == language_auto)                     \
-      {                                                                        \
-       SYMBOL_LANGUAGE (symbol) = language_unknown;                    \
-      }                                                                        \
-  } while (0)
+#define SYMBOL_INIT_DEMANGLED_NAME(symbol,obstack) \
+  (symbol_init_demangled_name (&symbol->ginfo, (obstack)))
+extern void symbol_init_demangled_name (struct general_symbol_info *symbol,
+                                        struct obstack *obstack);
 
+  
 /* Macro that returns the demangled name for a symbol based on the language
    for that symbol.  If no demangled name exists, returns NULL. */
 
@@ -468,6 +405,18 @@ struct block
 #define BLOCK_SUPERBLOCK(bl)   (bl)->superblock
 #define BLOCK_GCC_COMPILED(bl) (bl)->gcc_compile_flag
 
+/* Macro to loop through all symbols in a block BL.
+   i counts which symbol we are looking at, and sym points to the current
+   symbol.
+   The contortion at the end is to avoid reading past the last valid
+   BLOCK_SYM.  */
+#define ALL_BLOCK_SYMBOLS(bl, i, sym)                  \
+       for ((i) = 0, (sym) = BLOCK_SYM ((bl), (i));    \
+            (i) < BLOCK_NSYMS ((bl));                  \
+            ++(i), (sym) = ((i) < BLOCK_NSYMS ((bl)))  \
+                           ? BLOCK_SYM ((bl), (i))     \
+                           : NULL)
+
 /* Nonzero if symbols of block BL should be sorted alphabetically.
    Don't sort a block which corresponds to a function.  If we did the
    sorting would have to preserve the order of the symbols for the
@@ -763,7 +712,7 @@ struct partial_symbol
 \f
 
 /* Source-file information.  This describes the relation between source files,
-   ine numbers and addresses in the program text.  */
+   line numbers and addresses in the program text.  */
 
 struct sourcevector
   {
@@ -794,7 +743,10 @@ struct linetable_entry
    30   0x300
    10   0x400   - for the increment part of a for stmt.
 
- */
+   If an entry has a line number of zero, it marks the start of a PC
+   range for which no line number information is available.  It is
+   acceptable, though wasteful of table space, for such a range to be
+   zero length.  */
 
 struct linetable
   {
@@ -829,7 +781,10 @@ struct section_offsets
     CORE_ADDR offsets[1];      /* As many as needed. */
   };
 
-#define        ANOFFSET(secoff, whichone)      (secoff->offsets[whichone])
+#define        ANOFFSET(secoff, whichone) \
+   ((whichone == -1) \
+    ? (internal_error (__FILE__, __LINE__, "Section index is uninitialized"), -1) \
+    : secoff->offsets[whichone])
 
 /* The maximum possible size of a section_offsets table.  */
 
@@ -957,6 +912,10 @@ struct partial_symtab
 
     char *filename;
 
+    /* Full path of the source file.  NULL if not known.  */
+
+    char *fullname;
+
     /* Information about the object file from which symbols should be read.  */
 
     struct objfile *objfile;
@@ -1044,34 +1003,6 @@ struct partial_symtab
 
 #define VTBL_FNADDR_OFFSET 2
 
-/* Macro that yields non-zero value iff NAME is the prefix for C++ operator
-   names.  If you leave out the parenthesis here you will lose!
-   Currently 'o' 'p' CPLUS_MARKER is used for both the symbol in the
-   symbol-file and the names in gdb's symbol table.
-   Note that this macro is g++ specific (FIXME). */
-
-#define OPNAME_PREFIX_P(NAME) \
-  ((NAME)[0] == 'o' && (NAME)[1] == 'p' && is_cplus_marker ((NAME)[2]))
-
-/* Macro that yields non-zero value iff NAME is the prefix for C++ vtbl
-   names.  Note that this macro is g++ specific (FIXME).
-   '_vt$' is the old cfront-style vtables; '_VT$' is the new
-   style, using thunks (where '$' is really CPLUS_MARKER). */
-
-#define VTBL_PREFIX_P(NAME) \
-  (((NAME)[0] == '_' \
-   && (((NAME)[1] == 'V' && (NAME)[2] == 'T') \
-       || ((NAME)[1] == 'v' && (NAME)[2] == 't')) \
-   && is_cplus_marker ((NAME)[3])) || ((NAME)[0]=='_' && (NAME)[1]=='_' \
-   && (NAME)[2]=='v' && (NAME)[3]=='t' && (NAME)[4]=='_'))
-
-/* Macro that yields non-zero value iff NAME is the prefix for C++ destructor
-   names.  Note that this macro is g++ specific (FIXME).  */
-
-#define DESTRUCTOR_PREFIX_P(NAME) \
-  ((NAME)[0] == '_' && is_cplus_marker ((NAME)[1]) && (NAME)[2] == '_')
-\f
-
 /* External variables and functions for the objects described above. */
 
 /* This symtab variable specifies the current file for printing source lines */
@@ -1098,7 +1029,7 @@ extern int asm_demangle;
 
 /* lookup a symbol table by source file name */
 
-extern struct symtab *lookup_symtab (char *);
+extern struct symtab *lookup_symtab (const char *);
 
 /* lookup a symbol by name (optional block, optional symtab) */
 
@@ -1109,6 +1040,7 @@ extern struct symbol *lookup_symbol (const char *, const struct block *,
 /* lookup a symbol by name, within a specified block */
 
 extern struct symbol *lookup_block_symbol (const struct block *, const char *,
+                                          const char *,
                                           const namespace_enum);
 
 /* lookup a [struct, union, enum] by name, within a specified block */
@@ -1148,7 +1080,7 @@ find_pc_sect_partial_function (CORE_ADDR, asection *,
 
 /* lookup partial symbol table by filename */
 
-extern struct partial_symtab *lookup_partial_symtab (char *);
+extern struct partial_symtab *lookup_partial_symtab (const char *);
 
 /* lookup partial symbol table by address */
 
@@ -1207,10 +1139,6 @@ extern struct minimal_symbol *prim_record_minimal_symbol_and_info
    enum minimal_symbol_type,
    char *info, int section, asection * bfd_section, struct objfile *);
 
-#ifdef SOFUN_ADDRESS_MAYBE_MISSING
-extern CORE_ADDR find_stab_function_addr (char *, char *, struct objfile *);
-#endif
-
 extern unsigned int msymbol_hash_iw (const char *);
 
 extern unsigned int msymbol_hash (const char *);
@@ -1349,9 +1277,6 @@ extern struct symtabs_and_lines decode_line_spec (char *, int);
 
 extern struct symtabs_and_lines decode_line_spec_1 (char *, int);
 
-extern struct symtabs_and_lines
-decode_line_1 (char **, int, struct symtab *, int, char ***);
-
 /* Symmisc.c */
 
 void maintenance_print_symbols (char *, int);
@@ -1388,12 +1313,20 @@ extern void select_source_symtab (struct symtab *);
 
 extern char **make_symbol_completion_list (char *, char *);
 
+extern char **make_file_symbol_completion_list (char *, char *, char *);
+
 extern struct symbol **make_symbol_overload_list (struct symbol *);
 
+extern char **make_source_files_completion_list (char *, char *);
+
 /* symtab.c */
 
 extern struct partial_symtab *find_main_psymtab (void);
 
+extern struct symtab *find_line_symtab (struct symtab *, int, int *, int *);
+
+extern struct symtab_and_line find_function_start_sal (struct symbol *sym, int);
+
 /* blockframe.c */
 
 extern struct blockvector *blockvector_for_pc (CORE_ADDR, int *);
@@ -1414,10 +1347,14 @@ extern int in_prologue (CORE_ADDR pc, CORE_ADDR func_start);
 extern struct symbol *fixup_symbol_section (struct symbol *,
                                            struct objfile *);
 
+extern struct partial_symbol *fixup_psymbol_section (struct partial_symbol
+                                                    *psym,
+                                                    struct objfile *objfile);
+
 /* Symbol searching */
 
 /* When using search_symbols, a list of the following structs is returned.
-   Callers must free the search list using free_symbol_search! */
+   Callers must free the search list using free_search_symbols! */
 struct symbol_search
   {
     /* The block in which the match was found. Could be, for example,
@@ -1444,4 +1381,11 @@ extern void search_symbols (char *, namespace_enum, int, char **,
 extern void free_search_symbols (struct symbol_search *);
 extern struct cleanup *make_cleanup_free_search_symbols (struct symbol_search *);
 
+/* The name of the ``main'' function.
+   FIXME: cagney/2001-03-20: Can't make main_name() const since some
+   of the calling code currently assumes that the string isn't
+   const. */
+extern void set_main_name (const char *name);
+extern /*const*/ char *main_name (void);
+
 #endif /* !defined(SYMTAB_H) */
This page took 0.028378 seconds and 4 git commands to generate.