aboutsummaryrefslogtreecommitdiff
path: root/gdb/dwarf2
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2022-09-24 13:34:09 -0600
committerTom Tromey <tom@tromey.com>2022-10-16 10:50:47 -0600
commit98ed24fb35d89eb20179edf6c12f599c7a9e228e (patch)
tree222be496751ed4e4bdacc9beb242715e6ab8f696 /gdb/dwarf2
parent45685a2fd86073e76a772c5b677f14f8465a5040 (diff)
downloadgdb-98ed24fb35d89eb20179edf6c12f599c7a9e228e.zip
gdb-98ed24fb35d89eb20179edf6c12f599c7a9e228e.tar.gz
gdb-98ed24fb35d89eb20179edf6c12f599c7a9e228e.tar.bz2
Use checked_static_cast in more places
I looked through all the uses of static_cast<... *> in gdb and converted many of them to checked_static_cast. I couldn't test a few of these changes.
Diffstat (limited to 'gdb/dwarf2')
-rw-r--r--gdb/dwarf2/read.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
index 78f4cc1..3f71ebd 100644
--- a/gdb/dwarf2/read.c
+++ b/gdb/dwarf2/read.c
@@ -3102,7 +3102,7 @@ dwarf2_gdb_index::dump (struct objfile *objfile)
{
dwarf2_per_objfile *per_objfile = get_dwarf2_per_objfile (objfile);
- mapped_index *index = (static_cast<mapped_index *>
+ mapped_index *index = (gdb::checked_static_cast<mapped_index *>
(per_objfile->per_bfd->index_table.get ()));
gdb_printf (".gdb_index: version %d\n", index->version);
gdb_printf ("\n");
@@ -18576,11 +18576,11 @@ dwarf2_per_cu_data *
cooked_index_functions::find_per_cu (dwarf2_per_bfd *per_bfd,
CORE_ADDR adjusted_pc)
{
+ if (per_bfd->index_table == nullptr)
+ return nullptr;
cooked_index_vector *table
- = (static_cast<cooked_index_vector *>
+ = (gdb::checked_static_cast<cooked_index_vector *>
(per_bfd->index_table.get ()));
- if (table == nullptr)
- return nullptr;
return table->lookup (adjusted_pc);
}
@@ -18597,7 +18597,7 @@ cooked_index_functions::find_compunit_symtab_by_address
CORE_ADDR baseaddr = objfile->data_section_offset ();
cooked_index_vector *table
- = (static_cast<cooked_index_vector *>
+ = (gdb::checked_static_cast<cooked_index_vector *>
(per_objfile->per_bfd->index_table.get ()));
dwarf2_per_cu_data *per_cu = table->lookup (address - baseaddr);
if (per_cu == nullptr)
@@ -18625,7 +18625,7 @@ cooked_index_functions::expand_matching_symbols
= lang->get_symbol_name_matcher (lookup_name);
cooked_index_vector *table
- = (static_cast<cooked_index_vector *>
+ = (gdb::checked_static_cast<cooked_index_vector *>
(per_objfile->per_bfd->index_table.get ()));
for (const cooked_index_entry *entry : table->all_entries ())
{
@@ -18657,7 +18657,7 @@ cooked_index_functions::expand_symtabs_matching
return true;
cooked_index_vector *table
- = (static_cast<cooked_index_vector *>
+ = (gdb::checked_static_cast<cooked_index_vector *>
(per_objfile->per_bfd->index_table.get ()));
table->wait ();