Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [patch/doc] Tweak "info inferiors" output.
@ 2009-08-14 16:22 Pedro Alves
  2009-08-14 17:38 ` Tom Tromey
  2009-08-14 18:30 ` Eli Zaretskii
  0 siblings, 2 replies; 14+ messages in thread
From: Pedro Alves @ 2009-08-14 16:22 UTC (permalink / raw)
  To: gdb-patches

Here's a tiny piece I'm cutting out of the pending multi-exec patch.

(Tromey, we talked a bit about this bit at the end of 
http://sourceware.org/ml/gdb-patches/2009-06/msg00668.html)

This tweaks the "info inferiors" output to align columns left, removes
the "Cur" header, and makes the command query the target how to
print a process id (or better, the inferior's target side ID, there
may be no concept of processes on the other end at all).

----------------------------------------------------------

Native:

Before                         After

(gdb) info inferiors           (gdb) info inferiors
Cur   Id     PID                 Id   Target ID
  *    1    3099               * 1    process 3099

----------------------------------------------------------

Remote:

Before                         After

(gdb) info inferiors           (gdb) info inferiors
Cur   Id     PID                 Id   Target ID
  *    1   42000               * 1    Remote target
(gdb)     

(42000 is the magic pid that is an internal detail.  The user
should never see it.)

----------------------------------------------------------

More columns will be added later when multi-executable support goes in.

Comments?  Eli, documentation bits ok?

-- 
Pedro Alves

2009-08-14  Pedro Alves  <pedro@codesourcery.com>

	* inferior.c (print_inferior): Align columns left.  Remove header
	for the the "current" column.  Print if there's no selected
	inferior.

2009-08-14  Pedro Alves  <pedro@codesourcery.com>

	* gdb.texinfo (Debugging Multiple Inferiors): Add "info inferiors"
	small example.

---
 gdb/doc/gdb.texinfo |    7 +++++++
 gdb/inferior.c      |   14 ++++++++++----
 2 files changed, 17 insertions(+), 4 deletions(-)

Index: src/gdb/inferior.c
===================================================================
--- src.orig/gdb/inferior.c	2009-08-14 16:10:15.000000000 +0100
+++ src/gdb/inferior.c	2009-08-14 16:13:11.000000000 +0100
@@ -324,9 +324,9 @@ print_inferior (struct ui_out *uiout, in
 
   old_chain = make_cleanup_ui_out_table_begin_end (uiout, 3, inf_count,
 						   "inferiors");
-  ui_out_table_header (uiout, 3, ui_right, "current", "Cur");
-  ui_out_table_header (uiout, 4, ui_right, "id", "Id");
-  ui_out_table_header (uiout, 7, ui_right, "target-id", "PID");
+  ui_out_table_header (uiout, 1, ui_left, "current", "");
+  ui_out_table_header (uiout, 4, ui_left, "id", "Id");
+  ui_out_table_header (uiout, 17, ui_left, "target-id", "Target ID");
   ui_out_table_body (uiout);
 
   for (inf = inferior_list; inf; inf = inf->next)
@@ -344,12 +344,18 @@ print_inferior (struct ui_out *uiout, in
 	ui_out_field_skip (uiout, "current");
 
       ui_out_field_int (uiout, "id", inf->num);
-      ui_out_field_int (uiout, "target-id", inf->pid);
+      ui_out_field_string (uiout, "target-id",
+			   target_pid_to_str (pid_to_ptid (inf->pid)));
 
       ui_out_text (uiout, "\n");
       do_cleanups (chain2);
     }
 
+  if (inferior_list
+      && ptid_equal (inferior_ptid, null_ptid))
+    ui_out_message (uiout, 0, "\n\
+No selected inferior/thread.  See `help thread' or `help inferior'.\n");
+
   do_cleanups (old_chain);
 }
 
Index: src/gdb/doc/gdb.texinfo
===================================================================
--- src.orig/gdb/doc/gdb.texinfo	2009-08-14 16:13:20.000000000 +0100
+++ src/gdb/doc/gdb.texinfo	2009-08-14 16:16:40.000000000 +0100
@@ -2376,6 +2376,13 @@ To find out what inferiors exist at any 
 Print a list of all inferiors currently being managed by @value{GDBN}.
 @end table
 
+@smallexample
+(@value{GDBP}) info inferiors
+  Id   Target ID
+* 1    process 2307
+  2    process 3401
+@end smallexample
+
 To switch focus between inferiors, use the @code{inferior} command:
 
 @table @code


^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2009-08-25 15:29 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-08-14 16:22 [patch/doc] Tweak "info inferiors" output Pedro Alves
2009-08-14 17:38 ` Tom Tromey
2009-08-14 18:30 ` Eli Zaretskii
2009-08-14 19:27   ` Pedro Alves
2009-08-14 20:59     ` Eli Zaretskii
2009-08-17 14:37       ` Pedro Alves
2009-08-17 14:45         ` Pedro Alves
2009-08-17 17:55         ` Eli Zaretskii
2009-08-17 18:01           ` Tom Tromey
2009-08-17 19:28             ` Eli Zaretskii
2009-08-17 20:12               ` Stan Shebs
2009-08-24 11:15                 ` Pedro Alves
2009-08-24 18:54                   ` Eli Zaretskii
2009-08-25 15:40                     ` Pedro Alves

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox