From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19049 invoked by alias); 14 Jun 2010 18:22:12 -0000 Received: (qmail 19026 invoked by uid 22791); 14 Jun 2010 18:22:10 -0000 X-SWARE-Spam-Status: No, hits=-4.5 required=5.0 tests=AWL,BAYES_50,RCVD_IN_DNSWL_HI,SPF_HELO_PASS,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 14 Jun 2010 18:22:02 +0000 Received: from int-mx05.intmail.prod.int.phx2.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.18]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o5EIM0UT008861 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 14 Jun 2010 14:22:00 -0400 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx05.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o5EILxMZ030660; Mon, 14 Jun 2010 14:22:00 -0400 Received: from opsy.redhat.com (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id o5EILxe5000650; Mon, 14 Jun 2010 14:21:59 -0400 Received: by opsy.redhat.com (Postfix, from userid 500) id DBC30378504; Mon, 14 Jun 2010 12:21:58 -0600 (MDT) From: Tom Tromey To: gdb-patches@sourceware.org Subject: [0/7] RFC: read DWARF psymtabs in the background Reply-To: Tom Tromey Date: Mon, 14 Jun 2010 18:22:00 -0000 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii 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-06/txt/msg00316.txt.bz2 This is a patch series to implement reading psymtabs for DWARF in the background. The motivation for this is a better user experience. With this series, gdb starts up dramatically faster, because we can hide much of the reading in the background: gdb -batch -nx ./gdb Without: 2.37user 0.45system 0:03.47elapsed With: 0.23user 0.04system 0:00.34elapsed This example measures time-to-the-prompt. Once at the prompt, if you do some operation needing psymtabs, gdb will wait until they have been read in. It also works when attaching to a program with a lot of objfiles. Here is startup for attach to OO.o Writer: gdb -batch -p NNNN Without: 40.44user 2.19system 1:36.94elapsed With: 2.20user 0.24system 0:04.32elapsed It is not dramatically better in all cases: gdb -batch -ex "thread apply all bt full" -p NNN Without: 44.31user 2.31system 1:39.16elapsed With: 46.01user 2.88system 1:21.92elapsed In this case we end up waiting for most of the debuginfo to be read. I have some other changes, coming later, that help with this. All the code is written so that threads are optional. On platforms without threads, everything works as before, albeit in a somewhat more convoluted way. There are still some unpolished edges in this series. I will try to call these out in the specific patches. As you might imagine it is rather tough to be certain that this code is truly thread-safe. GDB has plenty of hidden global variables, shared state, etc. I'll explain my approach to making this as safe as I could in the appropriate patches. Note that the patches probably don't build independently. I didn't really try that; I just split them up along conceptual lines. I realize that threads are unpopular in many quarters, so this is an RFC. I think I regtested this, but it is hard to recall. Anyway it doesn't matter -- I will do that when I fix the little problems that remain. Tom