public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Tom Tromey <tromey@adacore.com>
To: Pedro Alves <pedro@palves.net>
Cc: Tom Tromey <tromey@adacore.com>,  gdb-patches@sourceware.org
Subject: Re: [PATCH] Fix method naming bug in new DWARF indexer
Date: Fri, 29 Apr 2022 13:47:52 -0600	[thread overview]
Message-ID: <87a6c3llhz.fsf@tromey.com> (raw)
In-Reply-To: <5ec4d8e1-9c16-c73a-ec8b-7802b498ba9b@palves.net> (Pedro Alves's message of "Tue, 26 Apr 2022 19:40:22 +0100")

Pedro> Hmm, it actually fixes most of the performance for me.  With that
Pedro> new patch (and I guess the linkage names patch made a difference
Pedro> too), I see roughly the same startup time in new gdb vs old gdb
Pedro> when using the same index, and either an index generated by old
Pedro> gdb, or by new gdb.

I'm going to check it in.

Pedro>  [369902] intrusive_list<inferior, intrusive_base_node<inferior> >::begin:
Pedro>           9 [global, function]
Pedro>           255 [global, function]
Pedro> while in the new indexer, for the same function, we have:
[...]

Pedro> What was the logic that the old writer used to come up with the
Pedro> seemingly right number of function entries?

It looks like the old reader checked the value of DW_AT_inline:

-      if (pdi->has_pc_info || pdi->has_range_info
-	  || (!pdi->is_external && pdi->may_be_inlined))
-	{
-	  if (!pdi->is_declaration)
-	    /* Ignore subprogram DIEs that do not have a name, they are
-	       illegal.  Do not emit a complaint at this point, we will
-	       do so when we convert this psymtab into a symtab.  */
-	    if (pdi->name (cu))
-	      add_partial_symbol (pdi, cu);
-	}

and

-	case DW_AT_inline:
-	  {
-	    LONGEST value = attr.constant_value (-1);
-	    if (value == DW_INL_inlined
-		|| value == DW_INL_declared_inlined)
-	      may_be_inlined = 1;
-	  }
-	  break;

Pedro> For the time being, I'll continue using indexes, because as soon
Pedro> as you need to run to a breakpoint from the command line, which I
Pedro> do all the time, then having an index still beats the new
Pedro> scanner.

Yeah :(

What happens here is that gdb does the finalization step in the
background.  Interactively, this helps make it seem faster.  However,
it's not really faster, it is just deferring some work.

You can see it with an invocation like:

   gdb -q -batch -iex 'set debug timestamp 1' -iex 'set debug dwarf-read 1' -ex start ./gdb

Here for gdb-with-an-index I see:

    0.820423 [dwarf-read] dwarf2_initialize_objfile: found gdb index from file
    1.699175 [dwarf-read] process_queue: Expanding one or more symtabs of objfile /tmp/gdb.idx ...

But for ordinary gdb:

    1.310033 [dwarf-read] dwarf2_build_psymtabs_hard: Done building psymtabs of /tmp/gdb
    4.666649 [dwarf-read] process_queue: Expanding one or more symtabs of objfile /tmp/gdb ...

This is disappointing of course.  It might be possible to reduce this
time at the cost of a bit more complexity in the lookup code and perhaps
a bit more memory use.  For example, right now finalization merges the
results from all the readers into a single entry table -- but maybe the
table could remain sharded instead.  Another possibility might be to do
the work in worker threads and, instead of sharding the result, pre-sort
the vectors and use a sorted merge operation to combine them.

I'll file some bugs about these things.
I'm starting to lose track of what I still need to fix up.

Tom

  reply	other threads:[~2022-04-29 19:47 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-21 16:38 Tom Tromey
2022-04-22 12:19 ` Pedro Alves
2022-04-22 12:41   ` Tom Tromey
2022-04-25 18:27   ` Tom Tromey
2022-04-26 18:40     ` Pedro Alves
2022-04-29 19:47       ` Tom Tromey [this message]
2022-05-02 14:18         ` Pedro Alves

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=87a6c3llhz.fsf@tromey.com \
    --to=tromey@adacore.com \
    --cc=gdb-patches@sourceware.org \
    --cc=pedro@palves.net \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).