Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Tom Tromey <tom@tromey.com>
To: "Hannes Domani via gdb" <gdb@sourceware.org>
Cc: Hannes Domani <ssbssa@yahoo.de>
Subject: Re: question about expand_symtabs_matching()
Date: Wed, 27 Feb 2019 21:26:00 -0000	[thread overview]
Message-ID: <87fts82aay.fsf@tromey.com> (raw)
In-Reply-To: <948301287.10289911.1551297622910@mail.yahoo.com> (Hannes Domani	via gdb's message of "Wed, 27 Feb 2019 20:00:22 +0000 (UTC)")

Hannes> This is probably a stupid question.

Not at all.

Hannes> In gdb/linespec.c:1146 is this call:
Hannes>       if (objfile->sf)
Hannes>         objfile->sf->qf->expand_symtabs_matching (objfile,
Hannes>                                                   NULL,
Hannes>                                                   lookup_name,
Hannes>                                                   NULL, NULL,
Hannes>                                                   search_domain);
Hannes> What exactly is this call doing, since none of the 3 callback functions is used?

gdb first scans debug symbols to create "partial symbol tables" (or in
some cases it uses the "gdb index").

These don't contain much information, so in order to actually do much
with the symbols, the relevant psymtabs must be expanded into full
symbol tables.

This call is expanding all the partial symbol tables that match
lookup_name and search_domain.  The loop that comes after this actually
does the work of the function, by looking only at expanded symbol
tables.

Hannes> This is slowing gdb down quite a lot if you have pending breakpoints, and are 
Hannes> loading/unloading many shared libraries.

Yeah.  gdb does too much work when re-evaluating breakpoint locations.

For example, it seems to me that when re-evaluating a breakpoint
location, there's no reason to search an objfile again -- the results
can't have changed.  There are various ways this could be tackled but I
suppose the basic idea is to cache the results somewhere.

Hannes> When I removed it, I couldn't see any different behavior (other than being faster).

I think it would make a difference if the inferior dlopen()d a library
and the library had a new location for an existing breakpoint.

Tom

  reply	other threads:[~2019-02-27 21:26 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <948301287.10289911.1551297622910.ref@mail.yahoo.com>
2019-02-27 20:02 ` Hannes Domani via gdb
2019-02-27 21:26   ` Tom Tromey [this message]
     [not found] <183519794.10360727.1551304006549.ref@mail.yahoo.com>
     [not found] ` <183519794.10360727.1551304006549@mail.yahoo.com>
2019-02-27 23:55   ` Tom Tromey
2019-02-28 11:32     ` Hannes Domani via gdb
2019-03-01 18:30       ` Tom Tromey
2019-03-01 18:51         ` Hannes Domani via gdb
2019-03-08 21:13           ` 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=87fts82aay.fsf@tromey.com \
    --to=tom@tromey.com \
    --cc=gdb@sourceware.org \
    --cc=ssbssa@yahoo.de \
    /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