public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH v3] gdb: Do not add const sections to the section map
@ 2022-06-01 12:08 Ilya Leoshkevich
  2022-06-01 14:17 ` Pedro Alves
  0 siblings, 1 reply; 2+ messages in thread
From: Ilya Leoshkevich @ 2022-06-01 12:08 UTC (permalink / raw)
  To: Tom Tromey, Andrew Burgess
  Cc: Ulrich Weigand, Andreas Arnez, Pedro Alves, gdb-patches,
	Ilya Leoshkevich

From: Ulrich Weigand <ulrich.weigand@de.ibm.com>

build_objfile_section_table() creates four synthetic sections per
objfile, which are collected by update_section_map() and passed to
std::sort().  When there are a lot of objfiles, for example, when
debugging JITs, the presence of these sections slows down the sorting
significantly.

The output of update_section_map() is used by find_pc_section(), which
can never return any of these sections: their size is 0, so they cannot
be accepted by bsearch_cmp().

Filter them out in insert_section_p(), which is used only by
update_section_map().
---
 gdb/objfiles.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/gdb/objfiles.c b/gdb/objfiles.c
index 60d8aa5cb78..8db28a946f9 100644
--- a/gdb/objfiles.c
+++ b/gdb/objfiles.c
@@ -986,7 +986,8 @@ preferred_obj_section (struct obj_section *a, struct obj_section *b)
 }
 
 /* Return 1 if SECTION should be inserted into the section map.
-   We want to insert only non-overlay and non-TLS section.  */
+   We want to insert only non-overlay and non-TLS/ABS/UND/IND/COM
+   sections.  */
 
 static int
 insert_section_p (const struct bfd *abfd,
@@ -1003,6 +1004,11 @@ 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.3


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

* Re: [PATCH v3] gdb: Do not add const sections to the section map
  2022-06-01 12:08 [PATCH v3] gdb: Do not add const sections to the section map Ilya Leoshkevich
@ 2022-06-01 14:17 ` Pedro Alves
  0 siblings, 0 replies; 2+ messages in thread
From: Pedro Alves @ 2022-06-01 14:17 UTC (permalink / raw)
  To: Ilya Leoshkevich, Tom Tromey, Andrew Burgess
  Cc: Ulrich Weigand, Andreas Arnez, gdb-patches

On 2022-06-01 13:08, Ilya Leoshkevich wrote:
> can never return any of these sections: their size is 0, so they cannot
> be accepted by bsearch_cmp().

Would it make sense to make insert_section_p skip any section with size=0
instead, then?

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

end of thread, other threads:[~2022-06-01 14:17 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-01 12:08 [PATCH v3] gdb: Do not add const sections to the section map Ilya Leoshkevich
2022-06-01 14:17 ` Pedro Alves

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).