From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18872 invoked by alias); 4 Sep 2013 08:58:56 -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 18856 invoked by uid 89); 4 Sep 2013 08:58:56 -0000 Received: from mga09.intel.com (HELO mga09.intel.com) (134.134.136.24) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 04 Sep 2013 08:58:56 +0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.4 required=5.0 tests=AWL,BAYES_00,KHOP_THREADED,RDNS_NONE,SPF_SOFTFAIL autolearn=no version=3.3.2 X-HELO: mga09.intel.com Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga102.jf.intel.com with ESMTP; 04 Sep 2013 01:55:52 -0700 X-ExtLoop1: 1 Received: from irsmsx103.ger.corp.intel.com ([163.33.3.157]) by orsmga001.jf.intel.com with ESMTP; 04 Sep 2013 01:58:47 -0700 Received: from irsmsx153.ger.corp.intel.com (163.33.192.75) by IRSMSX103.ger.corp.intel.com (163.33.3.157) with Microsoft SMTP Server (TLS) id 14.3.123.3; Wed, 4 Sep 2013 09:56:10 +0100 Received: from irsmsx105.ger.corp.intel.com ([169.254.7.64]) by IRSMSX153.ger.corp.intel.com ([169.254.9.218]) with mapi id 14.03.0123.003; Wed, 4 Sep 2013 09:56:09 +0100 From: "Agovic, Sanimir" To: 'Mohsan Saleem' CC: "gdb-patches@sourceware.org" Subject: RE: [PATCH] fix PR-12417 Date: Wed, 04 Sep 2013 08:58:00 -0000 Message-ID: <0377C58828D86C4588AEEC42FC3B85A71766C229@IRSMSX105.ger.corp.intel.com> References: <521E2414.40602@codesourcery.com> <52254BC6.1050105@codesourcery.com> <1378282781.96893.YahooMailNeo@web142604.mail.bf1.yahoo.com> In-Reply-To: <1378282781.96893.YahooMailNeo@web142604.mail.bf1.yahoo.com> Content-Type: text/plain; charset="iso-8859-1" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes X-SW-Source: 2013-09/txt/msg00125.txt.bz2 Some comments below.=20 -Sanimir > -----Original Message----- > From: gdb-patches-owner@sourceware.org [mailto:gdb-patches-owner@sourcewa= re.org] On Behalf > Of Mohsan Saleem > Sent: Wednesday, September 04, 2013 10:20 AM > To: gdb-patches@sourceware.org > Subject: Re: [PATCH] fix PR-12417 >=20 >=20 > Index: ./gdb/thread.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > RCS file: /cvs/src/src/gdb/thread.c,v > retrieving revision 1.155 > diff -u -p -r1.155 thread.c > --- ./gdb/thread.c=A0=A0=A0 15 Jul 2013 11:14:32 -0000=A0=A0=A0 1.155 > +++ ./gdb/thread.c=A0=A0=A0 3 Sep 2013 02:36:11 -0000 > @@ -64,6 +64,7 @@ static void info_threads_command (char * > =A0 static void thread_apply_command (char *, int); > =A0 static void restore_current_thread (ptid_t); > =A0 static void prune_threads (void); > +static const char *thread_name (struct thread_info *); >=20 > =A0 /* Data to cleanup thread array.=A0 */ >=20 > @@ -78,6 +79,14 @@ struct thread_array_cleanup > =A0 }; >=20 >=20 > +const char * > +thread_name (struct thread_info *ti) > Constify TI if possible. > +{ > +=A0 const char *name; > Newline between variable decl and first statement. > +=A0 name =3D ti->name !=3D NULL ? ti->name : target_thread_name (ti); > A matter of taste, but I prefer explicit if/else name =3D ti->name; if (name =3D=3D NULL) name =3D target_thread_name (ti); if (name =3D=3D NULL) name =3D ""; > @@ -251,7 +260,7 @@ add_thread_with_info (ptid_t ptid, struc > =A0 =A0 result->private =3D private; >=20 > =A0 =A0 if (print_thread_events) > -=A0 =A0 printf_unfiltered (_("[New %s]\n"), target_pid_to_str (ptid)); > +=A0 =A0 printf_unfiltered (_("[New %s \"%s\"\n"), target_pid_to_str (pti= d), thread_name > This will print [New 1234 ""] in case a thread name is not available, not s= ure if we should omit thread name instead. > @@ -1456,7 +1466,9 @@ do_captured_thread_select (struct ui_out >=20 > =A0 =A0 ui_out_text (uiout, "[Switching to thread "); > =A0 =A0 ui_out_field_int (uiout, "new-thread-id", pid_to_thread_id (infer= ior_ptid)); > -=A0 ui_out_text (uiout, " ("); > +=A0 ui_out_text (uiout, " \""); > +=A0 ui_out_text (uiout, thread_name (tp)); > +=A0 ui_out_text (uiout, "\" ("); > =A0 =A0 ui_out_text (uiout, target_pid_to_str (inferior_ptid)); > =A0 =A0 ui_out_text (uiout, ")]"); >=20 Is the thread name exposed via the MI protocol in some way? -Sanimir Intel GmbH Dornacher Strasse 1 85622 Feldkirchen/Muenchen, Deutschland Sitz der Gesellschaft: Feldkirchen bei Muenchen Geschaeftsfuehrer: Christian Lamprechter, Hannes Schwaderer, Douglas Lusk Registergericht: Muenchen HRB 47456 Ust.-IdNr./VAT Registration No.: DE129385895 Citibank Frankfurt a.M. (BLZ 502 109 00) 600119052