public inbox for gdb-cvs@sourceware.org help / color / mirror / Atom feed
From: Christian Biesinger <cbiesinger@sourceware.org> To: gdb-cvs@sourceware.org Subject: [binutils-gdb] Only clear the minsym array when necessary Date: Wed, 30 Oct 2019 16:05:00 -0000 [thread overview] Message-ID: <20191030160525.56704.qmail@sourceware.org> (raw) https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=808590ec5af20db08005885559fe29ebe7128b48 commit 808590ec5af20db08005885559fe29ebe7128b48 Author: Christian Biesinger <cbiesinger@google.com> Date: Tue Oct 29 17:14:48 2019 -0500 Only clear the minsym array when necessary The array starts out initialized to zero: minimal_symbol *msymbol_hash[MINIMAL_SYMBOL_HASH_SIZE] {}; So we only need to explicitly clear it if there were previous minsyms added to it. This patch does that. gdb/ChangeLog: 2019-10-30 Christian Biesinger <cbiesinger@google.com> * minsyms.c (clear_minimal_symbol_hash_tables): New function. (build_minimal_symbol_hash_tables): Code to clear the table moved to clear_minimal_symbol_hash_tables. (minimal_symbol_reader::install): Call clear_minimal_symbol_hash_tables when needed. Change-Id: I7da994fe6747f67714e7efe9fdbb0dbc4d6ea532 Diff: --- gdb/ChangeLog | 8 ++++++++ gdb/minsyms.c | 22 ++++++++++++++-------- 2 files changed, 22 insertions(+), 8 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 7338ec3..0382082 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,11 @@ +2019-10-30 Christian Biesinger <cbiesinger@google.com> + + * minsyms.c (clear_minimal_symbol_hash_tables): New function. + (build_minimal_symbol_hash_tables): Code to clear the table moved + to clear_minimal_symbol_hash_tables. + (minimal_symbol_reader::install): Call clear_minimal_symbol_hash_tables + when needed. + 2019-10-29 Simon Marchi <simon.marchi@polymtl.ca> * infcmd.c: Remove includes. diff --git a/gdb/minsyms.c b/gdb/minsyms.c index db3e546..78cb15b 100644 --- a/gdb/minsyms.c +++ b/gdb/minsyms.c @@ -1238,6 +1238,16 @@ compact_minimal_symbols (struct minimal_symbol *msymbol, int mcount, return (mcount); } +static void +clear_minimal_symbol_hash_tables (struct objfile *objfile) +{ + for (size_t i = 0; i < MINIMAL_SYMBOL_HASH_SIZE; i++) + { + objfile->per_bfd->msymbol_hash[i] = 0; + objfile->per_bfd->msymbol_demangled_hash[i] = 0; + } +} + /* Build (or rebuild) the minimal symbol hash tables. This is necessary after compacting or sorting the table since the entries move around thus causing the internal minimal_symbol pointers to become jumbled. */ @@ -1248,14 +1258,7 @@ build_minimal_symbol_hash_tables (struct objfile *objfile) int i; struct minimal_symbol *msym; - /* Clear the hash tables. */ - for (i = 0; i < MINIMAL_SYMBOL_HASH_SIZE; i++) - { - objfile->per_bfd->msymbol_hash[i] = 0; - objfile->per_bfd->msymbol_demangled_hash[i] = 0; - } - - /* Now, (re)insert the actual entries. */ + /* (Re)insert the actual entries. */ for ((i = objfile->per_bfd->minimal_symbol_count, msym = objfile->per_bfd->msymbols.get ()); i > 0; @@ -1345,6 +1348,9 @@ minimal_symbol_reader::install () The strings themselves are also located in the storage_obstack of this objfile. */ + if (m_objfile->per_bfd->minimal_symbol_count != 0) + clear_minimal_symbol_hash_tables (m_objfile); + m_objfile->per_bfd->minimal_symbol_count = mcount; m_objfile->per_bfd->msymbols = std::move (msym_holder);
reply other threads:[~2019-10-30 16:05 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=20191030160525.56704.qmail@sourceware.org \ --to=cbiesinger@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).