Remove for_each_inferior
[deliverable/binutils-gdb.git] / gdb / progspace.h
index 08e04eb024e63aedb054869ca03c7d582422b0ac..85c99a62091a61aab1d7af9341363d67c89348fc 100644 (file)
@@ -1,6 +1,6 @@
 /* Program and address space management, for GDB, the GNU debugger.
 
-   Copyright (C) 2009-2014 Free Software Foundation, Inc.
+   Copyright (C) 2009-2017 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -210,6 +210,17 @@ struct program_space
     REGISTRY_FIELDS;
   };
 
+/* An address space.  It is used for comparing if
+   pspaces/inferior/threads see the same address space and for
+   associating caches to each address space.  */
+struct address_space
+{
+  int num;
+
+  /* Per aspace data-pointers required by other GDB modules.  */
+  REGISTRY_FIELDS;
+};
+
 /* The object file that the main symbol table was loaded from (e.g. the
    argument to the "symbol-file" or "file" command).  */
 
@@ -236,19 +247,21 @@ extern struct program_space *current_program_space;
    pointer to the new object.  */
 extern struct program_space *add_program_space (struct address_space *aspace);
 
+/* Remove a program space from the program spaces list and release it.  It is
+   an error to call this function while PSPACE is the current program space. */
+extern void delete_program_space (struct program_space *pspace);
+
 /* Returns the number of program spaces listed.  */
 extern int number_of_program_spaces (void);
 
+/* Returns true iff there's no inferior bound to PSPACE.  */
+extern int program_space_empty_p (struct program_space *pspace);
+
 /* Copies program space SRC to DEST.  Copies the main executable file,
    and the main symbol file.  Returns DEST.  */
 extern struct program_space *clone_program_space (struct program_space *dest,
                                                struct program_space *src);
 
-/* Save the current program space so that it may be restored by a later
-   call to do_cleanups.  Returns the struct cleanup pointer needed for
-   later doing the cleanup.  */
-extern struct cleanup *save_current_program_space (void);
-
 /* Sets PSPACE as the current program space.  This is usually used
    instead of set_current_space_and_thread when the current
    thread/inferior is not important for the operations that follow.
@@ -259,13 +272,23 @@ extern struct cleanup *save_current_program_space (void);
    space.  */
 extern void set_current_program_space (struct program_space *pspace);
 
-/* Saves the current thread (may be null), frame and program space in
-   the current cleanup chain.  */
-extern struct cleanup *save_current_space_and_thread (void);
+/* Save/restore the current program space.  */
 
-/* Switches full context to program space PSPACE.  Switches to the
-   first thread found bound to PSPACE.  */
-extern void switch_to_program_space_and_thread (struct program_space *pspace);
+class scoped_restore_current_program_space
+{
+public:
+  scoped_restore_current_program_space ()
+    : m_saved_pspace (current_program_space)
+  {}
+
+  ~scoped_restore_current_program_space ()
+  { set_current_program_space (m_saved_pspace); }
+
+  DISABLE_COPY_AND_ASSIGN (scoped_restore_current_program_space);
+
+private:
+  program_space *m_saved_pspace;
+};
 
 /* Create a new address space object, and add it to the list.  */
 extern struct address_space *new_address_space (void);
@@ -288,10 +311,6 @@ extern int address_space_num (struct address_space *aspace);
    mappings.  */
 extern void update_address_spaces (void);
 
-/* Prune away automatically added program spaces that aren't required
-   anymore.  */
-extern void prune_program_spaces (void);
-
 /* Reset saved solib data at the start of an solib event.  This lets
    us properly collect the data when calling solib_add, so it can then
    later be printed.  */
This page took 0.024631 seconds and 4 git commands to generate.