From patchwork Tue Feb 20 15:21:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 56709 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 AB2783858C54 for ; Tue, 20 Feb 2024 15:22:03 +0000 (GMT) X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from mail-il1-x12e.google.com (mail-il1-x12e.google.com [IPv6:2607:f8b0:4864:20::12e]) by sourceware.org (Postfix) with ESMTPS id D40313858D20 for ; Tue, 20 Feb 2024 15:21:26 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org D40313858D20 Authentication-Results: sourceware.org; dmarc=pass (p=quarantine 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 D40313858D20 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::12e ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1708442488; cv=none; b=TqxhNlJQlh9QS7xi/itAi6KNTq9wB2t5UrZRCAF8B4XaVbgHNIQFieP2NoYFzSUrKrrYRakceeHekyQFPbPT2cc/P1fwodYK+3jIRuZQ74o+f985IyfhlK1mgkc/7bSiwFYoxQbtrwunfMoEwHmroQksEAGMLmr6dFxoRgc+OmQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1708442488; c=relaxed/simple; bh=nlOXhfJsxZ56DW2xcb77HYcSsB5WCZouUFghJqL51vU=; h=DKIM-Signature:From:Subject:Date:Message-Id:MIME-Version:To; b=tu5cjKd9sJK2CXFzpaaH1DrpnxIQe/hC7Q4yJWGVToKNvWEDuKp033yQN4blBzqqk1SPXlx3d2utFC9GJu8AFWXlicYcSULl9fmlWMOENpN7N7BPUNOvGwdEjLC3wvP6RXC3FLv/DcuJzO2TdaIkXYRXbC/EtmqhY1xIXV0OYSM= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-il1-x12e.google.com with SMTP id e9e14a558f8ab-3650beccdc4so8575205ab.2 for ; Tue, 20 Feb 2024 07:21:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1708442486; x=1709047286; darn=sourceware.org; h=to:content-transfer-encoding:mime-version:message-id:date:subject :from:from:to:cc:subject:date:message-id:reply-to; bh=+zWMo+ogdfhyyZimy2fK41FfP3VaJKqIsf5KIzY1qfs=; b=JpqVJmG0B6dyRL1UIKV3YoTp5RCv/iRdthbI2iHgdGG3A0r/5S+7Tv4W06r+jgvMIb GYlUCz+vpNMBRVFEX7gpW92rjyJINjnSFYnls+8NUV81Jnhlg1t1qslcpTSqIdGnbw5T XSs7Npgy7OPJteISUgv93iDQHIv3jxLU6WFxmE04j/WwhehqI2OY1oxWio7InLC/WPCA yIlGuvvpH5SXw9MUM8KO0o0HgSMiQ+jZyBJSUscYh7M5nEtD6TLp3n32HqoppZmR1D7N VCoAMufDspcR2OO/OgqDknM7+psyeTPWuUT6/0aTh7aPTnNXoqzkpI91fSLxCjc0cyS0 9LDQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708442486; x=1709047286; h=to:content-transfer-encoding:mime-version:message-id:date:subject :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=+zWMo+ogdfhyyZimy2fK41FfP3VaJKqIsf5KIzY1qfs=; b=CraM2gnUGIiwEf5mf5tm3fmDzczXJvgP8tYFN8Qmux4kzUZogPUUjHXz+8Dps5mM25 03FUWpd3ncxeKJjimokWkc2MWf5FKaSh/gQdeZy5z4xrVZ22P4dxoFxht2hGgPl44it0 hIPcacZgPoUHRPNO88/potpHmUuEeQPUiSqK87x6DbBQKywDPpHLO0R0Vr8lHsmySMzH ztRy3yGxuWUt3dJEj28mOmiIa2S/2d0DlagL+InfHiAMwadefmeU+oCferRaxqD0O9GL PkusjzFDXfMTWPBinLBi9UH5GSyS3sDAWrB6YXiMknSLLXowZsninA626NE12AphODZc Oa5g== X-Gm-Message-State: AOJu0YwLDjpGQDXxa8s97NETPkdt14JyRd57cZeGGZ43slMI92He4gy6 O41k6+yTk+r8cIqAQXJii82R+AgkiPkJLngSJ8sak452aCuJaS//vJG4ArAKzr4LNIxfiMT4R44 = X-Google-Smtp-Source: AGHT+IGvgmVBzuYHTnH2zSYIjDEf/5RQEe07liZQFrJvj+t/SSLZdHFC5nMAuqdw4XyVzS+YMl4aew== X-Received: by 2002:a92:cb02:0:b0:363:bde2:152f with SMTP id s2-20020a92cb02000000b00363bde2152fmr15224018ilo.24.1708442485962; Tue, 20 Feb 2024 07:21:25 -0800 (PST) Received: from localhost.localdomain (71-211-170-195.hlrn.qwest.net. [71.211.170.195]) by smtp.gmail.com with ESMTPSA id k24-20020a023358000000b004743a0b8b8csm314914jak.153.2024.02.20.07.21.25 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Feb 2024 07:21:25 -0800 (PST) From: Tom Tromey Subject: [PATCH v2 0/5] Fix DAP pause bug Date: Tue, 20 Feb 2024 08:21:23 -0700 Message-Id: <20240220-py-simple-exc-v2-0-c672f1984b4d@adacore.com> MIME-Version: 1.0 X-B4-Tracking: v=1; b=H4sIAHPD1GUC/3WNQQ6CMBBFr0Jm7Zi2gogr72FYTIdBmgglLSEQw t0t7F2+5P33N4gSnER4ZhsEmV10fkhgLhlwR8NH0DWJwSiTK6PvOK4YXT9+BWVhrHSlbkyPUrc FpM0YpHXL2XvXiS1FQRto4O6o9BQnCYfYuTj5sJ6/sz70fxezRoVsysJyawvJ6UUNsQ9yZd9Dv e/7D1g9r1fFAAAA To: gdb-patches@sourceware.org X-Mailer: b4 0.12.4 X-Spam-Status: No, score=-5.6 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+patchwork=sourceware.org@sourceware.org Tom de Vriest pointed out that the DAP pause.exp test wasn't actually testing interruption of Python. Digging into this revealed that the "python" and "source" commands don't handle Python exceptions in the normal way (in gdb terms). This series changes how these are implemented and fixes the original problem that Tom pointed out. Tested on x86-64 Fedora 38. --- Changes in v2: - Renamed new function in first patch - Link to v1: https://inbox.sourceware.org/gdb-patches/20240216-py-simple-exc-v1-0-c275bcfb5e4a@adacore.com --- Tom Tromey (5): Introduce read_remainder_of_file Fix formatting buglet in python.c kfail a FinishBreakpoint test Rewrite "python" command exception handling Use the .py file in gdb.dap/pause.exp gdb/python/lib/gdb/__init__.py | 27 ------ gdb/python/python.c | 111 +++++++++------------- gdb/testsuite/gdb.ada/tasks.exp | 8 +- gdb/testsuite/gdb.dap/pause.exp | 2 +- gdb/testsuite/gdb.python/py-arch.exp | 2 +- gdb/testsuite/gdb.python/py-block.exp | 4 +- gdb/testsuite/gdb.python/py-breakpoint.exp | 18 ++-- gdb/testsuite/gdb.python/py-connection.exp | 8 +- gdb/testsuite/gdb.python/py-disasm.exp | 32 +++---- gdb/testsuite/gdb.python/py-error.exp | 9 +- gdb/testsuite/gdb.python/py-finish-breakpoint.exp | 8 +- gdb/testsuite/gdb.python/py-format-address.exp | 28 +++--- gdb/testsuite/gdb.python/py-format-string.exp | 8 +- gdb/testsuite/gdb.python/py-frame.exp | 18 ++-- gdb/testsuite/gdb.python/py-inferior.exp | 24 ++--- gdb/testsuite/gdb.python/py-lazy-string.exp | 6 +- gdb/testsuite/gdb.python/py-mi-cmd.exp | 40 ++++---- gdb/testsuite/gdb.python/py-missing-debug.exp | 16 ++-- gdb/testsuite/gdb.python/py-objfile.exp | 2 +- gdb/testsuite/gdb.python/py-parameter.exp | 14 +-- gdb/testsuite/gdb.python/py-pp-registration.exp | 2 +- gdb/testsuite/gdb.python/py-progspace-events.exp | 2 +- gdb/testsuite/gdb.python/py-progspace.exp | 8 +- gdb/testsuite/gdb.python/py-record-btrace.exp | 4 +- gdb/testsuite/gdb.python/py-record-full.exp | 4 +- gdb/testsuite/gdb.python/py-template.exp | 2 +- gdb/testsuite/gdb.python/py-thrhandle.exp | 2 +- gdb/testsuite/gdb.python/py-type.exp | 20 ++-- gdb/testsuite/gdb.python/py-unwind.exp | 24 ++--- gdb/testsuite/gdb.python/py-value.exp | 36 +++---- gdb/testsuite/gdb.python/python.exp | 10 +- gdb/testsuite/gdb.python/tui-window-names.exp | 16 ++-- gdb/testsuite/gdb.python/tui-window.exp | 2 +- gdbsupport/filestuff.cc | 24 +++-- gdbsupport/filestuff.h | 4 + 35 files changed, 260 insertions(+), 285 deletions(-) --- base-commit: d9511b64b85296f39ded68f82f7f25ee7d6b25fb change-id: 20240216-py-simple-exc-91903ca871f5 Best regards,