From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7448 invoked by alias); 6 Jun 2009 00:09:43 -0000 Received: (qmail 7440 invoked by uid 22791); 6 Jun 2009 00:09:43 -0000 X-SWARE-Spam-Status: No, hits=-2.3 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: sourceware.org Received: from mx2.redhat.com (HELO mx2.redhat.com) (66.187.237.31) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sat, 06 Jun 2009 00:09:36 +0000 Received: from int-mx2.corp.redhat.com (int-mx2.corp.redhat.com [172.16.27.26]) by mx2.redhat.com (8.13.8/8.13.8) with ESMTP id n5607W0T009023; Fri, 5 Jun 2009 20:07:32 -0400 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx2.corp.redhat.com (8.13.1/8.13.1) with ESMTP id n5607VRa024629; Fri, 5 Jun 2009 20:07:31 -0400 Received: from opsy.redhat.com (vpn-12-153.rdu.redhat.com [10.11.12.153]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id n5607UwY007158; Fri, 5 Jun 2009 20:07:30 -0400 Received: by opsy.redhat.com (Postfix, from userid 500) id 6C90E378615; Fri, 5 Jun 2009 18:07:29 -0600 (MDT) To: Pedro Alves Cc: gdb-patches@sourceware.org Subject: Re: Move the multi-forks support to the generic multi-inferiors support. References: <200905310013.38916.pedro@codesourcery.com> <200905312308.04692.pedro@codesourcery.com> From: Tom Tromey Reply-To: Tom Tromey Date: Sat, 06 Jun 2009 00:09:00 -0000 In-Reply-To: (Tom Tromey's message of "Mon\, 01 Jun 2009 09\:56\:32 -0600") Message-ID: User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2009-06/txt/msg00147.txt.bz2 >>>>> "Tom" == Tom Tromey 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 * 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");