comp_dir (comp_dir_ == nullptr ? nullptr : xstrdup (comp_dir_)),
language (language_),
m_last_source_start_addr (last_addr)
+ {
+ /* Allocate the compunit symtab now. The caller needs it to allocate
+ non-primary symtabs. It is also needed by get_macro_table. */
+ 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. */
+ main_subfile = m_current_subfile;
+ }
+
+ /* Reopen an existing compunit_symtab so that additional symbols can
+ be added to it. Arguments are as for the main constructor. CUST
+ is the expandable compunit_symtab to be reopened. */
+
+ buildsym_compunit (struct objfile *objfile_, const char *name,
+ const char *comp_dir_, enum language language_,
+ CORE_ADDR last_addr, struct compunit_symtab *cust)
+ : objfile (objfile_),
+ m_last_source_file (name == nullptr ? nullptr : xstrdup (name)),
+ comp_dir (comp_dir_ == nullptr ? nullptr : xstrdup (comp_dir_)),
+ compunit_symtab (cust),
+ language (language_),
+ m_last_source_start_addr (last_addr)
{
}
m_last_source_file.reset (new_name);
}
+ const char *get_last_source_file ()
+ {
+ return m_last_source_file.get ();
+ }
+
struct macro_table *get_macro_table ()
{
if (m_pending_macros == nullptr)
m_pending_blocks = nullptr;
}
+ struct block *finish_block (struct symbol *symbol,
+ struct pending_block *old_blocks,
+ const struct dynamic_prop *static_link,
+ CORE_ADDR start, CORE_ADDR end);
+
+ void record_block_range (struct block *block,
+ CORE_ADDR start, CORE_ADDR end_inclusive);
+
+ void start_subfile (const char *name);
+
+ void patch_subfile_names (struct subfile *subfile, const char *name);
+
+ void push_subfile ();
+
+ const char *pop_subfile ();
+
+ void record_line (struct subfile *subfile, int line, CORE_ADDR pc);
+
+ struct compunit_symtab *get_compunit_symtab ()
+ {
+ return compunit_symtab;
+ }
+
+ void set_last_source_start_addr (CORE_ADDR addr)
+ {
+ m_last_source_start_addr = addr;
+ }
+
+ CORE_ADDR get_last_source_start_addr ()
+ {
+ return m_last_source_start_addr;
+ }
+
+ struct using_direct **get_local_using_directives ()
+ {
+ return &m_local_using_directives;
+ }
+
+ void set_local_using_directives (struct using_direct *new_local)
+ {
+ m_local_using_directives = new_local;
+ }
+
+ struct using_direct **get_global_using_directives ()
+ {
+ return &m_global_using_directives;
+ }
+
+ bool outermost_context_p () const
+ {
+ return m_context_stack.empty ();
+ }
+
+ struct context_stack *get_current_context_stack ()
+ {
+ if (m_context_stack.empty ())
+ return nullptr;
+ return &m_context_stack.back ();
+ }
+
+ int get_context_stack_depth () const
+ {
+ return m_context_stack.size ();
+ }
+
+ struct subfile *get_current_subfile ()
+ {
+ return m_current_subfile;
+ }
+
+ struct pending **get_local_symbols ()
+ {
+ return &m_local_symbols;
+ }
+
+ struct pending **get_file_symbols ()
+ {
+ return &m_file_symbols;
+ }
+
+ struct pending **get_global_symbols ()
+ {
+ return &m_global_symbols;
+ }
+
+ void record_debugformat (const char *format)
+ {
+ debugformat = format;
+ }
+
+ void record_producer (const char *producer)
+ {
+ this->producer = producer;
+ }
+
+ struct context_stack *push_context (int desc, CORE_ADDR valu);
+
+ struct context_stack pop_context ();
+
+ struct block *end_symtab_get_static_block (CORE_ADDR end_addr,
+ int expandable, int required);
+
+ struct compunit_symtab *end_symtab_from_static_block
+ (struct block *static_block, int section, int expandable);
+
+ struct compunit_symtab *end_symtab (CORE_ADDR end_addr, int section);
+
+ struct compunit_symtab *end_expandable_symtab (CORE_ADDR end_addr,
+ int section);
+
+ void augment_type_symtab ();
+
+private:
+
+ void record_pending_block (struct block *block, struct pending_block *opblock);
+
+ struct block *finish_block_internal (struct symbol *symbol,
+ struct pending **listhead,
+ struct pending_block *old_blocks,
+ const struct dynamic_prop *static_link,
+ CORE_ADDR start, CORE_ADDR end,
+ int is_global, int expandable);
+
+ struct blockvector *make_blockvector ();
+
+ void watch_main_source_file_lossage ();
+
+ struct compunit_symtab *end_symtab_with_blockvector
+ (struct block *static_block, int section, int expandable);
+
/* The objfile we're reading debug info from. */
struct objfile *objfile;
OPBLOCK, or at the beginning if opblock is NULL. This puts the
block in the list after all its subblocks. */
-static void
-record_pending_block (struct block *block, struct pending_block *opblock)
+void
+buildsym_compunit::record_pending_block (struct block *block,
+ struct pending_block *opblock)
{
struct pending_block *pblock;
- pblock = XOBNEW (&buildsym_compunit->m_pending_block_obstack,
- struct pending_block);
+ pblock = XOBNEW (&m_pending_block_obstack, struct pending_block);
pblock->block = block;
if (opblock)
{
}
else
{
- pblock->next = buildsym_compunit->m_pending_blocks;
- buildsym_compunit->m_pending_blocks = pblock;
+ pblock->next = m_pending_blocks;
+ m_pending_blocks = pblock;
}
}
the order the symbols have in the list (reversed from the input
file). Put the block on the list of pending blocks. */
-static struct block *
-finish_block_internal (struct symbol *symbol,
- struct pending **listhead,
- struct pending_block *old_blocks,
- const struct dynamic_prop *static_link,
- CORE_ADDR start, CORE_ADDR end,
- int is_global, int expandable)
+struct block *
+buildsym_compunit::finish_block_internal
+ (struct symbol *symbol,
+ struct pending **listhead,
+ struct pending_block *old_blocks,
+ const struct dynamic_prop *static_link,
+ CORE_ADDR start, CORE_ADDR end,
+ int is_global, int expandable)
{
- struct objfile *objfile = buildsym_compunit->objfile;
struct gdbarch *gdbarch = get_objfile_arch (objfile);
struct pending *next, *next1;
struct block *block;
{
BLOCK_DICT (block)
= dict_create_linear (&objfile->objfile_obstack,
- buildsym_compunit->language, *listhead);
+ language, *listhead);
}
else
{
if (expandable)
{
- BLOCK_DICT (block)
- = dict_create_hashed_expandable (buildsym_compunit->language);
+ BLOCK_DICT (block) = dict_create_hashed_expandable (language);
dict_add_pending (BLOCK_DICT (block), *listhead);
}
else
{
BLOCK_DICT (block) =
dict_create_hashed (&objfile->objfile_obstack,
- buildsym_compunit->language, *listhead);
+ language, *listhead);
}
}
start of this scope that don't have superblocks yet. */
opblock = NULL;
- for (pblock = buildsym_compunit->m_pending_blocks;
+ for (pblock = m_pending_blocks;
pblock && pblock != old_blocks;
pblock = pblock->next)
{
block_set_using (block,
(is_global
- ? buildsym_compunit->m_global_using_directives
- : buildsym_compunit->m_local_using_directives),
+ ? m_global_using_directives
+ : m_local_using_directives),
&objfile->objfile_obstack);
if (is_global)
- buildsym_compunit->m_global_using_directives = NULL;
+ m_global_using_directives = NULL;
else
- buildsym_compunit->m_local_using_directives = NULL;
+ m_local_using_directives = NULL;
record_pending_block (block, opblock);
}
struct block *
-finish_block (struct symbol *symbol,
- struct pending_block *old_blocks,
- const struct dynamic_prop *static_link,
- CORE_ADDR start, CORE_ADDR end)
+buildsym_compunit::finish_block (struct symbol *symbol,
+ struct pending_block *old_blocks,
+ const struct dynamic_prop *static_link,
+ CORE_ADDR start, CORE_ADDR end)
{
- return finish_block_internal (symbol, &buildsym_compunit->m_local_symbols,
- old_blocks, static_link,
- start, end, 0, 0);
+ return finish_block_internal (symbol, &m_local_symbols,
+ old_blocks, static_link, start, end, 0, 0);
}
/* Record that the range of addresses from START to END_INCLUSIVE
already provided by BLOCK_START and BLOCK_END, then we create an
address map for the block. */
void
-record_block_range (struct block *block,
- CORE_ADDR start, CORE_ADDR end_inclusive)
+buildsym_compunit::record_block_range (struct block *block,
+ CORE_ADDR start,
+ CORE_ADDR end_inclusive)
{
/* If this is any different from the range recorded in the block's
own BLOCK_START and BLOCK_END, then note that the address map has
need to record this block in the addrmap. */
if (start != BLOCK_START (block)
|| end_inclusive + 1 != BLOCK_END (block))
- buildsym_compunit->m_pending_addrmap_interesting = true;
+ m_pending_addrmap_interesting = true;
- if (buildsym_compunit->m_pending_addrmap == nullptr)
- buildsym_compunit->m_pending_addrmap
- = addrmap_create_mutable (&buildsym_compunit->m_pending_addrmap_obstack);
+ if (m_pending_addrmap == nullptr)
+ m_pending_addrmap = addrmap_create_mutable (&m_pending_addrmap_obstack);
- addrmap_set_empty (buildsym_compunit->m_pending_addrmap,
- start, end_inclusive, block);
+ addrmap_set_empty (m_pending_addrmap, start, end_inclusive, block);
}
-static struct blockvector *
-make_blockvector (void)
+struct blockvector *
+buildsym_compunit::make_blockvector ()
{
- struct objfile *objfile = buildsym_compunit->objfile;
struct pending_block *next;
struct blockvector *blockvector;
int i;
/* Count the length of the list of blocks. */
- for (next = buildsym_compunit->m_pending_blocks, i = 0;
- next;
- next = next->next, i++)
+ for (next = m_pending_blocks, i = 0; next; next = next->next, i++)
{
}
sure this is true. */
BLOCKVECTOR_NBLOCKS (blockvector) = i;
- for (next = buildsym_compunit->m_pending_blocks; next; next = next->next)
+ for (next = m_pending_blocks; next; next = next->next)
{
BLOCKVECTOR_BLOCK (blockvector, --i) = next->block;
}
- buildsym_compunit->free_pending_blocks ();
+ free_pending_blocks ();
/* If we needed an address map for this symtab, record it in the
blockvector. */
- if (buildsym_compunit->m_pending_addrmap != nullptr
- && buildsym_compunit->m_pending_addrmap_interesting)
+ if (m_pending_addrmap != nullptr && m_pending_addrmap_interesting)
BLOCKVECTOR_MAP (blockvector)
- = addrmap_create_fixed (buildsym_compunit->m_pending_addrmap,
- &objfile->objfile_obstack);
+ = addrmap_create_fixed (m_pending_addrmap, &objfile->objfile_obstack);
else
BLOCKVECTOR_MAP (blockvector) = 0;
name. NAME is the name of the file (cannot be NULL). */
void
-start_subfile (const char *name)
+buildsym_compunit::start_subfile (const char *name)
{
const char *subfile_dirname;
struct subfile *subfile;
- gdb_assert (buildsym_compunit != NULL);
-
- subfile_dirname = buildsym_compunit->comp_dir.get ();
+ subfile_dirname = comp_dir.get ();
/* See if this subfile is already registered. */
- for (subfile = buildsym_compunit->subfiles; subfile; subfile = subfile->next)
+ for (subfile = subfiles; subfile; subfile = subfile->next)
{
char *subfile_name;
if (FILENAME_CMP (subfile_name, name) == 0)
{
- buildsym_compunit->m_current_subfile = subfile;
+ m_current_subfile = subfile;
if (subfile_name != subfile->name)
xfree (subfile_name);
return;
subfile = XNEW (struct subfile);
memset (subfile, 0, sizeof (struct subfile));
- subfile->buildsym_compunit = buildsym_compunit;
+ subfile->buildsym_compunit = this;
- subfile->next = buildsym_compunit->subfiles;
- buildsym_compunit->subfiles = subfile;
+ subfile->next = subfiles;
+ subfiles = subfile;
- buildsym_compunit->m_current_subfile = subfile;
+ m_current_subfile = subfile;
subfile->name = xstrdup (name);
enum language sublang = deduce_language_from_filename (subfile->name);
if (sublang == language_cplus || sublang == language_fortran)
- for (s = buildsym_compunit->subfiles; s != NULL; s = s->next)
+ for (s = subfiles; s != NULL; s = s->next)
if (s->language == language_c)
s->language = sublang;
}
directory name actually is (by checking for a trailing '/'). */
void
-patch_subfile_names (struct subfile *subfile, const char *name)
+buildsym_compunit::patch_subfile_names (struct subfile *subfile,
+ const char *name)
{
if (subfile != NULL
- && buildsym_compunit->comp_dir == NULL
+ && comp_dir == NULL
&& subfile->name != NULL
&& IS_DIR_SEPARATOR (subfile->name[strlen (subfile->name) - 1]))
{
- buildsym_compunit->comp_dir.reset (subfile->name);
+ comp_dir.reset (subfile->name);
subfile->name = xstrdup (name);
set_last_source_file (name);
order. */
void
-push_subfile ()
+buildsym_compunit::push_subfile ()
{
- gdb_assert (buildsym_compunit != nullptr);
- gdb_assert (buildsym_compunit->m_current_subfile != NULL);
- gdb_assert (buildsym_compunit->m_current_subfile->name != NULL);
- buildsym_compunit->m_subfile_stack.push_back
- (buildsym_compunit->m_current_subfile->name);
+ gdb_assert (m_current_subfile != NULL);
+ gdb_assert (m_current_subfile->name != NULL);
+ m_subfile_stack.push_back (m_current_subfile->name);
}
const char *
-pop_subfile ()
+buildsym_compunit::pop_subfile ()
{
- gdb_assert (buildsym_compunit != nullptr);
- gdb_assert (!buildsym_compunit->m_subfile_stack.empty ());
- const char *name = buildsym_compunit->m_subfile_stack.back ();
- buildsym_compunit->m_subfile_stack.pop_back ();
+ gdb_assert (!m_subfile_stack.empty ());
+ const char *name = m_subfile_stack.back ();
+ m_subfile_stack.pop_back ();
return name;
}
\f
line vector for SUBFILE. */
void
-record_line (struct subfile *subfile, int line, CORE_ADDR pc)
+buildsym_compunit::record_line (struct subfile *subfile, int line,
+ CORE_ADDR pc)
{
struct linetable_entry *e;
xmalloc (sizeof (struct linetable)
+ subfile->line_vector_length * sizeof (struct linetable_entry));
subfile->line_vector->nitems = 0;
- buildsym_compunit->m_have_line_numbers = true;
+ m_have_line_numbers = true;
}
if (subfile->line_vector->nitems + 1 >= subfile->line_vector_length)
{
gdb_assert (buildsym_compunit != NULL);
- return buildsym_compunit->compunit_symtab;
+ return buildsym_compunit->get_compunit_symtab ();
}
/* See buildsym.h. */
buildsym_compunit = new struct buildsym_compunit (objfile, name, comp_dir,
language, start_addr);
- /* 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 = buildsym_compunit->m_current_subfile;
-
- return buildsym_compunit->compunit_symtab;
+ return buildsym_compunit->get_compunit_symtab ();
}
/* Restart compilation for a symtab.
name,
COMPUNIT_DIRNAME (cust),
compunit_language (cust),
- start_addr);
- buildsym_compunit->compunit_symtab = cust;
+ start_addr,
+ cust);
}
/* Subroutine of end_symtab to simplify it. Look for a subfile that
manipulates the debug info. This can also happen from an innocent
symlink in the paths, we don't canonicalize paths here. */
-static void
-watch_main_source_file_lossage (void)
+void
+buildsym_compunit::watch_main_source_file_lossage ()
{
struct subfile *mainsub, *subfile;
- /* We have to watch for buildsym_compunit == NULL here. It's a quirk of
- end_symtab, it can return NULL so there may not be a main subfile. */
- if (buildsym_compunit == NULL)
- return;
-
/* Get the main source file. */
- mainsub = buildsym_compunit->main_subfile;
+ mainsub = main_subfile;
/* If the main source file doesn't have any line number or symbol
info, look for an alias in another subfile. */
struct subfile *prev_mainsub_alias = NULL;
prevsub = NULL;
- for (subfile = buildsym_compunit->subfiles;
+ for (subfile = subfiles;
subfile != NULL;
subfile = subfile->next)
{
mainsub->symtab = mainsub_alias->symtab;
if (prev_mainsub_alias == NULL)
- buildsym_compunit->subfiles = mainsub_alias->next;
+ subfiles = mainsub_alias->next;
else
prev_mainsub_alias->next = mainsub_alias->next;
xfree (mainsub_alias->name);
not contain any symbols. */
struct block *
-end_symtab_get_static_block (CORE_ADDR end_addr, int expandable, int required)
+buildsym_compunit::end_symtab_get_static_block (CORE_ADDR end_addr,
+ int expandable, int required)
{
- struct objfile *objfile = buildsym_compunit->objfile;
-
/* Finish the lexical context of the last function in the file; pop
the context stack. */
- if (!buildsym_compunit->m_context_stack.empty ())
+ if (!m_context_stack.empty ())
{
struct context_stack cstk = pop_context ();
finish_block (cstk.name, cstk.old_blocks, NULL,
cstk.start_addr, end_addr);
- if (!buildsym_compunit->m_context_stack.empty ())
+ if (!m_context_stack.empty ())
{
/* This is said to happen with SCO. The old coffread.c
code simply emptied the context stack, so we do the
believed to happen in most cases (even for coffread.c);
it used to be an abort(). */
complaint (_("Context stack not empty in end_symtab"));
- buildsym_compunit->m_context_stack.clear ();
+ m_context_stack.clear ();
}
}
/* Reordered executables may have out of order pending blocks; if
OBJF_REORDERED is true, then sort the pending blocks. */
- if ((objfile->flags & OBJF_REORDERED) && buildsym_compunit->m_pending_blocks)
+ if ((objfile->flags & OBJF_REORDERED) && m_pending_blocks)
{
struct pending_block *pb;
std::vector<block *> barray;
- for (pb = buildsym_compunit->m_pending_blocks; pb != NULL; pb = pb->next)
+ for (pb = m_pending_blocks; pb != NULL; pb = pb->next)
barray.push_back (pb->block);
/* Sort blocks by start address in descending order. Blocks with the
});
int i = 0;
- for (pb = buildsym_compunit->m_pending_blocks; pb != NULL; pb = pb->next)
+ for (pb = m_pending_blocks; pb != NULL; pb = pb->next)
pb->block = barray[i++];
}
finish_global_stabs (objfile);
if (!required
- && buildsym_compunit->m_pending_blocks == NULL
- && buildsym_compunit->m_file_symbols == NULL
- && buildsym_compunit->m_global_symbols == NULL
- && !buildsym_compunit->m_have_line_numbers
- && buildsym_compunit->m_pending_macros == NULL
- && buildsym_compunit->m_global_using_directives == NULL)
+ && m_pending_blocks == NULL
+ && m_file_symbols == NULL
+ && m_global_symbols == NULL
+ && !m_have_line_numbers
+ && m_pending_macros == NULL
+ && m_global_using_directives == NULL)
{
/* Ignore symtabs that have no functions with real debugging info. */
return NULL;
{
/* Define the STATIC_BLOCK. */
return finish_block_internal (NULL, get_file_symbols (), NULL, NULL,
- buildsym_compunit->m_last_source_start_addr,
+ m_last_source_start_addr,
end_addr, 0, expandable);
}
}
Handle the "have blockvector" case.
See end_symtab_from_static_block for a description of the arguments. */
-static struct compunit_symtab *
-end_symtab_with_blockvector (struct block *static_block,
- int section, int expandable)
+struct compunit_symtab *
+buildsym_compunit::end_symtab_with_blockvector (struct block *static_block,
+ int section, int expandable)
{
- struct objfile *objfile = buildsym_compunit->objfile;
- struct compunit_symtab *cu = buildsym_compunit->compunit_symtab;
+ struct compunit_symtab *cu = compunit_symtab;
struct symtab *symtab;
struct blockvector *blockvector;
struct subfile *subfile;
CORE_ADDR end_addr;
gdb_assert (static_block != NULL);
- gdb_assert (buildsym_compunit != NULL);
- gdb_assert (buildsym_compunit->subfiles != NULL);
+ gdb_assert (subfiles != NULL);
end_addr = BLOCK_END (static_block);
/* Create the GLOBAL_BLOCK and build the blockvector. */
finish_block_internal (NULL, get_global_symbols (), NULL, NULL,
- buildsym_compunit->m_last_source_start_addr, end_addr,
+ m_last_source_start_addr, end_addr,
1, expandable);
blockvector = make_blockvector ();
/* Now create the symtab objects proper, if not already done,
one for each subfile. */
- for (subfile = buildsym_compunit->subfiles;
+ for (subfile = subfiles;
subfile != NULL;
subfile = subfile->next)
{
{
struct symtab *main_symtab, *prev_symtab;
- main_symtab = buildsym_compunit->main_subfile->symtab;
+ main_symtab = main_subfile->symtab;
prev_symtab = NULL;
ALL_COMPUNIT_FILETABS (cu, symtab)
{
/* Fill out the compunit symtab. */
- if (buildsym_compunit->comp_dir != NULL)
+ if (comp_dir != NULL)
{
/* Reallocate the dirname on the symbol obstack. */
- const char *comp_dir = buildsym_compunit->comp_dir.get ();
+ const char *comp_dir = this->comp_dir.get ();
COMPUNIT_DIRNAME (cu)
= (const char *) obstack_copy0 (&objfile->objfile_obstack,
comp_dir, strlen (comp_dir));
}
/* Save the debug format string (if any) in the symtab. */
- COMPUNIT_DEBUGFORMAT (cu) = buildsym_compunit->debugformat;
+ COMPUNIT_DEBUGFORMAT (cu) = debugformat;
/* Similarly for the producer. */
- COMPUNIT_PRODUCER (cu) = buildsym_compunit->producer;
+ COMPUNIT_PRODUCER (cu) = producer;
COMPUNIT_BLOCKVECTOR (cu) = blockvector;
{
COMPUNIT_BLOCK_LINE_SECTION (cu) = section;
- COMPUNIT_MACRO_TABLE (cu) = buildsym_compunit->release_macros ();
+ COMPUNIT_MACRO_TABLE (cu) = release_macros ();
/* Default any symbols without a specified symtab to the primary symtab. */
{
expandable. */
struct compunit_symtab *
-end_symtab_from_static_block (struct block *static_block,
- int section, int expandable)
+buildsym_compunit::end_symtab_from_static_block (struct block *static_block,
+ int section, int expandable)
{
struct compunit_symtab *cu;
yourself. */
struct compunit_symtab *
-end_symtab (CORE_ADDR end_addr, int section)
+buildsym_compunit::end_symtab (CORE_ADDR end_addr, int section)
{
struct block *static_block;
/* Same as end_symtab except create a symtab that can be later added to. */
struct compunit_symtab *
-end_expandable_symtab (CORE_ADDR end_addr, int section)
+buildsym_compunit::end_expandable_symtab (CORE_ADDR end_addr, int section)
{
struct block *static_block;
This is the case for DWARF4 Type Units. */
void
-augment_type_symtab (void)
+buildsym_compunit::augment_type_symtab ()
{
- struct compunit_symtab *cust = buildsym_compunit->compunit_symtab;
+ struct compunit_symtab *cust = compunit_symtab;
const struct blockvector *blockvector = COMPUNIT_BLOCKVECTOR (cust);
- if (!buildsym_compunit->m_context_stack.empty ())
+ if (!m_context_stack.empty ())
complaint (_("Context stack not empty in augment_type_symtab"));
- if (buildsym_compunit->m_pending_blocks != NULL)
+ if (m_pending_blocks != NULL)
complaint (_("Blocks in a type symtab"));
- if (buildsym_compunit->m_pending_macros != NULL)
+ if (m_pending_macros != NULL)
complaint (_("Macro in a type symtab"));
- if (buildsym_compunit->m_have_line_numbers)
+ if (m_have_line_numbers)
complaint (_("Line numbers recorded in a type symtab"));
- if (buildsym_compunit->m_file_symbols != NULL)
+ if (m_file_symbols != NULL)
{
struct block *block = BLOCKVECTOR_BLOCK (blockvector, STATIC_BLOCK);
/* First mark any symbols without a specified symtab as belonging
to the primary symtab. */
- set_missing_symtab (buildsym_compunit->m_file_symbols, cust);
+ set_missing_symtab (m_file_symbols, cust);
- dict_add_pending (BLOCK_DICT (block), buildsym_compunit->m_file_symbols);
+ dict_add_pending (BLOCK_DICT (block), m_file_symbols);
}
- if (buildsym_compunit->m_global_symbols != NULL)
+ if (m_global_symbols != NULL)
{
struct block *block = BLOCKVECTOR_BLOCK (blockvector, GLOBAL_BLOCK);
/* First mark any symbols without a specified symtab as belonging
to the primary symtab. */
- set_missing_symtab (buildsym_compunit->m_global_symbols, cust);
+ set_missing_symtab (m_global_symbols, cust);
dict_add_pending (BLOCK_DICT (block),
- buildsym_compunit->m_global_symbols);
+ m_global_symbols);
}
reset_symtab_globals ();
context. */
struct context_stack *
-push_context (int desc, CORE_ADDR valu)
+buildsym_compunit::push_context (int desc, CORE_ADDR valu)
{
- gdb_assert (buildsym_compunit != nullptr);
-
- buildsym_compunit->m_context_stack.emplace_back ();
- struct context_stack *newobj = &buildsym_compunit->m_context_stack.back ();
+ m_context_stack.emplace_back ();
+ struct context_stack *newobj = &m_context_stack.back ();
newobj->depth = desc;
- newobj->locals = buildsym_compunit->m_local_symbols;
- newobj->old_blocks = buildsym_compunit->m_pending_blocks;
+ newobj->locals = m_local_symbols;
+ newobj->old_blocks = m_pending_blocks;
newobj->start_addr = valu;
- newobj->local_using_directives
- = buildsym_compunit->m_local_using_directives;
+ newobj->local_using_directives = m_local_using_directives;
newobj->name = NULL;
- buildsym_compunit->m_local_symbols = NULL;
- buildsym_compunit->m_local_using_directives = NULL;
+ m_local_symbols = NULL;
+ m_local_using_directives = NULL;
return newobj;
}
popped. */
struct context_stack
-pop_context ()
+buildsym_compunit::pop_context ()
{
- gdb_assert (buildsym_compunit != nullptr);
- gdb_assert (!buildsym_compunit->m_context_stack.empty ());
- struct context_stack result = buildsym_compunit->m_context_stack.back ();
- buildsym_compunit->m_context_stack.pop_back ();
+ gdb_assert (!m_context_stack.empty ());
+ struct context_stack result = m_context_stack.back ();
+ m_context_stack.pop_back ();
return result;
}
void
record_debugformat (const char *format)
{
- buildsym_compunit->debugformat = format;
+ buildsym_compunit->record_debugformat (format);
}
void
record_producer (const char *producer)
{
- buildsym_compunit->producer = producer;
+ buildsym_compunit->record_producer (producer);
}
\f
/* See buildsym.h. */
const char *
-get_last_source_file (void)
+get_last_source_file ()
{
if (buildsym_compunit == nullptr)
return nullptr;
- return buildsym_compunit->m_last_source_file.get ();
+ return buildsym_compunit->get_last_source_file ();
}
/* See buildsym.h. */
set_last_source_start_addr (CORE_ADDR addr)
{
gdb_assert (buildsym_compunit != nullptr);
- buildsym_compunit->m_last_source_start_addr = addr;
+ buildsym_compunit->set_last_source_start_addr (addr);
}
/* See buildsym.h. */
get_last_source_start_addr ()
{
gdb_assert (buildsym_compunit != nullptr);
- return buildsym_compunit->m_last_source_start_addr;
+ return buildsym_compunit->get_last_source_start_addr ();
}
/* See buildsym.h. */
get_local_using_directives ()
{
gdb_assert (buildsym_compunit != nullptr);
- return &buildsym_compunit->m_local_using_directives;
+ return buildsym_compunit->get_local_using_directives ();
}
/* See buildsym.h. */
set_local_using_directives (struct using_direct *new_local)
{
gdb_assert (buildsym_compunit != nullptr);
- buildsym_compunit->m_local_using_directives = new_local;
+ buildsym_compunit->set_local_using_directives (new_local);
}
/* See buildsym.h. */
get_global_using_directives ()
{
gdb_assert (buildsym_compunit != nullptr);
- return &buildsym_compunit->m_global_using_directives;
+ return buildsym_compunit->get_global_using_directives ();
}
/* See buildsym.h. */
outermost_context_p ()
{
gdb_assert (buildsym_compunit != nullptr);
- return buildsym_compunit->m_context_stack.empty ();
+ return buildsym_compunit->outermost_context_p ();
}
/* See buildsym.h. */
get_current_context_stack ()
{
gdb_assert (buildsym_compunit != nullptr);
- if (buildsym_compunit->m_context_stack.empty ())
- return nullptr;
- return &buildsym_compunit->m_context_stack.back ();
+ return buildsym_compunit->get_current_context_stack ();
}
/* See buildsym.h. */
get_context_stack_depth ()
{
gdb_assert (buildsym_compunit != nullptr);
- return buildsym_compunit->m_context_stack.size ();
+ return buildsym_compunit->get_context_stack_depth ();
}
/* See buildsym.h. */
get_current_subfile ()
{
gdb_assert (buildsym_compunit != nullptr);
- return buildsym_compunit->m_current_subfile;
+ return buildsym_compunit->get_current_subfile ();
}
/* See buildsym.h. */
get_local_symbols ()
{
gdb_assert (buildsym_compunit != nullptr);
- return &buildsym_compunit->m_local_symbols;
+ return buildsym_compunit->get_local_symbols ();
}
/* See buildsym.h. */
get_file_symbols ()
{
gdb_assert (buildsym_compunit != nullptr);
- return &buildsym_compunit->m_file_symbols;
+ return buildsym_compunit->get_file_symbols ();
}
/* See buildsym.h. */
get_global_symbols ()
{
gdb_assert (buildsym_compunit != nullptr);
- return &buildsym_compunit->m_global_symbols;
+ return buildsym_compunit->get_global_symbols ();
+}
+
+void
+start_subfile (const char *name)
+{
+ gdb_assert (buildsym_compunit != nullptr);
+ buildsym_compunit->start_subfile (name);
+}
+
+void
+patch_subfile_names (struct subfile *subfile, const char *name)
+{
+ gdb_assert (buildsym_compunit != nullptr);
+ buildsym_compunit->patch_subfile_names (subfile, name);
+}
+
+void
+push_subfile ()
+{
+ gdb_assert (buildsym_compunit != nullptr);
+ buildsym_compunit->push_subfile ();
+}
+
+const char *
+pop_subfile ()
+{
+ gdb_assert (buildsym_compunit != nullptr);
+ return buildsym_compunit->pop_subfile ();
+}
+
+struct block *
+end_symtab_get_static_block (CORE_ADDR end_addr, int expandable, int required)
+{
+ gdb_assert (buildsym_compunit != nullptr);
+ return buildsym_compunit->end_symtab_get_static_block (end_addr, expandable,
+ required);
+}
+
+struct compunit_symtab *
+end_symtab_from_static_block (struct block *static_block,
+ int section, int expandable)
+{
+ gdb_assert (buildsym_compunit != nullptr);
+ struct compunit_symtab *result
+ = buildsym_compunit->end_symtab_from_static_block (static_block,
+ section, expandable);
+ reset_symtab_globals ();
+ return result;
+}
+
+struct compunit_symtab *
+end_symtab (CORE_ADDR end_addr, int section)
+{
+ gdb_assert (buildsym_compunit != nullptr);
+ struct compunit_symtab *result
+ = buildsym_compunit->end_symtab (end_addr, section);
+ reset_symtab_globals ();
+ return result;
+}
+
+struct compunit_symtab *
+end_expandable_symtab (CORE_ADDR end_addr, int section)
+{
+ gdb_assert (buildsym_compunit != nullptr);
+ struct compunit_symtab *result
+ = buildsym_compunit->end_expandable_symtab (end_addr, section);
+ reset_symtab_globals ();
+ return result;
+}
+
+void
+augment_type_symtab ()
+{
+ gdb_assert (buildsym_compunit != nullptr);
+ buildsym_compunit->augment_type_symtab ();
+ reset_symtab_globals ();
+}
+
+struct context_stack *
+push_context (int desc, CORE_ADDR valu)
+{
+ gdb_assert (buildsym_compunit != nullptr);
+ return buildsym_compunit->push_context (desc, valu);
+}
+
+struct context_stack
+pop_context ()
+{
+ gdb_assert (buildsym_compunit != nullptr);
+ return buildsym_compunit->pop_context ();
+}
+
+struct block *
+finish_block (struct symbol *symbol, struct pending_block *old_blocks,
+ const struct dynamic_prop *static_link,
+ CORE_ADDR start, CORE_ADDR end)
+{
+ gdb_assert (buildsym_compunit != nullptr);
+ return buildsym_compunit->finish_block (symbol, old_blocks, static_link,
+ start, end);
+}
+
+void
+record_block_range (struct block *block, CORE_ADDR start,
+ CORE_ADDR end_inclusive)
+{
+ gdb_assert (buildsym_compunit != nullptr);
+ buildsym_compunit->record_block_range (block, start, end_inclusive);
+}
+
+void
+record_line (struct subfile *subfile, int line, CORE_ADDR pc)
+{
+ gdb_assert (buildsym_compunit != nullptr);
+ buildsym_compunit->record_line (subfile, line, pc);
}