From 6a9196a65f1e98627eeb91af7862153fe7fc3232 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Fri, 15 Sep 2023 12:19:57 -0600 Subject: [PATCH] Use gdb::checked_static_cast for code_breakpoint This replaces some casts to 'code_breakpoint *' with checked_static_cast. Approved-By: Simon Marchi --- gdb/breakpoint.c | 6 ++++-- gdb/elfread.c | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index a22f1258a00..d807ae3c9b5 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -6170,10 +6170,12 @@ bpstat_run_callbacks (bpstat *bs_head) handle_jit_event (bs->bp_location_at->address); break; case bp_gnu_ifunc_resolver: - gnu_ifunc_resolver_stop ((code_breakpoint *) b); + gnu_ifunc_resolver_stop + (gdb::checked_static_cast (b)); break; case bp_gnu_ifunc_resolver_return: - gnu_ifunc_resolver_return_stop ((code_breakpoint *) b); + gnu_ifunc_resolver_return_stop + (gdb::checked_static_cast (b)); break; } } diff --git a/gdb/elfread.c b/gdb/elfread.c index 55e3e47ceca..8704b52f35b 100644 --- a/gdb/elfread.c +++ b/gdb/elfread.c @@ -1033,7 +1033,7 @@ elf_gnu_ifunc_resolver_return_stop (code_breakpoint *b) "gnu-indirect-function breakpoint type %d"), (int) b->type); } - b = (code_breakpoint *) b_next; + b = gdb::checked_static_cast (b_next); } gdb_assert (b->type == bp_gnu_ifunc_resolver); gdb_assert (b->has_single_location ()); -- 2.30.2