PR22348, conflicting global vars in crx and cr16
[deliverable/binutils-gdb.git] / gdb / symtab.h
index 8b975ad44f03540799086b533f84e5b1f295bb8c..cd6dbaea480599a06b099043923c4769f8e349aa 100644 (file)
@@ -1418,34 +1418,28 @@ extern CORE_ADDR find_solib_trampoline_target (struct frame_info *, CORE_ADDR);
 struct symtab_and_line
 {
   /* The program space of this sal.  */
-  struct program_space *pspace;
+  struct program_space *pspace = NULL;
 
-  struct symtab *symtab;
-  struct obj_section *section;
+  struct symtab *symtab = NULL;
+  struct symbol *symbol = NULL;
+  struct obj_section *section = NULL;
   /* Line number.  Line numbers start at 1 and proceed through symtab->nlines.
      0 is never a valid line number; it is used to indicate that line number
      information is not available.  */
-  int line;
+  int line = 0;
 
-  CORE_ADDR pc;
-  CORE_ADDR end;
-  int explicit_pc;
-  int explicit_line;
+  CORE_ADDR pc = 0;
+  CORE_ADDR end = 0;
+  bool explicit_pc = false;
+  bool explicit_line = false;
 
   /* The probe associated with this symtab_and_line.  */
-  struct probe *probe;
+  struct probe *probe = NULL;
   /* If PROBE is not NULL, then this is the objfile in which the probe
      originated.  */
-  struct objfile *objfile;
+  struct objfile *objfile = NULL;
 };
 
-extern void init_sal (struct symtab_and_line *sal);
-
-struct symtabs_and_lines
-{
-  struct symtab_and_line *sals;
-  int nelts;
-};
 \f
 
 /* Given a pc value, return line number it is in.  Second arg nonzero means
@@ -1499,22 +1493,37 @@ extern void forget_cached_source_info (void);
 
 extern void select_source_symtab (struct symtab *);
 
+/* The reason we're calling into a completion match list collector
+   function.  */
+enum class complete_symbol_mode
+  {
+    /* Completing an expression.  */
+    EXPRESSION,
+
+    /* Completing a linespec.  */
+    LINESPEC,
+  };
+
 extern void default_collect_symbol_completion_matches_break_on
   (completion_tracker &tracker,
+   complete_symbol_mode mode,
    const char *text, const char *word, const char *break_on,
    enum type_code code);
 extern void default_collect_symbol_completion_matches
   (completion_tracker &tracker,
+   complete_symbol_mode,
    const char *,
    const char *,
    enum type_code);
 extern void collect_symbol_completion_matches (completion_tracker &tracker,
+                                              complete_symbol_mode,
                                               const char *, const char *);
 extern void collect_symbol_completion_matches_type (completion_tracker &tracker,
                                                    const char *, const char *,
                                                    enum type_code);
 
 extern void collect_file_symbol_completion_matches (completion_tracker &tracker,
+                                                   complete_symbol_mode,
                                                    const char *,
                                                    const char *,
                                                    const char *);
@@ -1541,14 +1550,48 @@ extern CORE_ADDR skip_prologue_using_sal (struct gdbarch *gdbarch,
 extern struct symbol *fixup_symbol_section (struct symbol *,
                                            struct objfile *);
 
+/* If MSYMBOL is an text symbol, look for a function debug symbol with
+   the same address.  Returns NULL if not found.  This is necessary in
+   case a function is an alias to some other function, because debug
+   information is only emitted for the alias target function's
+   definition, not for the alias.  */
+extern symbol *find_function_alias_target (bound_minimal_symbol msymbol);
+
 /* Symbol searching */
 /* Note: struct symbol_search, search_symbols, et.al. are declared here,
    instead of making them local to symtab.c, for gdbtk's sake.  */
 
-/* When using search_symbols, a list of the following structs is returned.
-   Callers must free the search list using free_search_symbols!  */
+/* When using search_symbols, a vector of the following structs is
+   returned.  */
 struct symbol_search
 {
+  symbol_search (int block_, struct symbol *symbol_)
+    : block (block_),
+      symbol (symbol_)
+  {
+    msymbol.minsym = nullptr;
+    msymbol.objfile = nullptr;
+  }
+
+  symbol_search (int block_, struct minimal_symbol *minsym,
+                struct objfile *objfile)
+    : block (block_),
+      symbol (nullptr)
+  {
+    msymbol.minsym = minsym;
+    msymbol.objfile = objfile;
+  }
+
+  bool operator< (const symbol_search &other) const
+  {
+    return compare_search_syms (*this, other) < 0;
+  }
+
+  bool operator== (const symbol_search &other) const
+  {
+    return compare_search_syms (*this, other) == 0;
+  }
+
   /* The block in which the match was found.  Could be, for example,
      STATIC_BLOCK or GLOBAL_BLOCK.  */
   int block;
@@ -1562,15 +1605,15 @@ struct symbol_search
      which only minimal_symbols exist.  */
   struct bound_minimal_symbol msymbol;
 
-  /* A link to the next match, or NULL for the end.  */
-  struct symbol_search *next;
+private:
+
+  static int compare_search_syms (const symbol_search &sym_a,
+                                 const symbol_search &sym_b);
 };
 
-extern void search_symbols (const char *, enum search_domain, int,
-                           const char **, struct symbol_search **);
-extern void free_search_symbols (struct symbol_search *);
-extern struct cleanup *make_cleanup_free_search_symbols (struct symbol_search
-                                                        **);
+extern std::vector<symbol_search> search_symbols (const char *,
+                                                 enum search_domain, int,
+                                                 const char **);
 
 /* The name of the ``main'' function.
    FIXME: cagney/2001-03-20: Can't make main_name() const since some
This page took 0.035758 seconds and 4 git commands to generate.