From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16783 invoked by alias); 6 Aug 2010 02:56:18 -0000 Received: (qmail 16775 invoked by uid 22791); 6 Aug 2010 02:56:18 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM X-Spam-Check-By: sourceware.org Received: from mail-ww0-f43.google.com (HELO mail-ww0-f43.google.com) (74.125.82.43) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 06 Aug 2010 02:56:13 +0000 Received: by wwi17 with SMTP id 17so909409wwi.12 for ; Thu, 05 Aug 2010 19:56:11 -0700 (PDT) Received: by 10.216.13.17 with SMTP id a17mr341147wea.46.1281063371204; Thu, 05 Aug 2010 19:56:11 -0700 (PDT) MIME-Version: 1.0 Received: by 10.216.186.205 with HTTP; Thu, 5 Aug 2010 19:55:51 -0700 (PDT) In-Reply-To: References: From: Hui Zhu Date: Fri, 06 Aug 2010 02:56:00 -0000 Message-ID: Subject: Re: [RFA]corelow.c: Add tid to add_to_thread_list To: Tom Tromey Cc: gdb-patches ml Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes 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: 2010-08/txt/msg00056.txt.bz2 On Fri, Aug 6, 2010 at 02:44, Tom Tromey wrote: >>>>>> ">" =3D=3D Hui Zhu writes: > >>> I make a patch for kernel (http://lkml.org/lkml/2010/8/3/75) but they >>> think it should be fixed in user space. >>> So I add the tid to add_to_thread_list. > > I don't know about this area of gdb, so I can't really comment on the > semantics of the change, but I do have a comment about how the change is > written: > >>> - =A0ptid =3D ptid_build (pid, lwpid, 0); >>> + =A0tid =3D 0; >>> +get_ptid: >>> + =A0ptid =3D ptid_build (pid, lwpid, tid); >>> + =A0if (find_thread_ptid (ptid)) >>> + =A0 =A0{ >>> + =A0 =A0 =A0tid ++; >>> + =A0 =A0 =A0goto get_ptid; >>> + =A0 =A0} > > I think this would be more readably written without 'goto', as a loop. > > Tom > Thanks. The prev one is too casual. I make a new one that use the loop. Best, Hui 2010-08-06 Hui Zhu * corelow.c(add_to_thread_list): Add tid. --- corelow.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) --- a/corelow.c +++ b/corelow.c @@ -244,7 +244,7 @@ add_to_thread_list (bfd *abfd, asection { ptid_t ptid; int core_tid; - int pid, lwpid; + int pid, lwpid, tid; asection *reg_sect =3D (asection *) reg_sect_arg; if (strncmp (bfd_section_name (abfd, asect), ".reg/", 5) !=3D 0) @@ -278,7 +278,13 @@ add_to_thread_list (bfd *abfd, asection if (current_inferior ()->pid =3D=3D 0) inferior_appeared (current_inferior (), pid); - ptid =3D ptid_build (pid, lwpid, 0); + tid =3D 0; + do + { + ptid =3D ptid_build (pid, lwpid, tid); + tid ++; + } + while (find_thread_ptid (ptid)); add_thread (ptid);