This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Don't prune program spaces when doing "maintenance info program-spaces"


While debugging a program spaces issue, I found that "maintenance info
program-spaces" pruned the program spaces prior to printing them. I
don't think a command to inspect the state of the program (especially
a maintenance one) should modify the state. All it can do is potentially
hide bugs.

gdb/Changelog:

	* progspace.c (print_program_space): Add "prune" parameter.
	(maintenance_info_program_spaces_command): Update call to
	print_program_space with new parameter.
---
 gdb/progspace.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/gdb/progspace.c b/gdb/progspace.c
index a74b6ab..aef2d4e 100644
--- a/gdb/progspace.c
+++ b/gdb/progspace.c
@@ -272,18 +272,19 @@ prune_program_spaces (void)
 
 /* Prints the list of program spaces and their details on UIOUT.  If
    REQUESTED is not -1, it's the ID of the pspace that should be
-   printed.  Otherwise, all spaces are printed.  */
+   printed.  Otherwise, all spaces are printed.  If PRUNE is true,
+   prune the unused program spaces prior to printing them, so they
+   won't be displayed. */
 
 static void
-print_program_space (struct ui_out *uiout, int requested)
+print_program_space (struct ui_out *uiout, int requested, int prune)
 {
   struct program_space *pspace;
   int count = 0;
   struct cleanup *old_chain;
 
-  /* Might as well prune away unneeded ones, so the user doesn't even
-     seem them.  */
-  prune_program_spaces ();
+  if (prune)
+    prune_program_spaces ();
 
   /* Compute number of pspaces we will print.  */
   ALL_PSPACES (pspace)
@@ -385,7 +386,7 @@ maintenance_info_program_spaces_command (char *args, int from_tty)
 	error (_("program space ID %d not known."), requested);
     }
 
-  print_program_space (current_uiout, requested);
+  print_program_space (current_uiout, requested, 0 /* prune */);
 }
 
 /* Simply returns the count of program spaces.  */
-- 
2.1.0


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]