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 8BA9C3858C83 for ; Wed, 20 Jul 2022 20:21:20 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 8BA9C3858C83 Received: from [10.0.0.11] (192-222-157-6.qc.cable.ebox.net [192.222.157.6]) (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 11BED1E21F; Wed, 20 Jul 2022 16:21:19 -0400 (EDT) Message-ID: <44f74af8-248b-1af8-3612-980c08607bf4@simark.ca> Date: Wed, 20 Jul 2022 16:21:19 -0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.11.0 Subject: Re: [PATCH v2 01/29] displaced step: pass down target_waitstatus instead of gdb_signal Content-Language: en-US To: Pedro Alves , gdb-patches@sourceware.org References: <20220713222433.374898-1-pedro@palves.net> <20220713222433.374898-2-pedro@palves.net> From: Simon Marchi In-Reply-To: <20220713222433.374898-2-pedro@palves.net> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-11.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, 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 X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Jul 2022 20:21:21 -0000 On 2022-07-13 18:24, Pedro Alves wrote: > This commit tweaks displaced_step_finish & friends to pass down a > target_waitstatus instead of a gdb_signal. This needed because a > patch later in the series will want to make > displaced_step_buffers::finish handle TARGET_WAITKIND_THREAD_EXITED. > It also helps with the TARGET_WAITKIND_THREAD_CLONED patch. > > Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=27338 > Change-Id: I4c5d338647b028071bc498c4e47063795a2db4c0 > --- > gdb/displaced-stepping.c | 11 ++++++----- > gdb/displaced-stepping.h | 2 +- > gdb/gdbarch-components.py | 2 +- > gdb/gdbarch-gen.h | 4 ++-- > gdb/gdbarch.c | 4 ++-- > gdb/infrun.c | 17 +++++++---------- > gdb/linux-tdep.c | 5 +++-- > gdb/linux-tdep.h | 2 +- > 8 files changed, 23 insertions(+), 24 deletions(-) > > diff --git a/gdb/displaced-stepping.c b/gdb/displaced-stepping.c > index eac2c5dab94..83080cf6bdd 100644 > --- a/gdb/displaced-stepping.c > +++ b/gdb/displaced-stepping.c > @@ -174,10 +174,11 @@ write_memory_ptid (ptid_t ptid, CORE_ADDR memaddr, > } > > static bool > -displaced_step_instruction_executed_successfully (gdbarch *arch, > - gdb_signal signal) > +displaced_step_instruction_executed_successfully > + (gdbarch *arch, const target_waitstatus &status) > { > - if (signal != GDB_SIGNAL_TRAP) > + if (status.kind() == TARGET_WAITKIND_STOPPED Missing space. > + && status.sig () != GDB_SIGNAL_TRAP) > return false; The change here (combined with the one in infrun.c changes the behavior), I just want to make sure this is what you intend. Before, infrun did this: sig = (event.ws.kind () == TARGET_WAITKIND_STOPPED ? event.ws.sig () : GDB_SIGNAL_0); So for event kinds kinds other than TARGET_WAITKIND_STOPPED, it passed GDB_SIGNAL_0. That would make us return false in displaced_step_instruction_executed_successfully. Now, we do this in displaced_step_instruction_executed_successfully: if (status.kind() == TARGET_WAITKIND_STOPPED && status.sig () != GDB_SIGNAL_TRAP) return false; So a none-TARGET_WAITKIND_STOPPED event would not enter that if, and we would return true. Simon