public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Ilya Leoshkevich <iii@linux.ibm.com>
To: Tom Tromey <tromey@adacore.com>
Cc: Ulrich Weigand <ulrich.weigand@de.ibm.com>,
	Andreas Arnez <arnez@linux.ibm.com>,
	binutils@sourceware.org
Subject: Re: [PATCH] gdb: do not add const sections to the section map
Date: Thu, 19 May 2022 19:37:03 +0200	[thread overview]
Message-ID: <f3670a73b6d55e98ac713898083333489df4af4f.camel@linux.ibm.com> (raw)
In-Reply-To: <875ym1d0dw.fsf@tromey.com>

On Thu, 2022-05-19 at 09:10 -0600, Tom Tromey wrote:
> > > > > > Ilya Leoshkevich <iii@linux.ibm.com> writes:
> 
> > From: Ulrich Weigand <ulrich.weigand@de.ibm.com>
> > build_objfile_section_table () creates four synthetic sections,
> > which
> > significantly slow down section map sorting.  This is especially
> > noticeable when debugging JITs that report a lot of objfiles. 
> > Since
> > these sections are not useful for find_pc_section (), do not add
> > them
> > to the section map.
> 
> How does it slow down the sorting?

CoreCLR JIT reports each compiled function as a separate objfile with
a single .text section and a few debug sections [1].  Once you have a
few thousand of them - which is easily reachable - std::sort becomes a
bottleneck.  Ignoring synthetic sections from each objfile reduces the
amount of sections to sort significantly.

That's unfortunately not quite enough to debug bigger apps.  But it's
still a noticeable improvement, so I've decided to post it.

I'm currently trying to implement a more complex optimization in the
section map area ([2] - not working yet, and probably not reviewable
either, just FYI).

> It seems a little strange at least to drop the *ABS* section, since
> IIUC
> that's for symbols that specify some kind of absolute address. 
> Couldn't
> these matter for lookup purposes?  It's probable I don't really know
> what's going on here...

All four seem to have a size of 0, so they should never be returned
by find_pc_section ().

> I wonder if we can drop all support for all these sections from gdb.

They were added in 65cf35635977, which introduced
gdb_bfd_section_index ().  This function is used in quite a few places,
so I guess as long as bfd can report these sections, this should stay?

> Tom

[1]
https://github.com/dotnet/runtime/blob/v6.0.5/src/coreclr/vm/gdbjit.cpp#L2147
[2]
https://github.com/iii-i/binutils-gdb/releases/tag/section-map-20220519

      reply	other threads:[~2022-05-19 17:37 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-16 19:42 Ilya Leoshkevich
2022-05-17 14:52 ` Andrew Burgess
2022-05-19 15:10 ` Tom Tromey
2022-05-19 17:37   ` Ilya Leoshkevich [this message]

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=f3670a73b6d55e98ac713898083333489df4af4f.camel@linux.ibm.com \
    --to=iii@linux.ibm.com \
    --cc=arnez@linux.ibm.com \
    --cc=binutils@sourceware.org \
    --cc=tromey@adacore.com \
    --cc=ulrich.weigand@de.ibm.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).