* symtab.h (symbol_name_match_p_ftype): New typedef.
(iterate_over_symbols): Use the above.
* symtab.c (iterate_over_symbols): Likewise.
* language.h (language_defn->la_iterate_over_symbols): Likewise.
* ada-lang.c (ada_iterate_over_symbols): Likewise.
* linespec.c (iterate_over_all_matching_symtabs): Likewise.
(iterate_name_matcher): Document return values.
(collect_one_symbol): Likewise.
(collect_function_symbols): Likewise.
(collect_symbols): Likewise.
+2012-02-01 Gary Benson <gbenson@redhat.com>
+
+ * symtab.h (symbol_name_match_p_ftype): New typedef.
+ (iterate_over_symbols): Use the above.
+ * symtab.c (iterate_over_symbols): Likewise.
+ * language.h (language_defn->la_iterate_over_symbols): Likewise.
+ * ada-lang.c (ada_iterate_over_symbols): Likewise.
+ * linespec.c (iterate_over_all_matching_symtabs): Likewise.
+ (iterate_name_matcher): Document return values.
+ (collect_one_symbol): Likewise.
+ (collect_function_symbols): Likewise.
+ (collect_symbols): Likewise.
+
2012-02-01 Tom Tromey <tromey@redhat.com>
* ada-lang.c (resolve_subexp): Update.
static void
ada_iterate_over_symbols (const struct block *block,
const char *name, domain_enum domain,
- int (*callback) (struct symbol *, void *),
+ symbol_found_callback_ftype *callback,
void *data)
{
int ndefs, i;
void (*la_iterate_over_symbols) (const struct block *block,
const char *name,
domain_enum domain,
- int (*callback) (struct symbol *, void *),
+ symbol_found_callback_ftype *callback,
void *data);
/* Add fields above this point, so the magic number is always last. */
const struct symbol_matcher_data *data = d;
if (data->symbol_name_match_p (name, data->lookup_name) == 0)
- return 1;
- return 0;
+ return 1; /* Expand this symbol's symbol table. */
+ return 0; /* Skip this symbol. */
}
/* A helper that walks over all matching symtabs in all objfiles and
static void
iterate_over_all_matching_symtabs (const char *name,
const domain_enum domain,
- int (*callback) (struct symbol *, void *),
+ symbol_found_callback_ftype *callback,
void *data,
struct program_space *search_pspace)
{
struct type *t;
if (SYMBOL_CLASS (sym) != LOC_TYPEDEF)
- return 1;
+ return 1; /* Continue iterating. */
t = SYMBOL_TYPE (sym);
CHECK_TYPEDEF (t);
if (TYPE_CODE (t) != TYPE_CODE_STRUCT
&& TYPE_CODE (t) != TYPE_CODE_UNION
&& TYPE_CODE (t) != TYPE_CODE_NAMESPACE)
- return 1;
+ return 1; /* Continue iterating. */
slot = htab_find_slot (collector->unique_syms, sym, INSERT);
if (!*slot)
VEC_safe_push (symbolp, collector->symbols, sym);
}
- return 1;
+ return 1; /* Continue iterating. */
}
/* Return the symbol corresponding to the substring of *ARGPTR ending
if (SYMBOL_CLASS (sym) == LOC_BLOCK)
VEC_safe_push (symbolp, *syms, sym);
- return 1;
+ return 1; /* Continue iterating. */
}
/* Look up a function symbol in *ARGPTR. If found, advance *ARGPTR
add_sal_to_sals (info->state, &info->result, &sal,
SYMBOL_NATURAL_NAME (sym));
- return 1;
+ return 1; /* Continue iterating. */
}
/* We've found a minimal symbol MSYMBOL to associate with our
void
iterate_over_symbols (const struct block *block, const char *name,
const domain_enum domain,
- int (*callback) (struct symbol *, void *),
+ symbol_found_callback_ftype *callback,
void *data)
{
while (block)
VEC (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. */
+
+typedef int (symbol_found_callback_ftype) (struct symbol *sym, void *data);
+
void iterate_over_symbols (const struct block *block, const char *name,
const domain_enum domain,
- int (*callback) (struct symbol *, void *),
+ symbol_found_callback_ftype *callback,
void *data);
struct cleanup *demangle_for_lookup (const char *name, enum language lang,