Automatic date update in version.in
[platform/upstream/binutils.git] / gdb / minsyms.h
index e6e2c8b..807e5ee 100644 (file)
@@ -1,6 +1,6 @@
 /* Minimal symbol table definitions for GDB.
 
-   Copyright (C) 2011 Free Software Foundation, Inc.
+   Copyright (C) 2011-2014 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
 #ifndef MINSYMS_H
 #define MINSYMS_H
 
+/* Several lookup functions return both a minimal symbol and the
+   objfile in which it is found.  This structure is used in these
+   cases.  */
+
+struct bound_minimal_symbol
+{
+  /* The minimal symbol that was found, or NULL if no minimal symbol
+     was found.  */
+
+  struct minimal_symbol *minsym;
+
+  /* If MINSYM is not NULL, then this is the objfile in which the
+     symbol is defined.  */
+
+  struct objfile *objfile;
+};
+
 /* This header declares most of the API for dealing with minimal
    symbols and minimal symbol tables.  A few things are declared
    elsewhere; see below.
@@ -71,7 +88,6 @@ struct cleanup *make_cleanup_discard_minimal_symbols (void);
    ADDRESS - the address of the symbol
    MS_TYPE - the type of the symbol
    SECTION - the symbol's section
-   BFD_SECTION - the symbol's BFD section; used to find the
    appropriate obj_section for the minimal symbol.  This can be NULL.
    OBJFILE - the objfile associated with the minimal symbol.  */
 
@@ -82,14 +98,12 @@ struct minimal_symbol *prim_record_minimal_symbol_full
      CORE_ADDR address,
      enum minimal_symbol_type ms_type,
      int section,
-     asection *bfd_section,
      struct objfile *objfile);
 
 /* Like prim_record_minimal_symbol_full, but:
    - uses strlen to compute NAME_LEN,
-   - passes COPY_NAME = 0,
-   - passes SECTION = 0,
-   - and passes BFD_SECTION = NULL.
+   - passes COPY_NAME = 1,
+   - and passes a default SECTION, depending on the type
    
    This variant does not return the new symbol.  */
 
@@ -99,14 +113,13 @@ void prim_record_minimal_symbol (const char *, CORE_ADDR,
 
 /* Like prim_record_minimal_symbol_full, but:
    - uses strlen to compute NAME_LEN,
-   - passes COPY_NAME = 0.  */
+   - passes COPY_NAME = 1.  */
 
 struct minimal_symbol *prim_record_minimal_symbol_and_info
     (const char *,
      CORE_ADDR,
      enum minimal_symbol_type,
      int section,
-     asection *bfd_section,
      struct objfile *);
 
 /* Install the minimal symbols that have been collected into the given
@@ -123,12 +136,6 @@ void install_minimal_symbols (struct objfile *);
 
 void terminate_minimal_symbol_table (struct objfile *objfile);
 
-/* Sort all the minimal symbols in OBJFILE.  This should be only be
-   called after relocating symbols; it ensures that the minimal
-   symbols are properly sorted by address.  */
-
-void msymbols_sort (struct objfile *objfile);
-
 \f
 
 /* Compute a hash code for the string argument.  */
@@ -149,42 +156,37 @@ unsigned int msymbol_hash_iw (const char *);
 
 \f
 
-/* Return the objfile that holds the minimal symbol SYM.  Every
-   minimal symbols is held by some objfile; this will never return
-   NULL.  */
-
-struct objfile *msymbol_objfile (struct minimal_symbol *sym);
-
-\f
-
 /* Look through all the current minimal symbol tables and find the
    first minimal symbol that matches NAME.  If OBJF is non-NULL, limit
-   the search to that objfile.  If SFILE is non-NULL, the only file-scope
-   symbols considered will be from that source file (global symbols are
-   still preferred).  Returns a pointer to the minimal symbol that
-   matches, or NULL if no match is found.  */
+   the search to that objfile.  If SFILE is non-NULL, the only
+   file-scope symbols considered will be from that source file (global
+   symbols are still preferred).  Returns a bound minimal symbol that
+   matches, or an empty bound minimal symbol if no match is found.  */
+
+struct bound_minimal_symbol lookup_minimal_symbol (const char *,
+                                                  const char *,
+                                                  struct objfile *);
 
-struct minimal_symbol *lookup_minimal_symbol (const char *,
-                                             const char *,
-                                             struct objfile *);
+/* Like lookup_minimal_symbol, but searches all files and
+   objfiles.  */
+
+struct bound_minimal_symbol lookup_bound_minimal_symbol (const char *);
 
 /* Find the minimal symbol named NAME, and return both the minsym
-   struct and its objfile.  This only checks the linkage name.  Sets
-   *OBJFILE_P and returns the minimal symbol, if it is found.  If it
-   is not found, returns NULL.  */
+   struct and its objfile.  This only checks the linkage name.  */
 
-struct minimal_symbol *lookup_minimal_symbol_and_objfile (const char *,
-                                                         struct objfile **);
+struct bound_minimal_symbol lookup_minimal_symbol_and_objfile (const char *);
 
 /* Look through all the current minimal symbol tables and find the
    first minimal symbol that matches NAME and has text type.  If OBJF
-   is non-NULL, limit the search to that objfile.  Returns a pointer
-   to the minimal symbol that matches, or NULL if no match is found.
+   is non-NULL, limit the search to that objfile.  Returns a bound
+   minimal symbol that matches, or an "empty" bound minimal symbol
+   otherwise.
 
    This function only searches the mangled (linkage) names.  */
 
-struct minimal_symbol *lookup_minimal_symbol_text (const char *,
-                                                  struct objfile *);
+struct bound_minimal_symbol lookup_minimal_symbol_text (const char *,
+                                                       struct objfile *);
 
 /* Look through all the current minimal symbol tables and find the
    first minimal symbol that matches NAME and is a solib trampoline.
@@ -194,7 +196,7 @@ struct minimal_symbol *lookup_minimal_symbol_text (const char *,
 
    This function only searches the mangled (linkage) names.  */
 
-struct minimal_symbol *lookup_minimal_symbol_solib_trampoline
+struct bound_minimal_symbol lookup_minimal_symbol_solib_trampoline
     (const char *,
      struct objfile *);
 
@@ -213,10 +215,10 @@ struct minimal_symbol *lookup_minimal_symbol_by_pc_name
    If SECTION is NULL, this uses the result of find_pc_section
    instead.
 
-   Returns a pointer to the minimal symbol if such a symbol is found,
-   or NULL if PC is not in a suitable range.  */
+   The result has a non-NULL 'minsym' member if such a symbol is
+   found, or NULL if PC is not in a suitable range.  */
 
-struct minimal_symbol *lookup_minimal_symbol_by_pc_section
+struct bound_minimal_symbol lookup_minimal_symbol_by_pc_section
     (CORE_ADDR,
      struct obj_section *);
 
@@ -226,13 +228,7 @@ struct minimal_symbol *lookup_minimal_symbol_by_pc_section
    This is a wrapper that calls lookup_minimal_symbol_by_pc_section
    with a NULL section argument.  */
 
-struct minimal_symbol *lookup_minimal_symbol_by_pc (CORE_ADDR);
-
-/* Check if PC is in a shared library trampoline code stub.
-   Return minimal symbol for the trampoline entry or NULL if PC is not
-   in a trampoline code stub.  */
-
-struct minimal_symbol *lookup_solib_trampoline_symbol_by_pc (CORE_ADDR);
+struct bound_minimal_symbol lookup_minimal_symbol_by_pc (CORE_ADDR);
 
 /* Iterate over all the minimal symbols in the objfile OBJF which
    match NAME.  Both the ordinary and demangled names of each symbol
@@ -248,4 +244,12 @@ void iterate_over_minimal_symbols (struct objfile *objf,
                                                     void *),
                                   void *user_data);
 
+/* Compute the upper bound of MINSYM.  The upper bound is the last
+   address thought to be part of the symbol.  If the symbol has a
+   size, it is used.  Otherwise use the lesser of the next minimal
+   symbol in the same section, or the end of the section, as the end
+   of the function.  */
+
+CORE_ADDR minimal_symbol_upper_bound (struct bound_minimal_symbol minsym);
+
 #endif /* MINSYMS_H */