Add end_psymtab_common, have all debug info readers call it.
[deliverable/binutils-gdb.git] / gdb / symtab.h
index 3a3384d3433c9078be74939ed30a898bf00dbc30..e67151f739d6a58a675a9d345e772e470175c381 100644 (file)
@@ -1,6 +1,6 @@
 /* Symbol table definitions for GDB.
 
-   Copyright (C) 1986-2014 Free Software Foundation, Inc.
+   Copyright (C) 1986-2015 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -38,6 +38,8 @@ struct program_space;
 struct language_defn;
 struct probe;
 struct common_block;
+struct obj_section;
+struct cmd_list_element;
 
 /* Some of the structures in this file are space critical.
    The space-critical structures are:
@@ -147,7 +149,7 @@ struct general_symbol_info
      This is used to select one of the fields from the language specific
      union above.  */
 
-  ENUM_BITFIELD(language) language : 8;
+  ENUM_BITFIELD(language) language : LANGUAGE_BITS;
 
   /* This is only used by Ada.  If set, then the 'mangled_lang' field
      of language_specific is valid.  Otherwise, the 'obstack' field is
@@ -307,9 +309,15 @@ enum minimal_symbol_type
      within a given .o file.  */
   mst_file_text,               /* Static version of mst_text */
   mst_file_data,               /* Static version of mst_data */
-  mst_file_bss                 /* Static version of mst_bss */
+  mst_file_bss,                        /* Static version of mst_bss */
+  nr_minsym_types
 };
 
+/* The number of enum minimal_symbol_type values, with some padding for
+   reasonable growth.  */
+#define MINSYM_TYPE_BITS 4
+gdb_static_assert (nr_minsym_types <= (1 << MINSYM_TYPE_BITS));
+
 /* Define a simple structure used to hold some very basic information about
    all defined global symbols (text, data, bss, abs, etc).  The only required
    information is the general_symbol_info.
@@ -332,7 +340,7 @@ struct minimal_symbol
 
   struct general_symbol_info mginfo;
 
-  /* Size of this symbol.  end_psymtab in dbxread.c uses this
+  /* Size of this symbol.  dbx_end_psymtab in dbxread.c uses this
      information to calculate the end of the partial symtab based on the
      address of the last symbol plus the size of the last symbol.  */
 
@@ -343,7 +351,7 @@ struct minimal_symbol
 
   /* Classification type for this minimal symbol.  */
 
-  ENUM_BITFIELD(minimal_symbol_type) type : 8;
+  ENUM_BITFIELD(minimal_symbol_type) type : MINSYM_TYPE_BITS;
 
   /* Non-zero if this symbol was created by gdb.
      Such symbols do not appear in the output of "info var|fun".  */
@@ -458,9 +466,17 @@ typedef enum domain_enum_tag
 
   /* Fortran common blocks.  Their naming must be separate from VAR_DOMAIN.
      They also always use LOC_COMMON_BLOCK.  */
-  COMMON_BLOCK_DOMAIN
+  COMMON_BLOCK_DOMAIN,
+
+  /* This must remain last.  */
+  NR_DOMAINS
 } domain_enum;
 
+/* The number of bits in a symbol used to represent the domain.  */
+
+#define SYMBOL_DOMAIN_BITS 3
+gdb_static_assert (NR_DOMAINS <= (1 << SYMBOL_DOMAIN_BITS));
+
 extern const char *domain_name (domain_enum);
 
 /* Searching domains, used for `search_symbols'.  Element numbers are
@@ -589,6 +605,15 @@ enum address_class
   LOC_FINAL_VALUE
 };
 
+/* The number of bits needed for values in enum address_class, with some
+   padding for reasonable growth, and room for run-time registered address
+   classes. See symtab.c:MAX_SYMBOL_IMPLS.
+   This is a #define so that we can have a assertion elsewhere to
+   verify that we have reserved enough space for synthetic address
+   classes.  */
+#define SYMBOL_ACLASS_BITS 5
+gdb_static_assert (LOC_FINAL_VALUE <= (1 << SYMBOL_ACLASS_BITS));
+
 /* The methods needed to implement LOC_COMPUTED.  These methods can
    use the symbol's .aux_value for additional per-symbol information.
 
@@ -687,13 +712,6 @@ struct symbol_impl
   const struct symbol_register_ops *ops_register;
 };
 
-/* The number of bits we reserve in a symbol for the aclass index.
-   This is a #define so that we can have a assertion elsewhere to
-   verify that we have reserved enough space for synthetic address
-   classes.  */
-
-#define SYMBOL_ACLASS_BITS 6
-
 /* This structure is space critical.  See space comments at the top.  */
 
 struct symbol
@@ -707,14 +725,23 @@ struct symbol
 
   struct type *type;
 
-  /* The symbol table containing this symbol.  This is the file
-     associated with LINE.  It can be NULL during symbols read-in but it is
-     never NULL during normal operation.  */
-  struct symtab *symtab;
+  /* The owner of this symbol.
+     Which one to use is defined by symbol.is_objfile_owned.  */
+
+  union
+  {
+    /* The symbol table containing this symbol.  This is the file associated
+       with LINE.  It can be NULL during symbols read-in but it is never NULL
+       during normal operation.  */
+    struct symtab *symtab;
+
+    /* For types defined by the architecture.  */
+    struct gdbarch *arch;
+  } owner;
 
   /* Domain code.  */
 
-  ENUM_BITFIELD(domain_enum_tag) domain : 6;
+  ENUM_BITFIELD(domain_enum_tag) domain : SYMBOL_DOMAIN_BITS;
 
   /* Address class.  This holds an index into the 'symbol_impls'
      table.  The actual enum address_class value is stored there,
@@ -722,6 +749,11 @@ struct symbol
 
   unsigned int aclass_index : SYMBOL_ACLASS_BITS;
 
+  /* If non-zero then symbol is objfile-owned, use owner.symtab.
+     Otherwise symbol is arch-owned, use owner.arch.  */
+
+  unsigned int is_objfile_owned : 1;
+
   /* Whether this is an argument.  */
 
   unsigned is_argument : 1;
@@ -738,6 +770,7 @@ struct symbol
      SYMBOL_INLINED set) this is the line number of the function's call
      site.  Inlined function symbols are not definitions, and they are
      never found by symbol table lookup.
+     If this symbol is arch-owned, LINE shall be zero.
 
      FIXME: Should we really make the assumption that nobody will try
      to debug files longer than 64K lines?  What about machine
@@ -763,12 +796,29 @@ struct symbol
   struct symbol *hash_next;
 };
 
+/* Several lookup functions return both a symbol and the block in which the
+   symbol is found.  This structure is used in these cases.  */
+
+struct block_symbol
+{
+  /* The symbol that was found, or NULL if no symbol was found.  */
+  struct symbol *symbol;
+
+  /* If SYMBOL is not NULL, then this is the block in which the symbol is
+     defined.  */
+  const struct block *block;
+};
+
 extern const struct symbol_impl *symbol_impls;
 
+/* Note: There is no accessor macro for symbol.owner because it is
+   "private".  */
+
 #define SYMBOL_DOMAIN(symbol)  (symbol)->domain
 #define SYMBOL_IMPL(symbol)            (symbol_impls[(symbol)->aclass_index])
 #define SYMBOL_ACLASS_INDEX(symbol)    (symbol)->aclass_index
 #define SYMBOL_CLASS(symbol)           (SYMBOL_IMPL (symbol).aclass)
+#define SYMBOL_OBJFILE_OWNED(symbol)   ((symbol)->is_objfile_owned)
 #define SYMBOL_IS_ARGUMENT(symbol)     (symbol)->is_argument
 #define SYMBOL_INLINED(symbol)         (symbol)->is_inlined
 #define SYMBOL_IS_CPLUS_TEMPLATE_FUNCTION(symbol) \
@@ -901,7 +951,8 @@ struct section_offsets
 
 struct symtab
 {
-  /* Unordered chain of all existing symtabs of this objfile.  */
+  /* Unordered chain of all filetabs in the compunit,  with the exception
+     that the "main" source file is the first entry in the list.  */
 
   struct symtab *next;
 
@@ -1117,10 +1168,6 @@ DEF_VEC_P (compunit_symtab_ptr);
 
 extern int currently_reading_symtab;
 
-/* The block in which the most recently looked up symbol was found.  */
-
-extern const struct block *block_found;
-
 /* symtab.c lookup functions */
 
 extern const char multiple_symbols_ask[];
@@ -1166,27 +1213,27 @@ struct field_of_this_result
    C++: if IS_A_FIELD_OF_THIS is non-NULL on entry, check to see if
    NAME is a field of the current implied argument `this'.  If so fill in the
    fields of IS_A_FIELD_OF_THIS, otherwise the fields are set to NULL.
-   BLOCK_FOUND is set to the block in which NAME is found (in the case of
-   a field of `this', value_of_this sets BLOCK_FOUND to the proper value).
    The symbol's section is fixed up if necessary.  */
 
-extern struct symbol *lookup_symbol_in_language (const char *,
-                                                const struct block *,
-                                                const domain_enum,
-                                                enum language,
-                                                struct field_of_this_result *);
+extern struct block_symbol
+  lookup_symbol_in_language (const char *,
+                            const struct block *,
+                            const domain_enum,
+                            enum language,
+                            struct field_of_this_result *);
 
 /* Same as lookup_symbol_in_language, but using the current language.  */
 
-extern struct symbol *lookup_symbol (const char *, const struct block *,
-                                    const domain_enum,
-                                    struct field_of_this_result *);
+extern struct block_symbol lookup_symbol (const char *,
+                                         const struct block *,
+                                         const domain_enum,
+                                         struct field_of_this_result *);
 
 /* A default version of lookup_symbol_nonlocal for use by languages
    that can't think of anything better to do.
    This implements the C lookup rules.  */
 
-extern struct symbol *
+extern struct block_symbol
   basic_lookup_symbol_nonlocal (const struct language_defn *langdef,
                                const char *,
                                const struct block *,
@@ -1197,19 +1244,18 @@ extern struct symbol *
 
 /* Lookup a symbol in the static block associated to BLOCK, if there
    is one; do nothing if BLOCK is NULL or a global block.
-   Upon success sets BLOCK_FOUND and fixes up the symbol's section
-   if necessary.  */
+   Upon success fixes up the symbol's section if necessary.  */
 
-extern struct symbol *lookup_symbol_in_static_block (const char *name,
-                                                    const struct block *block,
-                                                    const domain_enum domain);
+extern struct block_symbol
+  lookup_symbol_in_static_block (const char *name,
+                                const struct block *block,
+                                const domain_enum domain);
 
 /* Search all static file-level symbols for NAME from DOMAIN.
-   Upon success sets BLOCK_FOUND and fixes up the symbol's section
-   if necessary.  */
+   Upon success fixes up the symbol's section if necessary.  */
 
-extern struct symbol *lookup_static_symbol (const char *name,
-                                           const domain_enum domain);
+extern struct block_symbol lookup_static_symbol (const char *name,
+                                                const domain_enum domain);
 
 /* Lookup a symbol in all files' global blocks.
 
@@ -1220,26 +1266,27 @@ extern struct symbol *lookup_static_symbol (const char *name,
       if the target requires it.
       See gdbarch_iterate_over_objfiles_in_search_order.
 
-   Upon success sets BLOCK_FOUND and fixes up the symbol's section
-   if necessary.  */
+   Upon success fixes up the symbol's section if necessary.  */
 
-extern struct symbol *lookup_global_symbol (const char *name,
-                                           const struct block *block,
-                                           const domain_enum domain);
+extern struct block_symbol
+  lookup_global_symbol (const char *name,
+                       const struct block *block,
+                       const domain_enum domain);
 
 /* Lookup a symbol in block BLOCK.
-   Upon success sets BLOCK_FOUND and fixes up the symbol's section
-   if necessary.  */
+   Upon success fixes up the symbol's section if necessary.  */
 
-extern struct symbol *lookup_symbol_in_block (const char *name,
-                                             const struct block *block,
-                                             const domain_enum domain);
+extern struct symbol *
+  lookup_symbol_in_block (const char *name,
+                         const struct block *block,
+                         const domain_enum domain);
 
 /* Look up the `this' symbol for LANG in BLOCK.  Return the symbol if
    found, or NULL if not found.  */
 
-extern struct symbol *lookup_language_this (const struct language_defn *lang,
-                                           const struct block *block);
+extern struct block_symbol
+  lookup_language_this (const struct language_defn *lang,
+                       const struct block *block);
 
 /* Lookup a [struct, union, enum] by name, within a specified block.  */
 
@@ -1393,7 +1440,7 @@ extern int find_line_pc_range (struct symtab_and_line, CORE_ADDR *,
 
 extern void resolve_sal_pc (struct symtab_and_line *);
 
-/* Symbol-reading stuff in symfile.c and solib.c.  */
+/* solib.c */
 
 extern void clear_solib (void);
 
@@ -1451,12 +1498,6 @@ extern struct symtab_and_line find_function_start_sal (struct symbol *sym,
 
 extern void skip_prologue_sal (struct symtab_and_line *);
 
-/* symfile.c */
-
-extern void clear_symtab_users (int add_flags);
-
-extern enum language deduce_language_from_filename (const char *);
-
 /* symtab.c */
 
 extern CORE_ADDR skip_prologue_using_sal (struct gdbarch *gdbarch,
@@ -1506,10 +1547,9 @@ extern enum language main_language (void);
 /* Lookup symbol NAME from DOMAIN in MAIN_OBJFILE's global blocks.
    This searches MAIN_OBJFILE as well as any associated separate debug info
    objfiles of MAIN_OBJFILE.
-   Upon success sets BLOCK_FOUND and fixes up the symbol's section
-   if necessary.  */
+   Upon success fixes up the symbol's section if necessary.  */
 
-extern struct symbol *
+extern struct block_symbol
   lookup_global_symbol_from_objfile (struct objfile *main_objfile,
                                     const char *name,
                                     const domain_enum domain);
This page took 0.02695 seconds and 4 git commands to generate.