Make add_separate_debug_objfile static
authorTom Tromey <tom@tromey.com>
Fri, 1 Nov 2019 22:10:48 +0000 (16:10 -0600)
committerTom Tromey <tom@tromey.com>
Thu, 12 Dec 2019 22:50:51 +0000 (15:50 -0700)
This changes objfile::make to take a "parent" parameter, and makes
add_separate_debug_objfile static.

gdb/ChangeLog
2019-12-12  Tom Tromey  <tom@tromey.com>

* symfile.c (symbol_file_add_with_addrs): Pass "parent" to
objfile::make.
* objfiles.h (struct objjfile) <make>: No longer inline.
(add_separate_debug_objfile): Don't declare.
* objfiles.c (add_separate_debug_objfile): Now static.
(objfile::make): Move from objfiles.h.  Call
add_separate_debug_objfile.  Add "parent" parameter.

Change-Id: I631f43bb71738dea6ae0697317bf8ef4a0db4617

gdb/ChangeLog
gdb/objfiles.c
gdb/objfiles.h
gdb/symfile.c

index 393d43ef3169f1e738a6a53fd7dd06b6e8011bb8..7bcd2c7fbd0d48b76bee8c136fad7b53f87f92f0 100644 (file)
@@ -1,3 +1,13 @@
+2019-12-12  Tom Tromey  <tom@tromey.com>
+
+       * symfile.c (symbol_file_add_with_addrs): Pass "parent" to
+       objfile::make.
+       * objfiles.h (struct objjfile) <make>: No longer inline.
+       (add_separate_debug_objfile): Don't declare.
+       * objfiles.c (add_separate_debug_objfile): Now static.
+       (objfile::make): Move from objfiles.h.  Call
+       add_separate_debug_objfile.  Add "parent" parameter.
+
 2019-12-12  Tom Tromey  <tom@tromey.com>
 
        * symfile.c (symbol_file_add_with_addrs): Use objfile::make.
index b5bc09f41eafc7f335567d6d8cfc4348dc0af82e..0ee5720cf67bc671359db45e42a020728b7be359 100644 (file)
@@ -520,7 +520,7 @@ put_objfile_before (struct objfile *objfile, struct objfile *before_this)
 
 /* Add OBJFILE as a separate debug objfile of PARENT.  */
 
-void
+static void
 add_separate_debug_objfile (struct objfile *objfile, struct objfile *parent)
 {
   gdb_assert (objfile && parent);
@@ -541,6 +541,18 @@ add_separate_debug_objfile (struct objfile *objfile, struct objfile *parent)
   put_objfile_before (objfile, parent);
 }
 
+/* See objfiles.h.  */
+
+objfile *
+objfile::make (bfd *bfd_, const char *name_, objfile_flags flags_,
+              objfile *parent)
+{
+  objfile *result = new objfile (bfd_, name_, flags_);
+  if (parent != nullptr)
+    add_separate_debug_objfile (result, parent);
+  return result;
+}
+
 /* Free all separate debug objfile of OBJFILE, but don't free OBJFILE
    itself.  */
 
index b5c04eb7cb95247b9aeda332dc6a0e7f12d36754..663e6390dcd6f22e5874d99f1c509a243b82fc04 100644 (file)
@@ -402,10 +402,8 @@ private:
 public:
 
   /* Create an objfile.  */
-  static objfile *make (bfd *bfd_, const char *name_, objfile_flags flags_)
-  {
-    return new objfile (bfd_, name_, flags_);
-  }
+  static objfile *make (bfd *bfd_, const char *name_, objfile_flags flags_,
+                       objfile *parent = nullptr);
 
   ~objfile ();
 
@@ -649,8 +647,6 @@ extern CORE_ADDR entry_point_address (void);
 
 extern void build_objfile_section_table (struct objfile *);
 
-extern void add_separate_debug_objfile (struct objfile *, struct objfile *);
-
 extern void free_objfile_separate_debug (struct objfile *);
 
 extern void free_all_objfiles (void);
index eef27a8418ebaf1705865827104a44cafb3d9957..8e3cf7f23e57b8740edbd54dc6e22eb9d23c5abf 100644 (file)
@@ -1093,10 +1093,7 @@ symbol_file_add_with_addrs (bfd *abfd, const char *name,
 
   if (mainline)
     flags |= OBJF_MAINLINE;
-  objfile = objfile::make (abfd, name, flags);
-
-  if (parent)
-    add_separate_debug_objfile (objfile, parent);
+  objfile = objfile::make (abfd, name, flags, parent);
 
   /* We either created a new mapped symbol table, mapped an existing
      symbol table file which has not had initial symbol reading
This page took 0.033083 seconds and 4 git commands to generate.