diff options
author | Simon Marchi <simon.marchi@efficios.com> | 2023-10-10 14:03:18 -0400 |
---|---|---|
committer | Simon Marchi <simon.marchi@efficios.com> | 2023-10-19 10:57:51 -0400 |
commit | 3fcbae9d9c7cdc4103c4f494f5d3c63b373617ee (patch) | |
tree | 1b9c686e8c012c529b370245beb56262fde7f8bc /gdb/solib-frv.c | |
parent | e3b63a7910ac7a4ee959af20a544075becbf2671 (diff) | |
download | fsf-binutils-gdb-3fcbae9d9c7cdc4103c4f494f5d3c63b373617ee.zip fsf-binutils-gdb-3fcbae9d9c7cdc4103c4f494f5d3c63b373617ee.tar.gz fsf-binutils-gdb-3fcbae9d9c7cdc4103c4f494f5d3c63b373617ee.tar.bz2 |
gdb: use gdb::checked_static_cast when casting lm_info
Now that the lm_info class hierarchy has a virtual destructor and
therefore a vtable, use checked_static_cast instead of C-style cases to
ensure (when building in dev mode) that we're casting to the right kind
of lm_info.
Change-Id: I9a99b7d6aa9a44edbe76377d57a7008cfb75a744
Approved-By: Pedro Alves <pedro@palves.net>
Reviewed-By: Reviewed-By: Lancelot Six <lancelot.six@amd.com>
Diffstat (limited to 'gdb/solib-frv.c')
-rw-r--r-- | gdb/solib-frv.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/gdb/solib-frv.c b/gdb/solib-frv.c index 853d90a..47a81b8 100644 --- a/gdb/solib-frv.c +++ b/gdb/solib-frv.c @@ -819,7 +819,7 @@ static void frv_relocate_section_addresses (so_list &so, target_section *sec) { int seg; - lm_info_frv *li = (lm_info_frv *) so.lm_info; + auto *li = gdb::checked_static_cast<lm_info_frv *> (so.lm_info); int_elf32_fdpic_loadmap *map = li->map; for (seg = 0; seg < map->nsegs; seg++) @@ -860,7 +860,7 @@ frv_fdpic_find_global_pointer (CORE_ADDR addr) for (struct so_list *so : current_program_space->solibs ()) { int seg; - lm_info_frv *li = (lm_info_frv *) so->lm_info; + auto *li = gdb::checked_static_cast<lm_info_frv *> (so->lm_info); int_elf32_fdpic_loadmap *map = li->map; for (seg = 0; seg < map->nsegs; seg++) @@ -916,7 +916,7 @@ frv_fdpic_find_canonical_descriptor (CORE_ADDR entry_point) { for (struct so_list *so : current_program_space->solibs ()) { - lm_info_frv *li = (lm_info_frv *) so->lm_info; + auto *li = gdb::checked_static_cast<lm_info_frv *> (so->lm_info); addr = find_canonical_descriptor_in_load_object (entry_point, got_value, name, so->abfd, li); @@ -1068,7 +1068,7 @@ frv_fetch_objfile_link_map (struct objfile *objfile) of shared libraries. */ for (struct so_list *so : current_program_space->solibs ()) { - lm_info_frv *li = (lm_info_frv *) so->lm_info; + auto *li = gdb::checked_static_cast<lm_info_frv *> (so->lm_info); if (so->objfile == objfile) return li->lm_addr; |