Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Andrew Cagney <cagney@gnu.org>
To: Daniel Jacobowitz <drow@false.org>, Nick Savoiu <savoiu@ics.uci.edu>
Cc: gdb@sources.redhat.com
Subject: Re: Debugging a large program
Date: Tue, 05 Oct 2004 14:05:00 -0000	[thread overview]
Message-ID: <4162A966.8050005@gnu.org> (raw)
In-Reply-To: <20041004204942.GB8508@nevyn.them.org>

> 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
	<segmentation fault>
	backtrace
	print variable
involves very few symbols and addresses yet GDB is slurping all the 
following:

- entire minsymtab - O(<nr minsyms>) at least

- simplified symtab a.k.a. partial-symtab - O(<nr syms>) at least

and then when the first symbol request occures:

- full symtab - O(<nr syms>) 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(<nr sections>)

and then when a symbol is requested:

- lookup symbol - O(log (<nr symbols>)) * O(<nr solibs>) 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



  reply	other threads:[~2004-10-05 14:03 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-10-04 20:48 Nick Savoiu
2004-10-04 20:54 ` Daniel Jacobowitz
2004-10-05 14:05   ` Andrew Cagney [this message]
2004-10-05 14:07     ` Daniel Jacobowitz
2004-10-04 21:15 Nick Savoiu
2004-10-04 21:16 ` Daniel Jacobowitz
2004-10-04 23:21   ` Daniel Jacobowitz
2004-10-04 23:25     ` Nick Savoiu
2004-10-05  5:24       ` Daniel Jacobowitz
2004-10-05 15:26         ` Nick Savoiu
     [not found] <F51E79B1-195C-11D9-ACAD-000A9569836A@gnu.org>
2004-10-08 21:35 ` Jason Molenda
2004-10-11  1:46   ` Daniel Berlin
2004-10-11  6:10     ` Andrew Cagney
2004-10-11 13:59   ` Andrew Cagney

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4162A966.8050005@gnu.org \
    --to=cagney@gnu.org \
    --cc=drow@false.org \
    --cc=gdb@sources.redhat.com \
    --cc=savoiu@ics.uci.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox