From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id DbKsIsbk/V+0TQAAWB0awg (envelope-from ) for ; Tue, 12 Jan 2021 13:04:54 -0500 Received: by simark.ca (Postfix, from userid 112) id 81B9E1EF7E; Tue, 12 Jan 2021 13:04:54 -0500 (EST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,RDNS_NONE,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.2 Received: from sourceware.org (unknown [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id A0F6C1EE1B for ; Tue, 12 Jan 2021 13:04:50 -0500 (EST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 21F013894C3E; Tue, 12 Jan 2021 18:04:50 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 21F013894C3E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1610474690; bh=c8nDrIlmGZ3MrlLddMiLBqpQcqm0dujm03vNdX1AWdo=; h=Subject:To:References:Date:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=QMqfqLb8rs6wKB19QlJ7CNquH2DnCinQvh0awge389zgpFpvGYpylleltLmnZCl/y ed3EEr+3AP5SAlBLIvo6q1vNCckET9VA0tG2ROHUk9TXvvuL8IHr/uUg+yIBvIgyZT /eq1Xvs1h+Ny01p0+XwMy1opSqo/m58cYfmzolD4= Received: from mail.efficios.com (mail.efficios.com [167.114.26.124]) by sourceware.org (Postfix) with ESMTPS id 7AAF93894C3E for ; Tue, 12 Jan 2021 18:04:45 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 7AAF93894C3E Received: from localhost (localhost [127.0.0.1]) by mail.efficios.com (Postfix) with ESMTP id 477EA27B5DC; Tue, 12 Jan 2021 13:04:45 -0500 (EST) Received: from mail.efficios.com ([127.0.0.1]) by localhost (mail03.efficios.com [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id mUdrNO0PoKfE; Tue, 12 Jan 2021 13:04:45 -0500 (EST) Received: from localhost (localhost [127.0.0.1]) by mail.efficios.com (Postfix) with ESMTP id 0576227BA00; Tue, 12 Jan 2021 13:04:45 -0500 (EST) DKIM-Filter: OpenDKIM Filter v2.10.3 mail.efficios.com 0576227BA00 X-Virus-Scanned: amavisd-new at efficios.com Received: from mail.efficios.com ([127.0.0.1]) by localhost (mail03.efficios.com [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id UWVOyT-D70Wg; Tue, 12 Jan 2021 13:04:44 -0500 (EST) Received: from [10.0.0.11] (192-222-157-6.qc.cable.ebox.net [192.222.157.6]) by mail.efficios.com (Postfix) with ESMTPSA id DB6A927B90E; Tue, 12 Jan 2021 13:04:44 -0500 (EST) Subject: Re: [PATCH v3 4/5] gdb: generalize commit_resume, avoid commit-resuming when threads have pending statuses To: Simon Marchi , gdb-patches@sourceware.org References: <20210108041734.3873826-1-simon.marchi@polymtl.ca> <20210108041734.3873826-5-simon.marchi@polymtl.ca> Message-ID: <263a2b6f-c6fb-e20c-7c61-bd1d3700f3a1@efficios.com> Date: Tue, 12 Jan 2021 13:04:44 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.6.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit 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: , From: Simon Marchi via Gdb-patches Reply-To: Simon Marchi Errors-To: gdb-patches-bounces@sourceware.org Sender: "Gdb-patches" On 2021-01-12 12:14 p.m., Simon Marchi wrote: > I think this patch introduces some regressions, when running > > $ while make check TESTS="gdb.threads/interrupt-while-step-over.exp" RUNTESTFLAGS="--target_board=native-extended-gdbserver"; do done > > I'll sometimes get: > > /home/smarchi/src/binutils-gdb/gdb/inline-frame.c:383: internal-error: void skip_inline_frames(thread_info*, bpstat): Assertion `find_inline_frame_state (thread) == NULL' failed. > A problem internal to GDB has been detected, > further debugging may prove unreliable. > Quit this debugging session? (y or n) Ok, I think I found the reason. We are missing a little something when enqueuing phony stop replys (stop reply for a thread at was resumed but not commit-resumed, still in the RESUMED_PENDING_VCONT state). Imagine the following sequence: 1. Thread is resumed (goes into RESUMED_PENDING_VCONT) 2. Thread is stopped (phony stop reply is enqueued) 3. Core calls commit_resumed, sending a vCont;c for the thread We are now in a state where we have a stop reply that we are going to report as a stop to the core, but the thread is also running on the target -> bad. I think the state where the thread is in the RESUMED_PENDING_VCONT resume state but there is a stop reply enqueued for it is wrong and should be avoided. When we enqueue a phony stop reply, we want to pretend that the thread has executed on the remote target, so I think we should change the thread's state to "resumed". If I stick a `remote_thr->set_resumed ();` at the place we enqueue the phony stop replies, I no longer get the failure. I think this is sufficient, but if we ever want to distinguish threads that are currently resumed on the remote target vs threads that are stopped and have a stop reply waiting to be processed, we could add a 4th resume state STOP_REPLY_PENDING. When a enqueuing a stop reply (real or phony), we would move the matching thread(s) to that state. And when processing the stop reply / reporting the event to the core, we would move the state to NOT_RESUMED, just like we do now. But to be clear, I don't think we need this today. Simon