From patchwork Tue Feb 27 14:45:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 56735 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 0ABC738582A9 for ; Tue, 27 Feb 2024 14:46:29 +0000 (GMT) X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from mail-il1-x135.google.com (mail-il1-x135.google.com [IPv6:2607:f8b0:4864:20::135]) by sourceware.org (Postfix) with ESMTPS id DC7D43858C78 for ; Tue, 27 Feb 2024 14:45:53 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org DC7D43858C78 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 DC7D43858C78 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::135 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1709045155; cv=none; b=Ny8xWFPAAZ3C/QhJ7z3NPSRAAxKIp2e5TQKg8hWIDSC1Ps9PHxYUU9n00FwXKLlX2/CoiW0MDDdSP4SvJRcBgES3FpMrHgHIdhUngTin0bJHoSKHF7wj2sE1Ky4F9WkynDO/ZF6kKToMjs78omXy8cGQSyP3haVMME1mcoWONVU= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1709045155; c=relaxed/simple; bh=rliGBNRLR0xxqByN2GrxOavOQYkXT10nHXuusI4O4q4=; h=DKIM-Signature:From:Subject:Date:Message-Id:MIME-Version:To; b=bmwBWfcMaMX6xtZT+Avsmt5SsS02/RsLoQMYwzgwk1oro+JcG11iy5LAGleuPyMQoHCoHA+CCYXZMFRHnWHVyihltR0uBJULAVZx4nnmbO7MZUnU7M3RqvsZAgGNDeG8ofKE8iMkXGtO3kFh92RxDZXBIeX2dM5totdndu7xLCc= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-il1-x135.google.com with SMTP id e9e14a558f8ab-3657dbe2008so14253445ab.1 for ; Tue, 27 Feb 2024 06:45:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1709045153; x=1709649953; darn=sourceware.org; h=cc:to:content-transfer-encoding:mime-version:message-id:date :subject:from:from:to:cc:subject:date:message-id:reply-to; bh=ysJ+6HPgzW+/wyJ9NpH0+N8FWj7KZahVgJ9Fw+dnmy8=; b=DpJ6lv1GHxp69AoAvNMNAHxyqunhw9JWvVgG5iJVNZH3ZQg+G1knyVeoGOSJCWnFVF 7fNolSYQ836P8TmWsymnw7/qEAWsQWbfan2QJIQttU5Og/9/Cd1HgjHxtBXuLo/1lphV IZXAeV+vrALRD/MEMnFz8tROnWY20EKrBusgTBABUU2J8eSDaiJUeiHrNMGwVNk5ielU Ei05r/qsFgYdLiFt7ET6zqf8wqjHug+YUc9DTb/eIqsnoje9PzRwSyTeLpmOXCK7TDAZ NYQy5CxwfLzMAClO0iRreLa/3KxFI8j/bf2g4YKH9HCvmbM22TDJ5dj1CgDISJ0YxSb3 0V/Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709045153; x=1709649953; h=cc: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=ysJ+6HPgzW+/wyJ9NpH0+N8FWj7KZahVgJ9Fw+dnmy8=; b=fWMZnYYYHLrTYCodqaa1fvT/fcvk8OG4lNSKcpExqRlgDnHW9FHDi9az/sLECPPXL6 k3puahzTX1IYMePzr4dTI2KvLEE/lIedo4v4BsMrGaeHgNTb87gocHiVYDZM3mIB3boX nH9NO+UAURKEwzEwcr5T3QvntxBLbjryrgiCrONnziiZ40CcU2Z7lhqj6NIQ9tf9wq5P m2EZUja12aBAZJRSBT3CJxgTS0PseJCisPVNcm2VVGPBrWWxVQ7t9lPdTdF1WQJSSvQn lDlh9viptKLudpu2L7qlXFlwPjQ1okaMlVuztIBVUVFAV3oae5RFXhfBVS8y/S3/iH7g 725w== X-Gm-Message-State: AOJu0YyV2tCcsrSwPO0Ou5+Fje230miseFYyDGdf3e8N5+/CunPE+M+m xCKgj525+u1eaSHp2qJV9kYH1/KyB8XjEjO8O9HwjWHZ6aQqC67KfM1j9T2qdSUkrWnIhFh5MaU = X-Google-Smtp-Source: AGHT+IH4jfhZcl3J3VxRoYz0D7lQ77GoKB0fEO0c9QFjVui+ECAhU24RP1DQ5W16EYtGFvrAEALvwA== X-Received: by 2002:a05:6e02:11aa:b0:365:dd9:62fa with SMTP id 10-20020a056e0211aa00b003650dd962famr11388330ilj.28.1709045153132; Tue, 27 Feb 2024 06:45:53 -0800 (PST) Received: from localhost.localdomain (71-211-170-195.hlrn.qwest.net. [71.211.170.195]) by smtp.gmail.com with ESMTPSA id bm9-20020a056e02330900b00365374d2143sm2212686ilb.5.2024.02.27.06.45.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Feb 2024 06:45:52 -0800 (PST) From: Tom Tromey Subject: [PATCH v4 0/4] Fix DAP pause bug Date: Tue, 27 Feb 2024 07:45:48 -0700 Message-Id: <20240227-py-simple-exc-v4-0-3341d342c126@adacore.com> MIME-Version: 1.0 X-B4-Tracking: v=1; b=H4sIAJz13WUC/33NywrCMBAF0F+RrI0k0/Tlyv8QF5Pp1Absg0SKI v13k658oMsL99z7EIG94yD2m4fwPLvgxiEGs90I6nA4s3RNzAIUGAW6kNNdBtdPF5Z8I1nrWmW EVanbXEQzeW7dbd07nmK2GFhajwN1aaXHcGWfip0L19Hf199Zp/qvi1lLJQnK3FJrczZ4wAZp9 LyjsRfpZIYXD+rTQ/JFCa2uK2NN8+2zvz6LHqGCnBCNLc27X5blCRDEpP9FAQAA To: gdb-patches@sourceware.org Cc: Tom de Vries X-Mailer: b4 0.12.4 X-Spam-Status: No, score=-5.5 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 Vries 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 v4: - Dropped the kfail patch - Updated the documentation to reflect Python error behavior - Link to v3: https://inbox.sourceware.org/gdb-patches/20240220-py-simple-exc-v3-0-a2825caa4b74@adacore.com Changes in v3: - Fix style.exp failure when Pygments is missing, pointed out by CI - Link to v2: https://inbox.sourceware.org/gdb-patches/20240220-py-simple-exc-v2-0-c672f1984b4d@adacore.com 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 (4): Introduce read_remainder_of_file Fix formatting buglet in python.c Rewrite "python" command exception handling Use the .py file in gdb.dap/pause.exp gdb/doc/python.texi | 6 +- 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 | 2 +- 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 +- gdb/testsuite/lib/gdb-python.exp | 2 +- gdbsupport/filestuff.cc | 24 +++-- gdbsupport/filestuff.h | 4 + 37 files changed, 259 insertions(+), 288 deletions(-) --- base-commit: 5998b4a287772756e33d311a570df080a4f6e051 change-id: 20240216-py-simple-exc-91903ca871f5 Best regards,