From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id 2IGCBf1ITmWmBwMAWB0awg (envelope-from ) for ; Fri, 10 Nov 2023 10:15:09 -0500 Authentication-Results: simark.ca; dkim=pass (2048-bit key; secure) header.d=adacore.com header.i=@adacore.com header.a=rsa-sha256 header.s=google header.b=fefO0OAh; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 12D1B1E1A7; Fri, 10 Nov 2023 10:15:09 -0500 (EST) Received: from server2.sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id EA3F71E0C1 for ; Fri, 10 Nov 2023 10:15:06 -0500 (EST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 4F0EC3857017 for ; Fri, 10 Nov 2023 15:15:06 +0000 (GMT) Received: from mail-wm1-x334.google.com (mail-wm1-x334.google.com [IPv6:2a00:1450:4864:20::334]) by sourceware.org (Postfix) with ESMTPS id 72A183858C60 for ; Fri, 10 Nov 2023 15:14:54 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 72A183858C60 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=adacore.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 72A183858C60 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::334 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1699629295; cv=none; b=uHTnangEgvBK79tT9ZkE4Pt7FKS79Vuw0phC5C4/ZzXcFrVBnKM9ejmC4I6f3Jm4nHq6NudBHUDd1VbAxLq/4nc4P8Ht7xLVFg7Q6bpoYH7KowkPMPhwg4xqdzs7X+StzYM9AkFWq7oW6BUQ7LsIk2m4F6Lm9ktvzkIypal/UeQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1699629295; c=relaxed/simple; bh=qCL2KGMwhnFBJvCTwyyocoRgNHuWwNb4+rd3pACzVJY=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=duVbLLiABhkqs4bysy4NLStBC1RbDOsLVSDPa55AYAePtezKClklBW6G9fw9LNcRLf4lm9yEAnb39TH0TKag6DuyBApLlQ1mfoJoqNe55lXEEprbDQx2xt0POqPpCnT1CHXRnDJEw7lusmW5pJ+AuUestOzwjcg7437Q8JwpdYw= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-wm1-x334.google.com with SMTP id 5b1f17b1804b1-40853c639abso15785185e9.0 for ; Fri, 10 Nov 2023 07:14:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1699629292; x=1700234092; darn=sourceware.org; h=content-transfer-encoding:mime-version:user-agent:message-id:date :references:in-reply-to:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=YeyrU7uxkDz1yNlidinZfl/0mz8xHLo2EgDgbmY5lqU=; b=fefO0OAhycJd6l1Zm20i1M1UkYTeXGGHNG/iAn5VmzbrON3M8OcBQECik+RXCYMUbW THAXAdO79+uCBmdUWMhCB5TWKwxUYKhWrGtapbSKqeyK5Fi/1ji0rPiOxTn82QyJSF3m YnUXPCG6XA7pz0CAMsNtgCa4jwyzKOXj6gwqkKBpAZ92Rh23ettoAHPsZpbxlVHx968Y GQaogz89/3dyb2vNbqx6sQDKYJz4PAfK4i1/i6l3tTCXFdoBEuYklnjCneev6dkjqfQu mk4qQ3JAVZDVOtwLqN/mAEREYjTdxr4Y4Wq91eMNjJQ0PfP0OPioJAW7rcsI62GRwCKw I0DA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699629292; x=1700234092; h=content-transfer-encoding:mime-version:user-agent:message-id:date :references:in-reply-to:subject:cc:to:from:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=YeyrU7uxkDz1yNlidinZfl/0mz8xHLo2EgDgbmY5lqU=; b=jIhQkYgEkqtIXdOr439cC4YZPJTOeZdW2albG5UTgyE+WZTcxJLwaLCBiby135aTHJ qAMpUQ2ktjRwxP7D5sXBgn3Mvph9iSTPaY3iWcTy9FUKl7Pnvnq9IBh/VVU1w88GkzpP JsWmrY71imjSx8H47vTki8qV2PUaYGuxrCBtk/aalD4ABGR7+FkcZgm67xzaijpD4PzZ DZgOgJ0X0zLHqy4O+G+VQbgiHni2xu6b6a+OuPhcrxE1wVEZZex1KSkTh6GoY4g5nCAk OQlY84w9VuiXTCiiCpWTV4L6AKDBPLoDwXVI4c8jZ5p+8KVIvGgGjnepu6Aj+tzIFAUr QROQ== X-Gm-Message-State: AOJu0YxqMo4giMJTs01ZB+TM0BdG4F0dB+7A1viuLqIiJ8HBk9hiIjxP Q2eZCtZqI1Si3L+0EweWLCwqMyrpjtmhGlL82VN2eg== X-Google-Smtp-Source: AGHT+IEXlq6PijRUkLhap/kL4+6/NBXjk0vrlF4w3r+39bOISJUs+X+o+CkRvGtegreYKmyscA55lg== X-Received: by 2002:a05:6000:4014:b0:32d:b081:ff38 with SMTP id cp20-20020a056000401400b0032db081ff38mr6641512wrb.0.1699629292554; Fri, 10 Nov 2023 07:14:52 -0800 (PST) Received: from legouguec-Precision-7550 ([2a01:e0a:253:fe0:6747:199c:d648:1042]) by smtp.gmail.com with ESMTPSA id h4-20020a5d6884000000b003232380ffd5sm2080223wru.106.2023.11.10.07.14.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Nov 2023 07:14:52 -0800 (PST) From: =?utf-8?Q?K=C3=A9vin_Le_Gouguec?= To: Tom Tromey Cc: gdb-patches@sourceware.org Subject: Re: [PATCH 3/3] Implement the notStopped DAP response In-Reply-To: <87a5rlvexb.fsf@tromey.com> (Tom Tromey's message of "Fri, 10 Nov 2023 07:52:32 -0700") References: <20231107-dap-not-stopped-v1-0-3d91c935255d@adacore.com> <20231107-dap-not-stopped-v1-3-3d91c935255d@adacore.com> <878r78bqlk.fsf@adacore.com> <87a5rlvexb.fsf@tromey.com> Date: Fri, 10 Nov 2023 16:14:51 +0100 Message-ID: <871qcxwsgk.fsf@adacore.com> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-5.0 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, 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 X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Tom Tromey writes: >>>>>> "K=C3=A9vin" =3D=3D K=C3=A9vin Le Gouguec wr= ites: > >>> +# True when the inferior is thought to be running, False otherwise. >>> +# This may be accessed from any thread, which can be racy. However, >>> +# this unimportant because this global is only used for the >>> +# 'notStopped' response, which itself is inherently racy. >>> +inferior_running =3D False > > K=C3=A9vin> Out of curiosity, could `inferior_thread ()->state` have help= ed here? > K=C3=A9vin> (Exposing it as a gdb.Inferior method perhaps?) > > K=C3=A9vin> Not necessarily with the "racy" part; thinking more of the "k= eep a > K=C3=A9vin> single source of truth" part (i.e. dispense with relying on e= vent > K=C3=A9vin> notifications). > > Possibly, but it couldn't be called from a non-gdb thread, so we'd have > to send a message to the gdb thread and then a message back. Right, thanks for confirming. No strong opinion on my side; if we are fine with the notifications, might as well save the roundtrip. >>> + # Import this as late as possible. FIXME. >>> + from .events import inferior_running > > K=C3=A9vin> Assuming this is what the FIXME is about (apologies if not): = an > K=C3=A9vin> alternative could be doing a bare `import .events`, then look= up > K=C3=A9vin> `.events.inferior_running` in check(). Or defining an access= or function > K=C3=A9vin> in .events and importing that instead of this global. > > The problem is a circular import, as events imports from server. > I may just remove this comment? Not sure. Oh, hadn't caught that; somehow I convinced myself this was about "from foo import bar" failing to do TRT when bar is re-assigned within foo, IOW here a top-level "from .events import inferior_running" would fail to reflect changes from event notifications. Hm. So I guess another solution would be moving inferior_running under server.py, and making events set .server.inferior_running? Or=E2=80=A6 > Originally here I was thinking of putting more event listeners in > server.py, but it seemed strange not to just reuse the existing ones. =E2=80=A6 this. The late-import is fine too of course.