/* All struct objfile's are chained together by their next pointers.
The global variable "object_files" points to the first link in this
- chain. */
+ chain.
+
+ FIXME: There is a problem here if the objfile is reusable, and if
+ multiple users are to be supported. The problem is that the objfile
+ list is linked through a member of the objfile struct itself, which
+ is only valid for one gdb process. The list implementation needs to
+ be changed to something like:
+
+ struct list {struct list *next; struct objfile *objfile};
+
+ where the list structure is completely maintained separately within
+ each gdb process. */
struct objfile *next;
PTR md;
+ /* The file descriptor that was used to obtain the mmalloc descriptor
+ for this objfile. If we call mmalloc_detach with the malloc descriptor
+ we should then close this file descriptor. */
+
+ int mmfd;
+
/* Structure which keeps track of functions that manipulate objfile's
of the same type as this objfile. I.E. the function to read partial
symbols for example. Note that this structure is in statically
#define OBJF_MAPPED (1 << 0) /* Objfile data is mmap'd */
+/* When using mapped/remapped predigested gdb symbol information, we need
+ a flag that indicates that we have previously done an initial symbol
+ table read from this particular objfile. We can't just look for the
+ absence of any of the three symbol tables (msymbols, psymtab, symtab)
+ because if the file has no symbols for example, none of these will
+ exist. */
+
+#define OBJF_SYMS (1 << 1) /* Have tried to read symbols */
+
/* The object file that the main symbol table was loaded from (e.g. the
argument to the "symbol-file" or "file" command). */
extern struct objfile *
allocate_objfile PARAMS ((bfd *, int));
+extern void
+unlink_objfile PARAMS ((struct objfile *));
+
extern void
free_objfile PARAMS ((struct objfile *));
extern int
have_minimal_symbols PARAMS ((void));
-extern PTR
-iterate_over_objfiles PARAMS ((PTR (*func) (struct objfile *,
- PTR arg1, PTR arg2, PTR arg3),
- PTR arg1, PTR arg2, PTR arg3));
-
-extern PTR
-iterate_over_symtabs PARAMS ((PTR (*func) (struct objfile *, struct symtab *,
- PTR arg1, PTR arg2, PTR arg3),
- PTR arg1, PTR arg2, PTR arg3));
-
-extern PTR
-iterate_over_psymtabs PARAMS ((PTR (*func) (struct objfile *,
- struct partial_symtab *,
- PTR arg1, PTR arg2, PTR arg3),
- PTR arg1, PTR arg2, PTR arg3));
-
/* Traverse all object files. ALL_OBJFILES_SAFE works even if you delete
the objfile during the traversal. */
#define ALL_OBJFILES(obj) \
- for ((obj)=object_files; (obj)!=NULL; (obj)=(obj)->next)
+ for ((obj) = object_files; (obj) != NULL; (obj) = (obj)->next)
#define ALL_OBJFILES_SAFE(obj,nxt) \
- for ((obj)=object_files; (obj)!=NULL?((nxt)=(obj)->next,1):0; (obj)=(nxt))
+ for ((obj) = object_files; \
+ (obj) != NULL? ((nxt)=(obj)->next,1) :0; \
+ (obj) = (nxt))
+
+
+/* Traverse all symtabs in one objfile. */
+
+#define ALL_OBJFILE_SYMTABS(objfile, s) \
+ for ((s) = (objfile) -> symtabs; (s) != NULL; (s) = (s) -> next)
+
+/* Traverse all psymtabs in one objfile. */
+
+#define ALL_OBJFILE_PSYMTABS(objfile, p) \
+ for ((p) = (objfile) -> psymtabs; (p) != NULL; (p) = (p) -> next)
+
+/* Traverse all minimal symbols in one objfile. */
+
+#define ALL_OBJFILE_MSYMBOLS(objfile, m) \
+ for ((m) = (objfile) -> msymbols; (m)->name != NULL; (m)++)
+
+
+/* Traverse all symtabs in all objfiles. */
+
+#define ALL_SYMTABS(objfile, s) \
+ ALL_OBJFILES (objfile) \
+ ALL_OBJFILE_SYMTABS (objfile, s)
+
+/* Traverse all psymtabs in all objfiles. */
+
+#define ALL_PSYMTABS(objfile, p) \
+ ALL_OBJFILES (objfile) \
+ ALL_OBJFILE_PSYMTABS (objfile, p)
+
+/* Traverse all minimal symbols in all objfiles. */
+
+#define ALL_MSYMBOLS(objfile, m) \
+ ALL_OBJFILES (objfile) \
+ if ((objfile)->msymbols) \
+ ALL_OBJFILE_MSYMBOLS (objfile, m)
#endif /* !defined (OBJFILES_H) */