From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id wZogNOzZ0WhEmg4AWB0awg (envelope-from ) for ; Mon, 22 Sep 2025 19:21:16 -0400 Authentication-Results: simark.ca; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=uofr.net header.i=@uofr.net header.a=rsa-sha256 header.s=selector-1 header.b=YBz2x2pa; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id D01D61E0BA; Mon, 22 Sep 2025 19:21:16 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIM_INVALID,DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED autolearn=ham autolearn_force=no version=4.0.1 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 2EAE11E04C for ; Mon, 22 Sep 2025 19:21:16 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 8D5A33858D1E for ; Mon, 22 Sep 2025 23:21:15 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8D5A33858D1E Authentication-Results: sourceware.org; dkim=fail reason="signature verification failed" (1024-bit key, unprotected) header.d=uofr.net header.i=@uofr.net header.a=rsa-sha256 header.s=selector-1 header.b=YBz2x2pa Received: from uofr.net (uofr.net [50.116.51.30]) by sourceware.org (Postfix) with ESMTPS id CD9203858D1E for ; Mon, 22 Sep 2025 23:18:26 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org CD9203858D1E Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=malsyned.net Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=malsyned.net ARC-Filter: OpenARC Filter v1.0.0 sourceware.org CD9203858D1E Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=50.116.51.30 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1758583106; cv=none; b=Jzk5IK5iXJU75Q2DjRS81SRQky6HbOVXjc3Ouk0MxmfMrVvBBgjocB67sdb4i+MeGnHNOTXq/i2w8SF+DImqv9LSb3/s1S3oHN8dqRP28N5O4F1NNV/nX/i4fiJ+cMbnGBHjo1xkYNQIkmzAJt1H0m/+BqlvSL766PufAZT9IFc= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1758583106; c=relaxed/simple; bh=udEjuCk4jg+pJ2LyKLYfeYYEjsLcLPHfuVhHVOpbG7o=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=Ynw0qPYjZkbycUJ1l/NPAteXmpquSq56t3roh0jHxHEPcYl1NaPiQkOAGBE3YRW0InKYm7rt2wHItcBtRNI4WrfTO1dNkLGPbxt6YzNKodbygl1bZMZgXdJSq6O2ciCYkyt9MCXVakh3/0tPYB1D9u7uSZy+bOJgVcRh87+tvoQ= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org CD9203858D1E DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=uofr.net; s=selector-1; h=Content-Transfer-Encoding:MIME-Version:Message-ID:Date: Subject:To:From:Sender:Reply-To:Cc:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=6B8p9K+MEmBs9rO6TU0OYR59tAqdBwfozV6EcVc63Lk=; b=YBz2x2paIg7hbepcqNFtcGqvay 66iafrmzEpERgkClV4QF+p9TzOUoP1rmt2cZ/ZtGvBy6HAfO53DBEjfPizubuprJM5xnbEwprKGlJ z8YQZ7k7cdGCRFMmVMJujbSKUzLUJ24SzS53GqTUcK7kkQsvV5Cq5Z9l2NH4kt13VjwE=; Received: from c-75-67-96-172.hsd1.ma.comcast.net ([75.67.96.172] helo=malsyned.hsd1.ma.comcast.net) by uofr.net with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1v0pnd-00B0ww-4y for gdb-patches@sourceware.org; Mon, 22 Sep 2025 19:18:26 -0400 From: "Dennis Lambe Jr." To: gdb-patches@sourceware.org Subject: [RFC][PATCH 0/5] [PR gdb/33469] mi, python: Fix comma location when unwinder emits async records Date: Mon, 22 Sep 2025 19:18:15 -0400 Message-ID: <20250922231820.2667505-1-malsyned@malsyned.net> X-Mailer: git-send-email 2.51.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 When frame filters are enabled and a stack unwinder does something to cause an async record to be emitted, -stack-list-frames output is incorrect. A comma is missing from the first async record, and a spurious comma is inserted before the first frame= of the frame list. Example: -stack-list-frames =cmd-param-changedparam="language",value="c++" =cmd-param-changed,param="language",value="auto" ^done,stack=[,frame={level="0",addr="0x0000555555555148",func="main",file="/home/malsyned/projects/gdb-comma-bug/main.c",line="4",arch="i386:x86-64"}] This happens because async record emitters like mi_interp::on_param_changed() are written as though calling mi_out::do_redirect() ensures that a comma will be emitted by the next following mi_ui_out::field_string() call. It's not guaranteed, though. It usually works out by coincidence because the emitter methods are called when no other output record is mid-creation. Emitting async records from a Python unwinder definitely breaks that assumption, but it wouldn't surprise me if there were other ways to violate it. The way async record emitter methods are written implies to me that they are meant to be able to operate correctly in this context, but when emitted by stack unwinders, they don't always. This patch set works by adding an optional `bool async` parameter to ui_out::redirect() and related methods. Most classes derived from ui_out ignore this parameter, but mi_ui_out uses it to decide whether to push a new m_suppress_field_separator onto a stack. RFC: This version of the patch set only changes mi_interp::on_param_changed(), because that's the async record my code was emitting when I found this bug and that I have good test cases for. I'm interested in revving this patch set to change other async record emitters in mi-interp.c based on comments on this version. Dennis Lambe Jr. (5): [PR gdb/33469] ui_out: add optional async param to redirect() [PR gdb/33469] ui_out_redirect_pop: add optional async param [PR gdb/33469] mi_ui_out: redirect: push separator state when async = true [PR gdb/33469] mi-interp: on_param_changed: pass async = true to redirect() [PR gdb/33469] testsuite: framefilters-mi: async records from unwinder gdb/mi/mi-interp.c | 3 +- gdb/mi/mi-out.c | 28 ++++++++++++++----- gdb/mi/mi-out.h | 4 ++- .../gdb.python/py-framefilter-mi.exp | 6 ++++ gdb/testsuite/gdb.python/py-framefilter.py | 15 ++++++++++ gdb/ui-out.h | 14 ++++++---- 6 files changed, 56 insertions(+), 14 deletions(-) -- 2.51.0