1 /* Support routines for building symbol tables in GDB's internal format.
2 Copyright 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1995, 1996
3 Free Software Foundation, Inc.
5 This file is part of GDB.
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
21 /* This module provides subroutines used for creating and adding to
22 the symbol table. These routines are called from various symbol-
23 file-reading routines.
25 Routines to support specific debugging information formats (stabs,
26 DWARF, etc) belong somewhere else. */
32 #include "symfile.h" /* Needed for "struct complaint" */
35 #include "complaints.h"
36 #include "gdb_string.h"
38 /* Ask buildsym.h to define the vars it normally declares `extern'. */
40 #include "buildsym.h" /* Our own declarations */
43 /* For cleanup_undefined_types and finish_global_stabs (somewhat
44 questionable--see comment where we call them). */
45 #include "stabsread.h"
48 compare_line_numbers PARAMS ((const void *, const void *));
50 static struct blockvector *
51 make_blockvector PARAMS ((struct objfile *));
54 /* Initial sizes of data structures. These are realloc'd larger if needed,
55 and realloc'd down to the size actually used, when completed. */
57 #define INITIAL_CONTEXT_STACK_SIZE 10
58 #define INITIAL_LINE_VECTOR_LENGTH 1000
61 /* Complaints about the symbols we have encountered. */
63 struct complaint innerblock_complaint =
64 {"inner block not inside outer block in %s", 0, 0};
66 struct complaint innerblock_anon_complaint =
67 {"inner block not inside outer block", 0, 0};
69 struct complaint blockvector_complaint =
70 {"block at 0x%lx out of order", 0, 0};
73 /* maintain the lists of symbols and blocks */
75 /* Add a symbol to one of the lists of symbols. */
78 add_symbol_to_list (symbol, listhead)
79 struct symbol *symbol;
80 struct pending **listhead;
82 register struct pending *link;
84 /* We keep PENDINGSIZE symbols in each link of the list.
85 If we don't have a link with room in it, add a new link. */
86 if (*listhead == NULL || (*listhead)->nsyms == PENDINGSIZE)
91 free_pendings = link->next;
95 link = (struct pending *) xmalloc (sizeof (struct pending));
98 link->next = *listhead;
103 (*listhead)->symbol[(*listhead)->nsyms++] = symbol;
106 /* Find a symbol named NAME on a LIST. NAME need not be '\0'-terminated;
107 LENGTH is the length of the name. */
110 find_symbol_in_list (list, name, length)
111 struct pending *list;
120 for (j = list->nsyms; --j >= 0; )
122 pp = SYMBOL_NAME (list->symbol[j]);
123 if (*pp == *name && strncmp (pp, name, length) == 0 &&
126 return (list->symbol[j]);
134 /* At end of reading syms, or in case of quit,
135 really free as many `struct pending's as we can easily find. */
139 really_free_pendings (foo)
142 struct pending *next, *next1;
144 struct pending_block *bnext, *bnext1;
147 for (next = free_pendings; next; next = next1)
152 free_pendings = NULL;
154 #if 0 /* Now we make the links in the symbol_obstack, so don't free them. */
155 for (bnext = pending_blocks; bnext; bnext = bnext1)
157 bnext1 = bnext->next;
161 pending_blocks = NULL;
163 for (next = file_symbols; next != NULL; next = next1)
170 for (next = global_symbols; next != NULL; next = next1)
175 global_symbols = NULL;
178 /* Take one of the lists of symbols and make a block from it.
179 Keep the order the symbols have in the list (reversed from the input file).
180 Put the block on the list of pending blocks. */
183 finish_block (symbol, listhead, old_blocks, start, end, objfile)
184 struct symbol *symbol;
185 struct pending **listhead;
186 struct pending_block *old_blocks;
187 CORE_ADDR start, end;
188 struct objfile *objfile;
190 register struct pending *next, *next1;
191 register struct block *block;
192 register struct pending_block *pblock;
193 struct pending_block *opblock;
197 /* Count the length of the list of symbols. */
199 for (next = *listhead, i = 0;
201 i += next->nsyms, next = next->next)
206 block = (struct block *) obstack_alloc (&objfile -> symbol_obstack,
207 (sizeof (struct block) + ((i - 1) * sizeof (struct symbol *))));
209 /* Copy the symbols into the block. */
211 BLOCK_NSYMS (block) = i;
212 for (next = *listhead; next; next = next->next)
214 for (j = next->nsyms - 1; j >= 0; j--)
216 BLOCK_SYM (block, --i) = next->symbol[j];
220 BLOCK_START (block) = start;
221 BLOCK_END (block) = end;
222 /* Superblock filled in when containing block is made */
223 BLOCK_SUPERBLOCK (block) = NULL;
224 BLOCK_GCC_COMPILED (block) = processing_gcc_compilation;
226 /* Put the block in as the value of the symbol that names it. */
230 struct type *ftype = SYMBOL_TYPE (symbol);
231 SYMBOL_BLOCK_VALUE (symbol) = block;
232 BLOCK_FUNCTION (block) = symbol;
234 if (TYPE_NFIELDS (ftype) <= 0)
236 /* No parameter type information is recorded with the function's
237 type. Set that from the type of the parameter symbols. */
238 int nparams = 0, iparams;
240 for (i = 0; i < BLOCK_NSYMS (block); i++)
242 sym = BLOCK_SYM (block, i);
243 switch (SYMBOL_CLASS (sym))
248 case LOC_REGPARM_ADDR:
259 case LOC_CONST_BYTES:
262 case LOC_BASEREG_ARG:
264 case LOC_OPTIMIZED_OUT:
271 TYPE_NFIELDS (ftype) = nparams;
272 TYPE_FIELDS (ftype) = (struct field *)
273 TYPE_ALLOC (ftype, nparams * sizeof (struct field));
275 for (i = iparams = 0; iparams < nparams; i++)
277 sym = BLOCK_SYM (block, i);
278 switch (SYMBOL_CLASS (sym))
283 case LOC_REGPARM_ADDR:
284 TYPE_FIELD_TYPE (ftype, iparams) = SYMBOL_TYPE (sym);
295 case LOC_CONST_BYTES:
298 case LOC_BASEREG_ARG:
300 case LOC_OPTIMIZED_OUT:
310 BLOCK_FUNCTION (block) = NULL;
313 /* Now "free" the links of the list, and empty the list. */
315 for (next = *listhead; next; next = next1)
318 next->next = free_pendings;
319 free_pendings = next;
323 /* Install this block as the superblock
324 of all blocks made since the start of this scope
325 that don't have superblocks yet. */
328 for (pblock = pending_blocks; pblock != old_blocks; pblock = pblock->next)
330 if (BLOCK_SUPERBLOCK (pblock->block) == NULL)
333 /* Check to be sure the blocks are nested as we receive them.
334 If the compiler/assembler/linker work, this just burns a small
336 if (BLOCK_START (pblock->block) < BLOCK_START (block) ||
337 BLOCK_END (pblock->block) > BLOCK_END (block))
341 complain (&innerblock_complaint,
342 SYMBOL_SOURCE_NAME (symbol));
346 complain (&innerblock_anon_complaint);
348 BLOCK_START (pblock->block) = BLOCK_START (block);
349 BLOCK_END (pblock->block) = BLOCK_END (block);
352 BLOCK_SUPERBLOCK (pblock->block) = block;
357 /* Record this block on the list of all blocks in the file.
358 Put it after opblock, or at the beginning if opblock is 0.
359 This puts the block in the list after all its subblocks. */
361 /* Allocate in the symbol_obstack to save time.
362 It wastes a little space. */
363 pblock = (struct pending_block *)
364 obstack_alloc (&objfile -> symbol_obstack,
365 sizeof (struct pending_block));
366 pblock->block = block;
369 pblock->next = opblock->next;
370 opblock->next = pblock;
374 pblock->next = pending_blocks;
375 pending_blocks = pblock;
379 static struct blockvector *
380 make_blockvector (objfile)
381 struct objfile *objfile;
383 register struct pending_block *next;
384 register struct blockvector *blockvector;
387 /* Count the length of the list of blocks. */
389 for (next = pending_blocks, i = 0; next; next = next->next, i++) {;}
391 blockvector = (struct blockvector *)
392 obstack_alloc (&objfile -> symbol_obstack,
393 (sizeof (struct blockvector)
394 + (i - 1) * sizeof (struct block *)));
396 /* Copy the blocks into the blockvector.
397 This is done in reverse order, which happens to put
398 the blocks into the proper order (ascending starting address).
399 finish_block has hair to insert each block into the list
400 after its subblocks in order to make sure this is true. */
402 BLOCKVECTOR_NBLOCKS (blockvector) = i;
403 for (next = pending_blocks; next; next = next->next)
405 BLOCKVECTOR_BLOCK (blockvector, --i) = next->block;
408 #if 0 /* Now we make the links in the obstack, so don't free them. */
409 /* Now free the links of the list, and empty the list. */
411 for (next = pending_blocks; next; next = next1)
417 pending_blocks = NULL;
419 #if 1 /* FIXME, shut this off after a while to speed up symbol reading. */
420 /* Some compilers output blocks in the wrong order, but we depend
421 on their being in the right order so we can binary search.
422 Check the order and moan about it. FIXME. */
423 if (BLOCKVECTOR_NBLOCKS (blockvector) > 1)
425 for (i = 1; i < BLOCKVECTOR_NBLOCKS (blockvector); i++)
427 if (BLOCK_START(BLOCKVECTOR_BLOCK (blockvector, i-1))
428 > BLOCK_START(BLOCKVECTOR_BLOCK (blockvector, i)))
431 /* FIXME-32x64: loses if CORE_ADDR doesn't fit in a
432 long. Possible solutions include a version of
433 complain which takes a callback, a
434 sprintf_address_numeric to match
435 print_address_numeric, or a way to set up a GDB_FILE
436 * which causes sprintf rather than fprintf to be
439 complain (&blockvector_complaint,
440 (unsigned long) BLOCK_START(BLOCKVECTOR_BLOCK (blockvector, i)));
446 return (blockvector);
450 /* Start recording information about source code that came from an included
451 (or otherwise merged-in) source file with a different name. NAME is
452 the name of the file (cannot be NULL), DIRNAME is the directory in which
453 it resides (or NULL if not known). */
456 start_subfile (name, dirname)
460 register struct subfile *subfile;
462 /* See if this subfile is already known as a subfile of the
463 current main source file. */
465 for (subfile = subfiles; subfile; subfile = subfile->next)
467 if (STREQ (subfile->name, name))
469 current_subfile = subfile;
474 /* This subfile is not known. Add an entry for it.
475 Make an entry for this subfile in the list of all subfiles
476 of the current main source file. */
478 subfile = (struct subfile *) xmalloc (sizeof (struct subfile));
479 subfile->next = subfiles;
481 current_subfile = subfile;
483 /* Save its name and compilation directory name */
484 subfile->name = (name == NULL) ? NULL : savestring (name, strlen (name));
486 (dirname == NULL) ? NULL : savestring (dirname, strlen (dirname));
488 /* Initialize line-number recording for this subfile. */
489 subfile->line_vector = NULL;
491 /* Default the source language to whatever can be deduced from
492 the filename. If nothing can be deduced (such as for a C/C++
493 include file with a ".h" extension), then inherit whatever
494 language the previous subfile had. This kludgery is necessary
495 because there is no standard way in some object formats to
496 record the source language. Also, when symtabs are allocated
497 we try to deduce a language then as well, but it is too late
498 for us to use that information while reading symbols, since
499 symtabs aren't allocated until after all the symbols have
500 been processed for a given source file. */
502 subfile->language = deduce_language_from_filename (subfile->name);
503 if (subfile->language == language_unknown &&
504 subfile->next != NULL)
506 subfile->language = subfile->next->language;
509 /* cfront output is a C program, so in most ways it looks like a C
510 program. But to demangle we need to set the language to C++. We
511 can distinguish cfront code by the fact that it has #line
512 directives which specify a file name ending in .C.
514 So if the filename of this subfile ends in .C, then change the language
515 of any pending subfiles from C to C++. We also accept any other C++
516 suffixes accepted by deduce_language_from_filename (in particular,
517 some people use .cxx with cfront). */
518 /* Likewise for f2c. */
523 enum language sublang = deduce_language_from_filename (subfile->name);
525 if (sublang == language_cplus || sublang == language_fortran)
526 for (s = subfiles; s != NULL; s = s->next)
527 if (s->language == language_c)
528 s->language = sublang;
531 /* And patch up this file if necessary. */
532 if (subfile->language == language_c
533 && subfile->next != NULL
534 && (subfile->next->language == language_cplus
535 || subfile->next->language == language_fortran))
537 subfile->language = subfile->next->language;
541 /* For stabs readers, the first N_SO symbol is assumed to be the source
542 file name, and the subfile struct is initialized using that assumption.
543 If another N_SO symbol is later seen, immediately following the first
544 one, then the first one is assumed to be the directory name and the
545 second one is really the source file name.
547 So we have to patch up the subfile struct by moving the old name value to
548 dirname and remembering the new name. Some sanity checking is performed
549 to ensure that the state of the subfile struct is reasonable and that the
550 old name we are assuming to be a directory name actually is (by checking
551 for a trailing '/'). */
554 patch_subfile_names (subfile, name)
555 struct subfile *subfile;
558 if (subfile != NULL && subfile->dirname == NULL && subfile->name != NULL
559 && subfile->name[strlen(subfile->name)-1] == '/')
561 subfile->dirname = subfile->name;
562 subfile->name = savestring (name, strlen (name));
563 last_source_file = name;
565 /* Default the source language to whatever can be deduced from
566 the filename. If nothing can be deduced (such as for a C/C++
567 include file with a ".h" extension), then inherit whatever
568 language the previous subfile had. This kludgery is necessary
569 because there is no standard way in some object formats to
570 record the source language. Also, when symtabs are allocated
571 we try to deduce a language then as well, but it is too late
572 for us to use that information while reading symbols, since
573 symtabs aren't allocated until after all the symbols have
574 been processed for a given source file. */
576 subfile->language = deduce_language_from_filename (subfile->name);
577 if (subfile->language == language_unknown &&
578 subfile->next != NULL)
580 subfile->language = subfile->next->language;
586 /* Handle the N_BINCL and N_EINCL symbol types
587 that act like N_SOL for switching source files
588 (different subfiles, as we call them) within one object file,
589 but using a stack rather than in an arbitrary order. */
594 register struct subfile_stack *tem
595 = (struct subfile_stack *) xmalloc (sizeof (struct subfile_stack));
597 tem->next = subfile_stack;
599 if (current_subfile == NULL || current_subfile->name == NULL)
603 tem->name = current_subfile->name;
610 register struct subfile_stack *link = subfile_stack;
617 subfile_stack = link->next;
623 /* Add a linetable entry for line number LINE and address PC to the line
624 vector for SUBFILE. */
627 record_line (subfile, line, pc)
628 register struct subfile *subfile;
632 struct linetable_entry *e;
633 /* Ignore the dummy line number in libg.o */
640 /* Make sure line vector exists and is big enough. */
641 if (!subfile->line_vector)
643 subfile->line_vector_length = INITIAL_LINE_VECTOR_LENGTH;
644 subfile->line_vector = (struct linetable *)
645 xmalloc (sizeof (struct linetable)
646 + subfile->line_vector_length * sizeof (struct linetable_entry));
647 subfile->line_vector->nitems = 0;
650 if (subfile->line_vector->nitems + 1 >= subfile->line_vector_length)
652 subfile->line_vector_length *= 2;
653 subfile->line_vector = (struct linetable *)
654 xrealloc ((char *) subfile->line_vector, (sizeof (struct linetable)
655 + subfile->line_vector_length * sizeof (struct linetable_entry)));
658 e = subfile->line_vector->item + subfile->line_vector->nitems++;
659 e->line = line; e->pc = pc;
663 /* Needed in order to sort line tables from IBM xcoff files. Sigh! */
666 compare_line_numbers (ln1p, ln2p)
670 struct linetable_entry *ln1 = (struct linetable_entry *) ln1p;
671 struct linetable_entry *ln2 = (struct linetable_entry *) ln2p;
673 /* Note: this code does not assume that CORE_ADDRs can fit in ints.
674 Please keep it that way. */
675 if (ln1->pc < ln2->pc)
678 if (ln1->pc > ln2->pc)
681 /* If pc equal, sort by line. I'm not sure whether this is optimum
682 behavior (see comment at struct linetable in symtab.h). */
683 return ln1->line - ln2->line;
687 /* Start a new symtab for a new source file.
688 Called, for example, when a stabs symbol of type N_SO is seen, or when
689 a DWARF TAG_compile_unit DIE is seen.
690 It indicates the start of data for one original source file. */
693 start_symtab (name, dirname, start_addr)
696 CORE_ADDR start_addr;
699 last_source_file = name;
700 last_source_start_addr = start_addr;
702 global_symbols = NULL;
705 /* Context stack is initially empty. Allocate first one with room for
706 10 levels; reuse it forever afterward. */
707 if (context_stack == NULL)
709 context_stack_size = INITIAL_CONTEXT_STACK_SIZE;
710 context_stack = (struct context_stack *)
711 xmalloc (context_stack_size * sizeof (struct context_stack));
713 context_stack_depth = 0;
715 /* Initialize the list of sub source files with one entry
716 for this file (the top-level source file). */
719 current_subfile = NULL;
720 start_subfile (name, dirname);
723 /* Finish the symbol definitions for one main source file,
724 close off all the lexical contexts for that file
725 (creating struct block's for them), then make the struct symtab
726 for that file and put it in the list of all such.
728 END_ADDR is the address of the end of the file's text.
729 SECTION is the section number (in objfile->section_offsets) of
730 the blockvector and linetable.
732 Note that it is possible for end_symtab() to return NULL. In particular,
733 for the DWARF case at least, it will return NULL when it finds a
734 compilation unit that has exactly one DIE, a TAG_compile_unit DIE. This
735 can happen when we link in an object file that was compiled from an empty
736 source file. Returning NULL is probably not the correct thing to do,
737 because then gdb will never know about this empty file (FIXME). */
740 end_symtab (end_addr, objfile, section)
742 struct objfile *objfile;
745 register struct symtab *symtab = NULL;
746 register struct blockvector *blockvector;
747 register struct subfile *subfile;
748 register struct context_stack *cstk;
749 struct subfile *nextsub;
751 /* Finish the lexical context of the last function in the file;
752 pop the context stack. */
754 if (context_stack_depth > 0)
756 context_stack_depth--;
757 cstk = &context_stack[context_stack_depth];
758 /* Make a block for the local symbols within. */
759 finish_block (cstk->name, &local_symbols, cstk->old_blocks,
760 cstk->start_addr, end_addr, objfile);
762 if (context_stack_depth > 0)
764 /* This is said to happen with SCO. The old coffread.c code
765 simply emptied the context stack, so we do the same. FIXME:
766 Find out why it is happening. This is not believed to happen
767 in most cases (even for coffread.c); it used to be an abort(). */
768 static struct complaint msg =
769 {"Context stack not empty in end_symtab", 0, 0};
771 context_stack_depth = 0;
775 /* Reordered executables may have out of order pending blocks; if
776 OBJF_REORDERED is true, then sort the pending blocks. */
777 if ((objfile->flags & OBJF_REORDERED) && pending_blocks)
779 /* FIXME! Remove this horrid bubble sort and use qsort!!!
780 It'd be a whole lot easier if they weren't in a linked list!!! */
784 struct pending_block *pb, *pbnext;
792 /* swap blocks if unordered! */
794 if (BLOCK_START(pb->block) < BLOCK_START(pbnext->block))
796 struct block *tmp = pb->block;
797 pb->block = pbnext->block;
802 pbnext = pbnext->next;
807 /* Cleanup any undefined types that have been left hanging around
808 (this needs to be done before the finish_blocks so that
809 file_symbols is still good).
811 Both cleanup_undefined_types and finish_global_stabs are stabs
812 specific, but harmless for other symbol readers, since on gdb
813 startup or when finished reading stabs, the state is set so these
814 are no-ops. FIXME: Is this handled right in case of QUIT? Can
815 we make this cleaner? */
817 cleanup_undefined_types ();
818 finish_global_stabs (objfile);
820 if (pending_blocks == NULL
821 && file_symbols == NULL
822 && global_symbols == NULL)
824 /* Ignore symtabs that have no functions with real debugging info */
829 /* Define the STATIC_BLOCK & GLOBAL_BLOCK, and build the blockvector. */
830 finish_block (0, &file_symbols, 0, last_source_start_addr, end_addr,
832 finish_block (0, &global_symbols, 0, last_source_start_addr, end_addr,
834 blockvector = make_blockvector (objfile);
837 #ifdef PROCESS_LINENUMBER_HOOK
838 PROCESS_LINENUMBER_HOOK (); /* Needed for xcoff. */
841 /* Now create the symtab objects proper, one for each subfile. */
842 /* (The main file is the last one on the chain.) */
844 for (subfile = subfiles; subfile; subfile = nextsub)
846 int linetablesize = 0;
847 /* If we have blocks of symbols, make a symtab.
848 Otherwise, just ignore this file and any line number info in it. */
852 if (subfile->line_vector)
854 linetablesize = sizeof (struct linetable) +
855 subfile->line_vector->nitems * sizeof (struct linetable_entry);
857 /* I think this is artifact from before it went on the obstack.
858 I doubt we'll need the memory between now and when we
859 free it later in this function. */
860 /* First, shrink the linetable to make more memory. */
861 subfile->line_vector = (struct linetable *)
862 xrealloc ((char *) subfile->line_vector, linetablesize);
865 /* Like the pending blocks, the line table may be scrambled
866 in reordered executables. Sort it if OBJF_REORDERED is
868 if (objfile->flags & OBJF_REORDERED)
869 qsort (subfile->line_vector->item,
870 subfile->line_vector->nitems,
871 sizeof (struct linetable_entry), compare_line_numbers);
874 /* Now, allocate a symbol table. */
875 symtab = allocate_symtab (subfile->name, objfile);
877 /* Fill in its components. */
878 symtab->blockvector = blockvector;
879 if (subfile->line_vector)
881 /* Reallocate the line table on the symbol obstack */
882 symtab->linetable = (struct linetable *)
883 obstack_alloc (&objfile -> symbol_obstack, linetablesize);
884 memcpy (symtab->linetable, subfile->line_vector, linetablesize);
888 symtab->linetable = NULL;
890 symtab->block_line_section = section;
891 if (subfile->dirname)
893 /* Reallocate the dirname on the symbol obstack */
894 symtab->dirname = (char *)
895 obstack_alloc (&objfile -> symbol_obstack,
896 strlen (subfile -> dirname) + 1);
897 strcpy (symtab->dirname, subfile->dirname);
901 symtab->dirname = NULL;
903 symtab->free_code = free_linetable;
904 symtab->free_ptr = NULL;
906 /* Use whatever language we have been using for this subfile,
907 not the one that was deduced in allocate_symtab from the
908 filename. We already did our own deducing when we created
909 the subfile, and we may have altered our opinion of what
910 language it is from things we found in the symbols. */
911 symtab->language = subfile->language;
913 /* All symtabs for the main file and the subfiles share a
914 blockvector, so we need to clear primary for everything but
919 if (subfile->name != NULL)
921 free ((PTR) subfile->name);
923 if (subfile->dirname != NULL)
925 free ((PTR) subfile->dirname);
927 if (subfile->line_vector != NULL)
929 free ((PTR) subfile->line_vector);
932 nextsub = subfile->next;
936 /* Set this for the main source file. */
942 last_source_file = NULL;
943 current_subfile = NULL;
949 /* Push a context block. Args are an identifying nesting level (checkable
950 when you pop it), and the starting PC address of this context. */
952 struct context_stack *
953 push_context (desc, valu)
957 register struct context_stack *new;
959 if (context_stack_depth == context_stack_size)
961 context_stack_size *= 2;
962 context_stack = (struct context_stack *)
963 xrealloc ((char *) context_stack,
964 (context_stack_size * sizeof (struct context_stack)));
967 new = &context_stack[context_stack_depth++];
969 new->locals = local_symbols;
970 new->old_blocks = pending_blocks;
971 new->start_addr = valu;
974 local_symbols = NULL;
980 /* Compute a small integer hash code for the given name. */
986 register char *p = name;
987 register int total = p[0];
1002 /* Ensure result is positive. */
1005 total += (1000 << 6);
1007 return (total % HASHSIZE);
1011 /* Initialize anything that needs initializing when starting to read
1012 a fresh piece of a symbol file, e.g. reading in the stuff corresponding
1018 free_pendings = NULL;
1019 file_symbols = NULL;
1020 global_symbols = NULL;
1021 pending_blocks = NULL;
1024 /* Initialize anything that needs initializing when a completely new
1025 symbol file is specified (not just adding some symbols from another
1026 file, e.g. a shared library). */
1029 buildsym_new_init ()
1034 /* Initializer for this module */
1037 _initialize_buildsym ()