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