From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-io1-xd2e.google.com (mail-io1-xd2e.google.com [IPv6:2607:f8b0:4864:20::d2e]) by sourceware.org (Postfix) with ESMTPS id 7AF34385843F for ; Mon, 11 Dec 2023 16:02:24 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 7AF34385843F 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 7AF34385843F Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::d2e ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1702310545; cv=none; b=KJTpGCKd8i87pjkTRXAUPkM2ZEWssQRXPjroi6OWtXPI/e8y/6oj1d+aLTtN0r3rWh6JOjNChdkpAIJglTueupAbz6IHuMRmdXeww7vjy1FvjpYWP/R7V7DNgx9vX9qs01TMetibbNQWAZBXn7xFhcoxyGss2+GuWVNWIv5NYSE= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1702310545; c=relaxed/simple; bh=rCfVQUT8mHIXKt3Si7KFF9H/jiAZ7rTu+yVS94QG0NQ=; h=DKIM-Signature:From:Date:Subject:MIME-Version:Message-Id:To; b=HzzbvUz/0iP0UEDhhXV7ULkLze3I6Bs4GTpDTCBbUtgx44wmxdOWSkSG9lGsl3HRLG7YUAFZn+4uPtAF0JoId3mh4+JGJIdWpfxyyP3yTWRVFwQGzo09Xwu4mdUh9aG9g4MRmjSM9Gn3wGgZfCWmBbrfPUm+hUMNzT1qjqfcFFE= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-io1-xd2e.google.com with SMTP id ca18e2360f4ac-7b7282c8941so101128039f.3 for ; Mon, 11 Dec 2023 08:02:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1702310543; x=1702915343; darn=sourceware.org; h=to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=95ziRDvc05ggMPrUdaDiKy8qC67noNUgHDEiS1OkPq4=; b=NKBxb2p8jIYTWUdrHAH2iOpbjsugu6pTDZtbAOlqML+JpLwMSK00tFjI/BqcNaMU4J Ee7zoN5WJDyNvEDVr2HkAlOirVGEUbmJUMPhfr5whAhLZAgV8IMjlu4NdDL6ohlT+bBY jooNul80GFEG6hjyXHpJambzD/zK1Xdn19JOoH9hNSxkZCG5b4vkPAwSOJE+y8thouJ1 a5yIrkpV5kg62vM+JynOElvHViQH2hh1eQf8y8bHxCNc+XSQfyaIw9ihDgcmL+eRC2jR oq9bn5X52kTyisLcf9eLMQ4KbFYwtxd0u4wtDMu7kz19FIJGMS1nTThXE49459CPp4tE hOYg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702310543; x=1702915343; h=to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=95ziRDvc05ggMPrUdaDiKy8qC67noNUgHDEiS1OkPq4=; b=TiWn8DaawLCIFrqGLuKtzFFqnp4S5NkEGH8hQDNpie5tWjSsW3DcwnvrVaHL4lvhtp vYuyr68Yn1R6H72MUGX0fSl6CzabzP2uUK7qmxKq/86lVK0pPZE8OvH2PlCHRXvTU5Hs FOhI4ooF8rm0gyundZsn6ffcMhAX18Fppg8J+NUxXzbOMm2zlLQ9lZTOkhAM5I0zGtXu PvK5uExsiL/lA3nxcNeKAjIKOa1Qod0Rr7BoCoAXUE5xE9gj2zYL9hiEFg3u8jHWrHzT JVLBknTp49lIJ9lyj8DY0gUXjUlZfqjU/Wuvs1gt1CAc/VZ+KYXN6ZrE/0Mt4kNOdt1t nHeQ== X-Gm-Message-State: AOJu0YyLX6bBmNHYHY9Nfbdlrxe3ZXIVZ5liBQCtenXIUwwFMQDXkV// cNdOY1SQlnjfYKk8arEf6rg7RH6iywrluJruqxI= X-Google-Smtp-Source: AGHT+IG08tQrZ+oUiw62NVijV+yWAoFqjaBal9tY4iGdqPVJqByKPFxBkZhAtxsJXhXj/io8UdzEZg== X-Received: by 2002:a05:6e02:12ce:b0:35d:59a2:1281 with SMTP id i14-20020a056e0212ce00b0035d59a21281mr7764181ilm.45.1702310543773; Mon, 11 Dec 2023 08:02:23 -0800 (PST) Received: from localhost.localdomain (71-211-161-25.hlrn.qwest.net. [71.211.161.25]) by smtp.gmail.com with ESMTPSA id h25-20020a02cd39000000b0042acf934cbasm1879113jaq.72.2023.12.11.08.02.23 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Dec 2023 08:02:23 -0800 (PST) From: Tom Tromey Date: Mon, 11 Dec 2023 09:02:22 -0700 Subject: [PATCH v2 5/6] Catch KeyboardInterrupt in send_gdb_with_response MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20231211-dap-cancel-v2-5-db7b52cf0329@adacore.com> References: <20231211-dap-cancel-v2-0-db7b52cf0329@adacore.com> In-Reply-To: <20231211-dap-cancel-v2-0-db7b52cf0329@adacore.com> To: gdb-patches@sourceware.org X-Mailer: b4 0.12.4 X-Spam-Status: No, score=-9.7 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,RCVD_IN_ABUSEAT,RCVD_IN_DNSWL_NONE,RCVD_IN_XBL,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 List-Id: Cancellation will generally be seen by the DAP code as a KeyboardInterrupt. However, this derives from BaseException and not Exception, so a small change is needed to send_gdb_with_response, to forward the exception to the DAP server thread. --- gdb/python/lib/gdb/dap/startup.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gdb/python/lib/gdb/dap/startup.py b/gdb/python/lib/gdb/dap/startup.py index a16b51f7cf5..1d3b94762a6 100644 --- a/gdb/python/lib/gdb/dap/startup.py +++ b/gdb/python/lib/gdb/dap/startup.py @@ -172,11 +172,11 @@ def send_gdb_with_response(fn): try: val = fn() result_q.put(val) - except Exception as e: + except (Exception, KeyboardInterrupt) as e: result_q.put(e) send_gdb(message) val = result_q.get() - if isinstance(val, Exception): + if isinstance(val, (Exception, KeyboardInterrupt)): raise val return val -- 2.43.0