aboutsummaryrefslogtreecommitdiff
path: root/gdb/dwarf2read.c
diff options
context:
space:
mode:
authorPaul N. Hilfinger <hilfinger@adacore.com>2010-10-07 07:13:51 +0000
committerPaul N. Hilfinger <hilfinger@adacore.com>2010-10-07 07:13:51 +0000
commit40658b9446ce0507f120bdc69c51c3dfbfd35381 (patch)
treebf7dc4987b4885a535d3481cf952858337588741 /gdb/dwarf2read.c
parentc4d840bdd6f9e19843bd35835cc08e992fe5e1db (diff)
downloadgdb-40658b9446ce0507f120bdc69c51c3dfbfd35381.zip
gdb-40658b9446ce0507f120bdc69c51c3dfbfd35381.tar.gz
gdb-40658b9446ce0507f120bdc69c51c3dfbfd35381.tar.bz2
Rework symbol searches to move Ada-specific stuff to ada-lang.c.
This is a clean-up of some of our symbol-lookup machinery to pull some kludgy Ada-specific definitions out of psymtab.c. In place of map_ada_symtabs and ada_lookup_partial_symbol, we have a method map_matching_symbols, which searches through all symbol tables and partial symbol tables looking for a symbol that matches according to a matching function that is passed as a parameter. This requires some care, because partial symbol tables speed up searches by binary search, while full symbol tables use hashing. To call map_matching_symbols, therefore, you may need to supply both a matching function that is compatible with the dictionary hash function and an ordering relation that is compatible with strcmp_iw, which is used to order partial symbol tables. Having added this general routine to psymtab.c, we use it in ada-lang.c to rework add_non_local_symbols (now renamed add_nonlocal_symbols). Changelog: gdb/ * ada-lang.c (full_match): Declare. (ada_match_name): Rename to match_name (we should avoid prefixing static symbols with "ada_"). (match_name): New name for ada_match_name. (struct ada_psym_data): Remove and replace with... (struct match_data): User data for map_matching_symbols. (ada_add_psyms): Remove. (aux_add_nonlocal_symbols): New function, used as callback for map_matching_symbols. (compare_names): Ordering function adopted from strcmp_iw for Ada-encoded symbols. (ada_add_non_local_symbols): Rename to add_nonlocal_symbols. (add_nonlocal_symbols): Renamed from ada_add_non_local_symbols. Rework to use map_matching_symbols instead of map_ada_symtabs. (ada_lookup_symbol_list): Use add_nonlocal_symbols. * psymtab.c: Include dependency on dictionary.h. (match_partial_symbol): New function. (ada_lookup_partial_symbol): Remove. (map_block): New function, auxiliary to map_matching_symbols_psymtab. (map_matching_symbols_psymtab): New function. (psym_functions): Replace map_ada_symtabs with map_matching_symbols_psymtab. * symfile.h: Replace map_ada_symtabs definition with map_matching_symbols.
Diffstat (limited to 'gdb/dwarf2read.c')
-rw-r--r--gdb/dwarf2read.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index 02304cb..5aeb739 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -2371,16 +2371,16 @@ dw2_find_symbol_file (struct objfile *objfile, const char *name)
}
static void
-dw2_map_ada_symtabs (struct objfile *objfile,
- int (*wild_match) (const char *, const char *),
- int (*is_name_suffix) (const char *),
- void (*callback) (struct objfile *,
- struct symtab *, void *),
- const char *name, int global,
- domain_enum namespace, int wild,
- void *data)
-{
- /* For now, we don't support Ada. Still the function can be called if the
+dw2_map_matching_symbols (const char * name, domain_enum namespace,
+ struct objfile *objfile, int global,
+ int (*callback) (struct block *,
+ struct symbol *, void *),
+ void *data,
+ int (*match) (const char *, const char *),
+ int (*ordered_compare) (const char *,
+ const char *))
+{
+ /* Currently unimplemented; used for Ada. The function can be called if the
current language is Ada for a non-Ada objfile using GNU index. As Ada
does not look for non-Ada symbols this function should just return. */
}
@@ -2560,7 +2560,7 @@ const struct quick_symbol_functions dwarf2_gdb_index_functions =
dw2_expand_all_symtabs,
dw2_expand_symtabs_with_filename,
dw2_find_symbol_file,
- dw2_map_ada_symtabs,
+ dw2_map_matching_symbols,
dw2_expand_symtabs_matching,
dw2_find_pc_sect_symtab,
dw2_map_symbol_names,