From patchwork Wed Aug 26 17:39:03 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulrich Weigand X-Patchwork-Id: 8463 Received: (qmail 22009 invoked by alias); 26 Aug 2015 17:39:33 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 21991 invoked by uid 89); 26 Aug 2015 17:39:32 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.8 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD, SPF_PASS autolearn=ham version=3.3.2 X-HELO: e06smtp16.uk.ibm.com Received: from e06smtp16.uk.ibm.com (HELO e06smtp16.uk.ibm.com) (195.75.94.112) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (CAMELLIA256-SHA encrypted) ESMTPS; Wed, 26 Aug 2015 17:39:30 +0000 Received: from /spool/local by e06smtp16.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 26 Aug 2015 18:39:26 +0100 Received: from d06dlp02.portsmouth.uk.ibm.com (9.149.20.14) by e06smtp16.uk.ibm.com (192.168.101.146) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Wed, 26 Aug 2015 18:39:25 +0100 X-MailFrom: uweigand@de.ibm.com X-RcptTo: gdb-patches@sourceware.org Received: from b06cxnps3074.portsmouth.uk.ibm.com (d06relay09.portsmouth.uk.ibm.com [9.149.109.194]) by d06dlp02.portsmouth.uk.ibm.com (Postfix) with ESMTP id 0485C219005F for ; Wed, 26 Aug 2015 18:38:58 +0100 (BST) Received: from d06av01.portsmouth.uk.ibm.com (d06av01.portsmouth.uk.ibm.com [9.149.37.212]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id t7QHdLXU14352486 for ; Wed, 26 Aug 2015 17:39:24 GMT Received: from d06av01.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av01.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id t7QHdCww016180 for ; Wed, 26 Aug 2015 11:39:12 -0600 Received: from oc7340732750.ibm.com (dyn-9-152-213-24.boeblingen.de.ibm.com [9.152.213.24]) by d06av01.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id t7QHdCkR016065; Wed, 26 Aug 2015 11:39:12 -0600 Received: by oc7340732750.ibm.com (Postfix, from userid 500) id 3ADD439FA; Wed, 26 Aug 2015 19:39:03 +0200 (CEST) Subject: Cell multi-arch broken (Re: [PATCH 2/2] GNU/Linux: Stop using libthread_db/td_ta_thr_iter) To: palves@redhat.com (Pedro Alves) Date: Wed, 26 Aug 2015 19:39:03 +0200 (CEST) From: "Ulrich Weigand" Cc: gdb-patches@sourceware.org In-Reply-To: <1423422659-27559-3-git-send-email-palves@redhat.com> from "Pedro Alves" at Feb 08, 2015 07:10:59 PM MIME-Version: 1.0 Message-Id: <20150826173903.3ADD439FA@oc7340732750.ibm.com> X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 15082617-0025-0000-0000-0000069B610D Pedro Alves wrote: > gdb/ChangeLog: > 2015-02-08 Pedro Alves > @@ -1719,6 +1696,9 @@ find_new_threads_once (struct thread_db_info *info, int iteration, > data.info = info; > data.new_threads = 0; > > + /* See comment in thread_db_update_thread_list. */ > + gdb_assert (!target_has_execution || thread_db_use_events ()); > + Now that I've had the occasion to run some tests on Cell/B.E. again, I've tried to verify combined multi-arch debugging still works, but noticed that it is currently completely broken; GDB will immediately run into the assertion you've added above. In fact, it is so broken that the test suite assumes we're not even on a Cell/B.E. (since it can't debug the trivial test program), and silently skips all Cell tests, so I didn't notice in the daily build reports ... The reason why we're running into the abort is that the multi-arch debugging logic attempts to resolve a thread-local variable from inside the frame unwinders (which is probably not done elsewhere). This uncovers a code path where the above assertion is wrong: In thread_db_get_thread_local_address, we have: /* If we have not discovered any threads yet, check now. */ if (!have_threads (ptid)) thread_db_find_new_threads_1 (ptid); Now, note that thread_db_get_thread_local_address is one of the few remaining routines that always uses the thread DB, even if we do not use thread events. However, thread_db_find_new_threads_1 now assumes it gets only ever called when using thread events, which ultimately leads to the assert. As a quick fix, the patch appended below makes it work again; but this may be a bit overkill since thread_db_update_thread_list no longer realized that we're only interested in process ptid, and updates all inferiors. (Maybe the to_update_thread_list target callback should get a ptid argument?) Any suggestions on how best to fix this? Bye, Ulrich P.S. With this fix, the Cell multi-arch tests now run again. As probably to be expected, this uncovers a series of other problems where code has bit-rotten in the meantime. I'll have other patches to fix this again ... Index: binutils-gdb/gdb/linux-thread-db.c =================================================================== --- binutils-gdb.orig/gdb/linux-thread-db.c +++ binutils-gdb/gdb/linux-thread-db.c @@ -1853,7 +1853,7 @@ thread_db_get_thread_local_address (stru /* If we have not discovered any threads yet, check now. */ if (!have_threads (ptid)) - thread_db_find_new_threads_1 (ptid); + thread_db_update_thread_list (ops); /* Find the matching thread. */ thread_info = find_thread_ptid (ptid);