* [PATCH] gdb: do not add const sections to the section map
@ 2022-05-16 19:42 Ilya Leoshkevich
2022-05-17 14:52 ` Andrew Burgess
2022-05-19 15:10 ` Tom Tromey
0 siblings, 2 replies; 4+ messages in thread
From: Ilya Leoshkevich @ 2022-05-16 19:42 UTC (permalink / raw)
To: Tom Tromey; +Cc: Ulrich Weigand, Andreas Arnez, binutils, Ilya Leoshkevich
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.
---
gdb/objfiles.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/gdb/objfiles.c b/gdb/objfiles.c
index 80f68fda1c1..259c19584a6 100644
--- a/gdb/objfiles.c
+++ b/gdb/objfiles.c
@@ -1005,6 +1005,9 @@ insert_section_p (const struct bfd *abfd,
if ((bfd_section_flags (section) & SEC_THREAD_LOCAL) != 0)
/* This is a TLS section. */
return 0;
+ if (bfd_is_const_section (section))
+ /* This is one of the global *ABS*, *UND*, *IND*, or *COM* sections. */
+ return 0;
return 1;
}
--
2.35.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] gdb: do not add const sections to the section map
2022-05-16 19:42 [PATCH] gdb: do not add const sections to the section map Ilya Leoshkevich
@ 2022-05-17 14:52 ` Andrew Burgess
2022-05-19 15:10 ` Tom Tromey
1 sibling, 0 replies; 4+ messages in thread
From: Andrew Burgess @ 2022-05-17 14:52 UTC (permalink / raw)
To: Ilya Leoshkevich via Binutils, Tom Tromey
Cc: Ulrich Weigand, Andreas Arnez, binutils, Ilya Leoshkevich
Ilya Leoshkevich via Binutils <binutils@sourceware.org> writes:
Thanks for this. GDB patches need to be sent to
gdb-patches@sourceware.org for review.
> 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.
> ---
> gdb/objfiles.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/gdb/objfiles.c b/gdb/objfiles.c
> index 80f68fda1c1..259c19584a6 100644
> --- a/gdb/objfiles.c
> +++ b/gdb/objfiles.c
> @@ -1005,6 +1005,9 @@ insert_section_p (const struct bfd *abfd,
> if ((bfd_section_flags (section) & SEC_THREAD_LOCAL) != 0)
> /* This is a TLS section. */
> return 0;
> + if (bfd_is_const_section (section))
> + /* This is one of the global *ABS*, *UND*, *IND*, or *COM* sections. */
> + return 0;
You either need to a { ... } around the comment and the return, or move
the comment before the `if` here.
Thanks,
Andrew
>
> return 1;
> }
> --
> 2.35.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] gdb: do not add const sections to the section map
2022-05-16 19:42 [PATCH] gdb: do not add const sections to the section map Ilya Leoshkevich
2022-05-17 14:52 ` Andrew Burgess
@ 2022-05-19 15:10 ` Tom Tromey
2022-05-19 17:37 ` Ilya Leoshkevich
1 sibling, 1 reply; 4+ messages in thread
From: Tom Tromey @ 2022-05-19 15:10 UTC (permalink / raw)
To: Ilya Leoshkevich; +Cc: Tom Tromey, Ulrich Weigand, Andreas Arnez, binutils
>>>>> 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?
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...
I wonder if we can drop all support for all these sections from gdb.
Tom
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] gdb: do not add const sections to the section map
2022-05-19 15:10 ` Tom Tromey
@ 2022-05-19 17:37 ` Ilya Leoshkevich
0 siblings, 0 replies; 4+ messages in thread
From: Ilya Leoshkevich @ 2022-05-19 17:37 UTC (permalink / raw)
To: Tom Tromey; +Cc: Ulrich Weigand, Andreas Arnez, binutils
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
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-05-19 17:37 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-16 19:42 [PATCH] gdb: do not add const sections to the section map Ilya Leoshkevich
2022-05-17 14:52 ` Andrew Burgess
2022-05-19 15:10 ` Tom Tromey
2022-05-19 17:37 ` Ilya Leoshkevich
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).