From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2341 invoked by alias); 19 Sep 2015 06:21:27 -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 2329 invoked by uid 89); 19 Sep 2015 06:21:26 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=AWL,BAYES_00,FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-pa0-f41.google.com Received: from mail-pa0-f41.google.com (HELO mail-pa0-f41.google.com) (209.85.220.41) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Sat, 19 Sep 2015 06:21:25 +0000 Received: by pacex6 with SMTP id ex6so69287844pac.0 for ; Fri, 18 Sep 2015 23:21:23 -0700 (PDT) X-Received: by 10.66.101.97 with SMTP id ff1mr11507757pab.91.1442643683267; Fri, 18 Sep 2015 23:21:23 -0700 (PDT) Received: from seba.sebabeach.org.gmail.com (173-13-178-53-sfba.hfc.comcastbusiness.net. [173.13.178.53]) by smtp.gmail.com with ESMTPSA id g5sm12410093pat.21.2015.09.18.23.21.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 18 Sep 2015 23:21:22 -0700 (PDT) From: Doug Evans To: "Ulrich Weigand" Cc: palves@redhat.com (Pedro Alves), gdb-patches@sourceware.org Subject: Re: Cell multi-arch broken (Re: [PATCH 2/2] GNU/Linux: Stop using libthread_db/td_ta_thr_iter) References: <20150826190157.EE3D939FA@oc7340732750.ibm.com> Date: Sat, 19 Sep 2015 06:21:00 -0000 In-Reply-To: (Doug Evans's message of "Thu, 27 Aug 2015 23:20:46 -0700") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-IsSubscribed: yes X-SW-Source: 2015-09/txt/msg00490.txt.bz2 Doug Evans writes: > "Ulrich Weigand" writes: >> Ah, indeed that works for me. The attached patch also fixes the >> problem for me. >> >> Bye, >> Ulrich >> >> Index: binutils-gdb/gdb/linux-thread-db.c >> =================================================================== >> --- binutils-gdb.orig/gdb/linux-thread-db.c >> +++ binutils-gdb/gdb/linux-thread-db.c >> @@ -1851,13 +1851,16 @@ thread_db_get_thread_local_address (stru >> struct thread_info *thread_info; >> struct target_ops *beneath; >> >> - /* If we have not discovered any threads yet, check now. */ >> - if (!have_threads (ptid)) >> - thread_db_find_new_threads_1 (ptid); >> - >> /* Find the matching thread. */ >> thread_info = find_thread_ptid (ptid); >> >> + /* We may not have discovered the thread yet. */ >> + if (thread_info != NULL && thread_info->priv == NULL) >> + { >> + thread_from_lwp (ptid); >> + thread_info = find_thread_ptid (ptid); >> + } >> + >> if (thread_info != NULL && thread_info->priv != NULL) >> { >> td_err_e err; > > Hi. > > Just a thought. > > It's kinda clumsy that thread_from_lwp ends with this: > > /* Fill the cache. */ > tp = find_thread_ptid (ptid); > record_thread (info, tp, ptid, &th, &ti); > > and then we just call find_thread_ptid again after it returns: > >> + thread_from_lwp (ptid); >> + thread_info = find_thread_ptid (ptid); > > One might ask "Why doesn't thread_from_lwp just return thread_info?" > > From record_thread things seem to be a be more subtle. > Even if we pass in a non-NULL TP we may still create a new one. > > /* Add the thread to GDB's thread list. If we already know about a > thread with this PTID, but it's marked exited, then the kernel > reused the tid of an old thread. */ > if (tp == NULL || tp->state == THREAD_EXITED) > tp = add_thread_with_info (ptid, priv); > else > tp->priv = priv; > > So it'd be helpful if record_thread also returned tp. > Sound about right? > > 2015-08-27 Doug Evans > > * linux-thread-db.c (record_thread): Return the created thread. > (thread_from_lwp): Likewise. > (thread_db_get_thread_local_address): Update. Committed.