From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27752 invoked by alias); 6 Nov 2013 22:03:49 -0000 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 Received: (qmail 27708 invoked by uid 89); 6 Nov 2013 22:03:48 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.9 required=5.0 tests=AWL,BAYES_00,RDNS_NONE,SPF_HELO_PASS,SPF_PASS,URIBL_BLOCKED autolearn=no version=3.3.2 X-HELO: mx1.redhat.com Received: from Unknown (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 06 Nov 2013 22:03:46 +0000 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id rA6M3dFD025005 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 6 Nov 2013 17:03:39 -0500 Received: from barimba (ovpn-113-94.phx2.redhat.com [10.3.113.94]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id rA6M3cud025931 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO); Wed, 6 Nov 2013 17:03:38 -0500 From: Tom Tromey To: Mohsan Saleem Cc: "gdb-patches\@sourceware.org" , "palves\@redhat.com" Subject: Re: [PATCH] fix PR-12417 References: <521E2414.40602@codesourcery.com> <52254BC6.1050105@codesourcery.com> <1378282781.96893.YahooMailNeo@web142604.mail.bf1.yahoo.com> <0377C58828D86C4588AEEC42FC3B85A71766C229@IRSMSX105.ger.corp.intel.com> <1378293943.43616.YahooMailNeo@web142603.mail.bf1.yahoo.com> <1379391306.56146.YahooMailNeo@web142602.mail.bf1.yahoo.com> Date: Wed, 06 Nov 2013 22:23:00 -0000 In-Reply-To: <1379391306.56146.YahooMailNeo@web142602.mail.bf1.yahoo.com> (Mohsan Saleem's message of "Mon, 16 Sep 2013 21:15:06 -0700 (PDT)") Message-ID: <8738n91939.fsf@fleche.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-SW-Source: 2013-11/txt/msg00158.txt.bz2 >>>>> "Mohsan" =3D=3D Mohsan Saleem writes: Mohsan> 2013-09-04 =C2=A0Mohsan Saleem=C2=A0 Mohsan> =C2=A0=C2=A0=C2=A0 PR threads/12417 Mohsan> =C2=A0=C2=A0=C2=A0 * thread.c (thread_name): New function. Mohsan> =C2=A0=C2=A0=C2=A0 (add_thread_with_info): Update to print thread n= ame. Mohsan> =C2=A0=C2=A0=C2=A0 (thread_apply_all_command): Likewise. Mohsan> =C2=A0=C2=A0=C2=A0 (thread_apply_command): Likewise. Mohsan> =C2=A0=C2=A0=C2=A0 (thread_find_command): Likewise. Mohsan> =C2=A0=C2=A0=C2=A0 (do_captured_thread_select): Likewise. Thanks. =20 Mohsan> +const char * Mohsan> +thread_name (struct thread_info *ti) Mohsan> +{ This needs an introductory comment. Mohsan> if (print_thread_events) Mohsan> - printf_unfiltered (_("[New %s]\n"), target_pid_to_str (ptid)); Mohsan> + printf_unfiltered (_("[New %s \"%s\"]\n"), target_pid_to_str (= ptid), thread_name (result)); This line is too long. Also, I think the output will be weird if the thread does not have a name. Mohsan> + printf_filtered (_("\nThread %d \"%s\" (%s):\n"), Mohsan> + tp_array[k]->num, Mohsan> + thread_name (tp_array[k]), Mohsan> + target_pid_to_str (inferior_ptid)); Likewise concerning the no-name case. Mohsan> + printf_filtered (_("\nThread %d \"%s\" (%s):\n"), tp->num, thre= ad_name (tp), Too long, plus no-name. Mohsan> ui_out_text (uiout, "[Switching to thread "); Mohsan> ui_out_field_int (uiout, "new-thread-id", pid_to_thread_id (infe= rior_ptid)); Mohsan> - ui_out_text (uiout, " ("); Mohsan> + ui_out_text (uiout, " \""); Mohsan> + ui_out_text (uiout, thread_name (tp)); Mohsan> + ui_out_text (uiout, "\" ("); Mohsan> ui_out_text (uiout, target_pid_to_str (inferior_ptid)); Mohsan> ui_out_text (uiout, ")]"); Two thoughts come to mind for the patch. First, perhaps a single function for emitting the thread description would be better. Then it could be normalized across all of gdb. Second, it would be nice to use ui-out properly in such a function, so that MI can see the thread name distinctly from the other bits. Tom