struct symtab *
allocate_symtab (struct compunit_symtab *cust, const char *filename)
{
- struct objfile *objfile = cust->objfile;
+ struct objfile *objfile = cust->objfile ();
struct symtab *symtab
= OBSTACK_ZALLOC (&objfile->objfile_obstack, struct symtab);
struct compunit_symtab);
const char *saved_name;
- cu->objfile = objfile;
+ cu->set_objfile (objfile);
/* The name we record here is only for display/debugging purposes.
Just save the basename to avoid path issues (too long for display,
void
add_compunit_symtab_to_objfile (struct compunit_symtab *cu)
{
- cu->next = cu->objfile->compunit_symtabs;
- cu->objfile->compunit_symtabs = cu;
+ cu->next = cu->objfile ()->compunit_symtabs;
+ cu->objfile ()->compunit_symtabs = cu;
}
\f
struct linetable *linetable;
struct objfile *objfile;
- objfile = symtab->compunit_symtab->objfile;
+ objfile = symtab->compunit_symtab->objfile ();
printf_filtered (_("objfile: %ps ((struct objfile *) %s)\n"),
styled_string (file_name_style.style (),
objfile_name (objfile)),
return nullptr;
CORE_ADDR delta
- = this->objfile->section_offsets[COMPUNIT_BLOCK_LINE_SECTION (this)];
+ = this->objfile ()->section_offsets[COMPUNIT_BLOCK_LINE_SECTION (this)];
CORE_ADDR unrelocated_pc = pc - delta;
struct call_site call_site_local (unrelocated_pc, nullptr, nullptr);
struct compunit_symtab
{
+ struct objfile *objfile () const
+ {
+ return m_objfile;
+ }
+
+ void set_objfile (struct objfile *objfile)
+ {
+ m_objfile = objfile;
+ }
+
/* Set m_call_site_htab. */
void set_call_site_htab (htab_t call_site_htab);
struct compunit_symtab *next;
/* Object file from which this symtab information was read. */
- struct objfile *objfile;
+ struct objfile *m_objfile;
/* Name of the symtab.
This is *not* intended to be a usable filename, and is
using compunit_symtab_range = next_range<compunit_symtab>;
-#define COMPUNIT_OBJFILE(cust) ((cust)->objfile)
+#define COMPUNIT_OBJFILE(cust) ((cust)->objfile ())
#define COMPUNIT_FILETABS(cust) ((cust)->filetabs)
#define COMPUNIT_DEBUGFORMAT(cust) ((cust)->debugformat)
#define COMPUNIT_PRODUCER(cust) ((cust)->producer)