static aix_thread_info *
get_aix_thread_info (thread_info *thread)
{
- return static_cast<aix_thread_info *> (thread->priv.get ());
+ return gdb::checked_static_cast<aix_thread_info *> (thread->priv.get ());
}
/* Information about a thread of which libpthdebug is aware. */
b->cond_string.reset ();
if (is_watchpoint (b))
- static_cast<watchpoint *> (b)->cond_exp.reset ();
+ gdb::checked_static_cast<watchpoint *> (b)->cond_exp.reset ();
else
{
int loc_num = 1;
expression_up new_exp = parse_exp_1 (&arg, 0, 0, 0, &tracker);
if (*arg != 0)
error (_("Junk at end of expression"));
- watchpoint *w = static_cast<watchpoint *> (b);
+ watchpoint *w = gdb::checked_static_cast<watchpoint *> (b);
w->cond_exp = std::move (new_exp);
w->cond_exp_valid_block = tracker.block ();
}
if (type == bp_static_tracepoint
|| type == bp_static_marker_tracepoint)
{
- auto *t = static_cast<struct tracepoint *> (this);
+ auto *t = gdb::checked_static_cast<struct tracepoint *> (this);
struct static_tracepoint_marker marker;
if (strace_marker_p (this))
sal.explicit_pc = 1;
auto *ss_bp
- = static_cast<momentary_breakpoint *> (tp->control.single_step_breakpoints);
+ = (gdb::checked_static_cast<momentary_breakpoint *>
+ (tp->control.single_step_breakpoints));
ss_bp->add_location (sal);
update_global_location_list (UGLL_INSERT);
static inline darwin_thread_info *
get_darwin_thread_info (class thread_info *thread)
{
- return static_cast<darwin_thread_info *> (thread->priv.get ());
+ return gdb::checked_static_cast<darwin_thread_info *> (thread->priv.get ());
}
/* Describe an inferior. */
static inline darwin_inferior *
get_darwin_inferior (inferior *inf)
{
- return static_cast<darwin_inferior *> (inf->priv.get ());
+ return gdb::checked_static_cast<darwin_inferior *> (inf->priv.get ());
}
/* Exception port. */
{
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");
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);
}
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)
= 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 ())
{
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 ();
static thread_db_thread_info *
get_thread_db_thread_info (thread_info *thread)
{
- return static_cast<thread_db_thread_info *> (thread->priv.get ());
+ return gdb::checked_static_cast<thread_db_thread_info *> (thread->priv.get ());
}
static const char *
as_linespec_location_spec (const location_spec *locspec)
{
gdb_assert (locspec->type () == LINESPEC_LOCATION_SPEC);
- return static_cast<const linespec_location_spec *> (locspec);
+ return gdb::checked_static_cast<const linespec_location_spec *> (locspec);
}
/* See description in location.h. */
as_address_location_spec (const location_spec *locspec)
{
gdb_assert (locspec->type () == ADDRESS_LOCATION_SPEC);
- return static_cast<const address_location_spec *> (locspec);
+ return gdb::checked_static_cast<const address_location_spec *> (locspec);
}
/* See description in location.h. */
as_probe_location_spec (const location_spec *locspec)
{
gdb_assert (locspec->type () == PROBE_LOCATION_SPEC);
- return static_cast<const probe_location_spec *> (locspec);
+ return gdb::checked_static_cast<const probe_location_spec *> (locspec);
}
/* See description in location.h. */
as_explicit_location_spec (const location_spec *locspec)
{
gdb_assert (locspec->type () == EXPLICIT_LOCATION_SPEC);
- return static_cast<const explicit_location_spec *> (locspec);
+ return gdb::checked_static_cast<const explicit_location_spec *> (locspec);
}
/* See description in location.h. */
as_explicit_location_spec (location_spec *locspec)
{
gdb_assert (locspec->type () == EXPLICIT_LOCATION_SPEC);
- return static_cast<explicit_location_spec *> (locspec);
+ return gdb::checked_static_cast<explicit_location_spec *> (locspec);
}
/* Return a string representation of the explicit location spec in
#include "osabi.h"
#include "regset.h"
#include "gdbthread.h"
+#include "gdbsupport/gdb-checked-static-cast.h"
/* Target operations defined for Neutrino targets (<target>-nto-tdep.c). */
static inline nto_thread_info *
get_nto_thread_info (thread_info *thread)
{
- return static_cast<nto_thread_info *> (thread->priv.get ());
+ return gdb::checked_static_cast<nto_thread_info *> (thread->priv.get ());
}
/* Per-inferior data, common for both procfs and remote. */
#include "target.h"
#include <set>
#include "gdbsupport/intrusive_list.h"
+#include "gdbsupport/gdb-checked-static-cast.h"
#include "gdbthread.h"
/* Abstract base class inherited by all process_stratum targets. */
as_process_stratum_target (target_ops *target)
{
gdb_assert (target->stratum () == process_stratum);
- return static_cast<process_stratum_target *> (target);
+ return gdb::checked_static_cast<process_stratum_target *> (target);
}
/* Return a collection of targets that have non-exited inferiors. */
if (thread->priv == NULL)
thread->priv.reset (new remote_thread_info);
- return static_cast<remote_thread_info *> (thread->priv.get ());
+ return gdb::checked_static_cast<remote_thread_info *> (thread->priv.get ());
}
/* Return PTID's private thread data, creating it if necessary. */
if (inf->priv == NULL)
inf->priv.reset (new remote_inferior);
- return static_cast<remote_inferior *> (inf->priv.get ());
+ return gdb::checked_static_cast<remote_inferior *> (inf->priv.get ());
}
/* Class used to track the construction of a vCont packet in the