/* Symbol table definitions for GDB.
- Copyright (C) 1986-2016 Free Software Foundation, Inc.
+ Copyright (C) 1986-2017 Free Software Foundation, Inc.
This file is part of GDB.
#if !defined (SYMTAB_H)
#define SYMTAB_H 1
-#include "vec.h"
+#include <vector>
#include "gdb_vecs.h"
#include "gdbtypes.h"
#include "common/enum-flags.h"
+#include "common/function-view.h"
+#include "completer.h"
/* Opaque declarations. */
struct ui_file;
the caller will generate the right code in the process of
treating this as an lvalue or rvalue. */
- void (*tracepoint_var_ref) (struct symbol *symbol, struct gdbarch *gdbarch,
- struct agent_expr *ax, struct axs_value *value);
+ void (*tracepoint_var_ref) (struct symbol *symbol, struct agent_expr *ax,
+ struct axs_value *value);
/* Generate C code to compute the location of SYMBOL. The C code is
emitted to STREAM. GDBARCH is the current architecture and PC is
The generated C code must assign the location to a local
variable; this variable's name is RESULT_NAME. */
- void (*generate_c_location) (struct symbol *symbol, struct ui_file *stream,
+ void (*generate_c_location) (struct symbol *symbol, string_file &stream,
struct gdbarch *gdbarch,
unsigned char *registers_used,
CORE_ADDR pc, const char *result_name);
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
extern void select_source_symtab (struct symtab *);
-extern VEC (char_ptr) *default_make_symbol_completion_list_break_on
- (const char *text, const char *word, const char *break_on,
+/* 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 VEC (char_ptr) *default_make_symbol_completion_list (const char *,
- const char *,
- enum type_code);
-extern VEC (char_ptr) *make_symbol_completion_list (const char *, const char *);
-extern VEC (char_ptr) *make_symbol_completion_type (const char *, const char *,
+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 VEC (char_ptr) *make_symbol_completion_list_fn (struct cmd_list_element *,
- const char *,
- const char *);
-extern VEC (char_ptr) *make_file_symbol_completion_list (const char *,
- const char *,
- const char *);
+extern void collect_file_symbol_completion_matches (completion_tracker &tracker,
+ complete_symbol_mode,
+ const char *,
+ const char *,
+ const char *);
-extern VEC (char_ptr) *make_source_files_completion_list (const char *,
- const char *);
+extern completion_list
+ make_source_files_completion_list (const char *, const char *);
/* symtab.c */
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. */
int compare_glob_filenames_for_search (const char *filename,
const char *search_name);
-int iterate_over_some_symtabs (const char *name,
- const char *real_path,
- int (*callback) (struct symtab *symtab,
- void *data),
- void *data,
- struct compunit_symtab *first,
- struct compunit_symtab *after_last);
+bool iterate_over_some_symtabs (const char *name,
+ const char *real_path,
+ struct compunit_symtab *first,
+ struct compunit_symtab *after_last,
+ gdb::function_view<bool (symtab *)> callback);
void iterate_over_symtabs (const char *name,
- int (*callback) (struct symtab *symtab,
- void *data),
- void *data);
+ gdb::function_view<bool (symtab *)> callback);
+
-VEC (CORE_ADDR) *find_pcs_for_symtab_line (struct symtab *symtab, int line,
- struct linetable_entry **best_entry);
+std::vector<CORE_ADDR> find_pcs_for_symtab_line
+ (struct symtab *symtab, int line, struct linetable_entry **best_entry);
-/* Callback for LA_ITERATE_OVER_SYMBOLS. The callback will be called
- once per matching symbol SYM, with DATA being the argument of the
- same name that was passed to LA_ITERATE_OVER_SYMBOLS. The callback
- should return nonzero to indicate that LA_ITERATE_OVER_SYMBOLS
- should continue iterating, or zero to indicate that the iteration
- should end. */
+/* Prototype for callbacks for LA_ITERATE_OVER_SYMBOLS. The callback
+ is called once per matching symbol SYM. The callback should return
+ true to indicate that LA_ITERATE_OVER_SYMBOLS should continue
+ iterating, or false to indicate that the iteration should end. */
-typedef int (symbol_found_callback_ftype) (struct symbol *sym, void *data);
+typedef bool (symbol_found_callback_ftype) (symbol *sym);
void iterate_over_symbols (const struct block *block, const char *name,
const domain_enum domain,
- symbol_found_callback_ftype *callback,
- void *data);
+ gdb::function_view<symbol_found_callback_ftype> callback);
/* Storage type used by demangle_for_lookup. demangle_for_lookup
either returns a const char * pointer that points to either of the