From: Tom Tromey <tom@tromey.com>
To: gdb-patches@sourceware.org
Cc: Tom Tromey <tom@tromey.com>
Subject: [PATCH 6/9] Use htab_up for demangled hash
Date: Thu, 07 Mar 2019 20:57:00 -0000 [thread overview]
Message-ID: <20190307205709.21919-7-tom@tromey.com> (raw)
In-Reply-To: <20190307205709.21919-1-tom@tromey.com>
This changes objfile_per_bfd_storage::demangled_names_hash to be an
htab_up. This lets us remove some manual management code from the
objfile_per_bfd_storage destructor.
gdb/ChangeLog
2019-03-07 Tom Tromey <tom@tromey.com>
* symtab.c (create_demangled_names_hash): Update.
(symbol_set_names): Update.
* objfiles.h (struct objfile_per_bfd_storage)
<demangled_names_hash>: Now an htab_up.
* objfiles.c (objfile_per_bfd_storage): Simplify.
---
gdb/ChangeLog | 8 ++++++++
gdb/objfiles.c | 2 --
gdb/objfiles.h | 2 +-
gdb/symtab.c | 6 +++---
4 files changed, 12 insertions(+), 6 deletions(-)
diff --git a/gdb/objfiles.c b/gdb/objfiles.c
index ff8b6fc72cf..7d36a2a7114 100644
--- a/gdb/objfiles.c
+++ b/gdb/objfiles.c
@@ -119,8 +119,6 @@ static const struct bfd_data *objfiles_bfd_data;
objfile_per_bfd_storage::~objfile_per_bfd_storage ()
{
- if (demangled_names_hash)
- htab_delete (demangled_names_hash);
}
/* Create the per-BFD storage object for OBJFILE. If ABFD is not
diff --git a/gdb/objfiles.h b/gdb/objfiles.h
index 9db212a1d13..709525ae5af 100644
--- a/gdb/objfiles.h
+++ b/gdb/objfiles.h
@@ -261,7 +261,7 @@ struct objfile_per_bfd_storage
name, and the second is the demangled name or just a zero byte
if the name doesn't demangle. */
- htab *demangled_names_hash = NULL;
+ htab_up demangled_names_hash;
/* The per-objfile information about the entry point, the scope (file/func)
containing the entry point, and the scope of the user's main() func. */
diff --git a/gdb/symtab.c b/gdb/symtab.c
index 005ea23da8d..449bc4cd2b3 100644
--- a/gdb/symtab.c
+++ b/gdb/symtab.c
@@ -740,9 +740,9 @@ create_demangled_names_hash (struct objfile_per_bfd_storage *per_bfd)
Choosing a much larger table size wastes memory, and saves only about
1% in symbol reading. */
- per_bfd->demangled_names_hash = htab_create_alloc
+ per_bfd->demangled_names_hash.reset (htab_create_alloc
(256, hash_demangled_name_entry, eq_demangled_name_entry,
- NULL, xcalloc, xfree);
+ NULL, xcalloc, xfree));
}
/* Try to determine the demangled name for a symbol, based on the
@@ -848,7 +848,7 @@ symbol_set_names (struct general_symbol_info *gsymbol,
entry.mangled = linkage_name_copy;
slot = ((struct demangled_name_entry **)
- htab_find_slot (per_bfd->demangled_names_hash,
+ htab_find_slot (per_bfd->demangled_names_hash.get (),
&entry, INSERT));
/* If this name is not in the hash table, add it. */
--
2.17.2
next prev parent reply other threads:[~2019-03-07 20:57 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-07 21:11 [PATCH 0/9] Minor minimal symbol improvements Tom Tromey
2019-03-07 20:57 ` [PATCH 3/9] Remove some unneeded initializations in minimal_symbol_reader Tom Tromey
2019-03-07 20:57 ` [PATCH 2/9] Introduce and use language_set Tom Tromey
2019-03-07 23:05 ` John Baldwin
2019-03-08 22:21 ` Tom Tromey
2019-03-08 22:43 ` Tom Tromey
2019-03-08 23:44 ` John Baldwin
2019-03-07 20:57 ` [PATCH 4/9] Remove minsym termination Tom Tromey
2019-03-07 20:57 ` [PATCH 8/9] Use memcpy in minimal_symbol_reader::install Tom Tromey
2019-03-07 20:57 ` Tom Tromey [this message]
2019-03-07 20:57 ` [PATCH 5/9] Simplify per-BFD storage management Tom Tromey
2019-03-07 20:57 ` [PATCH 9/9] Change minimal_symbol inheritance Tom Tromey
2019-03-07 20:57 ` [PATCH 7/9] Allocate minimal symbols with malloc Tom Tromey
2019-03-07 20:57 ` [PATCH 1/9] Slightly simplify minsym creation Tom Tromey
2019-03-15 22:04 ` [PATCH 0/9] Minor minimal symbol improvements Tom Tromey
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=20190307205709.21919-7-tom@tromey.com \
--to=tom@tromey.com \
--cc=gdb-patches@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: 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