Two modifications:
1. The addition of 2013 to the copyright year range for every file;
2. The use of a single year range, instead of potentially multiple
year ranges, as approved by the FSF.
Consider the following declaration:
package Pck is
task Dummy_Task is
entry Start;
end Dummy_Task;
end Pck;
Inserting a breakpoint on the body of that task does not currently
work:
(gdb) b pck.dummy_task
"pck.dummy_task" is not a function
Make breakpoint pending on future shared library load? (y or [n]) n
What happens here is that the compiler generates two symbols:
(a) Symbol `pck__dummy_task' which is a *variable* referencing
the task;
(b) Symbol `pck__dummy_taskTKB' which is the subprogram implementing
the body of the task.
The symbol lookup only finds the variable before of the TKB suffix in
the subprogram name. This patch fixes the problem by adjusting the
ada-lang.c:is_name_suffix routine to recognize "TKB" suffixes. But
that's not enough, because the search in the symtab is performed via
the block dictionary, using a hashing algorithm. So, for the search
to find `pck__dummy_taskTKB', I had to modify the hashing function
to ignore TKB suffixes as well.
gdb/ChangeLog:
* ada-lang.c (is_name_suffix): Add handling of "TKB" suffixes.
Update function documentation.
* dictionary.c (dict_hash): Ignore "TKB" suffixes in hash
computation.
gdb/testsuite/ChangeLog:
* gdb.ada/task_bp: New testcase.
Code cleanup.
* dictionary.c (dict_hash): Use SYMBOL_HASH_NEXT.
* dwarf2read.c (mapped_index_string_hash): Refer to SYMBOL_HASH_NEXT
in the function comment, a new note on values compatibility.
* minsyms.c (msymbol_hash_iw, msymbol_hash): Use SYMBOL_HASH_NEXT.
* symtab.h (SYMBOL_HASH_NEXT): New.
This change gets rid of an ARI warning which was recently introduced
by one of our changes.
gdb/ChangeLog:
* dictionary.c (dict_hash): Move assignment out of if condition.
Several changes to dict_hash from Adacore's local version were inadvertantly
left out of the last change to that function. These changes conservatively
cause dict_hash to revert to msymbol_hash_iw in more cases where the symbol
being hashed is known not to be Ada-encoded. This avoids a few cases where
the function hashes large groups of names with similar prefixes to the same
value.
Changelog:
gdb/
* dictionary.c (dict_hash): Revert to msymbol_hash_iw in
more cases.
This patch allows Ada to speed up symbol lookup by using the facilities
in dictionary.[ch] for hashed lookups. First, we generalize dictionary
search to allow clients to specify any matching function compatible with
the hashing function. Next, we modify the hashing algorithm so that symbols
that wild-match a name hash to the same value. Finally, we modify Ada
symbol lookup to use these facilities.
Because this patch touches on a hashing algorithm used by other
languages, I took the precaution of doing a speed test on a list of
about 12000 identifiers (repeatedly inserting all of them into a table
and then doing a lookup on a million names at random, thus testing the
speed of the hashing algorithm and how well it distributed names).
There was actually a slight speedup, probably as a result of open-
coding some of the tests in msymbol_hash_iw. By design, the revised
hashing algorithm produces the same results as the original on most
"normal" C identifiers.
We considered augmenting the dictionary interface still further by allowing
different hashing algorithms for different dictionaries, based on the
(supposed) language of the symbols in that dictionary. While this produced
better isolation of the changes to Ada programs, the additional flexibility
also complicated the dictionary interface. I'd prefer to keep things
simple for now.
Tested w/o regressions on Linux i686.
ChangeLog:
gdb/
* ada-lang.c (ada_match_name): Use new API for wild_match.
(wild_match): Change API to be consistent with that of strcmp_iw;
return 0 for a match, and switch operand order.
(full_match): New function.
(ada_add_block_symbols): Use dict_iter_match_{first,next} for
matching to allow use of hashing.
* dictionary.c (struct dict_vector): Generalize iter_name_first,
iter_name_next ot iter_match_first, iter_match_next.
(iter_name_first_hashed): Replace with iter_match_first_hashed.
(iter_name_next_hashed): Replace with iter_match_next_hashed.
(iter_name_first_linear): Replace with iter_match_first_linear.
(iter_name_next_linear): Replace with iter_match_next_linear.
(dict_iter_name_first): Re-implement to use dict_iter_match_first.
(dict_iter_name_next): Re-implement to use dict_iter_match_next.
(dict_iter_match_first): New function.
(dict_iter_match_next): New function.
(dict_hash): New function.
* dictionary.h (dict_iter_match_first, dict_iter_match_next): Declare.
* psymtab.c (ada_lookup_partial_symbol): Use new wild_match API.
(SYMBOL_MATCHES_SEARCH_NAME): New definition.
(symbol_search_name): Declare.
* dictionary.c (iter_name_first_hashed): Match on SYMBOL_SEARCH_NAME.
(iter_name_next_hashed): Ditto.
(iter_name_next_linear): Ditto.
(insert_symbol_hashed): Hash on SYMBOL_SEARCH_NAME.
* symtab.c (lookup_partial_symbol): Assume symbols ordered by
search name, using SYMBOL_SEARCH_NAME and SYMBOL_MATCHES_SEARCH_NAME.
(symbol_search_name): New function.
* symfile.c (compare_psymbols): Order by SYMBOL_SEARCH_NAME.
* minsyms.c (build_minimal_symbol_hash_tables): Change
test for adding to demangled hash table to check for difference
between SYMBOL_SEARCH_NAME and SYMBOL_LINKAGE_NAME.
* dictionary.h: New.
* dictionary.c: New.
* block.h: Add opaque declaration for struct dictionary.
(struct block): Add 'dict' member; delete 'hashtable', 'nsyms',
'sym' members.
(BLOCK_DICT): New macro.
Delete macros BLOCK_HASHTABLE, BLOCK_NSYMS, BLOCK_SYM,
BLOCK_BUCKETS, BLOCK_BUCKET, BLOCK_HASHTABLE_SIZE,
BLOCK_SHOULD_SORT.
(ALL_BLOCK_SYMBOLS): Update definition.
* Makefile.in (SFILES): Add dictionary.c.
(dictionary_h): New.
(COMMON_OBS): Add dictionary.o.
(dictionary.o): New.
(ada-lang.o): Depend on dictionary_h.
(buildsym.o, coffread.o, jv-lang.o, mdebugread.o, objfiles.o)
(stack.o, symmisc.o, symtab.o, tracepoint.o, valops.o)
(mi-cmd-stack.o): Ditto.
(gdbtk-cmds.o): Update dependencies.
(gdbtk-stack.o): Ditto.
* ada-lang.c: Include dictionary.h.
(symtab_for_sym): Update uses of ALL_BLOCK_SYMBOLS.
(fill_in_ada_prototype, debug_print_block): Ditto.
(ada_add_block_symbols): Update uses of ALL_BLOCK_SYMBOLS; replace
explicit iteration by use of ALL_BLOCK_SYMBOLS. Delete variable
'is_sorted'.
* mdebugread.c: Include dictionary.h.
(struct parse_stack): Delete 'maxsyms' member.
(parse_symbol): Update calls to new_block. Delete calls to
shrink_block. Use dictionary methods.
(psymtab_to_symtab_1): Delete calls to sort_symtab_syms.
Update calls to new_symtab. Don't maintain maxsyms data.
(mylookup_symbol): Update use of ALL_BLOCK_SYMBOLS.
(add_symbol): Just call dict_add_symbol.
(new_symtab): Delete 'maxsyms' argument.
(new_symtab): Update calls to new_block.
(new_block): Delete 'maxsyms' argument; add 'function' argument.
(shrink_block): Delete function.
(fixup_sigtramp): Update call to new_block. Add symbol via
dict_add_symbol.
* jv-lang.c: Include dictionary.h.
(get_java_class_symtab): Set the BLOCK_DICT of the blocks
appropriately. Set class_symtab->free_func. Make sure the
blockvector is big enough to hold two blocks.
(add_class_symtab_symbol): Use dictionary methods.
(free_class_block): New function.
(type_from_class): Replace explicit iteration by
ALL_BLOCK_SYMBOLS.
* symtab.h (struct symtab): Replace 'free_ptr' method by
'free_func'.
* dwarf2read.c (psymtab_to_symtab_1): Delete call to
sort_symtab_syms.
* dwarfread.c (psymtab_to_symtab_1): Delete call to
sort_symtab_syms.
* coffread.c (coff_symfile_read): Delete call to sort_symtab_syms.
Include dictionary.h.
(patch_opaque_types): Update use of ALL_BLOCK_SYMBOLS.
* dbxread.c (dbx_psymtab_to_symtab_1): Delete call to
sort_symtab_syms.
* objfiles.c: Include dictionary.h.
(objfile_relocate): Update use of ALL_BLOCK_SYMBOLS.
* buildsym.c: Include dictionary.h.
(finish_block): Use dictionary methods.
(end_symtab): Set free_func to NULL, not free_ptr.
* tracepoint.c: Include dictionary.h.
(add_local_symbols): Update use of ALL_BLOCK_SYMBOLS.
(scope_info): Ditto.
* stack.c: Include dictionary.h.
(print_block_frame_locals): Update use of ALL_BLOCK_SYMBOLS.
(print_block_frame_labels, print_frame_arg_vars)
(print_frame_args): Ditto.
* symmisc.c (free_symtab_block): Use dictionary methods.
(dump_symtab): Ditto.
(free_symtab): Replace use of 'free_ptr' by 'free_func'.
Include dictionary.h.
* symfile.h: Delete declarations of sort_block_syms,
sort_symtab_syms.
* symfile.c (sort_block_syms): Delete.
(sort_symtab_syms): Delete.
* symtab.c: Include dictionary.h.
(lookup_block_symbol): Use dictionary iterators.
(find_pc_sect_symtab): Update use of ALL_BLOCK_SYMBOLS.
(search_symbols, make_symbol_completion_list): Ditto.
(make_symbol_overload_list): Ditto.
* valops.c (value_of_local): Use dict_empty.
Include dictionary.h.
2003-06-11 David Carlton <carlton@bactrian.org>
* generic/gdbtk-stack.c: Include dictionary.h.
(gdb_block_vars): Update use of ALL_BLOCK_SYMBOLS.
(gdb_get_blocks, gdb_get_vars_command): Ditto.
* generic/gdbtk-cmds.c: Include dictionary.h.
(gdb_listfuncs): Update use of ALL_BLOCK_SYMBOLS.
2003-06-11 David Carlton <carlton@bactrian.org>
* mi-cmd-stack.c: Include dictionary.h.
(list_args_or_locals): Update use of ALL_BLOCK_SYMBOLS.