aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPedro Alves <pedro@palves.net>2020-08-29 00:11:35 +0100
committerPedro Alves <pedro@palves.net>2020-08-29 00:55:58 +0100
commitf7c7700d3241d862512b1fe5bebc0fc74c4470d9 (patch)
treeeda0577343b95c8ffcef4fd5d4ef286dfdf4279d
parent8f57f343104b8d3632e65ac1fbb12ee69891ef5f (diff)
downloadgdb-f7c7700d3241d862512b1fe5bebc0fc74c4470d9.zip
gdb-f7c7700d3241d862512b1fe5bebc0fc74c4470d9.tar.gz
gdb-f7c7700d3241d862512b1fe5bebc0fc74c4470d9.tar.bz2
Adjust "maint info program-spaces" to per-inferior target stack
By inspection, I noticed that print_program_space is calling target_pid_to_str on the wrong target stack. Most targets print a process pid the same way, so it isn't actually visible. gdb/ChangeLog: * progspace.c (print_program_space): Use all_inferiors. Switch to the inferior before calling target_pid_to_str.
-rw-r--r--gdb/ChangeLog5
-rw-r--r--gdb/progspace.c10
2 files changed, 13 insertions, 2 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index b9f4d48..1ff47c3 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,8 @@
+2020-08-29 Pedro Alves <pedro@palves.net>
+
+ * progspace.c (print_program_space): Use all_inferiors. Switch to
+ the inferior before calling target_pid_to_str.
+
2020-08-28 Tom Tromey <tom@tromey.com>
* xcoffread.c (xcoff_end_psymtab): Update comment.
diff --git a/gdb/progspace.c b/gdb/progspace.c
index 462083c..3f51216 100644
--- a/gdb/progspace.c
+++ b/gdb/progspace.c
@@ -302,7 +302,6 @@ print_program_space (struct ui_out *uiout, int requested)
for (struct program_space *pspace : program_spaces)
{
- struct inferior *inf;
int printed_header;
if (requested != -1 && requested != pspace->num)
@@ -328,9 +327,16 @@ print_program_space (struct ui_out *uiout, int requested)
e.g., both parent/child inferiors in a vfork, or, on targets
that share pspaces between inferiors. */
printed_header = 0;
- for (inf = inferior_list; inf; inf = inf->next)
+
+ /* We're going to switch inferiors. */
+ scoped_restore_current_thread restore_thread;
+
+ for (inferior *inf : all_inferiors ())
if (inf->pspace == pspace)
{
+ /* Switch to inferior in order to call target methods. */
+ switch_to_inferior_no_thread (inf);
+
if (!printed_header)
{
printed_header = 1;