From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8284 invoked by alias); 4 Oct 2004 21:15:16 -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 8274 invoked from network); 4 Oct 2004 21:15:15 -0000 Received: from unknown (HELO nevyn.them.org) (66.93.172.17) by sourceware.org with SMTP; 4 Oct 2004 21:15:15 -0000 Received: from drow by nevyn.them.org with local (Exim 4.34 #1 (Debian)) id 1CEaAs-0004r2-NS; Mon, 04 Oct 2004 17:15:14 -0400 Date: Mon, 04 Oct 2004 21:16:00 -0000 From: Daniel Jacobowitz To: Nick Savoiu Cc: gdb@sources.redhat.com Subject: Re: Debugging a large program Message-ID: <20041004211514.GA16453@nevyn.them.org> Mail-Followup-To: Nick Savoiu , gdb@sources.redhat.com References: <044c01c4aa56$e5f7fb00$5a02a8c0@rio> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <044c01c4aa56$e5f7fb00$5a02a8c0@rio> User-Agent: Mutt/1.5.5.1+cvs20040105i X-SW-Source: 2004-10/txt/msg00064.txt.bz2 On Mon, Oct 04, 2004 at 02:12:46PM -0700, Nick Savoiu wrote: > >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? > > > >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. > > Here's what readelf -S says: > > There are 30 section headers, starting at offset 0x57ec: > > [12] .text PROGBITS 0804ad40 002d40 0000f0 00 AX 0 > 0 16 > [23] .stab PROGBITS 00000000 0034e4 0007a4 0c 24 > 0 4 > [24] .stabstr STRTAB 00000000 003c88 001983 00 0 > 0 1 This is an extremely small application. I guess this is the KDE-style everything-is-in-a-shared-library setup? > BTW, 405MB was for gdb running to main() not just what I said above :) There > probably are a few global variables but I don't think they should take up > too much space. That requires loading symbol information for all the shared libraries, which is probably what's taking all the space. 400MB+ is a bit unusual, but I don't know how big your libraries are. -- Daniel Jacobowitz