-/* See buildsym.h. */
-
-struct compunit_symtab *
-buildsym_compunit_symtab (void)
-{
- gdb_assert (buildsym_compunit != NULL);
-
- return buildsym_compunit->compunit_symtab;
-}
-
-/* See buildsym.h. */
-
-struct macro_table *
-get_macro_table (void)
-{
- struct objfile *objfile;
-
- gdb_assert (buildsym_compunit != NULL);
-
- objfile = buildsym_compunit->objfile;
-
- if (! pending_macros)
- {
- pending_macros = new_macro_table (&objfile->per_bfd->storage_obstack,
- objfile->per_bfd->macro_cache,
- buildsym_compunit->compunit_symtab);
- }
-
- return pending_macros;
-}
-\f
-/* Init state to prepare for building a symtab.
- Note: This can't be done in buildsym_init because dbxread.c and xcoffread.c
- can call start_symtab+end_symtab multiple times after one call to
- buildsym_init. */
-
-static void
-prepare_for_building (const char *name, CORE_ADDR start_addr)
-{
- set_last_source_file (name);
- last_source_start_addr = start_addr;
-
- local_symbols = NULL;
- local_using_directives = NULL;
- within_function = 0;
- have_line_numbers = 0;
-
- context_stack_depth = 0;
-
- /* These should have been reset either by successful completion of building
- a symtab, or by the really_free_pendings cleanup. */
- gdb_assert (file_symbols == NULL);
- gdb_assert (global_symbols == NULL);
- gdb_assert (global_using_directives == NULL);
- gdb_assert (pending_macros == NULL);
- gdb_assert (pending_addrmap == NULL);
- gdb_assert (current_subfile == NULL);
-}
-
-/* Start a new symtab for a new source file in OBJFILE. Called, for example,
- when a stabs symbol of type N_SO is seen, or when a DWARF
- TAG_compile_unit DIE is seen. It indicates the start of data for
- one original source file.
-
- NAME is the name of the file (cannot be NULL). COMP_DIR is the directory in
- which the file was compiled (or NULL if not known). START_ADDR is the
- lowest address of objects in the file (or 0 if not known). */
-
-struct compunit_symtab *
-start_symtab (struct objfile *objfile, const char *name, const char *comp_dir,
- CORE_ADDR start_addr)
-{
- prepare_for_building (name, start_addr);
-
- buildsym_compunit = start_buildsym_compunit (objfile, comp_dir);
-
- /* Allocate the compunit symtab now. The caller needs it to allocate
- non-primary symtabs. It is also needed by get_macro_table. */
- buildsym_compunit->compunit_symtab = allocate_compunit_symtab (objfile,
- name);
-
- /* Build the subfile for NAME (the main source file) so that we can record
- a pointer to it for later.
- IMPORTANT: Do not allocate a struct symtab for NAME here.
- It can happen that the debug info provides a different path to NAME than
- DIRNAME,NAME. We cope with this in watch_main_source_file_lossage but
- that only works if the main_subfile doesn't have a symtab yet. */
- start_subfile (name);
- /* Save this so that we don't have to go looking for it at the end
- of the subfiles list. */
- buildsym_compunit->main_subfile = current_subfile;
-
- return buildsym_compunit->compunit_symtab;
-}
-
-/* Restart compilation for a symtab.
- CUST is the result of end_expandable_symtab.
- NAME, START_ADDR are the source file we are resuming with.
-
- This is used when a symtab is built from multiple sources.
- The symtab is first built with start_symtab/end_expandable_symtab
- and then for each additional piece call restart_symtab/augment_*_symtab.
- Note: At the moment there is only augment_type_symtab. */
-
-void
-restart_symtab (struct compunit_symtab *cust,
- const char *name, CORE_ADDR start_addr)
-{
- prepare_for_building (name, start_addr);
-
- buildsym_compunit = start_buildsym_compunit (COMPUNIT_OBJFILE (cust),
- COMPUNIT_DIRNAME (cust));
- buildsym_compunit->compunit_symtab = cust;
-}
-