From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca (simark.ca [158.69.221.121]) by sourceware.org (Postfix) with ESMTPS id 6DDDC3854179 for ; Thu, 18 May 2023 20:59:44 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 6DDDC3854179 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=simark.ca Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=simark.ca Received: from [10.0.0.170] (unknown [167.248.160.41]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id ECC4C1E0D4; Thu, 18 May 2023 16:59:43 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=simark.ca; s=mail; t=1684443584; bh=oim1nBXeRu3idt+87lGj0ixYaIIScEUogOrpcBGyJZo=; h=Date:Subject:To:References:From:In-Reply-To:From; b=qLor3QwXX1cAiCSw8lh1ec8280044GjpCImPPGDzSxVQ4hEaSDJmnSU5r7NS3uBCl LoBS10nCzTHIRxYiufNNL0sa3M87ZA9aMfnrlcmjpU0d/+PJ4j/9LAuxtHaSVkIK9u PdJ2LC9V2gWZVWirtNfmsAS1b/hF22Ciavan1tN0= Message-ID: Date: Thu, 18 May 2023 16:59:43 -0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.11.0 Subject: Re: [PATCH 12/12] gdb: remove breakpoint_pointer_iterator Content-Language: fr To: Simon Marchi , Andrew Burgess , Simon Marchi via Gdb-patches References: <20230511144832.17974-1-simon.marchi@efficios.com> <20230511144832.17974-13-simon.marchi@efficios.com> <877ct5ab5c.fsf@redhat.com> <1c9c1df1-5c2e-9981-a911-bb5e9188e39e@efficios.com> From: Simon Marchi In-Reply-To: <1c9c1df1-5c2e-9981-a911-bb5e9188e39e@efficios.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-6.0 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,SPF_HELO_PASS,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE 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: On 5/18/23 14:44, Simon Marchi via Gdb-patches wrote: >>> @@ -3055,12 +3052,12 @@ breakpoint_program_space_exit (struct program_space *pspace) >>> void >>> insert_breakpoints (void) >>> { >>> - for (breakpoint *bpt : all_breakpoints ()) >>> - if (is_hardware_watchpoint (bpt)) >>> + for (breakpoint &bpt : all_breakpoints ()) >>> + if (is_hardware_watchpoint (&bpt)) >>> { >>> - struct watchpoint *w = (struct watchpoint *) bpt; >>> + watchpoint &w = static_cast (bpt); >> >> Could possibly use gdb::checked_static_cast here? And in other places >> throughout this patch? > > checked_static_cast doesn't work with references though... so I would > have to write: > > watchpoint &w = *gdb::checked_static_cast (&bpt); > > Do you think it's possible to make checked_static_cast work for > references? I'll give it a try. I sent a patch to make checked_static_cast work with references here: https://inbox.sourceware.org/gdb-patches/20230518205737.403656-1-simon.marchi@efficios.com/T/#u I put that patch under this series, and modified this patch (patch 12) to use checked_static_cast. Simon