1 /* Support routines for building symbol tables in GDB's internal format.
2 Copyright (C) 1986-2018 Free Software Foundation, Inc.
4 This file is part of GDB.
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
8 the Free Software Foundation; either version 3 of the License, or
9 (at your option) any later version.
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.
16 You should have received a copy of the GNU General Public License
17 along with this program. If not, see <http://www.gnu.org/licenses/>. */
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.
23 Routines to support specific debugging information formats (stabs,
24 DWARF, etc) belong somewhere else.
26 The basic way this module is used is as follows:
28 scoped_free_pendings free_pending;
29 cust = start_symtab (...);
30 ... read debug info ...
31 cust = end_symtab (...);
33 The compunit symtab pointer ("cust") is returned from both start_symtab
34 and end_symtab to simplify the debug info readers.
36 There are minor variations on this, e.g., dwarf2read.c splits end_symtab
37 into two calls: end_symtab_get_static_block, end_symtab_from_static_block,
38 but all debug info readers follow this basic flow.
40 Reading DWARF Type Units is another variation:
42 scoped_free_pendings free_pending;
43 cust = start_symtab (...);
44 ... read debug info ...
45 cust = end_expandable_symtab (...);
47 And then reading subsequent Type Units within the containing "Comp Unit"
48 will use a second flow:
50 scoped_free_pendings free_pending;
51 cust = restart_symtab (...);
52 ... read debug info ...
53 cust = augment_type_symtab (...);
55 dbxread.c and xcoffread.c use another variation:
57 scoped_free_pendings free_pending;
58 cust = start_symtab (...);
59 ... read debug info ...
60 cust = end_symtab (...);
61 ... start_symtab + read + end_symtab repeated ...
67 #include "gdb_obstack.h"
72 #include "complaints.h"
73 #include "expression.h" /* For "enum exp_opcode" used by... */
74 #include "filenames.h" /* For DOSish file names. */
76 #include "demangle.h" /* Needed by SYMBOL_INIT_DEMANGLED_NAME. */
78 #include "cp-support.h"
79 #include "dictionary.h"
83 /* For cleanup_undefined_stabs_types and finish_global_stabs (somewhat
84 questionable--see comment where we call them). */
86 #include "stabsread.h"
88 /* The work-in-progress of the compunit we are building.
89 This is created first, before any subfiles by start_symtab. */
91 static struct buildsym_compunit
*buildsym_compunit
;
93 /* List of blocks already made (lexical contexts already closed).
94 This is used at the end to make the blockvector. */
98 struct pending_block
*next
;
102 static void free_buildsym_compunit (void);
104 static int compare_line_numbers (const void *ln1p
, const void *ln2p
);
106 /* Initial sizes of data structures. These are realloc'd larger if
107 needed, and realloc'd down to the size actually used, when
110 #define INITIAL_LINE_VECTOR_LENGTH 1000
113 buildsym_compunit::buildsym_compunit (struct objfile
*objfile_
,
115 const char *comp_dir_
,
116 enum language language_
,
118 : objfile (objfile_
),
119 m_last_source_file (name
== nullptr ? nullptr : xstrdup (name
)),
120 comp_dir (comp_dir_
== nullptr ? nullptr : xstrdup (comp_dir_
)),
121 language (language_
),
122 m_last_source_start_addr (last_addr
)
124 /* Allocate the compunit symtab now. The caller needs it to allocate
125 non-primary symtabs. It is also needed by get_macro_table. */
126 compunit_symtab
= allocate_compunit_symtab (objfile
, name
);
128 /* Build the subfile for NAME (the main source file) so that we can record
129 a pointer to it for later.
130 IMPORTANT: Do not allocate a struct symtab for NAME here.
131 It can happen that the debug info provides a different path to NAME than
132 DIRNAME,NAME. We cope with this in watch_main_source_file_lossage but
133 that only works if the main_subfile doesn't have a symtab yet. */
134 start_subfile (name
);
135 /* Save this so that we don't have to go looking for it at the end
136 of the subfiles list. */
137 main_subfile
= m_current_subfile
;
140 buildsym_compunit::~buildsym_compunit ()
142 struct subfile
*subfile
, *nextsub
;
144 if (m_pending_macros
!= nullptr)
145 free_macro_table (m_pending_macros
);
147 for (subfile
= subfiles
;
151 nextsub
= subfile
->next
;
152 xfree (subfile
->name
);
153 xfree (subfile
->line_vector
);
157 struct pending
*next
, *next1
;
159 for (next
= m_file_symbols
; next
!= NULL
; next
= next1
)
162 xfree ((void *) next
);
165 for (next
= m_global_symbols
; next
!= NULL
; next
= next1
)
168 xfree ((void *) next
);
173 buildsym_compunit::get_macro_table ()
175 if (m_pending_macros
== nullptr)
176 m_pending_macros
= new_macro_table (&objfile
->per_bfd
->storage_obstack
,
177 objfile
->per_bfd
->macro_cache
,
179 return m_pending_macros
;
182 /* Maintain the lists of symbols and blocks. */
184 /* Add a symbol to one of the lists of symbols. */
187 add_symbol_to_list (struct symbol
*symbol
, struct pending
**listhead
)
189 struct pending
*link
;
191 /* If this is an alias for another symbol, don't add it. */
192 if (symbol
->ginfo
.name
&& symbol
->ginfo
.name
[0] == '#')
195 /* We keep PENDINGSIZE symbols in each link of the list. If we
196 don't have a link with room in it, add a new link. */
197 if (*listhead
== NULL
|| (*listhead
)->nsyms
== PENDINGSIZE
)
199 link
= XNEW (struct pending
);
200 link
->next
= *listhead
;
205 (*listhead
)->symbol
[(*listhead
)->nsyms
++] = symbol
;
208 /* Find a symbol named NAME on a LIST. NAME need not be
209 '\0'-terminated; LENGTH is the length of the name. */
212 find_symbol_in_list (struct pending
*list
, char *name
, int length
)
219 for (j
= list
->nsyms
; --j
>= 0;)
221 pp
= SYMBOL_LINKAGE_NAME (list
->symbol
[j
]);
222 if (*pp
== *name
&& strncmp (pp
, name
, length
) == 0
223 && pp
[length
] == '\0')
225 return (list
->symbol
[j
]);
233 /* At end of reading syms, or in case of quit, ensure everything
234 associated with building symtabs is freed.
236 N.B. This is *not* intended to be used when building psymtabs. Some debug
237 info readers call this anyway, which is harmless if confusing. */
239 scoped_free_pendings::~scoped_free_pendings ()
241 free_buildsym_compunit ();
244 /* Record BLOCK on the list of all blocks in the file. Put it after
245 OPBLOCK, or at the beginning if opblock is NULL. This puts the
246 block in the list after all its subblocks. */
249 buildsym_compunit::record_pending_block (struct block
*block
,
250 struct pending_block
*opblock
)
252 struct pending_block
*pblock
;
254 pblock
= XOBNEW (&m_pending_block_obstack
, struct pending_block
);
255 pblock
->block
= block
;
258 pblock
->next
= opblock
->next
;
259 opblock
->next
= pblock
;
263 pblock
->next
= m_pending_blocks
;
264 m_pending_blocks
= pblock
;
268 /* Take one of the lists of symbols and make a block from it. Keep
269 the order the symbols have in the list (reversed from the input
270 file). Put the block on the list of pending blocks. */
273 buildsym_compunit::finish_block_internal
274 (struct symbol
*symbol
,
275 struct pending
**listhead
,
276 struct pending_block
*old_blocks
,
277 const struct dynamic_prop
*static_link
,
278 CORE_ADDR start
, CORE_ADDR end
,
279 int is_global
, int expandable
)
281 struct gdbarch
*gdbarch
= get_objfile_arch (objfile
);
282 struct pending
*next
, *next1
;
284 struct pending_block
*pblock
;
285 struct pending_block
*opblock
;
288 ? allocate_global_block (&objfile
->objfile_obstack
)
289 : allocate_block (&objfile
->objfile_obstack
));
294 = dict_create_linear (&objfile
->objfile_obstack
,
295 language
, *listhead
);
301 BLOCK_DICT (block
) = dict_create_hashed_expandable (language
);
302 dict_add_pending (BLOCK_DICT (block
), *listhead
);
307 dict_create_hashed (&objfile
->objfile_obstack
,
308 language
, *listhead
);
312 BLOCK_START (block
) = start
;
313 BLOCK_END (block
) = end
;
315 /* Put the block in as the value of the symbol that names it. */
319 struct type
*ftype
= SYMBOL_TYPE (symbol
);
320 struct dict_iterator iter
;
321 SYMBOL_BLOCK_VALUE (symbol
) = block
;
322 BLOCK_FUNCTION (block
) = symbol
;
324 if (TYPE_NFIELDS (ftype
) <= 0)
326 /* No parameter type information is recorded with the
327 function's type. Set that from the type of the
328 parameter symbols. */
329 int nparams
= 0, iparams
;
332 /* Here we want to directly access the dictionary, because
333 we haven't fully initialized the block yet. */
334 ALL_DICT_SYMBOLS (BLOCK_DICT (block
), iter
, sym
)
336 if (SYMBOL_IS_ARGUMENT (sym
))
341 TYPE_NFIELDS (ftype
) = nparams
;
342 TYPE_FIELDS (ftype
) = (struct field
*)
343 TYPE_ALLOC (ftype
, nparams
* sizeof (struct field
));
346 /* Here we want to directly access the dictionary, because
347 we haven't fully initialized the block yet. */
348 ALL_DICT_SYMBOLS (BLOCK_DICT (block
), iter
, sym
)
350 if (iparams
== nparams
)
353 if (SYMBOL_IS_ARGUMENT (sym
))
355 TYPE_FIELD_TYPE (ftype
, iparams
) = SYMBOL_TYPE (sym
);
356 TYPE_FIELD_ARTIFICIAL (ftype
, iparams
) = 0;
365 BLOCK_FUNCTION (block
) = NULL
;
368 if (static_link
!= NULL
)
369 objfile_register_static_link (objfile
, block
, static_link
);
371 /* Now free the links of the list, and empty the list. */
373 for (next
= *listhead
; next
; next
= next1
)
380 /* Check to be sure that the blocks have an end address that is
381 greater than starting address. */
383 if (BLOCK_END (block
) < BLOCK_START (block
))
387 complaint (_("block end address less than block "
388 "start address in %s (patched it)"),
389 SYMBOL_PRINT_NAME (symbol
));
393 complaint (_("block end address %s less than block "
394 "start address %s (patched it)"),
395 paddress (gdbarch
, BLOCK_END (block
)),
396 paddress (gdbarch
, BLOCK_START (block
)));
398 /* Better than nothing. */
399 BLOCK_END (block
) = BLOCK_START (block
);
402 /* Install this block as the superblock of all blocks made since the
403 start of this scope that don't have superblocks yet. */
406 for (pblock
= m_pending_blocks
;
407 pblock
&& pblock
!= old_blocks
;
408 pblock
= pblock
->next
)
410 if (BLOCK_SUPERBLOCK (pblock
->block
) == NULL
)
412 /* Check to be sure the blocks are nested as we receive
413 them. If the compiler/assembler/linker work, this just
414 burns a small amount of time.
416 Skip blocks which correspond to a function; they're not
417 physically nested inside this other blocks, only
419 if (BLOCK_FUNCTION (pblock
->block
) == NULL
420 && (BLOCK_START (pblock
->block
) < BLOCK_START (block
)
421 || BLOCK_END (pblock
->block
) > BLOCK_END (block
)))
425 complaint (_("inner block not inside outer block in %s"),
426 SYMBOL_PRINT_NAME (symbol
));
430 complaint (_("inner block (%s-%s) not "
431 "inside outer block (%s-%s)"),
432 paddress (gdbarch
, BLOCK_START (pblock
->block
)),
433 paddress (gdbarch
, BLOCK_END (pblock
->block
)),
434 paddress (gdbarch
, BLOCK_START (block
)),
435 paddress (gdbarch
, BLOCK_END (block
)));
437 if (BLOCK_START (pblock
->block
) < BLOCK_START (block
))
438 BLOCK_START (pblock
->block
) = BLOCK_START (block
);
439 if (BLOCK_END (pblock
->block
) > BLOCK_END (block
))
440 BLOCK_END (pblock
->block
) = BLOCK_END (block
);
442 BLOCK_SUPERBLOCK (pblock
->block
) = block
;
447 block_set_using (block
,
449 ? m_global_using_directives
450 : m_local_using_directives
),
451 &objfile
->objfile_obstack
);
453 m_global_using_directives
= NULL
;
455 m_local_using_directives
= NULL
;
457 record_pending_block (block
, opblock
);
463 buildsym_compunit::finish_block (struct symbol
*symbol
,
464 struct pending_block
*old_blocks
,
465 const struct dynamic_prop
*static_link
,
466 CORE_ADDR start
, CORE_ADDR end
)
468 return finish_block_internal (symbol
, &m_local_symbols
,
469 old_blocks
, static_link
, start
, end
, 0, 0);
472 /* Record that the range of addresses from START to END_INCLUSIVE
473 (inclusive, like it says) belongs to BLOCK. BLOCK's start and end
474 addresses must be set already. You must apply this function to all
475 BLOCK's children before applying it to BLOCK.
477 If a call to this function complicates the picture beyond that
478 already provided by BLOCK_START and BLOCK_END, then we create an
479 address map for the block. */
481 buildsym_compunit::record_block_range (struct block
*block
,
483 CORE_ADDR end_inclusive
)
485 /* If this is any different from the range recorded in the block's
486 own BLOCK_START and BLOCK_END, then note that the address map has
487 become interesting. Note that even if this block doesn't have
488 any "interesting" ranges, some later block might, so we still
489 need to record this block in the addrmap. */
490 if (start
!= BLOCK_START (block
)
491 || end_inclusive
+ 1 != BLOCK_END (block
))
492 m_pending_addrmap_interesting
= true;
494 if (m_pending_addrmap
== nullptr)
495 m_pending_addrmap
= addrmap_create_mutable (&m_pending_addrmap_obstack
);
497 addrmap_set_empty (m_pending_addrmap
, start
, end_inclusive
, block
);
501 buildsym_compunit::make_blockvector ()
503 struct pending_block
*next
;
504 struct blockvector
*blockvector
;
507 /* Count the length of the list of blocks. */
509 for (next
= m_pending_blocks
, i
= 0; next
; next
= next
->next
, i
++)
513 blockvector
= (struct blockvector
*)
514 obstack_alloc (&objfile
->objfile_obstack
,
515 (sizeof (struct blockvector
)
516 + (i
- 1) * sizeof (struct block
*)));
518 /* Copy the blocks into the blockvector. This is done in reverse
519 order, which happens to put the blocks into the proper order
520 (ascending starting address). finish_block has hair to insert
521 each block into the list after its subblocks in order to make
522 sure this is true. */
524 BLOCKVECTOR_NBLOCKS (blockvector
) = i
;
525 for (next
= m_pending_blocks
; next
; next
= next
->next
)
527 BLOCKVECTOR_BLOCK (blockvector
, --i
) = next
->block
;
530 free_pending_blocks ();
532 /* If we needed an address map for this symtab, record it in the
534 if (m_pending_addrmap
!= nullptr && m_pending_addrmap_interesting
)
535 BLOCKVECTOR_MAP (blockvector
)
536 = addrmap_create_fixed (m_pending_addrmap
, &objfile
->objfile_obstack
);
538 BLOCKVECTOR_MAP (blockvector
) = 0;
540 /* Some compilers output blocks in the wrong order, but we depend on
541 their being in the right order so we can binary search. Check the
542 order and moan about it.
543 Note: Remember that the first two blocks are the global and static
544 blocks. We could special case that fact and begin checking at block 2.
545 To avoid making that assumption we do not. */
546 if (BLOCKVECTOR_NBLOCKS (blockvector
) > 1)
548 for (i
= 1; i
< BLOCKVECTOR_NBLOCKS (blockvector
); i
++)
550 if (BLOCK_START (BLOCKVECTOR_BLOCK (blockvector
, i
- 1))
551 > BLOCK_START (BLOCKVECTOR_BLOCK (blockvector
, i
)))
554 = BLOCK_START (BLOCKVECTOR_BLOCK (blockvector
, i
));
556 complaint (_("block at %s out of order"),
557 hex_string ((LONGEST
) start
));
562 return (blockvector
);
565 /* Start recording information about source code that came from an
566 included (or otherwise merged-in) source file with a different
567 name. NAME is the name of the file (cannot be NULL). */
570 buildsym_compunit::start_subfile (const char *name
)
572 const char *subfile_dirname
;
573 struct subfile
*subfile
;
575 subfile_dirname
= comp_dir
.get ();
577 /* See if this subfile is already registered. */
579 for (subfile
= subfiles
; subfile
; subfile
= subfile
->next
)
583 /* If NAME is an absolute path, and this subfile is not, then
584 attempt to create an absolute path to compare. */
585 if (IS_ABSOLUTE_PATH (name
)
586 && !IS_ABSOLUTE_PATH (subfile
->name
)
587 && subfile_dirname
!= NULL
)
588 subfile_name
= concat (subfile_dirname
, SLASH_STRING
,
589 subfile
->name
, (char *) NULL
);
591 subfile_name
= subfile
->name
;
593 if (FILENAME_CMP (subfile_name
, name
) == 0)
595 m_current_subfile
= subfile
;
596 if (subfile_name
!= subfile
->name
)
597 xfree (subfile_name
);
600 if (subfile_name
!= subfile
->name
)
601 xfree (subfile_name
);
604 /* This subfile is not known. Add an entry for it. */
606 subfile
= XNEW (struct subfile
);
607 memset (subfile
, 0, sizeof (struct subfile
));
608 subfile
->buildsym_compunit
= this;
610 subfile
->next
= subfiles
;
613 m_current_subfile
= subfile
;
615 subfile
->name
= xstrdup (name
);
617 /* Initialize line-number recording for this subfile. */
618 subfile
->line_vector
= NULL
;
620 /* Default the source language to whatever can be deduced from the
621 filename. If nothing can be deduced (such as for a C/C++ include
622 file with a ".h" extension), then inherit whatever language the
623 previous subfile had. This kludgery is necessary because there
624 is no standard way in some object formats to record the source
625 language. Also, when symtabs are allocated we try to deduce a
626 language then as well, but it is too late for us to use that
627 information while reading symbols, since symtabs aren't allocated
628 until after all the symbols have been processed for a given
631 subfile
->language
= deduce_language_from_filename (subfile
->name
);
632 if (subfile
->language
== language_unknown
633 && subfile
->next
!= NULL
)
635 subfile
->language
= subfile
->next
->language
;
638 /* If the filename of this subfile ends in .C, then change the
639 language of any pending subfiles from C to C++. We also accept
640 any other C++ suffixes accepted by deduce_language_from_filename. */
641 /* Likewise for f2c. */
646 enum language sublang
= deduce_language_from_filename (subfile
->name
);
648 if (sublang
== language_cplus
|| sublang
== language_fortran
)
649 for (s
= subfiles
; s
!= NULL
; s
= s
->next
)
650 if (s
->language
== language_c
)
651 s
->language
= sublang
;
654 /* And patch up this file if necessary. */
655 if (subfile
->language
== language_c
656 && subfile
->next
!= NULL
657 && (subfile
->next
->language
== language_cplus
658 || subfile
->next
->language
== language_fortran
))
660 subfile
->language
= subfile
->next
->language
;
664 /* Delete the buildsym compunit. */
667 free_buildsym_compunit (void)
669 if (buildsym_compunit
== NULL
)
671 delete buildsym_compunit
;
672 buildsym_compunit
= NULL
;
675 /* For stabs readers, the first N_SO symbol is assumed to be the
676 source file name, and the subfile struct is initialized using that
677 assumption. If another N_SO symbol is later seen, immediately
678 following the first one, then the first one is assumed to be the
679 directory name and the second one is really the source file name.
681 So we have to patch up the subfile struct by moving the old name
682 value to dirname and remembering the new name. Some sanity
683 checking is performed to ensure that the state of the subfile
684 struct is reasonable and that the old name we are assuming to be a
685 directory name actually is (by checking for a trailing '/'). */
688 buildsym_compunit::patch_subfile_names (struct subfile
*subfile
,
693 && subfile
->name
!= NULL
694 && IS_DIR_SEPARATOR (subfile
->name
[strlen (subfile
->name
) - 1]))
696 comp_dir
.reset (subfile
->name
);
697 subfile
->name
= xstrdup (name
);
698 set_last_source_file (name
);
700 /* Default the source language to whatever can be deduced from
701 the filename. If nothing can be deduced (such as for a C/C++
702 include file with a ".h" extension), then inherit whatever
703 language the previous subfile had. This kludgery is
704 necessary because there is no standard way in some object
705 formats to record the source language. Also, when symtabs
706 are allocated we try to deduce a language then as well, but
707 it is too late for us to use that information while reading
708 symbols, since symtabs aren't allocated until after all the
709 symbols have been processed for a given source file. */
711 subfile
->language
= deduce_language_from_filename (subfile
->name
);
712 if (subfile
->language
== language_unknown
713 && subfile
->next
!= NULL
)
715 subfile
->language
= subfile
->next
->language
;
720 /* Handle the N_BINCL and N_EINCL symbol types that act like N_SOL for
721 switching source files (different subfiles, as we call them) within
722 one object file, but using a stack rather than in an arbitrary
726 buildsym_compunit::push_subfile ()
728 gdb_assert (m_current_subfile
!= NULL
);
729 gdb_assert (m_current_subfile
->name
!= NULL
);
730 m_subfile_stack
.push_back (m_current_subfile
->name
);
734 buildsym_compunit::pop_subfile ()
736 gdb_assert (!m_subfile_stack
.empty ());
737 const char *name
= m_subfile_stack
.back ();
738 m_subfile_stack
.pop_back ();
742 /* Add a linetable entry for line number LINE and address PC to the
743 line vector for SUBFILE. */
746 buildsym_compunit::record_line (struct subfile
*subfile
, int line
,
749 struct linetable_entry
*e
;
751 /* Ignore the dummy line number in libg.o */
757 /* Make sure line vector exists and is big enough. */
758 if (!subfile
->line_vector
)
760 subfile
->line_vector_length
= INITIAL_LINE_VECTOR_LENGTH
;
761 subfile
->line_vector
= (struct linetable
*)
762 xmalloc (sizeof (struct linetable
)
763 + subfile
->line_vector_length
* sizeof (struct linetable_entry
));
764 subfile
->line_vector
->nitems
= 0;
765 m_have_line_numbers
= true;
768 if (subfile
->line_vector
->nitems
+ 1 >= subfile
->line_vector_length
)
770 subfile
->line_vector_length
*= 2;
771 subfile
->line_vector
= (struct linetable
*)
772 xrealloc ((char *) subfile
->line_vector
,
773 (sizeof (struct linetable
)
774 + (subfile
->line_vector_length
775 * sizeof (struct linetable_entry
))));
778 /* Normally, we treat lines as unsorted. But the end of sequence
779 marker is special. We sort line markers at the same PC by line
780 number, so end of sequence markers (which have line == 0) appear
781 first. This is right if the marker ends the previous function,
782 and there is no padding before the next function. But it is
783 wrong if the previous line was empty and we are now marking a
784 switch to a different subfile. We must leave the end of sequence
785 marker at the end of this group of lines, not sort the empty line
786 to after the marker. The easiest way to accomplish this is to
787 delete any empty lines from our table, if they are followed by
788 end of sequence markers. All we lose is the ability to set
789 breakpoints at some lines which contain no instructions
791 if (line
== 0 && subfile
->line_vector
->nitems
> 0)
793 e
= subfile
->line_vector
->item
+ subfile
->line_vector
->nitems
- 1;
794 while (subfile
->line_vector
->nitems
> 0 && e
->pc
== pc
)
797 subfile
->line_vector
->nitems
--;
801 e
= subfile
->line_vector
->item
+ subfile
->line_vector
->nitems
++;
806 /* Needed in order to sort line tables from IBM xcoff files. Sigh! */
809 compare_line_numbers (const void *ln1p
, const void *ln2p
)
811 struct linetable_entry
*ln1
= (struct linetable_entry
*) ln1p
;
812 struct linetable_entry
*ln2
= (struct linetable_entry
*) ln2p
;
814 /* Note: this code does not assume that CORE_ADDRs can fit in ints.
815 Please keep it that way. */
816 if (ln1
->pc
< ln2
->pc
)
819 if (ln1
->pc
> ln2
->pc
)
822 /* If pc equal, sort by line. I'm not sure whether this is optimum
823 behavior (see comment at struct linetable in symtab.h). */
824 return ln1
->line
- ln2
->line
;
827 /* See buildsym.h. */
829 struct compunit_symtab
*
830 buildsym_compunit_symtab (void)
832 gdb_assert (buildsym_compunit
!= NULL
);
834 return buildsym_compunit
->get_compunit_symtab ();
837 /* See buildsym.h. */
840 get_macro_table (void)
842 struct objfile
*objfile
;
844 gdb_assert (buildsym_compunit
!= NULL
);
845 return buildsym_compunit
->get_macro_table ();
848 /* Start a new symtab for a new source file in OBJFILE. 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
851 one original source file.
853 NAME is the name of the file (cannot be NULL). COMP_DIR is the
854 directory in which the file was compiled (or NULL if not known).
855 START_ADDR is the lowest address of objects in the file (or 0 if
856 not known). LANGUAGE is the language of the source file, or
857 language_unknown if not known, in which case it'll be deduced from
860 struct compunit_symtab
*
861 start_symtab (struct objfile
*objfile
, const char *name
, const char *comp_dir
,
862 CORE_ADDR start_addr
, enum language language
)
864 /* These should have been reset either by successful completion of building
865 a symtab, or by the scoped_free_pendings destructor. */
866 gdb_assert (buildsym_compunit
== nullptr);
868 buildsym_compunit
= new struct buildsym_compunit (objfile
, name
, comp_dir
,
869 language
, start_addr
);
871 return buildsym_compunit
->get_compunit_symtab ();
874 /* Restart compilation for a symtab.
875 CUST is the result of end_expandable_symtab.
876 NAME, START_ADDR are the source file we are resuming with.
878 This is used when a symtab is built from multiple sources.
879 The symtab is first built with start_symtab/end_expandable_symtab
880 and then for each additional piece call restart_symtab/augment_*_symtab.
881 Note: At the moment there is only augment_type_symtab. */
884 restart_symtab (struct compunit_symtab
*cust
,
885 const char *name
, CORE_ADDR start_addr
)
887 /* These should have been reset either by successful completion of building
888 a symtab, or by the scoped_free_pendings destructor. */
889 gdb_assert (buildsym_compunit
== nullptr);
892 = new struct buildsym_compunit (COMPUNIT_OBJFILE (cust
),
894 COMPUNIT_DIRNAME (cust
),
895 compunit_language (cust
),
900 /* Subroutine of end_symtab to simplify it. Look for a subfile that
901 matches the main source file's basename. If there is only one, and
902 if the main source file doesn't have any symbol or line number
903 information, then copy this file's symtab and line_vector to the
904 main source file's subfile and discard the other subfile. This can
905 happen because of a compiler bug or from the user playing games
906 with #line or from things like a distributed build system that
907 manipulates the debug info. This can also happen from an innocent
908 symlink in the paths, we don't canonicalize paths here. */
911 buildsym_compunit::watch_main_source_file_lossage ()
913 struct subfile
*mainsub
, *subfile
;
915 /* Get the main source file. */
916 mainsub
= main_subfile
;
918 /* If the main source file doesn't have any line number or symbol
919 info, look for an alias in another subfile. */
921 if (mainsub
->line_vector
== NULL
922 && mainsub
->symtab
== NULL
)
924 const char *mainbase
= lbasename (mainsub
->name
);
926 struct subfile
*prevsub
;
927 struct subfile
*mainsub_alias
= NULL
;
928 struct subfile
*prev_mainsub_alias
= NULL
;
931 for (subfile
= subfiles
;
933 subfile
= subfile
->next
)
935 if (subfile
== mainsub
)
937 if (filename_cmp (lbasename (subfile
->name
), mainbase
) == 0)
940 mainsub_alias
= subfile
;
941 prev_mainsub_alias
= prevsub
;
948 gdb_assert (mainsub_alias
!= NULL
&& mainsub_alias
!= mainsub
);
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. */
954 mainsub
->line_vector
= mainsub_alias
->line_vector
;
955 mainsub
->line_vector_length
= mainsub_alias
->line_vector_length
;
956 mainsub
->symtab
= mainsub_alias
->symtab
;
958 if (prev_mainsub_alias
== NULL
)
959 subfiles
= mainsub_alias
->next
;
961 prev_mainsub_alias
->next
= mainsub_alias
->next
;
962 xfree (mainsub_alias
->name
);
963 xfree (mainsub_alias
);
968 /* Implementation of the first part of end_symtab. It allows modifying
969 STATIC_BLOCK before it gets finalized by end_symtab_from_static_block.
970 If the returned value is NULL there is no blockvector created for
971 this symtab (you still must call end_symtab_from_static_block).
973 END_ADDR is the same as for end_symtab: the address of the end of the
976 If EXPANDABLE is non-zero the STATIC_BLOCK dictionary is made
979 If REQUIRED is non-zero, then a symtab is created even if it does
980 not contain any symbols. */
983 buildsym_compunit::end_symtab_get_static_block (CORE_ADDR end_addr
,
984 int expandable
, int required
)
986 /* Finish the lexical context of the last function in the file; pop
987 the context stack. */
989 if (!m_context_stack
.empty ())
991 struct context_stack cstk
= pop_context ();
993 /* Make a block for the local symbols within. */
994 finish_block (cstk
.name
, cstk
.old_blocks
, NULL
,
995 cstk
.start_addr
, end_addr
);
997 if (!m_context_stack
.empty ())
999 /* This is said to happen with SCO. The old coffread.c
1000 code simply emptied the context stack, so we do the
1001 same. FIXME: Find out why it is happening. This is not
1002 believed to happen in most cases (even for coffread.c);
1003 it used to be an abort(). */
1004 complaint (_("Context stack not empty in end_symtab"));
1005 m_context_stack
.clear ();
1009 /* Reordered executables may have out of order pending blocks; if
1010 OBJF_REORDERED is true, then sort the pending blocks. */
1012 if ((objfile
->flags
& OBJF_REORDERED
) && m_pending_blocks
)
1014 struct pending_block
*pb
;
1016 std::vector
<block
*> barray
;
1018 for (pb
= m_pending_blocks
; pb
!= NULL
; pb
= pb
->next
)
1019 barray
.push_back (pb
->block
);
1021 /* Sort blocks by start address in descending order. Blocks with the
1022 same start address must remain in the original order to preserve
1023 inline function caller/callee relationships. */
1024 std::stable_sort (barray
.begin (), barray
.end (),
1025 [] (const block
*a
, const block
*b
)
1027 return BLOCK_START (a
) > BLOCK_START (b
);
1031 for (pb
= m_pending_blocks
; pb
!= NULL
; pb
= pb
->next
)
1032 pb
->block
= barray
[i
++];
1035 /* Cleanup any undefined types that have been left hanging around
1036 (this needs to be done before the finish_blocks so that
1037 file_symbols is still good).
1039 Both cleanup_undefined_stabs_types and finish_global_stabs are stabs
1040 specific, but harmless for other symbol readers, since on gdb
1041 startup or when finished reading stabs, the state is set so these
1042 are no-ops. FIXME: Is this handled right in case of QUIT? Can
1043 we make this cleaner? */
1045 cleanup_undefined_stabs_types (objfile
);
1046 finish_global_stabs (objfile
);
1049 && m_pending_blocks
== NULL
1050 && m_file_symbols
== NULL
1051 && m_global_symbols
== NULL
1052 && !m_have_line_numbers
1053 && m_pending_macros
== NULL
1054 && m_global_using_directives
== NULL
)
1056 /* Ignore symtabs that have no functions with real debugging info. */
1061 /* Define the STATIC_BLOCK. */
1062 return finish_block_internal (NULL
, get_file_symbols (), NULL
, NULL
,
1063 m_last_source_start_addr
,
1064 end_addr
, 0, expandable
);
1068 /* Subroutine of end_symtab_from_static_block to simplify it.
1069 Handle the "have blockvector" case.
1070 See end_symtab_from_static_block for a description of the arguments. */
1072 struct compunit_symtab
*
1073 buildsym_compunit::end_symtab_with_blockvector (struct block
*static_block
,
1074 int section
, int expandable
)
1076 struct compunit_symtab
*cu
= compunit_symtab
;
1077 struct symtab
*symtab
;
1078 struct blockvector
*blockvector
;
1079 struct subfile
*subfile
;
1082 gdb_assert (static_block
!= NULL
);
1083 gdb_assert (subfiles
!= NULL
);
1085 end_addr
= BLOCK_END (static_block
);
1087 /* Create the GLOBAL_BLOCK and build the blockvector. */
1088 finish_block_internal (NULL
, get_global_symbols (), NULL
, NULL
,
1089 m_last_source_start_addr
, end_addr
,
1091 blockvector
= make_blockvector ();
1093 /* Read the line table if it has to be read separately.
1094 This is only used by xcoffread.c. */
1095 if (objfile
->sf
->sym_read_linetable
!= NULL
)
1096 objfile
->sf
->sym_read_linetable (objfile
);
1098 /* Handle the case where the debug info specifies a different path
1099 for the main source file. It can cause us to lose track of its
1100 line number information. */
1101 watch_main_source_file_lossage ();
1103 /* Now create the symtab objects proper, if not already done,
1104 one for each subfile. */
1106 for (subfile
= subfiles
;
1108 subfile
= subfile
->next
)
1110 int linetablesize
= 0;
1112 if (subfile
->line_vector
)
1114 linetablesize
= sizeof (struct linetable
) +
1115 subfile
->line_vector
->nitems
* sizeof (struct linetable_entry
);
1117 /* Like the pending blocks, the line table may be
1118 scrambled in reordered executables. Sort it if
1119 OBJF_REORDERED is true. */
1120 if (objfile
->flags
& OBJF_REORDERED
)
1121 qsort (subfile
->line_vector
->item
,
1122 subfile
->line_vector
->nitems
,
1123 sizeof (struct linetable_entry
), compare_line_numbers
);
1126 /* Allocate a symbol table if necessary. */
1127 if (subfile
->symtab
== NULL
)
1128 subfile
->symtab
= allocate_symtab (cu
, subfile
->name
);
1129 symtab
= subfile
->symtab
;
1131 /* Fill in its components. */
1133 if (subfile
->line_vector
)
1135 /* Reallocate the line table on the symbol obstack. */
1136 SYMTAB_LINETABLE (symtab
) = (struct linetable
*)
1137 obstack_alloc (&objfile
->objfile_obstack
, linetablesize
);
1138 memcpy (SYMTAB_LINETABLE (symtab
), subfile
->line_vector
,
1143 SYMTAB_LINETABLE (symtab
) = NULL
;
1146 /* Use whatever language we have been using for this
1147 subfile, not the one that was deduced in allocate_symtab
1148 from the filename. We already did our own deducing when
1149 we created the subfile, and we may have altered our
1150 opinion of what language it is from things we found in
1152 symtab
->language
= subfile
->language
;
1155 /* Make sure the symtab of main_subfile is the first in its list. */
1157 struct symtab
*main_symtab
, *prev_symtab
;
1159 main_symtab
= main_subfile
->symtab
;
1161 ALL_COMPUNIT_FILETABS (cu
, symtab
)
1163 if (symtab
== main_symtab
)
1165 if (prev_symtab
!= NULL
)
1167 prev_symtab
->next
= main_symtab
->next
;
1168 main_symtab
->next
= COMPUNIT_FILETABS (cu
);
1169 COMPUNIT_FILETABS (cu
) = main_symtab
;
1173 prev_symtab
= symtab
;
1175 gdb_assert (main_symtab
== COMPUNIT_FILETABS (cu
));
1178 /* Fill out the compunit symtab. */
1180 if (comp_dir
!= NULL
)
1182 /* Reallocate the dirname on the symbol obstack. */
1183 const char *comp_dir
= this->comp_dir
.get ();
1184 COMPUNIT_DIRNAME (cu
)
1185 = (const char *) obstack_copy0 (&objfile
->objfile_obstack
,
1186 comp_dir
, strlen (comp_dir
));
1189 /* Save the debug format string (if any) in the symtab. */
1190 COMPUNIT_DEBUGFORMAT (cu
) = debugformat
;
1192 /* Similarly for the producer. */
1193 COMPUNIT_PRODUCER (cu
) = producer
;
1195 COMPUNIT_BLOCKVECTOR (cu
) = blockvector
;
1197 struct block
*b
= BLOCKVECTOR_BLOCK (blockvector
, GLOBAL_BLOCK
);
1199 set_block_compunit_symtab (b
, cu
);
1202 COMPUNIT_BLOCK_LINE_SECTION (cu
) = section
;
1204 COMPUNIT_MACRO_TABLE (cu
) = release_macros ();
1206 /* Default any symbols without a specified symtab to the primary symtab. */
1210 /* The main source file's symtab. */
1211 symtab
= COMPUNIT_FILETABS (cu
);
1213 for (block_i
= 0; block_i
< BLOCKVECTOR_NBLOCKS (blockvector
); block_i
++)
1215 struct block
*block
= BLOCKVECTOR_BLOCK (blockvector
, block_i
);
1217 struct dict_iterator iter
;
1219 /* Inlined functions may have symbols not in the global or
1220 static symbol lists. */
1221 if (BLOCK_FUNCTION (block
) != NULL
)
1222 if (symbol_symtab (BLOCK_FUNCTION (block
)) == NULL
)
1223 symbol_set_symtab (BLOCK_FUNCTION (block
), symtab
);
1225 /* Note that we only want to fix up symbols from the local
1226 blocks, not blocks coming from included symtabs. That is why
1227 we use ALL_DICT_SYMBOLS here and not ALL_BLOCK_SYMBOLS. */
1228 ALL_DICT_SYMBOLS (BLOCK_DICT (block
), iter
, sym
)
1229 if (symbol_symtab (sym
) == NULL
)
1230 symbol_set_symtab (sym
, symtab
);
1234 add_compunit_symtab_to_objfile (cu
);
1239 /* Implementation of the second part of end_symtab. Pass STATIC_BLOCK
1240 as value returned by end_symtab_get_static_block.
1242 SECTION is the same as for end_symtab: the section number
1243 (in objfile->section_offsets) of the blockvector and linetable.
1245 If EXPANDABLE is non-zero the GLOBAL_BLOCK dictionary is made
1248 struct compunit_symtab
*
1249 buildsym_compunit::end_symtab_from_static_block (struct block
*static_block
,
1250 int section
, int expandable
)
1252 struct compunit_symtab
*cu
;
1254 if (static_block
== NULL
)
1256 /* Handle the "no blockvector" case.
1257 When this happens there is nothing to record, so there's nothing
1258 to do: memory will be freed up later.
1260 Note: We won't be adding a compunit to the objfile's list of
1261 compunits, so there's nothing to unchain. However, since each symtab
1262 is added to the objfile's obstack we can't free that space.
1263 We could do better, but this is believed to be a sufficiently rare
1268 cu
= end_symtab_with_blockvector (static_block
, section
, expandable
);
1273 /* Finish the symbol definitions for one main source file, close off
1274 all the lexical contexts for that file (creating struct block's for
1275 them), then make the struct symtab for that file and put it in the
1278 END_ADDR is the address of the end of the file's text. SECTION is
1279 the section number (in objfile->section_offsets) of the blockvector
1282 Note that it is possible for end_symtab() to return NULL. In
1283 particular, for the DWARF case at least, it will return NULL when
1284 it finds a compilation unit that has exactly one DIE, a
1285 TAG_compile_unit DIE. This can happen when we link in an object
1286 file that was compiled from an empty source file. Returning NULL
1287 is probably not the correct thing to do, because then gdb will
1288 never know about this empty file (FIXME).
1290 If you need to modify STATIC_BLOCK before it is finalized you should
1291 call end_symtab_get_static_block and end_symtab_from_static_block
1294 struct compunit_symtab
*
1295 buildsym_compunit::end_symtab (CORE_ADDR end_addr
, int section
)
1297 struct block
*static_block
;
1299 static_block
= end_symtab_get_static_block (end_addr
, 0, 0);
1300 return end_symtab_from_static_block (static_block
, section
, 0);
1303 /* Same as end_symtab except create a symtab that can be later added to. */
1305 struct compunit_symtab
*
1306 buildsym_compunit::end_expandable_symtab (CORE_ADDR end_addr
, int section
)
1308 struct block
*static_block
;
1310 static_block
= end_symtab_get_static_block (end_addr
, 1, 0);
1311 return end_symtab_from_static_block (static_block
, section
, 1);
1314 /* Subroutine of augment_type_symtab to simplify it.
1315 Attach the main source file's symtab to all symbols in PENDING_LIST that
1319 set_missing_symtab (struct pending
*pending_list
,
1320 struct compunit_symtab
*cu
)
1322 struct pending
*pending
;
1325 for (pending
= pending_list
; pending
!= NULL
; pending
= pending
->next
)
1327 for (i
= 0; i
< pending
->nsyms
; ++i
)
1329 if (symbol_symtab (pending
->symbol
[i
]) == NULL
)
1330 symbol_set_symtab (pending
->symbol
[i
], COMPUNIT_FILETABS (cu
));
1335 /* Same as end_symtab, but for the case where we're adding more symbols
1336 to an existing symtab that is known to contain only type information.
1337 This is the case for DWARF4 Type Units. */
1340 buildsym_compunit::augment_type_symtab ()
1342 struct compunit_symtab
*cust
= compunit_symtab
;
1343 const struct blockvector
*blockvector
= COMPUNIT_BLOCKVECTOR (cust
);
1345 if (!m_context_stack
.empty ())
1346 complaint (_("Context stack not empty in augment_type_symtab"));
1347 if (m_pending_blocks
!= NULL
)
1348 complaint (_("Blocks in a type symtab"));
1349 if (m_pending_macros
!= NULL
)
1350 complaint (_("Macro in a type symtab"));
1351 if (m_have_line_numbers
)
1352 complaint (_("Line numbers recorded in a type symtab"));
1354 if (m_file_symbols
!= NULL
)
1356 struct block
*block
= BLOCKVECTOR_BLOCK (blockvector
, STATIC_BLOCK
);
1358 /* First mark any symbols without a specified symtab as belonging
1359 to the primary symtab. */
1360 set_missing_symtab (m_file_symbols
, cust
);
1362 dict_add_pending (BLOCK_DICT (block
), m_file_symbols
);
1365 if (m_global_symbols
!= NULL
)
1367 struct block
*block
= BLOCKVECTOR_BLOCK (blockvector
, GLOBAL_BLOCK
);
1369 /* First mark any symbols without a specified symtab as belonging
1370 to the primary symtab. */
1371 set_missing_symtab (m_global_symbols
, cust
);
1373 dict_add_pending (BLOCK_DICT (block
),
1378 /* Push a context block. Args are an identifying nesting level
1379 (checkable when you pop it), and the starting PC address of this
1382 struct context_stack
*
1383 buildsym_compunit::push_context (int desc
, CORE_ADDR valu
)
1385 m_context_stack
.emplace_back ();
1386 struct context_stack
*newobj
= &m_context_stack
.back ();
1388 newobj
->depth
= desc
;
1389 newobj
->locals
= m_local_symbols
;
1390 newobj
->old_blocks
= m_pending_blocks
;
1391 newobj
->start_addr
= valu
;
1392 newobj
->local_using_directives
= m_local_using_directives
;
1393 newobj
->name
= NULL
;
1395 m_local_symbols
= NULL
;
1396 m_local_using_directives
= NULL
;
1401 /* Pop a context block. Returns the address of the context block just
1404 struct context_stack
1405 buildsym_compunit::pop_context ()
1407 gdb_assert (!m_context_stack
.empty ());
1408 struct context_stack result
= m_context_stack
.back ();
1409 m_context_stack
.pop_back ();
1416 record_debugformat (const char *format
)
1418 buildsym_compunit
->record_debugformat (format
);
1422 record_producer (const char *producer
)
1424 buildsym_compunit
->record_producer (producer
);
1429 /* See buildsym.h. */
1432 set_last_source_file (const char *name
)
1434 gdb_assert (buildsym_compunit
!= nullptr || name
== nullptr);
1435 if (buildsym_compunit
!= nullptr)
1436 buildsym_compunit
->set_last_source_file (name
);
1439 /* See buildsym.h. */
1442 get_last_source_file ()
1444 if (buildsym_compunit
== nullptr)
1446 return buildsym_compunit
->get_last_source_file ();
1449 /* See buildsym.h. */
1452 set_last_source_start_addr (CORE_ADDR addr
)
1454 gdb_assert (buildsym_compunit
!= nullptr);
1455 buildsym_compunit
->set_last_source_start_addr (addr
);
1458 /* See buildsym.h. */
1461 get_last_source_start_addr ()
1463 gdb_assert (buildsym_compunit
!= nullptr);
1464 return buildsym_compunit
->get_last_source_start_addr ();
1467 /* See buildsym.h. */
1469 struct using_direct
**
1470 get_local_using_directives ()
1472 gdb_assert (buildsym_compunit
!= nullptr);
1473 return buildsym_compunit
->get_local_using_directives ();
1476 /* See buildsym.h. */
1479 set_local_using_directives (struct using_direct
*new_local
)
1481 gdb_assert (buildsym_compunit
!= nullptr);
1482 buildsym_compunit
->set_local_using_directives (new_local
);
1485 /* See buildsym.h. */
1487 struct using_direct
**
1488 get_global_using_directives ()
1490 gdb_assert (buildsym_compunit
!= nullptr);
1491 return buildsym_compunit
->get_global_using_directives ();
1494 /* See buildsym.h. */
1497 outermost_context_p ()
1499 gdb_assert (buildsym_compunit
!= nullptr);
1500 return buildsym_compunit
->outermost_context_p ();
1503 /* See buildsym.h. */
1505 struct context_stack
*
1506 get_current_context_stack ()
1508 gdb_assert (buildsym_compunit
!= nullptr);
1509 return buildsym_compunit
->get_current_context_stack ();
1512 /* See buildsym.h. */
1515 get_context_stack_depth ()
1517 gdb_assert (buildsym_compunit
!= nullptr);
1518 return buildsym_compunit
->get_context_stack_depth ();
1521 /* See buildsym.h. */
1524 get_current_subfile ()
1526 gdb_assert (buildsym_compunit
!= nullptr);
1527 return buildsym_compunit
->get_current_subfile ();
1530 /* See buildsym.h. */
1533 get_local_symbols ()
1535 gdb_assert (buildsym_compunit
!= nullptr);
1536 return buildsym_compunit
->get_local_symbols ();
1539 /* See buildsym.h. */
1544 gdb_assert (buildsym_compunit
!= nullptr);
1545 return buildsym_compunit
->get_file_symbols ();
1548 /* See buildsym.h. */
1551 get_global_symbols ()
1553 gdb_assert (buildsym_compunit
!= nullptr);
1554 return buildsym_compunit
->get_global_symbols ();
1558 start_subfile (const char *name
)
1560 gdb_assert (buildsym_compunit
!= nullptr);
1561 buildsym_compunit
->start_subfile (name
);
1565 patch_subfile_names (struct subfile
*subfile
, const char *name
)
1567 gdb_assert (buildsym_compunit
!= nullptr);
1568 buildsym_compunit
->patch_subfile_names (subfile
, name
);
1574 gdb_assert (buildsym_compunit
!= nullptr);
1575 buildsym_compunit
->push_subfile ();
1581 gdb_assert (buildsym_compunit
!= nullptr);
1582 return buildsym_compunit
->pop_subfile ();
1586 end_symtab_get_static_block (CORE_ADDR end_addr
, int expandable
, int required
)
1588 gdb_assert (buildsym_compunit
!= nullptr);
1589 return buildsym_compunit
->end_symtab_get_static_block (end_addr
, expandable
,
1593 struct compunit_symtab
*
1594 end_symtab_from_static_block (struct block
*static_block
,
1595 int section
, int expandable
)
1597 gdb_assert (buildsym_compunit
!= nullptr);
1598 struct compunit_symtab
*result
1599 = buildsym_compunit
->end_symtab_from_static_block (static_block
,
1600 section
, expandable
);
1601 free_buildsym_compunit ();
1605 struct compunit_symtab
*
1606 end_symtab (CORE_ADDR end_addr
, int section
)
1608 gdb_assert (buildsym_compunit
!= nullptr);
1609 struct compunit_symtab
*result
1610 = buildsym_compunit
->end_symtab (end_addr
, section
);
1611 free_buildsym_compunit ();
1615 struct compunit_symtab
*
1616 end_expandable_symtab (CORE_ADDR end_addr
, int section
)
1618 gdb_assert (buildsym_compunit
!= nullptr);
1619 struct compunit_symtab
*result
1620 = buildsym_compunit
->end_expandable_symtab (end_addr
, section
);
1621 free_buildsym_compunit ();
1626 augment_type_symtab ()
1628 gdb_assert (buildsym_compunit
!= nullptr);
1629 buildsym_compunit
->augment_type_symtab ();
1630 free_buildsym_compunit ();
1633 struct context_stack
*
1634 push_context (int desc
, CORE_ADDR valu
)
1636 gdb_assert (buildsym_compunit
!= nullptr);
1637 return buildsym_compunit
->push_context (desc
, valu
);
1640 struct context_stack
1643 gdb_assert (buildsym_compunit
!= nullptr);
1644 return buildsym_compunit
->pop_context ();
1648 finish_block (struct symbol
*symbol
, struct pending_block
*old_blocks
,
1649 const struct dynamic_prop
*static_link
,
1650 CORE_ADDR start
, CORE_ADDR end
)
1652 gdb_assert (buildsym_compunit
!= nullptr);
1653 return buildsym_compunit
->finish_block (symbol
, old_blocks
, static_link
,
1658 record_block_range (struct block
*block
, CORE_ADDR start
,
1659 CORE_ADDR end_inclusive
)
1661 gdb_assert (buildsym_compunit
!= nullptr);
1662 buildsym_compunit
->record_block_range (block
, start
, end_inclusive
);
1666 record_line (struct subfile
*subfile
, int line
, CORE_ADDR pc
)
1668 gdb_assert (buildsym_compunit
!= nullptr);
1669 buildsym_compunit
->record_line (subfile
, line
, pc
);