]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gdb/buildsym.c
Tweak last patch.
[thirdparty/binutils-gdb.git] / gdb / buildsym.c
CommitLineData
c906108c 1/* Support routines for building symbol tables in GDB's internal format.
197e01b6 2 Copyright (C) 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995,
0fb0cc75 3 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2007, 2008, 2009
25caa7a8 4 Free Software Foundation, Inc.
c906108c 5
c5aa993b 6 This file is part of GDB.
c906108c 7
c5aa993b
JM
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
a9762ec7 10 the Free Software Foundation; either version 3 of the License, or
c5aa993b 11 (at your option) any later version.
c906108c 12
c5aa993b
JM
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
c906108c 17
c5aa993b 18 You should have received a copy of the GNU General Public License
a9762ec7 19 along with this program. If not, see <http://www.gnu.org/licenses/>. */
c906108c
SS
20
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.
24
25 Routines to support specific debugging information formats (stabs,
26 DWARF, etc) belong somewhere else. */
27
28#include "defs.h"
29#include "bfd.h"
04ea0df1 30#include "gdb_obstack.h"
c906108c 31#include "symtab.h"
72367fb4 32#include "symfile.h"
c906108c
SS
33#include "objfiles.h"
34#include "gdbtypes.h"
0c5e171a 35#include "gdb_assert.h"
c906108c
SS
36#include "complaints.h"
37#include "gdb_string.h"
91b9ff21 38#include "expression.h" /* For "enum exp_opcode" used by... */
357e46e7 39#include "bcache.h"
d5166ae1 40#include "filenames.h" /* For DOSish file names */
99d9066e 41#include "macrotab.h"
261397f8 42#include "demangle.h" /* Needed by SYMBOL_INIT_DEMANGLED_NAME. */
fe898f56 43#include "block.h"
9219021c 44#include "cp-support.h"
de4f826b 45#include "dictionary.h"
801e3a5b 46#include "addrmap.h"
9219021c 47
c906108c 48/* Ask buildsym.h to define the vars it normally declares `extern'. */
c5aa993b
JM
49#define EXTERN
50/**/
c906108c
SS
51#include "buildsym.h" /* Our own declarations */
52#undef EXTERN
53
54/* For cleanup_undefined_types and finish_global_stabs (somewhat
55 questionable--see comment where we call them). */
56
57#include "stabsread.h"
58
94d09e04
DE
59/* List of subfiles. */
60
61static struct subfile *subfiles;
62
c906108c
SS
63/* List of free `struct pending' structures for reuse. */
64
65static struct pending *free_pendings;
66
67/* Non-zero if symtab has line number info. This prevents an
68 otherwise empty symtab from being tossed. */
69
70static int have_line_numbers;
801e3a5b
JB
71
72/* The mutable address map for the compilation unit whose symbols
73 we're currently reading. The symtabs' shared blockvector will
74 point to a fixed copy of this. */
75static struct addrmap *pending_addrmap;
76
77/* The obstack on which we allocate pending_addrmap.
78 If pending_addrmap is NULL, this is uninitialized; otherwise, it is
79 initialized (and holds pending_addrmap). */
80static struct obstack pending_addrmap_obstack;
81
82/* Non-zero if we recorded any ranges in the addrmap that are
83 different from those in the blockvector already. We set this to
84 zero when we start processing a symfile, and if it's still zero at
85 the end, then we just toss the addrmap. */
86static int pending_addrmap_interesting;
87
c906108c
SS
88\f
89static int compare_line_numbers (const void *ln1p, const void *ln2p);
90\f
91
92/* Initial sizes of data structures. These are realloc'd larger if
93 needed, and realloc'd down to the size actually used, when
94 completed. */
95
96#define INITIAL_CONTEXT_STACK_SIZE 10
97#define INITIAL_LINE_VECTOR_LENGTH 1000
98\f
99
c906108c
SS
100/* maintain the lists of symbols and blocks */
101
59527da0
JB
102/* Add a pending list to free_pendings. */
103void
104add_free_pendings (struct pending *list)
105{
52f0bd74 106 struct pending *link = list;
59527da0
JB
107
108 if (list)
109 {
110 while (link->next) link = link->next;
111 link->next = free_pendings;
112 free_pendings = list;
113 }
114}
115
9219021c
DC
116/* Add a symbol to one of the lists of symbols. While we're at it, if
117 we're in the C++ case and don't have full namespace debugging info,
118 check to see if it references an anonymous namespace; if so, add an
119 appropriate using directive. */
c906108c
SS
120
121void
122add_symbol_to_list (struct symbol *symbol, struct pending **listhead)
123{
52f0bd74 124 struct pending *link;
c906108c
SS
125
126 /* If this is an alias for another symbol, don't add it. */
127 if (symbol->ginfo.name && symbol->ginfo.name[0] == '#')
128 return;
129
130 /* We keep PENDINGSIZE symbols in each link of the list. If we
131 don't have a link with room in it, add a new link. */
132 if (*listhead == NULL || (*listhead)->nsyms == PENDINGSIZE)
133 {
134 if (free_pendings)
135 {
136 link = free_pendings;
137 free_pendings = link->next;
138 }
139 else
140 {
141 link = (struct pending *) xmalloc (sizeof (struct pending));
142 }
143
144 link->next = *listhead;
145 *listhead = link;
146 link->nsyms = 0;
147 }
148
149 (*listhead)->symbol[(*listhead)->nsyms++] = symbol;
150}
151
152/* Find a symbol named NAME on a LIST. NAME need not be
153 '\0'-terminated; LENGTH is the length of the name. */
154
155struct symbol *
156find_symbol_in_list (struct pending *list, char *name, int length)
157{
158 int j;
159 char *pp;
160
161 while (list != NULL)
162 {
163 for (j = list->nsyms; --j >= 0;)
164 {
3567439c 165 pp = SYMBOL_LINKAGE_NAME (list->symbol[j]);
c906108c
SS
166 if (*pp == *name && strncmp (pp, name, length) == 0 &&
167 pp[length] == '\0')
168 {
169 return (list->symbol[j]);
170 }
171 }
172 list = list->next;
173 }
174 return (NULL);
175}
176
177/* At end of reading syms, or in case of quit, really free as many
178 `struct pending's as we can easily find. */
179
c906108c 180void
bde58177 181really_free_pendings (void *dummy)
c906108c
SS
182{
183 struct pending *next, *next1;
184
185 for (next = free_pendings; next; next = next1)
186 {
187 next1 = next->next;
b8c9b27d 188 xfree ((void *) next);
c906108c
SS
189 }
190 free_pendings = NULL;
191
192 free_pending_blocks ();
193
194 for (next = file_symbols; next != NULL; next = next1)
195 {
196 next1 = next->next;
b8c9b27d 197 xfree ((void *) next);
c906108c
SS
198 }
199 file_symbols = NULL;
200
201 for (next = global_symbols; next != NULL; next = next1)
202 {
203 next1 = next->next;
b8c9b27d 204 xfree ((void *) next);
c906108c
SS
205 }
206 global_symbols = NULL;
99d9066e
JB
207
208 if (pending_macros)
209 free_macro_table (pending_macros);
801e3a5b
JB
210
211 if (pending_addrmap)
212 {
213 obstack_free (&pending_addrmap_obstack, NULL);
214 pending_addrmap = NULL;
215 }
c906108c
SS
216}
217
218/* This function is called to discard any pending blocks. */
219
220void
221free_pending_blocks (void)
222{
89ba75b1
JB
223 /* The links are made in the objfile_obstack, so we only need to
224 reset PENDING_BLOCKS. */
c906108c
SS
225 pending_blocks = NULL;
226}
227
228/* Take one of the lists of symbols and make a block from it. Keep
229 the order the symbols have in the list (reversed from the input
230 file). Put the block on the list of pending blocks. */
231
801e3a5b 232struct block *
c906108c
SS
233finish_block (struct symbol *symbol, struct pending **listhead,
234 struct pending_block *old_blocks,
235 CORE_ADDR start, CORE_ADDR end,
236 struct objfile *objfile)
237{
5af949e3 238 struct gdbarch *gdbarch = get_objfile_arch (objfile);
52f0bd74
AC
239 struct pending *next, *next1;
240 struct block *block;
241 struct pending_block *pblock;
c906108c 242 struct pending_block *opblock;
c906108c 243
4a146b47 244 block = allocate_block (&objfile->objfile_obstack);
c906108c 245
261397f8
DJ
246 if (symbol)
247 {
4a146b47 248 BLOCK_DICT (block) = dict_create_linear (&objfile->objfile_obstack,
de4f826b 249 *listhead);
261397f8
DJ
250 }
251 else
c906108c 252 {
4a146b47 253 BLOCK_DICT (block) = dict_create_hashed (&objfile->objfile_obstack,
de4f826b 254 *listhead);
c906108c
SS
255 }
256
257 BLOCK_START (block) = start;
258 BLOCK_END (block) = end;
259 /* Superblock filled in when containing block is made */
260 BLOCK_SUPERBLOCK (block) = NULL;
9219021c 261 BLOCK_NAMESPACE (block) = NULL;
c906108c 262
c906108c
SS
263 /* Put the block in as the value of the symbol that names it. */
264
265 if (symbol)
266 {
267 struct type *ftype = SYMBOL_TYPE (symbol);
de4f826b 268 struct dict_iterator iter;
c906108c
SS
269 SYMBOL_BLOCK_VALUE (symbol) = block;
270 BLOCK_FUNCTION (block) = symbol;
271
272 if (TYPE_NFIELDS (ftype) <= 0)
273 {
274 /* No parameter type information is recorded with the
275 function's type. Set that from the type of the
276 parameter symbols. */
277 int nparams = 0, iparams;
278 struct symbol *sym;
de4f826b 279 ALL_BLOCK_SYMBOLS (block, iter, sym)
c906108c 280 {
2a2d4dc3
AS
281 if (SYMBOL_IS_ARGUMENT (sym))
282 nparams++;
c906108c
SS
283 }
284 if (nparams > 0)
285 {
286 TYPE_NFIELDS (ftype) = nparams;
287 TYPE_FIELDS (ftype) = (struct field *)
288 TYPE_ALLOC (ftype, nparams * sizeof (struct field));
289
de4f826b
DC
290 iparams = 0;
291 ALL_BLOCK_SYMBOLS (block, iter, sym)
c906108c 292 {
de4f826b
DC
293 if (iparams == nparams)
294 break;
295
2a2d4dc3 296 if (SYMBOL_IS_ARGUMENT (sym))
c906108c 297 {
c906108c 298 TYPE_FIELD_TYPE (ftype, iparams) = SYMBOL_TYPE (sym);
8176bb6d 299 TYPE_FIELD_ARTIFICIAL (ftype, iparams) = 0;
c906108c 300 iparams++;
c906108c
SS
301 }
302 }
303 }
304 }
305 }
306 else
307 {
308 BLOCK_FUNCTION (block) = NULL;
309 }
310
311 /* Now "free" the links of the list, and empty the list. */
312
313 for (next = *listhead; next; next = next1)
314 {
315 next1 = next->next;
316 next->next = free_pendings;
317 free_pendings = next;
318 }
319 *listhead = NULL;
320
c906108c
SS
321 /* Check to be sure that the blocks have an end address that is
322 greater than starting address */
323
324 if (BLOCK_END (block) < BLOCK_START (block))
325 {
326 if (symbol)
327 {
23136709 328 complaint (&symfile_complaints,
3d263c1d 329 _("block end address less than block start address in %s (patched it)"),
de5ad195 330 SYMBOL_PRINT_NAME (symbol));
c906108c
SS
331 }
332 else
333 {
23136709 334 complaint (&symfile_complaints,
5af949e3
UW
335 _("block end address %s less than block start address %s (patched it)"),
336 paddress (gdbarch, BLOCK_END (block)),
337 paddress (gdbarch, BLOCK_START (block)));
c906108c
SS
338 }
339 /* Better than nothing */
340 BLOCK_END (block) = BLOCK_START (block);
341 }
c906108c
SS
342
343 /* Install this block as the superblock of all blocks made since the
344 start of this scope that don't have superblocks yet. */
345
346 opblock = NULL;
c0219d42
MS
347 for (pblock = pending_blocks;
348 pblock && pblock != old_blocks;
349 pblock = pblock->next)
c906108c
SS
350 {
351 if (BLOCK_SUPERBLOCK (pblock->block) == NULL)
352 {
c906108c
SS
353 /* Check to be sure the blocks are nested as we receive
354 them. If the compiler/assembler/linker work, this just
14711c82
DJ
355 burns a small amount of time.
356
357 Skip blocks which correspond to a function; they're not
358 physically nested inside this other blocks, only
359 lexically nested. */
360 if (BLOCK_FUNCTION (pblock->block) == NULL
361 && (BLOCK_START (pblock->block) < BLOCK_START (block)
362 || BLOCK_END (pblock->block) > BLOCK_END (block)))
c906108c
SS
363 {
364 if (symbol)
365 {
23136709 366 complaint (&symfile_complaints,
3d263c1d 367 _("inner block not inside outer block in %s"),
de5ad195 368 SYMBOL_PRINT_NAME (symbol));
c906108c
SS
369 }
370 else
371 {
23136709 372 complaint (&symfile_complaints,
5af949e3
UW
373 _("inner block (%s-%s) not inside outer block (%s-%s)"),
374 paddress (gdbarch, BLOCK_START (pblock->block)),
375 paddress (gdbarch, BLOCK_END (pblock->block)),
376 paddress (gdbarch, BLOCK_START (block)),
377 paddress (gdbarch, BLOCK_END (block)));
c906108c
SS
378 }
379 if (BLOCK_START (pblock->block) < BLOCK_START (block))
380 BLOCK_START (pblock->block) = BLOCK_START (block);
381 if (BLOCK_END (pblock->block) > BLOCK_END (block))
382 BLOCK_END (pblock->block) = BLOCK_END (block);
383 }
c906108c
SS
384 BLOCK_SUPERBLOCK (pblock->block) = block;
385 }
386 opblock = pblock;
387 }
388
27aa8d6a
SW
389 block_set_using (block, using_directives, &objfile->objfile_obstack);
390
c906108c 391 record_pending_block (objfile, block, opblock);
801e3a5b
JB
392
393 return block;
c906108c
SS
394}
395
de4f826b 396
c906108c
SS
397/* Record BLOCK on the list of all blocks in the file. Put it after
398 OPBLOCK, or at the beginning if opblock is NULL. This puts the
399 block in the list after all its subblocks.
400
4a146b47 401 Allocate the pending block struct in the objfile_obstack to save
c906108c
SS
402 time. This wastes a little space. FIXME: Is it worth it? */
403
404void
405record_pending_block (struct objfile *objfile, struct block *block,
406 struct pending_block *opblock)
407{
52f0bd74 408 struct pending_block *pblock;
c906108c
SS
409
410 pblock = (struct pending_block *)
4a146b47 411 obstack_alloc (&objfile->objfile_obstack, sizeof (struct pending_block));
c906108c
SS
412 pblock->block = block;
413 if (opblock)
414 {
415 pblock->next = opblock->next;
416 opblock->next = pblock;
417 }
418 else
419 {
420 pblock->next = pending_blocks;
421 pending_blocks = pblock;
422 }
423}
424
801e3a5b
JB
425
426/* Record that the range of addresses from START to END_INCLUSIVE
427 (inclusive, like it says) belongs to BLOCK. BLOCK's start and end
428 addresses must be set already. You must apply this function to all
429 BLOCK's children before applying it to BLOCK.
430
431 If a call to this function complicates the picture beyond that
432 already provided by BLOCK_START and BLOCK_END, then we create an
433 address map for the block. */
434void
435record_block_range (struct block *block,
436 CORE_ADDR start, CORE_ADDR end_inclusive)
437{
438 /* If this is any different from the range recorded in the block's
439 own BLOCK_START and BLOCK_END, then note that the address map has
440 become interesting. Note that even if this block doesn't have
441 any "interesting" ranges, some later block might, so we still
442 need to record this block in the addrmap. */
443 if (start != BLOCK_START (block)
444 || end_inclusive + 1 != BLOCK_END (block))
445 pending_addrmap_interesting = 1;
446
447 if (! pending_addrmap)
448 {
449 obstack_init (&pending_addrmap_obstack);
450 pending_addrmap = addrmap_create_mutable (&pending_addrmap_obstack);
451 }
452
453 addrmap_set_empty (pending_addrmap, start, end_inclusive, block);
454}
455
456
822e978b 457static struct blockvector *
c906108c
SS
458make_blockvector (struct objfile *objfile)
459{
52f0bd74
AC
460 struct pending_block *next;
461 struct blockvector *blockvector;
462 int i;
c906108c
SS
463
464 /* Count the length of the list of blocks. */
465
466 for (next = pending_blocks, i = 0; next; next = next->next, i++)
467 {;
468 }
469
470 blockvector = (struct blockvector *)
4a146b47 471 obstack_alloc (&objfile->objfile_obstack,
c906108c
SS
472 (sizeof (struct blockvector)
473 + (i - 1) * sizeof (struct block *)));
474
475 /* Copy the blocks into the blockvector. This is done in reverse
476 order, which happens to put the blocks into the proper order
477 (ascending starting address). finish_block has hair to insert
478 each block into the list after its subblocks in order to make
479 sure this is true. */
480
481 BLOCKVECTOR_NBLOCKS (blockvector) = i;
482 for (next = pending_blocks; next; next = next->next)
483 {
484 BLOCKVECTOR_BLOCK (blockvector, --i) = next->block;
485 }
486
89ba75b1 487 free_pending_blocks ();
c906108c 488
801e3a5b
JB
489 /* If we needed an address map for this symtab, record it in the
490 blockvector. */
491 if (pending_addrmap && pending_addrmap_interesting)
492 BLOCKVECTOR_MAP (blockvector)
493 = addrmap_create_fixed (pending_addrmap, &objfile->objfile_obstack);
494 else
495 BLOCKVECTOR_MAP (blockvector) = 0;
496
c906108c
SS
497 /* Some compilers output blocks in the wrong order, but we depend on
498 their being in the right order so we can binary search. Check the
a239dc23 499 order and moan about it. */
c906108c
SS
500 if (BLOCKVECTOR_NBLOCKS (blockvector) > 1)
501 {
502 for (i = 1; i < BLOCKVECTOR_NBLOCKS (blockvector); i++)
503 {
504 if (BLOCK_START (BLOCKVECTOR_BLOCK (blockvector, i - 1))
505 > BLOCK_START (BLOCKVECTOR_BLOCK (blockvector, i)))
506 {
59527da0
JB
507 CORE_ADDR start
508 = BLOCK_START (BLOCKVECTOR_BLOCK (blockvector, i));
c906108c 509
3d263c1d 510 complaint (&symfile_complaints, _("block at %s out of order"),
bb599908 511 hex_string ((LONGEST) start));
c906108c
SS
512 }
513 }
514 }
c906108c
SS
515
516 return (blockvector);
517}
518\f
519/* Start recording information about source code that came from an
520 included (or otherwise merged-in) source file with a different
521 name. NAME is the name of the file (cannot be NULL), DIRNAME is
0b0287a1 522 the directory in which the file was compiled (or NULL if not known). */
c906108c
SS
523
524void
525start_subfile (char *name, char *dirname)
526{
52f0bd74 527 struct subfile *subfile;
c906108c
SS
528
529 /* See if this subfile is already known as a subfile of the current
530 main source file. */
531
532 for (subfile = subfiles; subfile; subfile = subfile->next)
533 {
84ba0adf
DJ
534 char *subfile_name;
535
536 /* If NAME is an absolute path, and this subfile is not, then
537 attempt to create an absolute path to compare. */
538 if (IS_ABSOLUTE_PATH (name)
539 && !IS_ABSOLUTE_PATH (subfile->name)
540 && subfile->dirname != NULL)
541 subfile_name = concat (subfile->dirname, SLASH_STRING,
6eb7ee03 542 subfile->name, (char *) NULL);
84ba0adf
DJ
543 else
544 subfile_name = subfile->name;
545
546 if (FILENAME_CMP (subfile_name, name) == 0)
c906108c
SS
547 {
548 current_subfile = subfile;
84ba0adf
DJ
549 if (subfile_name != subfile->name)
550 xfree (subfile_name);
c906108c
SS
551 return;
552 }
84ba0adf
DJ
553 if (subfile_name != subfile->name)
554 xfree (subfile_name);
c906108c
SS
555 }
556
557 /* This subfile is not known. Add an entry for it. Make an entry
558 for this subfile in the list of all subfiles of the current main
559 source file. */
560
561 subfile = (struct subfile *) xmalloc (sizeof (struct subfile));
59527da0 562 memset ((char *) subfile, 0, sizeof (struct subfile));
c906108c
SS
563 subfile->next = subfiles;
564 subfiles = subfile;
565 current_subfile = subfile;
566
567 /* Save its name and compilation directory name */
1b36a34b
JK
568 subfile->name = (name == NULL) ? NULL : xstrdup (name);
569 subfile->dirname = (dirname == NULL) ? NULL : xstrdup (dirname);
c906108c
SS
570
571 /* Initialize line-number recording for this subfile. */
572 subfile->line_vector = NULL;
573
574 /* Default the source language to whatever can be deduced from the
575 filename. If nothing can be deduced (such as for a C/C++ include
576 file with a ".h" extension), then inherit whatever language the
577 previous subfile had. This kludgery is necessary because there
578 is no standard way in some object formats to record the source
579 language. Also, when symtabs are allocated we try to deduce a
580 language then as well, but it is too late for us to use that
581 information while reading symbols, since symtabs aren't allocated
582 until after all the symbols have been processed for a given
583 source file. */
584
585 subfile->language = deduce_language_from_filename (subfile->name);
586 if (subfile->language == language_unknown &&
587 subfile->next != NULL)
588 {
589 subfile->language = subfile->next->language;
590 }
591
592 /* Initialize the debug format string to NULL. We may supply it
593 later via a call to record_debugformat. */
594 subfile->debugformat = NULL;
595
303b6f5d
DJ
596 /* Similarly for the producer. */
597 subfile->producer = NULL;
598
25caa7a8 599 /* If the filename of this subfile ends in .C, then change the
c906108c 600 language of any pending subfiles from C to C++. We also accept
25caa7a8 601 any other C++ suffixes accepted by deduce_language_from_filename. */
c906108c
SS
602 /* Likewise for f2c. */
603
604 if (subfile->name)
605 {
606 struct subfile *s;
607 enum language sublang = deduce_language_from_filename (subfile->name);
608
609 if (sublang == language_cplus || sublang == language_fortran)
610 for (s = subfiles; s != NULL; s = s->next)
611 if (s->language == language_c)
612 s->language = sublang;
613 }
614
615 /* And patch up this file if necessary. */
616 if (subfile->language == language_c
617 && subfile->next != NULL
618 && (subfile->next->language == language_cplus
619 || subfile->next->language == language_fortran))
620 {
621 subfile->language = subfile->next->language;
622 }
623}
624
625/* For stabs readers, the first N_SO symbol is assumed to be the
626 source file name, and the subfile struct is initialized using that
627 assumption. If another N_SO symbol is later seen, immediately
628 following the first one, then the first one is assumed to be the
629 directory name and the second one is really the source file name.
630
631 So we have to patch up the subfile struct by moving the old name
632 value to dirname and remembering the new name. Some sanity
633 checking is performed to ensure that the state of the subfile
634 struct is reasonable and that the old name we are assuming to be a
635 directory name actually is (by checking for a trailing '/'). */
636
637void
638patch_subfile_names (struct subfile *subfile, char *name)
639{
640 if (subfile != NULL && subfile->dirname == NULL && subfile->name != NULL
641 && subfile->name[strlen (subfile->name) - 1] == '/')
642 {
643 subfile->dirname = subfile->name;
1b36a34b 644 subfile->name = xstrdup (name);
c906108c
SS
645 last_source_file = name;
646
647 /* Default the source language to whatever can be deduced from
648 the filename. If nothing can be deduced (such as for a C/C++
649 include file with a ".h" extension), then inherit whatever
650 language the previous subfile had. This kludgery is
651 necessary because there is no standard way in some object
652 formats to record the source language. Also, when symtabs
653 are allocated we try to deduce a language then as well, but
654 it is too late for us to use that information while reading
655 symbols, since symtabs aren't allocated until after all the
656 symbols have been processed for a given source file. */
657
658 subfile->language = deduce_language_from_filename (subfile->name);
659 if (subfile->language == language_unknown &&
660 subfile->next != NULL)
661 {
662 subfile->language = subfile->next->language;
663 }
664 }
665}
666\f
667/* Handle the N_BINCL and N_EINCL symbol types that act like N_SOL for
668 switching source files (different subfiles, as we call them) within
669 one object file, but using a stack rather than in an arbitrary
670 order. */
671
672void
673push_subfile (void)
674{
52f0bd74 675 struct subfile_stack *tem
c906108c
SS
676 = (struct subfile_stack *) xmalloc (sizeof (struct subfile_stack));
677
678 tem->next = subfile_stack;
679 subfile_stack = tem;
680 if (current_subfile == NULL || current_subfile->name == NULL)
681 {
3d263c1d 682 internal_error (__FILE__, __LINE__, _("failed internal consistency check"));
c906108c
SS
683 }
684 tem->name = current_subfile->name;
685}
686
687char *
688pop_subfile (void)
689{
52f0bd74
AC
690 char *name;
691 struct subfile_stack *link = subfile_stack;
c906108c
SS
692
693 if (link == NULL)
694 {
3d263c1d 695 internal_error (__FILE__, __LINE__, _("failed internal consistency check"));
c906108c
SS
696 }
697 name = link->name;
698 subfile_stack = link->next;
b8c9b27d 699 xfree ((void *) link);
c906108c
SS
700 return (name);
701}
702\f
703/* Add a linetable entry for line number LINE and address PC to the
704 line vector for SUBFILE. */
705
706void
aa1ee363 707record_line (struct subfile *subfile, int line, CORE_ADDR pc)
c906108c
SS
708{
709 struct linetable_entry *e;
710 /* Ignore the dummy line number in libg.o */
711
712 if (line == 0xffff)
713 {
714 return;
715 }
716
717 /* Make sure line vector exists and is big enough. */
718 if (!subfile->line_vector)
719 {
720 subfile->line_vector_length = INITIAL_LINE_VECTOR_LENGTH;
721 subfile->line_vector = (struct linetable *)
722 xmalloc (sizeof (struct linetable)
c5aa993b 723 + subfile->line_vector_length * sizeof (struct linetable_entry));
c906108c
SS
724 subfile->line_vector->nitems = 0;
725 have_line_numbers = 1;
726 }
727
728 if (subfile->line_vector->nitems + 1 >= subfile->line_vector_length)
729 {
730 subfile->line_vector_length *= 2;
731 subfile->line_vector = (struct linetable *)
732 xrealloc ((char *) subfile->line_vector,
733 (sizeof (struct linetable)
734 + (subfile->line_vector_length
735 * sizeof (struct linetable_entry))));
736 }
737
607ae575
DJ
738 /* Normally, we treat lines as unsorted. But the end of sequence
739 marker is special. We sort line markers at the same PC by line
740 number, so end of sequence markers (which have line == 0) appear
741 first. This is right if the marker ends the previous function,
742 and there is no padding before the next function. But it is
743 wrong if the previous line was empty and we are now marking a
744 switch to a different subfile. We must leave the end of sequence
745 marker at the end of this group of lines, not sort the empty line
746 to after the marker. The easiest way to accomplish this is to
747 delete any empty lines from our table, if they are followed by
748 end of sequence markers. All we lose is the ability to set
749 breakpoints at some lines which contain no instructions
750 anyway. */
751 if (line == 0 && subfile->line_vector->nitems > 0)
752 {
753 e = subfile->line_vector->item + subfile->line_vector->nitems - 1;
754 while (subfile->line_vector->nitems > 0 && e->pc == pc)
755 {
756 e--;
757 subfile->line_vector->nitems--;
758 }
759 }
760
c906108c
SS
761 e = subfile->line_vector->item + subfile->line_vector->nitems++;
762 e->line = line;
607ae575 763 e->pc = pc;
c906108c
SS
764}
765
766/* Needed in order to sort line tables from IBM xcoff files. Sigh! */
767
768static int
769compare_line_numbers (const void *ln1p, const void *ln2p)
770{
771 struct linetable_entry *ln1 = (struct linetable_entry *) ln1p;
772 struct linetable_entry *ln2 = (struct linetable_entry *) ln2p;
773
774 /* Note: this code does not assume that CORE_ADDRs can fit in ints.
775 Please keep it that way. */
776 if (ln1->pc < ln2->pc)
777 return -1;
778
779 if (ln1->pc > ln2->pc)
780 return 1;
781
782 /* If pc equal, sort by line. I'm not sure whether this is optimum
783 behavior (see comment at struct linetable in symtab.h). */
784 return ln1->line - ln2->line;
785}
786\f
787/* Start a new symtab for a new source file. Called, for example,
788 when a stabs symbol of type N_SO is seen, or when a DWARF
789 TAG_compile_unit DIE is seen. It indicates the start of data for
0b0287a1
DE
790 one original source file.
791
792 NAME is the name of the file (cannot be NULL). DIRNAME is the directory in
793 which the file was compiled (or NULL if not known). START_ADDR is the
794 lowest address of objects in the file (or 0 if not known). */
c906108c
SS
795
796void
797start_symtab (char *name, char *dirname, CORE_ADDR start_addr)
798{
c906108c
SS
799 last_source_file = name;
800 last_source_start_addr = start_addr;
801 file_symbols = NULL;
802 global_symbols = NULL;
803 within_function = 0;
804 have_line_numbers = 0;
805
806 /* Context stack is initially empty. Allocate first one with room
807 for 10 levels; reuse it forever afterward. */
808 if (context_stack == NULL)
809 {
810 context_stack_size = INITIAL_CONTEXT_STACK_SIZE;
811 context_stack = (struct context_stack *)
812 xmalloc (context_stack_size * sizeof (struct context_stack));
813 }
814 context_stack_depth = 0;
815
801e3a5b
JB
816 /* We shouldn't have any address map at this point. */
817 gdb_assert (! pending_addrmap);
818
c906108c
SS
819 /* Initialize the list of sub source files with one entry for this
820 file (the top-level source file). */
821
822 subfiles = NULL;
823 current_subfile = NULL;
824 start_subfile (name, dirname);
825}
826
4584e32e
DE
827/* Subroutine of end_symtab to simplify it.
828 Look for a subfile that matches the main source file's basename.
829 If there is only one, and if the main source file doesn't have any
830 symbol or line number information, then copy this file's symtab and
831 line_vector to the main source file's subfile and discard the other subfile.
832 This can happen because of a compiler bug or from the user playing games
833 with #line or from things like a distributed build system that manipulates
834 the debug info. */
835
836static void
837watch_main_source_file_lossage (void)
838{
839 struct subfile *mainsub, *subfile;
840
841 /* Find the main source file.
842 This loop could be eliminated if start_symtab saved it for us. */
843 mainsub = NULL;
844 for (subfile = subfiles; subfile; subfile = subfile->next)
845 {
846 /* The main subfile is guaranteed to be the last one. */
847 if (subfile->next == NULL)
848 mainsub = subfile;
849 }
850
851 /* If the main source file doesn't have any line number or symbol info,
852 look for an alias in another subfile.
853 We have to watch for mainsub == NULL here. It's a quirk of end_symtab,
854 it can return NULL so there may not be a main subfile. */
855
856 if (mainsub
857 && mainsub->line_vector == NULL
858 && mainsub->symtab == NULL)
859 {
860 const char *mainbase = lbasename (mainsub->name);
861 int nr_matches = 0;
862 struct subfile *prevsub;
863 struct subfile *mainsub_alias = NULL;
864 struct subfile *prev_mainsub_alias = NULL;
865
866 prevsub = NULL;
867 for (subfile = subfiles;
868 /* Stop before we get to the last one. */
869 subfile->next;
870 subfile = subfile->next)
871 {
872 if (strcmp (lbasename (subfile->name), mainbase) == 0)
873 {
874 ++nr_matches;
875 mainsub_alias = subfile;
876 prev_mainsub_alias = prevsub;
877 }
878 prevsub = subfile;
879 }
880
881 if (nr_matches == 1)
882 {
883 gdb_assert (mainsub_alias != NULL && mainsub_alias != mainsub);
884
885 /* Found a match for the main source file.
886 Copy its line_vector and symtab to the main subfile
887 and then discard it. */
888
889 mainsub->line_vector = mainsub_alias->line_vector;
890 mainsub->line_vector_length = mainsub_alias->line_vector_length;
891 mainsub->symtab = mainsub_alias->symtab;
892
893 if (prev_mainsub_alias == NULL)
894 subfiles = mainsub_alias->next;
895 else
896 prev_mainsub_alias->next = mainsub_alias->next;
897 xfree (mainsub_alias);
898 }
899 }
900}
901
07e7f39f
JK
902/* Helper function for qsort. Parametes are `struct block *' pointers,
903 function sorts them in descending order by their BLOCK_START. */
904
905static int
906block_compar (const void *ap, const void *bp)
907{
908 const struct block *a = *(const struct block **) ap;
909 const struct block *b = *(const struct block **) bp;
910
911 return ((BLOCK_START (b) > BLOCK_START (a))
912 - (BLOCK_START (b) < BLOCK_START (a)));
913}
914
c906108c
SS
915/* Finish the symbol definitions for one main source file, close off
916 all the lexical contexts for that file (creating struct block's for
917 them), then make the struct symtab for that file and put it in the
918 list of all such.
919
920 END_ADDR is the address of the end of the file's text. SECTION is
921 the section number (in objfile->section_offsets) of the blockvector
922 and linetable.
923
924 Note that it is possible for end_symtab() to return NULL. In
925 particular, for the DWARF case at least, it will return NULL when
926 it finds a compilation unit that has exactly one DIE, a
927 TAG_compile_unit DIE. This can happen when we link in an object
928 file that was compiled from an empty source file. Returning NULL
929 is probably not the correct thing to do, because then gdb will
930 never know about this empty file (FIXME). */
931
932struct symtab *
933end_symtab (CORE_ADDR end_addr, struct objfile *objfile, int section)
934{
52f0bd74
AC
935 struct symtab *symtab = NULL;
936 struct blockvector *blockvector;
937 struct subfile *subfile;
938 struct context_stack *cstk;
c906108c
SS
939 struct subfile *nextsub;
940
941 /* Finish the lexical context of the last function in the file; pop
942 the context stack. */
943
944 if (context_stack_depth > 0)
945 {
946 cstk = pop_context ();
947 /* Make a block for the local symbols within. */
948 finish_block (cstk->name, &local_symbols, cstk->old_blocks,
949 cstk->start_addr, end_addr, objfile);
950
951 if (context_stack_depth > 0)
952 {
953 /* This is said to happen with SCO. The old coffread.c
954 code simply emptied the context stack, so we do the
955 same. FIXME: Find out why it is happening. This is not
956 believed to happen in most cases (even for coffread.c);
957 it used to be an abort(). */
23136709 958 complaint (&symfile_complaints,
3d263c1d 959 _("Context stack not empty in end_symtab"));
c906108c
SS
960 context_stack_depth = 0;
961 }
962 }
963
964 /* Reordered executables may have out of order pending blocks; if
965 OBJF_REORDERED is true, then sort the pending blocks. */
966 if ((objfile->flags & OBJF_REORDERED) && pending_blocks)
967 {
07e7f39f
JK
968 unsigned count = 0;
969 struct pending_block *pb;
970 struct block **barray, **bp;
971 struct cleanup *back_to;
c906108c 972
07e7f39f
JK
973 for (pb = pending_blocks; pb != NULL; pb = pb->next)
974 count++;
c906108c 975
07e7f39f
JK
976 barray = xmalloc (sizeof (*barray) * count);
977 back_to = make_cleanup (xfree, barray);
c906108c 978
07e7f39f
JK
979 bp = barray;
980 for (pb = pending_blocks; pb != NULL; pb = pb->next)
981 *bp++ = pb->block;
982
983 qsort (barray, count, sizeof (*barray), block_compar);
984
985 bp = barray;
986 for (pb = pending_blocks; pb != NULL; pb = pb->next)
987 pb->block = *bp++;
988
989 do_cleanups (back_to);
c906108c
SS
990 }
991
992 /* Cleanup any undefined types that have been left hanging around
993 (this needs to be done before the finish_blocks so that
994 file_symbols is still good).
c5aa993b 995
c906108c
SS
996 Both cleanup_undefined_types and finish_global_stabs are stabs
997 specific, but harmless for other symbol readers, since on gdb
998 startup or when finished reading stabs, the state is set so these
999 are no-ops. FIXME: Is this handled right in case of QUIT? Can
1000 we make this cleaner? */
1001
46bf5051 1002 cleanup_undefined_types (objfile);
c906108c
SS
1003 finish_global_stabs (objfile);
1004
1005 if (pending_blocks == NULL
1006 && file_symbols == NULL
1007 && global_symbols == NULL
99d9066e
JB
1008 && have_line_numbers == 0
1009 && pending_macros == NULL)
c906108c
SS
1010 {
1011 /* Ignore symtabs that have no functions with real debugging
1012 info. */
1013 blockvector = NULL;
1014 }
1015 else
1016 {
1017 /* Define the STATIC_BLOCK & GLOBAL_BLOCK, and build the
1018 blockvector. */
1019 finish_block (0, &file_symbols, 0, last_source_start_addr, end_addr,
1020 objfile);
1021 finish_block (0, &global_symbols, 0, last_source_start_addr, end_addr,
1022 objfile);
1023 blockvector = make_blockvector (objfile);
1024 }
1025
c295b2e5
JB
1026 /* Read the line table if it has to be read separately. */
1027 if (objfile->sf->sym_read_linetable != NULL)
1028 objfile->sf->sym_read_linetable ();
c906108c 1029
4584e32e
DE
1030 /* Handle the case where the debug info specifies a different path
1031 for the main source file. It can cause us to lose track of its
1032 line number information. */
1033 watch_main_source_file_lossage ();
1034
c906108c
SS
1035 /* Now create the symtab objects proper, one for each subfile. */
1036 /* (The main file is the last one on the chain.) */
1037
1038 for (subfile = subfiles; subfile; subfile = nextsub)
1039 {
1040 int linetablesize = 0;
1041 symtab = NULL;
1042
1043 /* If we have blocks of symbols, make a symtab. Otherwise, just
1044 ignore this file and any line number info in it. */
1045 if (blockvector)
1046 {
1047 if (subfile->line_vector)
1048 {
1049 linetablesize = sizeof (struct linetable) +
1050 subfile->line_vector->nitems * sizeof (struct linetable_entry);
c906108c
SS
1051
1052 /* Like the pending blocks, the line table may be
1053 scrambled in reordered executables. Sort it if
1054 OBJF_REORDERED is true. */
1055 if (objfile->flags & OBJF_REORDERED)
1056 qsort (subfile->line_vector->item,
1057 subfile->line_vector->nitems,
c5aa993b 1058 sizeof (struct linetable_entry), compare_line_numbers);
c906108c
SS
1059 }
1060
1061 /* Now, allocate a symbol table. */
cb1df416
DJ
1062 if (subfile->symtab == NULL)
1063 symtab = allocate_symtab (subfile->name, objfile);
1064 else
1065 symtab = subfile->symtab;
c906108c
SS
1066
1067 /* Fill in its components. */
1068 symtab->blockvector = blockvector;
99d9066e 1069 symtab->macro_table = pending_macros;
c906108c
SS
1070 if (subfile->line_vector)
1071 {
1072 /* Reallocate the line table on the symbol obstack */
1073 symtab->linetable = (struct linetable *)
4a146b47 1074 obstack_alloc (&objfile->objfile_obstack, linetablesize);
c906108c
SS
1075 memcpy (symtab->linetable, subfile->line_vector, linetablesize);
1076 }
1077 else
1078 {
1079 symtab->linetable = NULL;
1080 }
1081 symtab->block_line_section = section;
1082 if (subfile->dirname)
1083 {
1084 /* Reallocate the dirname on the symbol obstack */
1085 symtab->dirname = (char *)
4a146b47 1086 obstack_alloc (&objfile->objfile_obstack,
c906108c
SS
1087 strlen (subfile->dirname) + 1);
1088 strcpy (symtab->dirname, subfile->dirname);
1089 }
1090 else
1091 {
1092 symtab->dirname = NULL;
1093 }
1094 symtab->free_code = free_linetable;
de4f826b 1095 symtab->free_func = NULL;
c906108c
SS
1096
1097 /* Use whatever language we have been using for this
1098 subfile, not the one that was deduced in allocate_symtab
1099 from the filename. We already did our own deducing when
1100 we created the subfile, and we may have altered our
1101 opinion of what language it is from things we found in
1102 the symbols. */
1103 symtab->language = subfile->language;
1104
1105 /* Save the debug format string (if any) in the symtab */
1106 if (subfile->debugformat != NULL)
1107 {
1108 symtab->debugformat = obsavestring (subfile->debugformat,
c5aa993b 1109 strlen (subfile->debugformat),
4a146b47 1110 &objfile->objfile_obstack);
c906108c
SS
1111 }
1112
303b6f5d
DJ
1113 /* Similarly for the producer. */
1114 if (subfile->producer != NULL)
1115 symtab->producer = obsavestring (subfile->producer,
1116 strlen (subfile->producer),
1117 &objfile->objfile_obstack);
1118
c906108c
SS
1119 /* All symtabs for the main file and the subfiles share a
1120 blockvector, so we need to clear primary for everything
1121 but the main file. */
1122
1123 symtab->primary = 0;
1124 }
24be086d
JB
1125 else
1126 {
1127 if (subfile->symtab)
1128 {
1129 /* Since we are ignoring that subfile, we also need
1130 to unlink the associated empty symtab that we created.
1131 Otherwise, we can into trouble because various parts
1132 such as the block-vector are uninitialized whereas
1133 the rest of the code assumes that they are.
1134
1135 We can only unlink the symtab because it was allocated
1136 on the objfile obstack. */
1137 struct symtab *s;
1138
1139 if (objfile->symtabs == subfile->symtab)
1140 objfile->symtabs = objfile->symtabs->next;
1141 else
1142 ALL_OBJFILE_SYMTABS (objfile, s)
1143 if (s->next == subfile->symtab)
1144 {
1145 s->next = s->next->next;
1146 break;
1147 }
1148 subfile->symtab = NULL;
1149 }
1150 }
c906108c
SS
1151 if (subfile->name != NULL)
1152 {
b8c9b27d 1153 xfree ((void *) subfile->name);
c906108c
SS
1154 }
1155 if (subfile->dirname != NULL)
1156 {
b8c9b27d 1157 xfree ((void *) subfile->dirname);
c906108c
SS
1158 }
1159 if (subfile->line_vector != NULL)
1160 {
b8c9b27d 1161 xfree ((void *) subfile->line_vector);
c906108c
SS
1162 }
1163 if (subfile->debugformat != NULL)
1164 {
b8c9b27d 1165 xfree ((void *) subfile->debugformat);
c906108c 1166 }
303b6f5d
DJ
1167 if (subfile->producer != NULL)
1168 xfree (subfile->producer);
c906108c
SS
1169
1170 nextsub = subfile->next;
b8c9b27d 1171 xfree ((void *) subfile);
c906108c
SS
1172 }
1173
1174 /* Set this for the main source file. */
1175 if (symtab)
1176 {
1177 symtab->primary = 1;
1178 }
1179
cb1df416
DJ
1180 /* Default any symbols without a specified symtab to the primary
1181 symtab. */
1182 if (blockvector)
1183 {
1184 int block_i;
1185
1186 for (block_i = 0; block_i < BLOCKVECTOR_NBLOCKS (blockvector); block_i++)
1187 {
1188 struct block *block = BLOCKVECTOR_BLOCK (blockvector, block_i);
1189 struct symbol *sym;
1190 struct dict_iterator iter;
1191
edb3359d
DJ
1192 /* Inlined functions may have symbols not in the global or static
1193 symbol lists. */
1194 if (BLOCK_FUNCTION (block) != NULL)
1195 if (SYMBOL_SYMTAB (BLOCK_FUNCTION (block)) == NULL)
1196 SYMBOL_SYMTAB (BLOCK_FUNCTION (block)) = symtab;
1197
cb1df416
DJ
1198 for (sym = dict_iterator_first (BLOCK_DICT (block), &iter);
1199 sym != NULL;
1200 sym = dict_iterator_next (&iter))
1201 if (SYMBOL_SYMTAB (sym) == NULL)
1202 SYMBOL_SYMTAB (sym) = symtab;
1203 }
1204 }
1205
c906108c
SS
1206 last_source_file = NULL;
1207 current_subfile = NULL;
99d9066e 1208 pending_macros = NULL;
801e3a5b
JB
1209 if (pending_addrmap)
1210 {
1211 obstack_free (&pending_addrmap_obstack, NULL);
1212 pending_addrmap = NULL;
1213 }
c906108c
SS
1214
1215 return symtab;
1216}
1217
1218/* Push a context block. Args are an identifying nesting level
1219 (checkable when you pop it), and the starting PC address of this
1220 context. */
1221
1222struct context_stack *
1223push_context (int desc, CORE_ADDR valu)
1224{
52f0bd74 1225 struct context_stack *new;
c906108c
SS
1226
1227 if (context_stack_depth == context_stack_size)
1228 {
1229 context_stack_size *= 2;
1230 context_stack = (struct context_stack *)
1231 xrealloc ((char *) context_stack,
c5aa993b 1232 (context_stack_size * sizeof (struct context_stack)));
c906108c
SS
1233 }
1234
1235 new = &context_stack[context_stack_depth++];
1236 new->depth = desc;
1237 new->locals = local_symbols;
1238 new->params = param_symbols;
1239 new->old_blocks = pending_blocks;
1240 new->start_addr = valu;
27aa8d6a 1241 new->using_directives = using_directives;
c906108c
SS
1242 new->name = NULL;
1243
1244 local_symbols = NULL;
1245 param_symbols = NULL;
27aa8d6a 1246 using_directives = NULL;
c906108c
SS
1247
1248 return new;
1249}
0c5e171a 1250
a672ef13
KD
1251/* Pop a context block. Returns the address of the context block just
1252 popped. */
1253
0c5e171a
KD
1254struct context_stack *
1255pop_context (void)
1256{
1257 gdb_assert (context_stack_depth > 0);
1258 return (&context_stack[--context_stack_depth]);
1259}
1260
c906108c 1261\f
357e46e7 1262
c906108c
SS
1263/* Compute a small integer hash code for the given name. */
1264
1265int
1266hashname (char *name)
1267{
357e46e7 1268 return (hash(name,strlen(name)) % HASHSIZE);
c906108c
SS
1269}
1270\f
1271
1272void
1273record_debugformat (char *format)
1274{
1b36a34b 1275 current_subfile->debugformat = xstrdup (format);
c906108c
SS
1276}
1277
303b6f5d
DJ
1278void
1279record_producer (const char *producer)
1280{
05279ca0
JB
1281 /* The producer is not always provided in the debugging info.
1282 Do nothing if PRODUCER is NULL. */
1283 if (producer == NULL)
1284 return;
1285
1b36a34b 1286 current_subfile->producer = xstrdup (producer);
303b6f5d
DJ
1287}
1288
c906108c
SS
1289/* Merge the first symbol list SRCLIST into the second symbol list
1290 TARGETLIST by repeated calls to add_symbol_to_list(). This
1291 procedure "frees" each link of SRCLIST by adding it to the
1292 free_pendings list. Caller must set SRCLIST to a null list after
1293 calling this function.
1294
1295 Void return. */
1296
1297void
1298merge_symbol_lists (struct pending **srclist, struct pending **targetlist)
1299{
52f0bd74 1300 int i;
c906108c
SS
1301
1302 if (!srclist || !*srclist)
1303 return;
1304
1305 /* Merge in elements from current link. */
1306 for (i = 0; i < (*srclist)->nsyms; i++)
1307 add_symbol_to_list ((*srclist)->symbol[i], targetlist);
1308
1309 /* Recurse on next. */
1310 merge_symbol_lists (&(*srclist)->next, targetlist);
1311
1312 /* "Free" the current link. */
1313 (*srclist)->next = free_pendings;
1314 free_pendings = (*srclist);
1315}
1316\f
1317/* Initialize anything that needs initializing when starting to read a
1318 fresh piece of a symbol file, e.g. reading in the stuff
1319 corresponding to a psymtab. */
1320
1321void
fba45db2 1322buildsym_init (void)
c906108c
SS
1323{
1324 free_pendings = NULL;
1325 file_symbols = NULL;
1326 global_symbols = NULL;
1327 pending_blocks = NULL;
99d9066e 1328 pending_macros = NULL;
801e3a5b
JB
1329
1330 /* We shouldn't have any address map at this point. */
1331 gdb_assert (! pending_addrmap);
1332 pending_addrmap_interesting = 0;
c906108c
SS
1333}
1334
1335/* Initialize anything that needs initializing when a completely new
1336 symbol file is specified (not just adding some symbols from another
1337 file, e.g. a shared library). */
1338
1339void
fba45db2 1340buildsym_new_init (void)
c906108c
SS
1341{
1342 buildsym_init ();
1343}