Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom de Vries <tdevries@suse.de>
To: Tom Tromey <tom@tromey.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [RFC][gdb/symtab] Lazy expansion of full symbol table
Date: Tue, 15 Jun 2021 01:36:49 +0200	[thread overview]
Message-ID: <533bf7e4-d96c-a6b7-8c37-a4141ebdc761@suse.de> (raw)
In-Reply-To: <87pmwoxj3j.fsf@tromey.com>

On 6/14/21 10:54 PM, Tom Tromey wrote:
>>>>>> "Tom" == Tom de Vries <tdevries@suse.de> writes:
> 
> Tom> [ I'm not posting the experimental patch series as such for now.  Available
> Tom> here ( https://github.com/vries/gdb/commits/lazy-full-symtab ). ]
> 
> Tom> In PR23710, the stated problem is that gdb is slow and memory hungry when
> Tom> consuming debug information generated by GCC with LTO.
> 
> Tom> | Minimal symbols | 0.18           |
> Tom> | Partial symbols | 2.34           |
> Tom> | Full symbols    | 3.34           |
> 
> I don't have this executable

Uploaded to https://ftp.suse.com/pub/people/tdevries/gdb/pr23710/cc1

> but FWIW my scanner rewrite is ~10x faster
> than the current psymtab reader.
> 

Interesting, that's
https://github.com/tromey/gdb/commits/submit/no-more-psym ?

I've tried that branch with the cc1 example, and ran into:
...
DW_FORM_strp pointing outside of .debug_str section [in module cc1]
...

> Tom> A way to fix this is to do processing of the full symbols in a lazy fashion.
> 
> Tom> This patch series implements a first attempt at this, for now intended not to
> Tom> be functionally correct, but to assess the kind of performance improvement we
> Tom> get from this.
> 
> Tom> With current trunk (commit 987610f2d68), we get 3.44, instead of the 6.44
> Tom> without this patch series.
> 
> That's about in line with the preliminary results I saw as well.
> You can see that branch at tromey/lazily-read-function-bodies, but it's
> probably unusable since I last rebased it in 2017.
> 

Ack, thanks for the pointer.

> Tom> The problem is that we need a way to do this gradually instead:
> Tom> - expand a few symbols
> Tom> - get the correspoding symbol table
> Tom> - expand a few more symbols
> Tom> - get the updated symbol table contain all expanded symbols
> 
> Tom> I'm not sure what is the smartest way to do that.
> 
> Tom> My current idea is to try to keep the builder around rather than destroy it,
> Tom> and have it generate an updated symbol table each time.
> 
> Tom> Is this a good idea?
> 
> Tom> Any other comments?
> 
> I think it's a good idea to do something.  Historically I didn't look
> into speeding up CU expansion on the theory that it didn't really matter
> -- most CUs are small -- but LTO upends that.
> 
> I never finished the earlier patch that I referenced, but the idea there
> was to skip function bodies when reading a CU.  Then, the functions
> could be fully read when needed.  I got this to work for by-name
> lookups, but I never finished the part where a by-address lookup would
> resize the blockvector, etc.
> 
> This approach could be extended to also not read type bodies until
> needed.  This could work by inflating the type during check_typedef.
> This can be a little dangerous because we do miss these calls from time
> to time; but maybe nearly as good would be to only lazily read
> "complicated" types, and use the accessor methods on those types to
> ensure they are inflated properly.
> 
> 
> Another deeper approach would be to abstract away symtabs (and I guess
> the blockvector) the way that we did for psymtabs: hide the details
> behind the "quick" methods and let each debug reader decide for itself
> how to store and look up symbols.  This is probably more work, but would
> allow even more laziness.  For example with the new indexer the symbols
> could simply hang off the entries in the index.
> 

OK, I'll try to take a look at the branch and digest your comments.

Thanks,
- Tom


  reply	other threads:[~2021-06-14 23:37 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-14  9:39 Tom de Vries
2021-06-14 20:54 ` Tom Tromey
2021-06-14 23:36   ` Tom de Vries [this message]
2021-06-15 13:26     ` Tom Tromey
2021-06-16 10:20       ` Tom de Vries
2021-06-18  2:30         ` Tom Tromey
2021-06-19 19:36           ` Tom de Vries
2021-06-20  9:41             ` Tom de Vries
2021-06-20 18:17               ` Tom Tromey
2021-06-22  9:16                 ` Tom de Vries
2021-06-20 23:44             ` Tom Tromey
2021-06-21  9:18               ` Tom de Vries
2021-06-27 22:24                 ` Tom Tromey
2021-06-28  0:48               ` Tom Tromey

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=533bf7e4-d96c-a6b7-8c37-a4141ebdc761@suse.de \
    --to=tdevries@suse.de \
    --cc=gdb-patches@sourceware.org \
    --cc=tom@tromey.com \
    /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