public inbox for gdb-cvs@sourceware.org help / color / mirror / Atom feed
From: Ilya Leoshkevich <iii@sourceware.org> To: gdb-cvs@sourceware.org Subject: [binutils-gdb] gdb: Do not add empty sections to the section map Date: Thu, 2 Jun 2022 12:21:42 +0000 (GMT) [thread overview] Message-ID: <20220602122142.C9EC13857346@sourceware.org> (raw) https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=625b6eae091709b95471eae92d42dc6bc71e6553 commit 625b6eae091709b95471eae92d42dc6bc71e6553 Author: Ilya Leoshkevich <iii@linux.ibm.com> Date: Wed Jun 1 14:04:10 2022 +0200 gdb: Do not add empty sections to the section map 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 (and all the other empty sections) out in insert_section_p (), which is used only by update_section_map (). Diff: --- gdb/objfiles.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/gdb/objfiles.c b/gdb/objfiles.c index 60d8aa5cb78..4fc859f185a 100644 --- a/gdb/objfiles.c +++ b/gdb/objfiles.c @@ -986,7 +986,7 @@ 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 non-TLS non-empty sections. */ static int insert_section_p (const struct bfd *abfd, @@ -1003,6 +1003,12 @@ 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_section_size (section) == 0) + { + /* This is an empty section. It has no PCs for find_pc_section (), so + there is no reason to insert it into the section map. */ + return 0; + } return 1; }
reply other threads:[~2022-06-02 12:21 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20220602122142.C9EC13857346@sourceware.org \ --to=iii@sourceware.org \ --cc=gdb-cvs@sourceware.org \ /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: linkBe 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).