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
+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.
2019-12-12 Tom Tromey <tom@tromey.com>
* symfile.c (symbol_file_add_with_addrs): Use objfile::make.
/* Add OBJFILE as a separate debug objfile of PARENT. */
/* Add OBJFILE as a separate debug objfile of PARENT. */
add_separate_debug_objfile (struct objfile *objfile, struct objfile *parent)
{
gdb_assert (objfile && parent);
add_separate_debug_objfile (struct objfile *objfile, struct objfile *parent)
{
gdb_assert (objfile && parent);
put_objfile_before (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. */
/* Free all separate debug objfile of OBJFILE, but don't free OBJFILE
itself. */
public:
/* Create an objfile. */
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);
extern void build_objfile_section_table (struct objfile *);
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);
extern void free_objfile_separate_debug (struct objfile *);
extern void free_all_objfiles (void);
if (mainline)
flags |= OBJF_MAINLINE;
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
/* We either created a new mapped symbol table, mapped an existing
symbol table file which has not had initial symbol reading