From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 75783 invoked by alias); 19 May 2016 14:48:21 -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 75756 invoked by uid 89); 19 May 2016 14:48:21 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.3 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=expense, freeze, racy, thousands X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Thu, 19 May 2016 14:48:18 +0000 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 39F6D5CF for ; Thu, 19 May 2016 14:48:12 +0000 (UTC) Received: from cascais.lan (ovpn01.gateway.prod.ext.ams2.redhat.com [10.39.146.11]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u4JEmBLn009731 for ; Thu, 19 May 2016 10:48:11 -0400 From: Pedro Alves To: gdb-patches@sourceware.org Subject: [PATCH 0/6] Fix PR gdb/19828 (attach -> internal error) and attach optimizations Date: Thu, 19 May 2016 14:48:00 -0000 Message-Id: <1463669290-30415-1-git-send-email-palves@redhat.com> X-SW-Source: 2016-05/txt/msg00328.txt.bz2 The goal of this series is fix PR gdb/19828. In this series, I put the fix for PR gdb/19828 last, but it actually fixes the bug on its own. However, that fix makes GDB add LWPs to the thread list sooner and that ends up changing code paths in the attach sequence and exposing inneficiencies that in turn result in gdb.threads/attach-many-short-lived-threads.exp timing out almost always on my machine... So the first four patches of the series are about preemptively fixing those time outs. To make it easier to debug these inneficiencies, I applied patch #6 first, and then amplified the problem by hacking the gdb.threads/attach-many-short-lived-threads.exp test program to spawn thousands (2k-10k) of threads instead of dozens. Then I simply ran the program in one terminal, and had gdb attach to it from another terminal. Without the other fixes, GDB would just never manage to finish attaching to all LWPs. With the fixes, GDB takes a few seconds to fully attach. So I suspect that this series ends up fixing the gdb.threads/attach-many-short-lived-threads.exp racy timeouts seen on some of the (probably slower) build slaves of our buildbot setup. I have some other ideas to try as follow up, that I'll likely end up exploring at some point, but I'll stop here for now. (E.g., try group-stopping the process with SIGSTOP to have the kernel freeze the whole thread group, though I think it may turn ugly and I kind of dislike it as we should instead be moving in the direction of PTRACE_SEIZE / PTRACE_INTERRUPT.) Fedora 23 is carrying a simpler GDB fix for PR gdb/19828 that avoids all these optimizations, but at the expense of leaving "attach&" (background attach) still broken. That might be safer to put in 7.11.1, but then again I dislike the idea of leaving attach& broken. I'll find and post that patch for you all to see what I mean. Pedro Alves (6): Linux native thread create/exit events support [Linux] Read vDSO range from /proc/PID/task/PID/maps instead of /proc/PID/maps [Linux] Avoid refetching core-of-thread if thread hasn't run [Linux] Optimize PID -> struct lwp_info lookup Make gdb/linux-nat.c consider a waitstatus pending on the infrun side Fix PR gdb/19828: gdb -p : internal error gdb/linux-nat.c | 241 ++++++++++++++++++---- gdb/linux-nat.h | 4 +- gdb/linux-tdep.c | 77 ++++--- gdb/linux-thread-db.c | 14 +- gdb/testsuite/gdb.threads/clone-attach-detach.c | 66 ++++++ gdb/testsuite/gdb.threads/clone-attach-detach.exp | 98 +++++++++ 6 files changed, 428 insertions(+), 72 deletions(-) create mode 100644 gdb/testsuite/gdb.threads/clone-attach-detach.c create mode 100644 gdb/testsuite/gdb.threads/clone-attach-detach.exp -- 2.5.5