#include "symtab.h"
/* The work-in-progress of the compunit we are building.
- This is created first, before any subfiles by start_symtab. */
+ This is created first, before any subfiles by start_compunit_symtab. */
static struct buildsym_compunit *buildsym_compunit;
}
struct compunit_symtab *
-end_symtab (CORE_ADDR end_addr, int section)
+end_compunit_symtab (CORE_ADDR end_addr, int section)
{
gdb_assert (buildsym_compunit != nullptr);
struct compunit_symtab *result
- = buildsym_compunit->end_symtab (end_addr, section);
+ = buildsym_compunit->end_compunit_symtab (end_addr, section);
free_buildsym_compunit ();
return result;
}
buildsym_compunit->record_line (subfile, line, pc, true);
}
-/* 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.
+/* Start a new compunit_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
+ DW_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).
the filename. */
struct compunit_symtab *
-start_symtab (struct objfile *objfile, const char *name, const char *comp_dir,
- CORE_ADDR start_addr, enum language language)
+start_compunit_symtab (struct objfile *objfile, const char *name,
+ const char *comp_dir, CORE_ADDR start_addr,
+ enum language language)
{
/* These should have been reset either by successful completion of building
a symtab, or by the scoped_free_pendings destructor. */
The basic way this module is used is as follows:
scoped_free_pendings free_pending;
- cust = start_symtab (...);
+ cust = start_compunit_symtab (...);
... read debug info ...
- cust = end_symtab (...);
+ cust = end_compunit_symtab (...);
- The compunit symtab pointer ("cust") is returned from both start_symtab
- and end_symtab to simplify the debug info readers.
+ The compunit symtab pointer ("cust") is returned from both
+ start_compunit_symtab and end_compunit_symtab to simplify the debug info readers.
dbxread.c and xcoffread.c use another variation:
scoped_free_pendings free_pending;
- cust = start_symtab (...);
+ cust = start_compunit_symtab (...);
... read debug info ...
- cust = end_symtab (...);
- ... start_symtab + read + end_symtab repeated ...
+ cust = end_compunit_symtab (...);
+ ... start_compunit_symtab + read + end_compunit_symtab repeated ...
*/
class scoped_free_pendings
extern const char *pop_subfile ();
-extern struct compunit_symtab *end_symtab (CORE_ADDR end_addr, int section);
+extern struct compunit_symtab *end_compunit_symtab (CORE_ADDR end_addr,
+ int section);
extern struct context_stack *push_context (int desc, CORE_ADDR valu);
extern void record_line (struct subfile *subfile, int line, CORE_ADDR pc);
-extern struct compunit_symtab *start_symtab (struct objfile *objfile,
- const char *name,
- const char *comp_dir,
- CORE_ADDR start_addr,
- enum language language);
+extern struct compunit_symtab *start_compunit_symtab (struct objfile *objfile,
+ const char *name,
+ const char *comp_dir,
+ CORE_ADDR start_addr,
+ enum language language);
/* Record the name of the debug format in the current pending symbol
table. FORMAT must be a string with a lifetime at least as long as
extern const char *get_last_source_file (void);
/* Set the last source start address. Can only be used between
- start_symtab and end_symtab* calls. */
+ start_compunit_symtab and end_compunit_symtab* calls. */
extern void set_last_source_start_addr (CORE_ADDR addr);
/* Get the last source start address. Can only be used between
- start_symtab and end_symtab* calls. */
+ start_compunit_symtab and end_compunit_symtab* calls. */
extern CORE_ADDR get_last_source_start_addr ();
}
\f
-/* Subroutine of end_symtab to simplify it. Look for a subfile that
+/* Subroutine of end_compunit_symtab to simplify it. Look for a subfile that
matches the main source file's basename. If there is only one, and
if the main source file doesn't have any symbol or line number
information, then copy this file's symtab and line_vector to the
}
}
-/* Implementation of the first part of end_symtab. It allows modifying
- STATIC_BLOCK before it gets finalized by end_symtab_from_static_block.
- If the returned value is NULL there is no blockvector created for
- this symtab (you still must call end_symtab_from_static_block).
+/* Implementation of the first part of end_compunit_symtab. It allows modifying
+ STATIC_BLOCK before it gets finalized by
+ end_compunit_symtab_from_static_block. If the returned value is NULL there
+ is no blockvector created for this symtab (you still must call
+ end_compunit_symtab_from_static_block).
- END_ADDR is the same as for end_symtab: the address of the end of the
- file's text.
+ END_ADDR is the same as for end_compunit_symtab: the address of the end of
+ the file's text.
If EXPANDABLE is non-zero the STATIC_BLOCK dictionary is made
expandable.
not contain any symbols. */
struct block *
-buildsym_compunit::end_symtab_get_static_block (CORE_ADDR end_addr,
- int expandable, int required)
+buildsym_compunit::end_compunit_symtab_get_static_block (CORE_ADDR end_addr,
+ int expandable,
+ int required)
{
/* Finish the lexical context of the last function in the file; pop
the context stack. */
same. FIXME: Find out why it is happening. This is not
believed to happen in most cases (even for coffread.c);
it used to be an abort(). */
- complaint (_("Context stack not empty in end_symtab"));
+ complaint (_("Context stack not empty in end_compunit_symtab"));
m_context_stack.clear ();
}
}
}
}
-/* Subroutine of end_symtab_from_static_block to simplify it.
+/* Subroutine of end_compunit_symtab_from_static_block to simplify it.
Handle the "have blockvector" case.
- See end_symtab_from_static_block for a description of the arguments. */
+ See end_compunit_symtab_from_static_block for a description of the
+ arguments. */
struct compunit_symtab *
-buildsym_compunit::end_symtab_with_blockvector (struct block *static_block,
- int section, int expandable)
+buildsym_compunit::end_compunit_symtab_with_blockvector
+ (struct block *static_block, int section, int expandable)
{
struct compunit_symtab *cu = m_compunit_symtab;
struct blockvector *blockvector;
return cu;
}
-/* Implementation of the second part of end_symtab. Pass STATIC_BLOCK
- as value returned by end_symtab_get_static_block.
+/* Implementation of the second part of end_compunit_symtab. Pass STATIC_BLOCK
+ as value returned by end_compunit_symtab_get_static_block.
- SECTION is the same as for end_symtab: the section number
+ SECTION is the same as for end_compunit_symtab: the section number
(in objfile->section_offsets) of the blockvector and linetable.
If EXPANDABLE is non-zero the GLOBAL_BLOCK dictionary is made
expandable. */
struct compunit_symtab *
-buildsym_compunit::end_symtab_from_static_block (struct block *static_block,
- int section, int expandable)
+buildsym_compunit::end_compunit_symtab_from_static_block
+ (struct block *static_block, int section, int expandable)
{
struct compunit_symtab *cu;
cu = NULL;
}
else
- cu = end_symtab_with_blockvector (static_block, section, expandable);
+ cu = end_compunit_symtab_with_blockvector (static_block, section, expandable);
return cu;
}
the section number (in objfile->section_offsets) of the blockvector
and linetable.
- Note that it is possible for end_symtab() to return NULL. In
+ Note that it is possible for end_compunit_symtab() to return NULL. In
particular, for the DWARF case at least, it will return NULL when
it finds a compilation unit that has exactly one DIE, a
TAG_compile_unit DIE. This can happen when we link in an object
never know about this empty file (FIXME).
If you need to modify STATIC_BLOCK before it is finalized you should
- call end_symtab_get_static_block and end_symtab_from_static_block
- yourself. */
+ call end_compunit_symtab_get_static_block and
+ end_compunit_symtab_from_static_block yourself. */
struct compunit_symtab *
-buildsym_compunit::end_symtab (CORE_ADDR end_addr, int section)
+buildsym_compunit::end_compunit_symtab (CORE_ADDR end_addr, int section)
{
struct block *static_block;
- static_block = end_symtab_get_static_block (end_addr, 0, 0);
- return end_symtab_from_static_block (static_block, section, 0);
+ static_block = end_compunit_symtab_get_static_block (end_addr, 0, 0);
+ return end_compunit_symtab_from_static_block (static_block, section, 0);
}
-/* Same as end_symtab except create a symtab that can be later added to. */
+/* Same as end_compunit_symtab except create a symtab that can be later added
+ to. */
struct compunit_symtab *
buildsym_compunit::end_expandable_symtab (CORE_ADDR end_addr, int section)
{
struct block *static_block;
- static_block = end_symtab_get_static_block (end_addr, 1, 0);
- return end_symtab_from_static_block (static_block, section, 1);
+ static_block = end_compunit_symtab_get_static_block (end_addr, 1, 0);
+ return end_compunit_symtab_from_static_block (static_block, section, 1);
}
/* Subroutine of augment_type_symtab to simplify it.
}
}
-/* Same as end_symtab, but for the case where we're adding more symbols
+/* Same as end_compunit_symtab, but for the case where we're adding more symbols
to an existing symtab that is known to contain only type information.
This is the case for DWARF4 Type Units. */
struct context_stack pop_context ();
- struct block *end_symtab_get_static_block (CORE_ADDR end_addr,
- int expandable, int required);
+ struct block *end_compunit_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_compunit_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_compunit_symtab (CORE_ADDR end_addr, int section);
struct compunit_symtab *end_expandable_symtab (CORE_ADDR end_addr,
int section);
void watch_main_source_file_lossage ();
- struct compunit_symtab *end_symtab_with_blockvector
- (struct block *static_block, int section, int expandable);
+ struct compunit_symtab *end_compunit_symtab_with_blockvector
+ (struct block *static_block, int section, int expandable);
/* The objfile we're reading debug info from. */
struct objfile *m_objfile;
it indicates the start of data for one original source file. */
static void
-coff_start_symtab (struct objfile *objfile, const char *name)
+coff_start_compunit_symtab (struct objfile *objfile, const char *name)
{
within_function = 0;
- start_symtab (objfile,
- name,
+ start_compunit_symtab (objfile,
+ name,
/* We never know the directory name for COFF. */
- NULL,
+ NULL,
/* The start address is irrelevant, since we call
- set_last_source_start_addr in coff_end_symtab. */
- 0,
+ set_last_source_start_addr in coff_end_compunit_symtab. */
+ 0,
/* Let buildsym.c deduce the language for this symtab. */
- language_unknown);
+ language_unknown);
record_debugformat ("COFF");
}
list of all such. */
static void
-coff_end_symtab (struct objfile *objfile)
+coff_end_compunit_symtab (struct objfile *objfile)
{
set_last_source_start_addr (current_source_start_addr);
- end_symtab (current_source_end_addr, SECT_OFF_TEXT (objfile));
+ end_compunit_symtab (current_source_end_addr, SECT_OFF_TEXT (objfile));
/* Reinitialize for beginning of new file. */
set_last_source_file (NULL);
type_vector_length = INITIAL_TYPE_VECTOR_LENGTH;
type_vector = XCNEWVEC (struct type *, type_vector_length);
- coff_start_symtab (objfile, "");
+ coff_start_compunit_symtab (objfile, "");
symnum = 0;
while (symnum < nsyms)
if (cs->c_symnum == next_file_symnum && cs->c_sclass != C_FILE)
{
if (get_last_source_file ())
- coff_end_symtab (objfile);
+ coff_end_compunit_symtab (objfile);
- coff_start_symtab (objfile, "_globals_");
- /* coff_start_symtab will set the language of this symtab to
+ coff_start_compunit_symtab (objfile, "_globals_");
+ /* coff_start_compunit_symtab will set the language of this symtab to
language_unknown, since such a ``file name'' is not
recognized. Override that with the minimal language to
allow printing values in this symtab. */
containing debugging information. */
if (get_last_source_file ())
{
- coff_end_symtab (objfile);
- coff_start_symtab (objfile, filestring);
+ coff_end_compunit_symtab (objfile);
+ coff_start_compunit_symtab (objfile, filestring);
}
in_source_file = 1;
break;
}
if (get_last_source_file ())
- coff_end_symtab (objfile);
+ coff_end_compunit_symtab (objfile);
/* Patch up any opaque types (references to types that are not defined
in the file where they are referenced, e.g. "struct foo *bar"). */
/* Start a symtab for OBJFILE in CTF format. */
static void
-ctf_start_symtab (ctf_psymtab *pst,
- struct objfile *of, CORE_ADDR text_offset)
+ctf_start_compunit_symtab (ctf_psymtab *pst,
+ struct objfile *of, CORE_ADDR text_offset)
{
struct ctf_context *ccp;
the .text section number. */
static struct compunit_symtab *
-ctf_end_symtab (ctf_psymtab *pst,
- CORE_ADDR end_addr, int section)
+ctf_end_compunit_symtab (ctf_psymtab *pst,
+ CORE_ADDR end_addr, int section)
{
struct ctf_context *ccp;
ccp = &pst->context;
struct compunit_symtab *result
- = ccp->builder->end_symtab (end_addr, section);
+ = ccp->builder->end_compunit_symtab (end_addr, section);
delete ccp->builder;
ccp->builder = nullptr;
return result;
int tsize;
offset = get_objfile_text_range (objfile, &tsize);
- ctf_start_symtab (this, objfile, offset);
+ ctf_start_compunit_symtab (this, objfile, offset);
expand_psymtab (objfile);
set_text_low (offset);
set_text_high (offset + tsize);
- compunit_symtab = ctf_end_symtab (this, offset + tsize,
- SECT_OFF_TEXT (objfile));
+ compunit_symtab = ctf_end_compunit_symtab (this, offset + tsize,
+ SECT_OFF_TEXT (objfile));
/* Finish up the debug error message. */
if (info_verbose)
if (get_last_source_start_addr () > text_offset)
set_last_source_start_addr (text_offset);
- pst->compunit_symtab = end_symtab (text_offset + text_size,
- SECT_OFF_TEXT (objfile));
+ pst->compunit_symtab = end_compunit_symtab (text_offset + text_size,
+ SECT_OFF_TEXT (objfile));
end_stabs ();
the pst->section_offsets. All symbols that refer to memory
locations need to be offset by these amounts.
OBJFILE is the object file from which we are reading symbols. It
- is used in end_symtab.
+ is used in end_compunit_symtab.
LANGUAGE is the language of the symtab.
*/
patch_subfile_names (get_current_subfile (), name);
break; /* Ignore repeated SOs. */
}
- end_symtab (valu, SECT_OFF_TEXT (objfile));
+ end_compunit_symtab (valu, SECT_OFF_TEXT (objfile));
end_stabs ();
}
function_start_offset = 0;
start_stabs ();
- start_symtab (objfile, name, NULL, valu, language);
+ start_compunit_symtab (objfile, name, NULL, valu, language);
record_debugformat ("stabs");
break;
buildsym_compunit constructor. */
struct compunit_symtab *
-dwarf2_cu::start_symtab (const char *name, const char *comp_dir,
- CORE_ADDR low_pc)
+dwarf2_cu::start_compunit_symtab (const char *name, const char *comp_dir,
+ CORE_ADDR low_pc)
{
gdb_assert (m_builder == nullptr);
We don't need the pc/line-number mapping for type units. */
void setup_type_unit_groups (struct die_info *die);
- /* Start a symtab for DWARF. NAME, COMP_DIR, LOW_PC are passed to the
- buildsym_compunit constructor. */
- struct compunit_symtab *start_symtab (const char *name,
- const char *comp_dir,
- CORE_ADDR low_pc);
+ /* Start a compunit_symtab for DWARF. NAME, COMP_DIR, LOW_PC are passed to
+ the buildsym_compunit constructor. */
+ struct compunit_symtab *start_compunit_symtab (const char *name,
+ const char *comp_dir,
+ CORE_ADDR low_pc);
/* Reset the builder. */
void reset_builder () { m_builder.reset (); }
get_scope_pc_bounds (cu->dies, &lowpc, &highpc, cu);
addr = gdbarch_adjust_dwarf2_addr (gdbarch, highpc + baseaddr);
- static_block = cu->get_builder ()->end_symtab_get_static_block (addr, 0, 1);
+ static_block
+ = cu->get_builder ()->end_compunit_symtab_get_static_block (addr, 0, 1);
/* If the comp unit has DW_AT_ranges, it may have discontiguous ranges.
Also, DW_AT_ranges may record ranges not belonging to any child DIEs
this comp unit. */
dwarf2_record_block_ranges (cu->dies, static_block, baseaddr, cu);
- cust = cu->get_builder ()->end_symtab_from_static_block (static_block,
- SECT_OFF_TEXT (objfile),
- 0);
+ cust = cu->get_builder ()->end_compunit_symtab_from_static_block
+ (static_block, SECT_OFF_TEXT (objfile), 0);
if (cust != NULL)
{
file_and_directory &fnd = find_file_and_directory (die, cu);
- cu->start_symtab (fnd.get_name (), fnd.intern_comp_dir (objfile), lowpc);
+ cu->start_compunit_symtab (fnd.get_name (), fnd.intern_comp_dir (objfile),
+ lowpc);
gdb_assert (per_objfile->sym_cu == nullptr);
scoped_restore restore_sym_cu
if (lh == NULL)
{
if (first_time)
- start_symtab ("", NULL, 0);
+ start_compunit_symtab ("", NULL, 0);
else
{
gdb_assert (tug_unshare->symtabs == NULL);
if (first_time)
{
- struct compunit_symtab *cust = start_symtab ("", NULL, 0);
+ struct compunit_symtab *cust = start_compunit_symtab ("", NULL, 0);
/* Note: We don't assign tu_group->compunit_symtab yet because we're
still initializing it, and our caller (a few levels up)
{
valu += section_offsets[SECT_OFF_TEXT (objfile)];
previous_stab_code = N_SO;
- cust = end_symtab (valu, SECT_OFF_TEXT (objfile));
+ cust = end_compunit_symtab (valu, SECT_OFF_TEXT (objfile));
end_stabs ();
last_symtab_ended = 1;
}
if (! last_symtab_ended)
{
- cust = end_symtab (pst->raw_text_high (), SECT_OFF_TEXT (objfile));
+ cust = end_compunit_symtab (pst->raw_text_high (),
+ SECT_OFF_TEXT (objfile));
end_stabs ();
}
}
/* Initialize anything that needs initializing at the same time as
- start_symtab() is called. */
+ start_compunit_symtab() is called. */
void
start_stabs (void)
common_block_name = NULL;
}
-/* Call after end_symtab(). */
+/* Call after end_compunit_symtab(). */
void
end_stabs (void)
and return it in a newly created table. If the old one is good
enough, return the old one. */
/* FIXME: I think all this stuff can be replaced by just passing
- sort_linevec = 1 to end_symtab. */
+ sort_linevec = 1 to end_compunit_symtab. */
static struct linetable *
arrange_linetable (struct linetable *oldLineTb)
}
/* include file support: C_BINCL/C_EINCL pairs will be kept in the
- following `IncludeChain'. At the end of each symtab (end_symtab),
+ following `IncludeChain'. At the end of each symtab (end_compunit_symtab),
we will determine if we should create additional symtab's to
represent if (the include files. */
pst_symtab_language = deduce_language_from_filename (filestring);
start_stabs ();
- start_symtab (objfile, filestring, NULL, file_start_addr,
- pst_symtab_language);
+ start_compunit_symtab (objfile, filestring, NULL, file_start_addr,
+ pst_symtab_language);
record_debugformat (debugfmt);
symnum = ((struct symloc *) pst->read_symtab_private)->first_symnum;
max_symnum =
{
if (get_last_source_file ())
{
- pst->compunit_symtab = end_symtab (cur_src_end_addr,
- SECT_OFF_TEXT (objfile));
+ pst->compunit_symtab = end_compunit_symtab
+ (cur_src_end_addr, SECT_OFF_TEXT (objfile));
end_stabs ();
}
start_stabs ();
- start_symtab (objfile, "_globals_", NULL,
- 0, pst_symtab_language);
+ start_compunit_symtab (objfile, "_globals_", NULL,
+ 0, pst_symtab_language);
record_debugformat (debugfmt);
cur_src_end_addr = first_object_file_end;
/* Done with all files, everything from here on is globals. */
{
complete_symtab (filestring, file_start_addr);
cur_src_end_addr = file_end_addr;
- end_symtab (file_end_addr, SECT_OFF_TEXT (objfile));
+ end_compunit_symtab (file_end_addr,
+ SECT_OFF_TEXT (objfile));
end_stabs ();
start_stabs ();
/* Give all csects for this source file the same
name. */
- start_symtab (objfile, filestring, NULL,
+ start_compunit_symtab (objfile, filestring, NULL,
0, pst_symtab_language);
record_debugformat (debugfmt);
}
complete_symtab (filestring, file_start_addr);
cur_src_end_addr = file_end_addr;
- end_symtab (file_end_addr, SECT_OFF_TEXT (objfile));
+ end_compunit_symtab (file_end_addr, SECT_OFF_TEXT (objfile));
end_stabs ();
/* XCOFF, according to the AIX 3.2 documentation, puts the
filestring = cs->c_name;
start_stabs ();
- start_symtab (objfile, filestring, NULL, 0, pst_symtab_language);
+ start_compunit_symtab (objfile, filestring, NULL, 0,
+ pst_symtab_language);
record_debugformat (debugfmt);
last_csect_name = 0;
complete_symtab (filestring, file_start_addr);
cur_src_end_addr = file_end_addr;
- cust = end_symtab (file_end_addr, SECT_OFF_TEXT (objfile));
+ cust = end_compunit_symtab (file_end_addr, SECT_OFF_TEXT (objfile));
/* When reading symbols for the last C_FILE of the objfile, try
to make sure that we set pst->compunit_symtab to the symtab for the
file, not to the _globals_ symtab. I'm not sure whether this