start_pc_sal = find_pc_sect_line (start_pc, NULL, 0);
if (start_pc_sal.symtab == NULL
- || producer_is_gcc_ge_4 (SYMTAB_COMPUNIT
- (start_pc_sal.symtab)->producer ()) < 6
+ || producer_is_gcc_ge_4 (start_pc_sal.symtab->compunit ()
+ ->producer ()) < 6
|| start_pc_sal.pc != start_pc || pc >= start_pc_sal.end)
return pc;
struct symbol *sym;
bv = blockvector_for_pc_sect (sal->pc, 0, &b,
- SYMTAB_COMPUNIT (sal->symtab));
+ sal->symtab->compunit ());
if (bv != NULL)
{
sym = block_linkage_function (b);
if (sal.symtab == NULL)
return NULL;
- cust = SYMTAB_COMPUNIT (sal.symtab);
+
+ cust = sal.symtab->compunit ();
if (cust->macro_table () == NULL)
return NULL;
+ BLOCKVECTOR_NBLOCKS (bv)
* sizeof (bv->block)));
if (bv != SYMTAB_BLOCKVECTOR (s))
- SYMTAB_COMPUNIT (s)->set_blockvector (bv);
+ s->compunit ()->set_blockvector (bv);
BLOCKVECTOR_BLOCK (bv, BLOCKVECTOR_NBLOCKS (bv)++) = b;
}
uiout->field_string ("fullname", symtab_to_fullname (st.symtab));
uiout->field_signed ("macro-info",
- SYMTAB_COMPUNIT (st.symtab)->macro_table () != NULL);
+ st.symtab->compunit ()->macro_table () != NULL);
}
/* Implement -file-list-exec-source-files command. */
{
struct symtab_and_line prologue_sal = find_pc_line (start_pc, 0);
struct compunit_symtab *compunit
- = SYMTAB_COMPUNIT (prologue_sal.symtab);
+ = prologue_sal.symtab->compunit ();
const char *debug_format = compunit->debugformat ();
if ((NULL != debug_format)
struct compunit_symtab *cust;
STPY_REQUIRE_VALID (self, symtab);
- cust = SYMTAB_COMPUNIT (symtab);
+ cust = symtab->compunit ();
if (cust->producer () != nullptr)
{
const char *producer = cust->producer ();
return;
}
- cust = SYMTAB_COMPUNIT (s);
+ cust = s->compunit ();
printf_filtered (_("Current source file is %s\n"), s->filename);
if (SYMTAB_DIRNAME (s) != NULL)
printf_filtered (_("Compilation directory is %s\n"), SYMTAB_DIRNAME (s));
if (fd.get () < 0)
{
- if (SYMTAB_COMPUNIT (s) != nullptr)
+ if (s->compunit () != nullptr)
{
- const objfile *ofp = SYMTAB_COMPUNIT (s)->objfile ();
+ const objfile *ofp = s->compunit ()->objfile ();
std::string srcpath;
if (IS_ABSOLUTE_PATH (s->filename))
cust->add_filetab (symtab);
/* Backlink to the containing compunit symtab. */
- symtab->compunit_symtab = cust;
+ symtab->set_compunit (cust);
return symtab;
}
}
else
{
- compunit_symtab *compunit = SYMTAB_COMPUNIT (symtab);
+ compunit_symtab *compunit = symtab->compunit ();
const char *compunit_filename
= symtab_to_filename_for_display (compunit->primary_filetab ());
compunit_symtabs included by this one. */
if (is_main_symtab_of_compunit_symtab (symtab))
{
- struct compunit_symtab *cust = SYMTAB_COMPUNIT (symtab);
+ struct compunit_symtab *cust = symtab->compunit ();
if (cust->user != nullptr)
{
struct linetable *linetable;
struct objfile *objfile;
- objfile = symtab->compunit_symtab->objfile ();
+ objfile = symtab->compunit ()->objfile ();
printf_filtered (_("objfile: %ps ((struct objfile *) %s)\n"),
styled_string (file_name_style.style (),
objfile_name (objfile)),
host_address_to_string (objfile));
printf_filtered (_("compunit_symtab: %s ((struct compunit_symtab *) %s)\n"),
- symtab->compunit_symtab->name,
- host_address_to_string (symtab->compunit_symtab));
+ symtab->compunit ()->name,
+ host_address_to_string (symtab->compunit ()));
printf_filtered (_("symtab: %ps ((struct symtab *) %s)\n"),
styled_string (file_name_style.style (),
symtab_to_fullname (symtab)),
symtab_and_line sal = find_pc_sect_line (func_addr, section, 0);
if (funfirstline && sal.symtab != NULL
- && (SYMTAB_COMPUNIT (sal.symtab)->locations_valid ()
+ && (sal.symtab->compunit ()->locations_valid ()
|| SYMTAB_LANGUAGE (sal.symtab) == language_asm))
{
struct gdbarch *gdbarch = SYMTAB_OBJFILE (sal.symtab)->arch ();
have proven the CU (Compilation Unit) supports it. sal->SYMTAB does not
have to be set by the caller so we use SYM instead. */
if (sym != NULL
- && SYMTAB_COMPUNIT (symbol_symtab (sym))->locations_valid ())
+ && symbol_symtab (sym)->compunit ()->locations_valid ())
force_skip = 0;
saved_pc = pc;
for symbols which match. */
iterate_over_symtabs (srcfile, [&] (symtab *s)
{
- add_symtab_completions (SYMTAB_COMPUNIT (s),
+ add_symtab_completions (s->compunit (),
tracker, mode, lookup_name,
sym_text, word, TYPE_CODE_UNDEF);
return false;
struct symtab
{
+ struct compunit_symtab *compunit () const
+ {
+ return m_compunit;
+ }
+
+ void set_compunit (struct compunit_symtab *compunit)
+ {
+ m_compunit = compunit;
+ }
+
/* Unordered chain of all filetabs in the compunit, with the exception
that the "main" source file is the first entry in the list. */
/* Backlink to containing compunit symtab. */
- struct compunit_symtab *compunit_symtab;
+ struct compunit_symtab *m_compunit;
/* Table mapping core addresses to line numbers for this file.
Can be NULL if none. Never shared between different symtabs. */
using symtab_range = next_range<symtab>;
-#define SYMTAB_COMPUNIT(symtab) ((symtab)->compunit_symtab)
#define SYMTAB_LINETABLE(symtab) ((symtab)->linetable)
#define SYMTAB_LANGUAGE(symtab) ((symtab)->language)
#define SYMTAB_BLOCKVECTOR(symtab) \
- (SYMTAB_COMPUNIT (symtab)->blockvector ())
+ (symtab->compunit ()->blockvector ())
#define SYMTAB_OBJFILE(symtab) \
- (SYMTAB_COMPUNIT (symtab)->objfile ())
+ (symtab->compunit ()->objfile ())
#define SYMTAB_PSPACE(symtab) (SYMTAB_OBJFILE (symtab)->pspace)
-#define SYMTAB_DIRNAME(symtab) (SYMTAB_COMPUNIT (symtab)->dirname ())
+#define SYMTAB_DIRNAME(symtab) ((symtab)->compunit ()->dirname ())
/* Compunit symtabs contain the actual "symbol table", aka blockvector, as well
as the list of all source files (what gdb has historically associated with
static inline bool
is_main_symtab_of_compunit_symtab (struct symtab *symtab)
{
- return symtab == SYMTAB_COMPUNIT (symtab)->primary_filetab ();
+ return symtab == symtab->compunit ()->primary_filetab ();
}
\f
if (prologue_end != 0)
{
struct symtab_and_line prologue_sal = find_pc_line (func_addr, 0);
- struct compunit_symtab *compunit = SYMTAB_COMPUNIT (prologue_sal.symtab);
+ struct compunit_symtab *compunit = prologue_sal.symtab->compunit ();
const char *debug_format = compunit->debugformat ();
if (debug_format != NULL &&