public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug symtab/16998] New: perf improvements for searching GLOBAL_BLOCK
@ 2014-05-29 19:49 dje at google dot com
  2014-05-29 20:37 ` [Bug symtab/16998] " dje at google dot com
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: dje at google dot com @ 2014-05-29 19:49 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=16998

            Bug ID: 16998
           Summary: perf improvements for searching GLOBAL_BLOCK
           Product: gdb
           Version: HEAD
            Status: NEW
          Severity: normal
          Priority: P2
         Component: symtab
          Assignee: unassigned at sourceware dot org
          Reporter: dje at google dot com

This pr is a corollary to pr 16994, and is for improving searching
GLOBAL_BLOCK.
[I'm trying to break down the entirety of gdb symbol problems into pieces -
there's just so many of them it's easier for me to keep track of them this way.
Still need one more bit of information to tie them together: I was thinking of
adding a "gdb-performance" "keyword".]

When .gdb_index was added, it was added in a way to let it easily sit along
side the psymtab implementation.  Which is totally reasonable as a first pass.

However, there is, I think, a performance cost.
The way gdb looks up global symbols (static ones too, but this bug is about
global symbols), is that it first searches already expanded symtabs and only if
not found there does gdb try the "quick_symbol_functions" API.

E.g.,

static int
lookup_symbol_global_iterator_cb (struct objfile *objfile,
                                  void *cb_data)
{
  struct global_sym_lookup_data *data =
    (struct global_sym_lookup_data *) cb_data;

  gdb_assert (data->result == NULL);

=>data->result = lookup_symbol_aux_objfile (objfile, GLOBAL_BLOCK,
                                            data->name, data->domain);
  if (data->result == NULL)
    data->result = lookup_symbol_aux_quick (objfile, GLOBAL_BLOCK,
                                            data->name, data->domain);

  /* If we found a match, tell the iterator to stop.  Otherwise,                
     keep going.  */
  return (data->result != NULL);
}

lookup_symbol_aux_objfile does this:

  ALL_OBJFILE_PRIMARY_SYMTABS (objfile, s)
    {
      bv = BLOCKVECTOR (s);
      block = BLOCKVECTOR_BLOCK (bv, block_index);
=>    sym = lookup_block_symbol (block, name, domain);
      if (sym)
        {
          block_found = block;
          return fixup_symbol_section (sym, objfile);
        }
    }

Over time symtabs get expanded, so the list to iterate over here grows.
But .gdb_index knows exactly which symtab(s) to look in.
[for global symbols there is only one, hence the "(s)" suffix is a bit of a
misnomer, but I'm leaving that aside for now]
So why not just always use .gdb_index for GLOBAL_BLOCK lookups?
[That's an honest question, maybe I'm missing something.
Still digging.]

-- 
You are receiving this mail because:
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug symtab/16998] perf improvements for searching GLOBAL_BLOCK
  2014-05-29 19:49 [Bug symtab/16998] New: perf improvements for searching GLOBAL_BLOCK dje at google dot com
@ 2014-05-29 20:37 ` dje at google dot com
  2014-05-30  2:26 ` dje at google dot com
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: dje at google dot com @ 2014-05-29 20:37 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=16998

dje at google dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |performance

-- 
You are receiving this mail because:
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug symtab/16998] perf improvements for searching GLOBAL_BLOCK
  2014-05-29 19:49 [Bug symtab/16998] New: perf improvements for searching GLOBAL_BLOCK dje at google dot com
  2014-05-29 20:37 ` [Bug symtab/16998] " dje at google dot com
@ 2014-05-30  2:26 ` dje at google dot com
  2023-02-11 17:04 ` tromey at sourceware dot org
  2023-09-18  8:06 ` tromey at sourceware dot org
  3 siblings, 0 replies; 5+ messages in thread
From: dje at google dot com @ 2014-05-30  2:26 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=16998

--- Comment #1 from dje at google dot com ---
I haven't looked into the details, but I wanted to write this down while it's
on my mind.  Iterating over symtabs hurts the non - .gdb_index (psymtabs) case
too.
While we're slurping in psyms, can we build enough of a .gdb_index work-alike
so that both the .gdb_index and psymtab cases can still use the same basic
algorithm for symbol lookup (look in index for list of symtabs to search in).

-- 
You are receiving this mail because:
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug symtab/16998] perf improvements for searching GLOBAL_BLOCK
  2014-05-29 19:49 [Bug symtab/16998] New: perf improvements for searching GLOBAL_BLOCK dje at google dot com
  2014-05-29 20:37 ` [Bug symtab/16998] " dje at google dot com
  2014-05-30  2:26 ` dje at google dot com
@ 2023-02-11 17:04 ` tromey at sourceware dot org
  2023-09-18  8:06 ` tromey at sourceware dot org
  3 siblings, 0 replies; 5+ messages in thread
From: tromey at sourceware dot org @ 2023-02-11 17:04 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=16998

Tom Tromey <tromey at sourceware dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |tromey at sourceware dot org

--- Comment #2 from Tom Tromey <tromey at sourceware dot org> ---
> But .gdb_index knows exactly which symtab(s) to look in.
...
> So why not just always use .gdb_index for GLOBAL_BLOCK lookups?

It makes sense to me.
Basically we'd want to extend the "quick" functionality
to some symtab-level operations as well, or maybe just
change the lookup code and ensure that the quick methods
also know to iterate over already-expanded symtabs.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug symtab/16998] perf improvements for searching GLOBAL_BLOCK
  2014-05-29 19:49 [Bug symtab/16998] New: perf improvements for searching GLOBAL_BLOCK dje at google dot com
                   ` (2 preceding siblings ...)
  2023-02-11 17:04 ` tromey at sourceware dot org
@ 2023-09-18  8:06 ` tromey at sourceware dot org
  3 siblings, 0 replies; 5+ messages in thread
From: tromey at sourceware dot org @ 2023-09-18  8:06 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=16998

--- Comment #3 from Tom Tromey <tromey at sourceware dot org> ---
One subtlety here is that now that we have readnow_functions,
there is a situation where there really is no index.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-09-18  8:06 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-05-29 19:49 [Bug symtab/16998] New: perf improvements for searching GLOBAL_BLOCK dje at google dot com
2014-05-29 20:37 ` [Bug symtab/16998] " dje at google dot com
2014-05-30  2:26 ` dje at google dot com
2023-02-11 17:04 ` tromey at sourceware dot org
2023-09-18  8:06 ` tromey at sourceware dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).