X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=gdb%2Fdictionary.c;h=2c81182cb5cffbf44d27a52ec3c373b6cb24b9ee;hb=df25ebbd091aebc132f97ffd6ce9cf7964a57981;hp=afdf53e3b1ac28961998c115b52879068ee85b4e;hpb=7b6bb8daaceb9ecf3f42dea57ae82733d6a3b2f6;p=deliverable%2Fbinutils-gdb.git diff --git a/gdb/dictionary.c b/gdb/dictionary.c index afdf53e3b1..2c81182cb5 100644 --- a/gdb/dictionary.c +++ b/gdb/dictionary.c @@ -1,7 +1,6 @@ /* Routines for name->symbol lookups in GDB. - Copyright (C) 2003, 2007, 2008, 2009, 2010, 2011 - Free Software Foundation, Inc. + Copyright (C) 2003-2015 Free Software Foundation, Inc. Contributed by David Carlton and by Kealia, Inc. @@ -26,7 +25,6 @@ #include "gdb_obstack.h" #include "symtab.h" #include "buildsym.h" -#include "gdb_assert.h" #include "dictionary.h" /* This file implements dictionaries, which are tables that associate @@ -83,9 +81,7 @@ * Define a function dict_ that looks up in the dict_vector and calls the appropriate function. Add a declaration for - dict_ to dictionary.h. - -*/ + dict_ to dictionary.h. */ /* An enum representing the various implementations of dictionaries. Used only for debugging. */ @@ -501,6 +497,22 @@ dict_add_symbol (struct dictionary *dict, struct symbol *sym) (DICT_VECTOR (dict))->add_symbol (dict, sym); } +/* Utility to add a list of symbols to a dictionary. + DICT must be an expandable dictionary. */ + +void +dict_add_pending (struct dictionary *dict, const struct pending *symbol_list) +{ + const struct pending *list; + int i; + + for (list = symbol_list; list != NULL; list = list->next) + { + for (i = 0; i < list->nsyms; ++i) + dict_add_symbol (dict, list->symbol[i]); + } +} + /* Initialize ITERATOR to point at the first symbol in DICT, and return that first symbol, or NULL if DICT is empty. */ @@ -540,7 +552,8 @@ dict_iter_match_first (const struct dictionary *dict, const char *name, symbol_compare_ftype *compare, struct dict_iterator *iterator) { - return (DICT_VECTOR (dict))->iter_match_first (dict, name, compare, iterator); + return (DICT_VECTOR (dict))->iter_match_first (dict, name, + compare, iterator); } struct symbol * @@ -802,6 +815,17 @@ dict_hash (const char *string0) hash = 0; while (*string) { + /* Ignore "TKB" suffixes. + + These are used by Ada for subprograms implementing a task body. + For instance for a task T inside package Pck, the name of the + subprogram implementing T's body is `pck__tTKB'. We need to + ignore the "TKB" suffix because searches for this task body + subprogram are going to be performed using `pck__t' (the encoded + version of the natural name `pck.t'). */ + if (strcmp (string, "TKB") == 0) + return hash; + switch (*string) { case '$': @@ -827,7 +851,7 @@ dict_hash (const char *string0) } /* FALL THROUGH */ default: - hash = hash * 67 + *string - 113; + hash = SYMBOL_HASH_NEXT (hash, *string); string += 1; break; }