aboutsummaryrefslogtreecommitdiff
path: root/gdb/psymtab.c
diff options
context:
space:
mode:
authorTom Tromey <tromey@adacore.com>2024-03-20 13:24:33 -0600
committerTom Tromey <tromey@adacore.com>2024-06-04 10:13:17 -0600
commit7149dfe819b16c0238fb67f55a47e9295c20ff1b (patch)
tree3d6e0285ec95cfd5ca444fb077deb6d17ac884ca /gdb/psymtab.c
parent56fefe83f7e607842fa95f6bb7d71f1645ce6c15 (diff)
downloadgdb-7149dfe819b16c0238fb67f55a47e9295c20ff1b.zip
gdb-7149dfe819b16c0238fb67f55a47e9295c20ff1b.tar.gz
gdb-7149dfe819b16c0238fb67f55a47e9295c20ff1b.tar.bz2
Make bcache more type-safe
The bcache uses memcpy to make copies of the data passed to it. In C++, this is only safe for trivially-copyable types. This patch changes bcache to require this property, and slightly changes the API to make it easier to use when copying a single object. It also makes the new 'insert' template methods return the correct type.
Diffstat (limited to 'gdb/psymtab.c')
-rw-r--r--gdb/psymtab.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/gdb/psymtab.c b/gdb/psymtab.c
index 596d87e..7d6648c 100644
--- a/gdb/psymtab.c
+++ b/gdb/psymtab.c
@@ -1062,10 +1062,8 @@ partial_symtab::add_psymbol (const partial_symbol &psymbol,
bool added;
/* Stash the partial symbol away in the cache. */
- partial_symbol *psym
- = ((struct partial_symbol *)
- partial_symtabs->psymbol_cache.insert
- (&psymbol, sizeof (struct partial_symbol), &added));
+ const partial_symbol *psym = partial_symtabs->psymbol_cache.insert (psymbol,
+ &added);
/* Do not duplicate global partial symbols. */
if (where == psymbol_placement::GLOBAL && !added)