OLD | NEW |
1 /* Routines for name->symbol lookups in GDB. | 1 /* Routines for name->symbol lookups in GDB. |
2 | 2 |
3 Copyright (C) 2003, 2007-2012 Free Software Foundation, Inc. | 3 Copyright (C) 2003, 2007-2012 Free Software Foundation, Inc. |
4 | 4 |
5 Contributed by David Carlton <carlton@bactrian.org> and by Kealia, | 5 Contributed by David Carlton <carlton@bactrian.org> and by Kealia, |
6 Inc. | 6 Inc. |
7 | 7 |
8 This file is part of GDB. | 8 This file is part of GDB. |
9 | 9 |
10 This program is free software; you can redistribute it and/or modify | 10 This program is free software; you can redistribute it and/or modify |
(...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
491 } | 491 } |
492 | 492 |
493 /* Add SYM to DICT. DICT had better be expandable. */ | 493 /* Add SYM to DICT. DICT had better be expandable. */ |
494 | 494 |
495 void | 495 void |
496 dict_add_symbol (struct dictionary *dict, struct symbol *sym) | 496 dict_add_symbol (struct dictionary *dict, struct symbol *sym) |
497 { | 497 { |
498 (DICT_VECTOR (dict))->add_symbol (dict, sym); | 498 (DICT_VECTOR (dict))->add_symbol (dict, sym); |
499 } | 499 } |
500 | 500 |
| 501 /* Utility to add a list of symbols to a dictionary. |
| 502 DICT must be an expandable dictionary. */ |
| 503 |
| 504 void |
| 505 dict_add_pending (struct dictionary *dict, const struct pending *symbol_list) |
| 506 { |
| 507 const struct pending *list; |
| 508 int i; |
| 509 |
| 510 for (list = symbol_list; list != NULL; list = list->next) |
| 511 { |
| 512 for (i = 0; i < list->nsyms; ++i) |
| 513 dict_add_symbol (dict, list->symbol[i]); |
| 514 } |
| 515 } |
| 516 |
501 /* Initialize ITERATOR to point at the first symbol in DICT, and | 517 /* Initialize ITERATOR to point at the first symbol in DICT, and |
502 return that first symbol, or NULL if DICT is empty. */ | 518 return that first symbol, or NULL if DICT is empty. */ |
503 | 519 |
504 struct symbol * | 520 struct symbol * |
505 dict_iterator_first (const struct dictionary *dict, | 521 dict_iterator_first (const struct dictionary *dict, |
506 struct dict_iterator *iterator) | 522 struct dict_iterator *iterator) |
507 { | 523 { |
508 return (DICT_VECTOR (dict))->iterator_first (dict, iterator); | 524 return (DICT_VECTOR (dict))->iterator_first (dict, iterator); |
509 } | 525 } |
510 | 526 |
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
793 { | 809 { |
794 if (strncmp (string, "_ada_", 5) == 0) | 810 if (strncmp (string, "_ada_", 5) == 0) |
795 string += 5; | 811 string += 5; |
796 else | 812 else |
797 return msymbol_hash_iw (string0); | 813 return msymbol_hash_iw (string0); |
798 } | 814 } |
799 | 815 |
800 hash = 0; | 816 hash = 0; |
801 while (*string) | 817 while (*string) |
802 { | 818 { |
| 819 /* Ignore "TKB" suffixes. |
| 820 |
| 821 These are used by Ada for subprograms implementing a task body. |
| 822 For instance for a task T inside package Pck, the name of the |
| 823 subprogram implementing T's body is `pck__tTKB'. We need to |
| 824 ignore the "TKB" suffix because searches for this task body |
| 825 subprogram are going to be performed using `pck__t' (the encoded |
| 826 version of the natural name `pck.t'). */ |
| 827 if (strcmp (string, "TKB") == 0) |
| 828 return hash; |
| 829 |
803 switch (*string) | 830 switch (*string) |
804 { | 831 { |
805 case '$': | 832 case '$': |
806 case '.': | 833 case '.': |
807 case 'X': | 834 case 'X': |
808 if (string0 == string) | 835 if (string0 == string) |
809 return msymbol_hash_iw (string0); | 836 return msymbol_hash_iw (string0); |
810 else | 837 else |
811 return hash; | 838 return hash; |
812 case ' ': | 839 case ' ': |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
916 { | 943 { |
917 DICT_LINEAR_EXPANDABLE_CAPACITY (dict) *= 2; | 944 DICT_LINEAR_EXPANDABLE_CAPACITY (dict) *= 2; |
918 DICT_LINEAR_SYMS (dict) | 945 DICT_LINEAR_SYMS (dict) |
919 = xrealloc (DICT_LINEAR_SYMS (dict), | 946 = xrealloc (DICT_LINEAR_SYMS (dict), |
920 DICT_LINEAR_EXPANDABLE_CAPACITY (dict) | 947 DICT_LINEAR_EXPANDABLE_CAPACITY (dict) |
921 * sizeof (struct symbol *)); | 948 * sizeof (struct symbol *)); |
922 } | 949 } |
923 | 950 |
924 DICT_LINEAR_SYM (dict, nsyms - 1) = sym; | 951 DICT_LINEAR_SYM (dict, nsyms - 1) = sym; |
925 } | 952 } |
OLD | NEW |