+extern struct partial_symtab *start_psymtab_common (struct objfile *,
+ const char *, CORE_ADDR);
+
+extern void end_psymtab_common (struct objfile *, struct partial_symtab *);
+
+/* Allocate a new partial symbol table associated with OBJFILE.
+ FILENAME (which must be non-NULL) is the filename of this partial
+ symbol table; it is copied into the appropriate storage. A new
+ partial symbol table is returned; aside from "next" and "filename",
+ its fields are initialized to zero. */
+
+extern struct partial_symtab *allocate_psymtab (const char *filename,
+ struct objfile *objfile)
+ ATTRIBUTE_NONNULL (1);
+
+static inline void
+discard_psymtab (struct objfile *objfile, struct partial_symtab *pst)
+{
+ objfile->partial_symtabs->discard_psymtab (pst);
+}
+
+/* Used when recording partial symbol tables. On destruction,
+ discards any partial symbol tables that have been built. However,
+ the tables can be kept by calling the "keep" method. */
+class psymtab_discarder
+{
+ public:
+
+ psymtab_discarder (struct objfile *objfile)
+ : m_objfile (objfile),
+ m_psymtab (objfile->partial_symtabs->psymtabs)
+ {
+ }
+
+ ~psymtab_discarder ()
+ {
+ if (m_objfile != NULL)
+ m_objfile->partial_symtabs->discard_psymtabs_to (m_psymtab);
+ }
+
+ /* Keep any partial symbol tables that were built. */
+ void keep ()
+ {
+ m_objfile = NULL;
+ }
+
+ private:
+
+ /* The objfile. If NULL this serves as a sentinel to indicate that
+ the psymtabs should be kept. */
+ struct objfile *m_objfile;
+ /* How far back to free. */
+ struct partial_symtab *m_psymtab;
+};