diff options
author | Tom Tromey <tromey@adacore.com> | 2023-09-15 12:22:47 -0600 |
---|---|---|
committer | Tom Tromey <tromey@adacore.com> | 2023-09-19 08:14:01 -0600 |
commit | 8e032233a013cedc72c52b57a349c47522138594 (patch) | |
tree | fb29349de293292faf56aad7970cb0485f829878 /gdb | |
parent | 6a9196a65f1e98627eeb91af7862153fe7fc3232 (diff) | |
download | binutils-8e032233a013cedc72c52b57a349c47522138594.zip binutils-8e032233a013cedc72c52b57a349c47522138594.tar.gz binutils-8e032233a013cedc72c52b57a349c47522138594.tar.bz2 |
Use gdb::checked_static_cast for catchpoints
This replaces some casts to various kinds of catchpoint with
checked_static_cast.
Approved-By: Simon Marchi <simon.marchi@efficios.com>
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/ada-lang.c | 2 | ||||
-rw-r--r-- | gdb/break-catch-sig.c | 10 | ||||
-rw-r--r-- | gdb/break-catch-syscall.c | 4 |
3 files changed, 9 insertions, 7 deletions
diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c index 2496c09..b9a271b 100644 --- a/gdb/ada-lang.c +++ b/gdb/ada-lang.c @@ -12203,7 +12203,7 @@ ada_catchpoint::allocate_location () bool ada_catchpoint::should_stop_exception (const struct bp_location *bl) const { - struct ada_catchpoint *c = (struct ada_catchpoint *) bl->owner; + ada_catchpoint *c = gdb::checked_static_cast<ada_catchpoint *> (bl->owner); const struct ada_catchpoint_location *ada_loc = (const struct ada_catchpoint_location *) bl; bool stop; diff --git a/gdb/break-catch-sig.c b/gdb/break-catch-sig.c index 10c8b81..7a07fb6 100644 --- a/gdb/break-catch-sig.c +++ b/gdb/break-catch-sig.c @@ -103,7 +103,8 @@ signal_to_name_or_int (enum gdb_signal sig) int signal_catchpoint::insert_location (struct bp_location *bl) { - struct signal_catchpoint *c = (struct signal_catchpoint *) bl->owner; + signal_catchpoint *c + = gdb::checked_static_cast<signal_catchpoint *> (bl->owner); if (!c->signals_to_be_caught.empty ()) { @@ -130,7 +131,8 @@ int signal_catchpoint::remove_location (struct bp_location *bl, enum remove_bp_reason reason) { - struct signal_catchpoint *c = (struct signal_catchpoint *) bl->owner; + signal_catchpoint *c + = gdb::checked_static_cast<signal_catchpoint *> (bl->owner); if (!c->signals_to_be_caught.empty ()) { @@ -165,8 +167,8 @@ signal_catchpoint::breakpoint_hit (const struct bp_location *bl, CORE_ADDR bp_addr, const target_waitstatus &ws) { - const struct signal_catchpoint *c - = (const struct signal_catchpoint *) bl->owner; + const signal_catchpoint *c + = gdb::checked_static_cast<const signal_catchpoint *> (bl->owner); gdb_signal signal_number; if (ws.kind () != TARGET_WAITKIND_STOPPED) diff --git a/gdb/break-catch-syscall.c b/gdb/break-catch-syscall.c index 9abf818..9bdfcf7 100644 --- a/gdb/break-catch-syscall.c +++ b/gdb/break-catch-syscall.c @@ -480,10 +480,10 @@ catch_syscall_enabled (void) static bool catching_syscall_number_1 (struct breakpoint *b, int syscall_number) { - if (is_syscall_catchpoint_enabled (b)) { - struct syscall_catchpoint *c = (struct syscall_catchpoint *) b; + syscall_catchpoint *c + = gdb::checked_static_cast<syscall_catchpoint *> (b); if (!c->syscalls_to_be_caught.empty ()) { |