aboutsummaryrefslogtreecommitdiff
path: root/gdb/objfiles.h
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/objfiles.h')
-rw-r--r--gdb/objfiles.h21
1 files changed, 20 insertions, 1 deletions
diff --git a/gdb/objfiles.h b/gdb/objfiles.h
index 663e639..49b4627 100644
--- a/gdb/objfiles.h
+++ b/gdb/objfiles.h
@@ -399,13 +399,18 @@ private:
/* The only way to create an objfile is to call objfile::make. */
objfile (bfd *, const char *, objfile_flags);
+ /* The only way to free an objfile is via 'unlink'. */
+ ~objfile ();
+
public:
/* Create an objfile. */
static objfile *make (bfd *bfd_, const char *name_, objfile_flags flags_,
objfile *parent = nullptr);
- ~objfile ();
+ /* Remove an objfile from the current program space, and free
+ it. */
+ void unlink ();
DISABLE_COPY_AND_ASSIGN (objfile);
@@ -637,6 +642,20 @@ public:
htab_up static_links;
};
+/* A deleter for objfile. */
+
+struct objfile_deleter
+{
+ void operator() (objfile *ptr) const
+ {
+ ptr->unlink ();
+ }
+};
+
+/* A unique pointer that holds an objfile. */
+
+typedef std::unique_ptr<objfile, objfile_deleter> objfile_up;
+
/* Declarations for functions defined in objfiles.c */
extern struct gdbarch *get_objfile_arch (const struct objfile *);