Introduce program_space::remove_objfile
[deliverable/binutils-gdb.git] / gdb / progspace.c
index 5aa7a3d177e488a24c218e8ba617dbf78b84df62..e6c4f55c4e8b1c39dda555ff7a019d3ec84f4a89 100644 (file)
@@ -175,6 +175,31 @@ program_space::add_objfile (struct objfile *objfile, struct objfile *before)
 
 }
 
+/* See progspace.h.  */
+
+void
+program_space::remove_objfile (struct objfile *objfile)
+{
+  struct objfile **objpp;
+
+  for (objpp = &object_files; *objpp != NULL; objpp = &((*objpp)->next))
+    {
+      if (*objpp == objfile)
+       {
+         *objpp = (*objpp)->next;
+         objfile->next = NULL;
+
+         if (objfile == symfile_object_file)
+           symfile_object_file = NULL;
+
+         return;
+       }
+    }
+
+  internal_error (__FILE__, __LINE__,
+                 _("remove_objfile: objfile already unlinked"));
+}
+
 /* Copies program space SRC to DEST.  Copies the main executable file,
    and the main symbol file.  Returns DEST.  */
 
This page took 0.023812 seconds and 4 git commands to generate.