From patchwork Fri Dec 1 15:41:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 81127 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 49824385C41D for ; Fri, 1 Dec 2023 15:41:45 +0000 (GMT) X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from mail-il1-x12c.google.com (mail-il1-x12c.google.com [IPv6:2607:f8b0:4864:20::12c]) by sourceware.org (Postfix) with ESMTPS id A0362385DC33 for ; Fri, 1 Dec 2023 15:41:03 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A0362385DC33 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 A0362385DC33 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::12c ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1701445264; cv=none; b=xVuMYhlO/FhdarQD++B/9+CWioNVbugSkGUAS2DHiEJg0YmHlIw/39TZkxU5v0HT5dUGa91W22AWCEaUH/407hDJPSNvW+Npz7va5oO8JzUR27Zw6ulXw+t45AGLLOI43qo/RExY8+ceYkM1CwtQW4tGy4beuoEuiHbYLDsFBp0= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1701445264; c=relaxed/simple; bh=ygcqaVDGAh5aMmjlgvc3s2HB4ixcidCTj8zmQsK71QI=; h=DKIM-Signature:From:Date:Subject:MIME-Version:Message-Id:To; b=nuXcDQOhMm5qCtGeI2Ll4AsybJWggKkvlYvbtvGS8d+jjXtEt56EHmJDArY8iC/BixwSoMB1GEV5vvP2NeBmnKB6of93BfWNT+74bogm5tEhoq5lHAFweGzhi74yyb1lIwZYjscgY6wCvyZ8IExysMA2Q9q0/w7YeK2WXlDnxiM= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-il1-x12c.google.com with SMTP id e9e14a558f8ab-35d4de84195so2890695ab.3 for ; Fri, 01 Dec 2023 07:41:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1701445263; x=1702050063; 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=22TNBWx7bPvyA7PnYRekI1hZSkV/8+P+ayq1trU/JxA=; b=ZHktgTUZ3IVOYQZtn7zhIejbXYzRyX/Hti1QThCFk2ZmWoAc+u7BbEmp3svG7E9Go4 iqNGxyQRgXI98hLkY7pKs1F3eSZiPHZNmiGlLeyBdxgZkYz1htMbr6OcfksCF40kJxIb C9YyVhEA8Pom99xMJuRtbKWadJ2d9kYXa9DDZR5P8VtvqFfyLh1/wyxYNlNcG9bASbUg atAGqnmoaRhyV+UsgqzoZ6S3oAQufRo1Ykn2hm5PqBVltd47OneclExwoDyIusCyizFx OOeV/keR9O0VXXDut8AgQ9LGo51s+AWmG5k8ussykjpfNk3fdVdj1Uh/21WzlfcGpvbm +kAg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701445263; x=1702050063; 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=22TNBWx7bPvyA7PnYRekI1hZSkV/8+P+ayq1trU/JxA=; b=TpIri3DCcwnCn4iS1FF7gHTJtidyxj5gXneH6f3wzvrgrbB5wHxfJpF/bNFQrlnzP+ 75Bjf9S2mrPv4nP9mkBNlv93IaKrbuQZiq0M0p3EYrqixrs5n5NKWLzgF7xxnWmeDstV 4M1pkONOST/pXraY+C0m2sAntFlD4r8vn48VOdeoBFx0jq0YNFADsaDXkn8JhDa16rGJ sddzFpaEgYp0+Fqz6nIZ90AqkFiH11eQ2In9KtjMiCj9QB8g0Kg5JArHT5mawV5JbSNs cvGJNzK4tKuSROvCiiNjjGO2NRpBHAwYVDFOwXEKyQwkfLmq7VOPft/PqSSGe+F12Tx0 jPLw== X-Gm-Message-State: AOJu0YxcaGGi6I+JXwjPmTXA3iGZ3ShR0GXotu1FEVNAu/hMBYY1150j 6kTC17m8nHidKcgq1vvIL3Fx1NY0j2+OrW0CzFg= X-Google-Smtp-Source: AGHT+IFANphkEp6t+iYxO8feoBxmwWbevgJFA4V/spnAKve4/XfwHVnKCRSfTfIXgz6JqjLGV0fqHA== X-Received: by 2002:a05:6e02:214b:b0:35d:37de:ca2e with SMTP id d11-20020a056e02214b00b0035d37deca2emr6800282ilv.0.1701445262829; Fri, 01 Dec 2023 07:41:02 -0800 (PST) Received: from localhost.localdomain (97-122-77-73.hlrn.qwest.net. [97.122.77.73]) by smtp.gmail.com with ESMTPSA id f4-20020a02cac4000000b0046662226e54sm906829jap.168.2023.12.01.07.41.02 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Dec 2023 07:41:02 -0800 (PST) From: Tom Tromey Date: Fri, 01 Dec 2023 08:41:01 -0700 Subject: [PATCH 5/6] Catch BaseException in send_gdb_with_response MIME-Version: 1.0 Message-Id: <20231201-dap-cancel-v1-5-872022fc328a@adacore.com> References: <20231201-dap-cancel-v1-0-872022fc328a@adacore.com> In-Reply-To: <20231201-dap-cancel-v1-0-872022fc328a@adacore.com> To: gdb-patches@sourceware.org X-Mailer: b4 0.12.4 X-Spam-Status: No, score=-11.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, 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+patchwork=sourceware.org@sourceware.org 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..1a7ec17e5e3 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 BaseException as e: result_q.put(e) send_gdb(message) val = result_q.get() - if isinstance(val, Exception): + if isinstance(val, BaseException): raise val return val