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 241A6384F6E5 for ; Mon, 21 Nov 2022 18:14:20 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 241A6384F6E5 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.11] (unknown [217.28.27.60]) (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 D726F1E0D3; Mon, 21 Nov 2022 13:14:19 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=simark.ca; s=mail; t=1669054459; bh=2R5OL0EyUQxmUksvoMqdRgebqgK2IovN4r5MqoPF21M=; h=Date:Subject:To:References:From:In-Reply-To:From; b=cvYLw23SxqySFaMFmGG0nso6IvvbSMrWLv6E+drx9u4PBKl3mdhP3mJe10XuDIxE0 U/jop3to25Ed5kzwwbg1QypzMZvNcFHnP/gv+f7oTjNmQ0dFCuttNOJIxh4f/swcfj 0bcpcyXH4PfE3HFWIKqgV1Xzpp2ejmvo+dtcSITo= Message-ID: <102b6335-e33d-ffc0-b7a5-fd79d4cf26af@simark.ca> Date: Mon, 21 Nov 2022 13:14:18 -0500 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2 Subject: Re: [PATCH] Remove reset_ecs Content-Language: en-US To: Tom Tromey , gdb-patches@sourceware.org References: <20221121175830.3585569-1-tom@tromey.com> From: Simon Marchi In-Reply-To: <20221121175830.3585569-1-tom@tromey.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-5.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 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 11/21/22 12:58, Tom Tromey wrote: > I noticed that execution_control_state has a 'reset' method, and > there's also a 'reset_ecs' function that calls it. This patch cleans > this area up a little by adding a parameter to the constructor and the > reset method. Some extraneous variables are also removed, like here: > > - struct execution_control_state ecss; > - struct execution_control_state *ecs = &ecss; > > Here 'ecs' is never changed, so this patch removes it entirely in > favor of just using the object everywhere. I think we could get rid of the reset method as well, it's not used outside of the constructor. Like this: struct execution_control_state { explicit execution_control_state (thread_info *thr = nullptr) : ptid (thr != nullptr ? thr->ptid : null_ptid), event_thread (thr) {} process_stratum_target *target = nullptr; ptid_t ptid; /* The thread that got the event, if this was a thread event; NULL otherwise. */ struct thread_info *event_thread; target_waitstatus ws; int stop_func_filled_in = 0; CORE_ADDR stop_func_start = 0; CORE_ADDR stop_func_end = 0; const char *stop_func_name = nullptr; int wait_some_more = 0; /* True if the event thread hit the single-step breakpoint of another thread. Thus the event doesn't cause a stop, the thread needs to be single-stepped past the single-step breakpoint before we can switch back to the original stepping thread. */ int hit_singlestep_breakpoint = 0; }; Simon