From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23028 invoked by alias); 5 Oct 2004 14:03:00 -0000 Mailing-List: contact gdb-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sources.redhat.com Received: (qmail 22315 invoked from network); 5 Oct 2004 14:02:51 -0000 Received: from unknown (HELO mx1.redhat.com) (66.187.233.31) by sourceware.org with SMTP; 5 Oct 2004 14:02:51 -0000 Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by mx1.redhat.com (8.12.11/8.12.10) with ESMTP id i95E2fYx015391 for ; Tue, 5 Oct 2004 10:02:46 -0400 Received: from localhost.redhat.com (porkchop.devel.redhat.com [172.16.58.2]) by int-mx1.corp.redhat.com (8.11.6/8.11.6) with ESMTP id i95E2Sr26300; Tue, 5 Oct 2004 10:02:29 -0400 Received: from gnu.org (localhost [127.0.0.1]) by localhost.redhat.com (Postfix) with ESMTP id 002CC28D2; Tue, 5 Oct 2004 10:02:14 -0400 (EDT) Message-ID: <4162A966.8050005@gnu.org> Date: Tue, 05 Oct 2004 14:05:00 -0000 From: Andrew Cagney User-Agent: Mozilla/5.0 (X11; U; NetBSD macppc; en-GB; rv:1.4.1) Gecko/20040831 MIME-Version: 1.0 To: Daniel Jacobowitz , Nick Savoiu Cc: gdb@sources.redhat.com Subject: Re: Debugging a large program References: <043c01c4aa53$01e419b0$5a02a8c0@rio> <20041004204942.GB8508@nevyn.them.org> In-Reply-To: <20041004204942.GB8508@nevyn.them.org> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-SW-Source: 2004-10/txt/msg00088.txt.bz2 > On Mon, Oct 04, 2004 at 01:44:55PM -0700, Nick Savoiu wrote: > >>> Hi, >>> >>> I'm using GDB to debug a rather large program and I'm running into memory >>> usage problems that slow down debugging considerably. Just invoking GDB on >>> the executable (without issuing 'run') results in GDB using up 450MB of >>> memory. >>> >>> I think that this is caused by GDB reading in all the symbol info. However, >>> the code that I'm debugging uses but a small fraction of the code that's >>> present in the program. Can I somehow tell GDB to only load the symbols it >>> needs? Tell me about it :-) > GDB already reads in only what it needs, and more lazily - however, > there's some information about every symbol that's needed. 450MB is > pretty remarkable; how big is the application? readelf -S output would > be the best way to answer the question. This, unfortunatly, isn't true. The "classic" user interaction: gdb ... run backtrace print variable involves very few symbols and addresses yet GDB is slurping all the following: - entire minsymtab - O() at least - simplified symtab a.k.a. partial-symtab - O() at least and then when the first symbol request occures: - full symtab - O() at least - address information - O() (or is this done above?) GDB needs to find ways to achieve (assuming co-operation from GCC and BFD) an initial: - process symtab sections (for address ranges) - O() and then when a symbol is requested: - lookup symbol - O(log ()) * O() for first time (better?); O(1) for re-searches Doing this means abandoning the psymtab and instead having symbol code directly read each symbol or address as it is needed, and with the minimum auxulary information (i.e., direct from disk). The first time I made this observation, the response was "impossible", the second time "hard". I guess I'm making progress :-) Andrew