From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-il1-x129.google.com (mail-il1-x129.google.com [IPv6:2607:f8b0:4864:20::129]) by sourceware.org (Postfix) with ESMTPS id 83AD33858C3A for ; Fri, 15 Sep 2023 18:36:06 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 83AD33858C3A Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=adacore.com Received: by mail-il1-x129.google.com with SMTP id e9e14a558f8ab-34fcbb4a097so1569645ab.1 for ; Fri, 15 Sep 2023 11:36:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1694802966; x=1695407766; darn=sourceware.org; h=to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=+glESpznIMCc7o704EobzYrO6pnGGG2Op2QNydhiD/s=; b=IwPSBwxZhQTavU0fWdOhPUxPle6UDwEWGU+a9KRJVXVVjEA34LTnI8zmTOGFDuVwxx pGa5JECqRsIAIV24VB9hWFzba4sR2SwKdPDu3sqQEWW72jX9llGSdRShNEwDIBqD3zyc dphFoU8s5l7zzS4PJan6/GihffVQZzo7Jfw/I2d/tRs5NOJ4QnGJdPXJqYvd8gnzGLXk xZmz5J5zGK0dGiCMNZ5sWIZywRi/HNIEbrQDJmZIwoB9dGNJgeN+rFLTyBOzDUJLJQG3 KIZDo1tk1yzq6OAvmOTgVYcFyG8yNnyH03qLeVM9izmPUQ5aZlSppuVs05eI4TZRiaTf yrNA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694802966; x=1695407766; h=to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=+glESpznIMCc7o704EobzYrO6pnGGG2Op2QNydhiD/s=; b=lwv83IQJBRJ1zUZ0YdsT09NISK3kHe76NF7cEQrfhGb+/u1pPz2gHoAZisD3EooIyb OfwakFxUz0FS1XeBtA1FXixjJdANOeQroDAMn52rxqQFfikVZUeCBpBK1tZ3R5HwD1ra hcnyAYEaDpdWQKISaku7KdBJ2dy6BKxZHuUWE4vudmXP1/BMd5cDWiZccYjaYGY4tCPt wxz5w2Wha1nx0+MRr3FvZd++kbgc7Ex6g7FyeA84dEe9XAcmXBoHcsWnN1RAsS5+a4c8 O8eDtCeLpBNTphat7gwNCbpMUisbh/VJP1wK8msgDIHTChE/PZiGLnVa7rkRkdcQfDCf arjg== X-Gm-Message-State: AOJu0YwW1ZidiSLzGVmYUCvnAn0l8OCsyx0vFJOZVG4bEGeot+Ix2xUL oZDG3P7kUhnREck+SDfboLF6b89wzIV/GihWq08pRQ== X-Google-Smtp-Source: AGHT+IGKfJITDGG4yd/omtAxYcM39zW+FEoJT2hXJSXJCYLnoNtOA8b8D32jDGpQLAZLuIf8jga2sw== X-Received: by 2002:a05:6e02:de2:b0:34f:41ba:7c98 with SMTP id m2-20020a056e020de200b0034f41ba7c98mr2885231ilj.12.1694802965837; Fri, 15 Sep 2023 11:36:05 -0700 (PDT) Received: from localhost.localdomain (71-211-130-31.hlrn.qwest.net. [71.211.130.31]) by smtp.gmail.com with ESMTPSA id w25-20020a02cf99000000b0042b0a6d899fsm1235997jar.60.2023.09.15.11.36.05 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Sep 2023 11:36:05 -0700 (PDT) From: Tom Tromey Date: Fri, 15 Sep 2023 12:36:04 -0600 Subject: [PATCH 4/4] Use gdb::checked_static_cast for catchpoints MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20230915-watchpoint-casts-v1-4-a4ff35c9644e@adacore.com> References: <20230915-watchpoint-casts-v1-0-a4ff35c9644e@adacore.com> In-Reply-To: <20230915-watchpoint-casts-v1-0-a4ff35c9644e@adacore.com> To: gdb-patches@sourceware.org X-Mailer: b4 0.12.3 X-Spam-Status: No, score=-11.4 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: This replaces some casts to various kinds of catchpoint with checked_static_cast. --- gdb/ada-lang.c | 3 ++- gdb/break-catch-sig.c | 8 +++++--- gdb/break-catch-syscall.c | 4 ++-- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c index 2496c099f19..b1de58cce6f 100644 --- a/gdb/ada-lang.c +++ b/gdb/ada-lang.c @@ -12203,7 +12203,8 @@ 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; + struct ada_catchpoint *c + = gdb::checked_static_cast (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 10c8b81f8e8..cc4f525e3a3 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; + struct signal_catchpoint *c + = gdb::checked_static_cast (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; + struct signal_catchpoint *c + = gdb::checked_static_cast (bl->owner); if (!c->signals_to_be_caught.empty ()) { @@ -166,7 +168,7 @@ signal_catchpoint::breakpoint_hit (const struct bp_location *bl, const target_waitstatus &ws) { const struct signal_catchpoint *c - = (const struct signal_catchpoint *) bl->owner; + = gdb::checked_static_cast (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 9abf8183984..313ac44562c 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; + struct syscall_catchpoint *c + = gdb::checked_static_cast (b); if (!c->syscalls_to_be_caught.empty ()) { -- 2.40.1