X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=gdb%2Fobjfiles.h;h=49b4627d67cc5e27370d24cbcc86fc369e15cae6;hb=268e4f09144c48e02f01d82ab3aab359457df214;hp=663e6390dcd6f22e5874d99f1c509a243b82fc04;hpb=f65fe5704af56aca58fd5547d0841a9512e540af;p=deliverable%2Fbinutils-gdb.git diff --git a/gdb/objfiles.h b/gdb/objfiles.h index 663e6390dc..49b4627d67 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_up; + /* Declarations for functions defined in objfiles.c */ extern struct gdbarch *get_objfile_arch (const struct objfile *);