]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
gdb: add getter/setter for compunit_symtab::objfile
authorSimon Marchi <simon.marchi@efficios.com>
Fri, 19 Nov 2021 18:11:24 +0000 (13:11 -0500)
committerSimon Marchi <simon.marchi@polymtl.ca>
Sun, 6 Feb 2022 20:48:18 +0000 (15:48 -0500)
Rename the field to m_objfile, and add a getter and a setter.  Update
all users.

Change-Id: If7e2f763ee3e70570140d9af9261b1b056253317

gdb/symfile.c
gdb/symmisc.c
gdb/symtab.c
gdb/symtab.h

index 9bd4f48d0b023b5cd65b443320e45ac237113d41..a660422b51e07d2e9d1828eaca6ebba78d66534a 100644 (file)
@@ -2774,7 +2774,7 @@ deduce_language_from_filename (const char *filename)
 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);
 
@@ -2832,7 +2832,7 @@ allocate_compunit_symtab (struct objfile *objfile, const char *name)
                                               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,
@@ -2858,8 +2858,8 @@ allocate_compunit_symtab (struct objfile *objfile, const char *name)
 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
 
index cd51f6645c563965a27dff7e3c255d98aafc0ebf..19c387d852d7e70a88a15c6bfc3d15e8cd3956df 100644 (file)
@@ -957,7 +957,7 @@ maintenance_print_one_line_table (struct symtab *symtab, void *data)
   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)),
index a32e561ed774c283d5ec35beb712d9c2b5734fb1..44b5bfb43bbf27520354369c71156e844c20635b 100644 (file)
@@ -338,7 +338,7 @@ compunit_symtab::find_call_site (CORE_ADDR pc) const
     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);
index 55d1b772c457f1aaad867ae7daadfc150dfd48c0..995026bbf82f72e11016f90fdfd95e6f3c1f2efb 100644 (file)
@@ -1449,6 +1449,16 @@ struct symtab
 
 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);
 
@@ -1459,7 +1469,7 @@ struct compunit_symtab
   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
@@ -1535,7 +1545,7 @@ struct compunit_symtab
 
 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)