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