From: Tom Tromey <tromey@redhat.com>
To: Pedro Alves <pedro@codesourcery.com>
Cc: gdb-patches@sourceware.org
Subject: Re: Move the multi-forks support to the generic multi-inferiors support.
Date: Sat, 06 Jun 2009 00:09:00 -0000 [thread overview]
Message-ID: <m3r5xyql6m.fsf@fleche.redhat.com> (raw)
In-Reply-To: <m3prdouevj.fsf@fleche.redhat.com> (Tom Tromey's message of "Mon\, 01 Jun 2009 09\:56\:32 -0600")
>>>>> "Tom" == Tom Tromey <tromey@redhat.com> writes:
Pedro> If you look at head's "info inferiors" output, it's not about cleaning
Pedro> up, it's about cooking something. :-)
Tom> Actually I hadn't looked at the code, I just tried it and saw that
Tom> there were still no column headings. I'll try to update that old
Tom> patch soon.
How about this? It adds the column headings and prints something when
there are no inferiors.
Built & regtested on x86-64 (compile farm).
Tom
2009-06-05 Tom Tromey <tromey@redhat.com>
* inferior.c (print_inferior): Make a table, not a list. Emit
table headers.
diff --git a/gdb/inferior.c b/gdb/inferior.c
index e060a1b..e74c7a4 100644
--- a/gdb/inferior.c
+++ b/gdb/inferior.c
@@ -294,8 +294,31 @@ print_inferior (struct ui_out *uiout, int requested_inferior)
{
struct inferior *inf;
struct cleanup *old_chain;
+ int inf_count = 0;
- old_chain = make_cleanup_ui_out_list_begin_end (uiout, "inferiors");
+ /* Compute number of inferiors we will print. */
+ for (inf = inferior_list; inf; inf = inf->next)
+ {
+ struct cleanup *chain2;
+
+ if (requested_inferior != -1 && inf->num != requested_inferior)
+ continue;
+
+ ++inf_count;
+ }
+
+ if (inf_count == 0)
+ {
+ ui_out_message (uiout, 0, "No inferiors.\n");
+ return;
+ }
+
+ 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_body (uiout);
for (inf = inferior_list; inf; inf = inf->next)
{
@@ -307,12 +330,11 @@ print_inferior (struct ui_out *uiout, int requested_inferior)
chain2 = make_cleanup_ui_out_tuple_begin_end (uiout, NULL);
if (inf->pid == ptid_get_pid (inferior_ptid))
- ui_out_text (uiout, "* ");
+ ui_out_field_string (uiout, "current", "*");
else
- ui_out_text (uiout, " ");
+ ui_out_field_skip (uiout, "current");
ui_out_field_int (uiout, "id", inf->num);
- ui_out_text (uiout, " ");
ui_out_field_int (uiout, "target-id", inf->pid);
ui_out_text (uiout, "\n");
next prev parent reply other threads:[~2009-06-06 0:09 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-05-30 23:13 Pedro Alves
2009-05-31 20:46 ` Tom Tromey
2009-05-31 22:07 ` Pedro Alves
2009-05-31 22:23 ` Doug Evans
2009-06-01 15:58 ` Tom Tromey
2009-06-06 0:09 ` Tom Tromey [this message]
2009-06-06 16:06 ` Pedro Alves
2009-06-08 1:34 ` Marc Khouzam
2009-06-08 22:43 ` Tom Tromey
2009-06-08 23:22 ` Pedro Alves
2009-06-08 22:39 ` Tom Tromey
2009-06-08 23:16 ` Pedro Alves
2009-06-10 22:09 ` Tom Tromey
2009-06-10 22:13 ` Pedro Alves
2009-06-08 12:58 ` Pedro Alves
2009-06-11 19:32 ` Michael Snyder
2009-07-01 18:27 ` Pedro Alves
2009-07-01 19:16 ` Eli Zaretskii
2009-07-02 14:32 ` Pedro Alves
2009-07-02 19:00 ` Eli Zaretskii
2009-07-02 21:59 ` Pedro Alves
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=m3r5xyql6m.fsf@fleche.redhat.com \
--to=tromey@redhat.com \
--cc=gdb-patches@sourceware.org \
--cc=pedro@codesourcery.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox