public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Tom Tromey <tromey@adacore.com>
To: gdb-patches@sourceware.org
Subject: [PATCH 3/4] Use gdb::checked_static_cast for code_breakpoint
Date: Fri, 15 Sep 2023 12:36:03 -0600	[thread overview]
Message-ID: <20230915-watchpoint-casts-v1-3-a4ff35c9644e@adacore.com> (raw)
In-Reply-To: <20230915-watchpoint-casts-v1-0-a4ff35c9644e@adacore.com>

This replaces some casts to 'code_breakpoint *' with
checked_static_cast.
---
 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 134ad76ce9a..5d87b17a58d 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -6174,10 +6174,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<code_breakpoint *> (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<code_breakpoint *> (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<code_breakpoint *> (b_next);
     }
   gdb_assert (b->type == bp_gnu_ifunc_resolver);
   gdb_assert (b->has_single_location ());

-- 
2.40.1


  parent reply	other threads:[~2023-09-15 18:36 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-15 18:36 [PATCH 0/4] Use checked_static_cast for breakpoint casts Tom Tromey
2023-09-15 18:36 ` [PATCH 1/4] Use gdb::checked_static_cast for watchpoints Tom Tromey
2023-09-18  0:40   ` Simon Marchi
2023-09-18 14:20     ` Tom Tromey
2023-09-15 18:36 ` [PATCH 2/4] Use gdb::checked_static_cast for tracepoints Tom Tromey
2023-09-15 18:36 ` Tom Tromey [this message]
2023-09-15 18:36 ` [PATCH 4/4] Use gdb::checked_static_cast for catchpoints Tom Tromey
2023-09-18  0:45 ` [PATCH 0/4] Use checked_static_cast for breakpoint casts Simon Marchi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230915-watchpoint-casts-v1-3-a4ff35c9644e@adacore.com \
    --to=tromey@adacore.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).