X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=gdb%2Fobjfiles.h;h=9a433ddd7b043b4c7c1c137d395f93155b903bc6;hb=e671856cb804c977650aaeb4107948a7b963e9e9;hp=49b4627d67cc5e27370d24cbcc86fc369e15cae6;hpb=268e4f09144c48e02f01d82ab3aab359457df214;p=deliverable%2Fbinutils-gdb.git diff --git a/gdb/objfiles.h b/gdb/objfiles.h index 49b4627d67..9a433ddd7b 100644 --- a/gdb/objfiles.h +++ b/gdb/objfiles.h @@ -28,12 +28,14 @@ #include "registry.h" #include "gdb_bfd.h" #include "psymtab.h" +#include #include #include #include "gdbsupport/next-iterator.h" #include "gdbsupport/safe-iterator.h" #include "bcache.h" #include "gdbarch.h" +#include "gdbsupport/refcounted-object.h" struct htab; struct objfile_data; @@ -399,11 +401,16 @@ 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: + /* Normally you should not call delete. Instead, call 'unlink' to + remove it from the program space's list. In some cases, you may + need to hold a reference to an objfile that is independent of its + existence on the program space's list; for this case, the + destructor must be public so that shared_ptr can reference + it. */ + ~objfile (); + /* Create an objfile. */ static objfile *make (bfd *bfd_, const char *name_, objfile_flags flags_, objfile *parent = nullptr); @@ -486,12 +493,6 @@ public: } - /* All struct objfile's are chained together by their next pointers. - The program space field "objfiles" (frequently referenced via - the macro "object_files") points to the first link in this chain. */ - - struct objfile *next = nullptr; - /* The object file's original name as specified by the user, made absolute, and tilde-expanded. However, it is not canonicalized (i.e., it has not been passed through gdb_realpath). @@ -517,7 +518,7 @@ public: /* The partial symbol tables. */ - std::shared_ptr partial_symtabs; + std::unique_ptr partial_symtabs; /* The object file's BFD. Can be null if the objfile contains only minimal symbols, e.g. the run time common symbols for SunOS4. */ @@ -668,8 +669,6 @@ extern void build_objfile_section_table (struct objfile *); extern void free_objfile_separate_debug (struct objfile *); -extern void free_all_objfiles (void); - extern void objfile_relocate (struct objfile *, const struct section_offsets *); extern void objfile_rebase (struct objfile *, CORE_ADDR); @@ -773,10 +772,6 @@ extern void default_iterate_over_objfiles_in_search_order uninitialized section index. */ #define SECT_OFF_BSS(objfile) (objfile)->sect_index_bss -/* Answer whether there is more than one object file loaded. */ - -#define MULTI_OBJFILE_P() (object_files && object_files->next) - /* Reset the per-BFD storage area on OBJ. */ void set_objfile_per_bfd (struct objfile *obj);