From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id aM1ZBDEbaWnKAQUAWB0awg (envelope-from ) for ; Thu, 15 Jan 2026 11:52:01 -0500 Authentication-Results: simark.ca; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=eH4w3ExB; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 02D161E0DD; Thu, 15 Jan 2026 11:52:00 -0500 (EST) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-3.4 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,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 vm01.sourceware.org (vm01.sourceware.org [38.145.34.32]) (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 820D51E070 for ; Thu, 15 Jan 2026 11:52:00 -0500 (EST) Received: from vm01.sourceware.org (localhost [127.0.0.1]) by sourceware.org (Postfix) with ESMTP id D647C4BA2E1D for ; Thu, 15 Jan 2026 16:51:59 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D647C4BA2E1D Authentication-Results: sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=eH4w3ExB Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTP id 71FBA4BA2E30 for ; Thu, 15 Jan 2026 16:51:34 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 71FBA4BA2E30 Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 71FBA4BA2E30 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1768495894; cv=none; b=MSKBY52g11/4bALmBNoDZBTK8itTaDMjJQHmc2Isk2rqutXrNM1KXOoc6iZPo/0AiwRnST0UKA8Vy+XaFg//uGqkYhBmgupzqcqzqaRJPBqB0tqXgzd0Sb3FiZSrhsfY3o02AHhPENN3VfAdvmA8ftblzW/JDBfwq3aQWpESZao= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1768495894; c=relaxed/simple; bh=JbW+38WUSdRmfJiSAWRsTeUSBipT2g+wFDXHjIH0AxY=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=faoODIRC3aomBDgdScyd8xfEqXbUA+pCr1DHFkatYefJh4dvYfdTIUIWKXPqKY+NrpdcFe6Vn+So1SFXJQDwsq82Du4zwDuzIvtTEK/ZnHQxghk13lQpgWt8W+pMlSGATg89eJQCYZr61fpjgh0/PF0PdKXv1qA5glznQMydVkM= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 71FBA4BA2E30 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1768495894; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=JbW+38WUSdRmfJiSAWRsTeUSBipT2g+wFDXHjIH0AxY=; b=eH4w3ExBs8rJ9R5x8VOY0FUR4WZlERCCLAMdGucYCM0k5IhlUkAWx+9CuymqvM5NyvAEH6 nKPRCu9ko3Z3eCFYmYJnAayQxN6gfBZX2xB+5Z8XkQWk0tEmLgjinVHNPGnSoC9hsRoO/K wqshavdMWsdUecuPoRKViK96yBXmbks= Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-325-VvlAPZeDMk2ykGskTH8wbQ-1; Thu, 15 Jan 2026 11:51:32 -0500 X-MC-Unique: VvlAPZeDMk2ykGskTH8wbQ-1 X-Mimecast-MFC-AGG-ID: VvlAPZeDMk2ykGskTH8wbQ_1768495891 Received: by mail-wm1-f71.google.com with SMTP id 5b1f17b1804b1-47ee3dd7fc8so9942175e9.3 for ; Thu, 15 Jan 2026 08:51:32 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1768495891; x=1769100691; h=mime-version:message-id:date:references:in-reply-to:subject:cc:to :from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=JbW+38WUSdRmfJiSAWRsTeUSBipT2g+wFDXHjIH0AxY=; b=ODg3ObeuPrsSbQ3bJv7ziwgYYyvRwRJ6BM8Yew0h7AcbSNUPYsACtQfj/BbhpLCIar DhHl8uyVO3E3KJxjY53fB9hovQNHZGnE92a9mjQH48uAxplBmHkYOieSEzG/8hn+QBGU Z0vwc66+et+uFM3feZX8+S3B6z9LoZO7e8wE/hFJMgxOtpGxdEsz5LIPHXxTXRNRTgPD OY9X4bEroiIMaNtKaG5zeTX1+2a955M1d2Xd66RHthy/Pa/BlaGo0dTcUCTv8ZCW2wbg QGnefV268fl+8/kJu2Ich9dVrTzp3JqEm834bKNSXrKOQQWaVt2zSSoC7eE5vyR8HwUH 5GxA== X-Gm-Message-State: AOJu0YxQo1xzC1xZBr/dpDLErCH+wo3zk2F/YmlrdsT8BWHrXIWF3Fk3 EbQZGOAJz1zsqMPPdjgn+qfWoQyC5nj4370YICSMXs7rCsufaX4U038pDfwQfVFMXzpAS+R8XlA o3EYJND8+HcFCpyFhebhBpVSW4zNDHcF31TeyIWgVOjuLDzaCouna5BcahpDMgKM= X-Gm-Gg: AY/fxX5ZG7jyCtdoG1i7O0yw3+RVroLZ7XFUP5VaPt25J+7JdAcY6GD6iiOihaI7bJ0 25C37ogtnAdB+FoD5CRHHXF2OsEmls7Ixchx4LEGGlp4fgyDqDoHTQU9fnlBoy1/QYBtmtg0z5H mHDOMmDQSqfCeoDbfF74piIGui5j9/qiNHJZzbzsJWdm5gd7Jxx7Tokt3zsIw3OD29bWXN8akhn 9N8HscMDuf5sJPN66C8CUD7+37mt42PNO6GR6tlFxIHM1/e+w6pF7vHKzddQWT2zog25RVDChUV E2C5LuCiVkEdl/wSAcP11YmUpjudn3zcrtDkZehMxRhUDISMg4Raj1lDzSgIGbmVKl2urp1acji yPSSCNNk/cXU4YwQE/D6dv9uycBAA X-Received: by 2002:a05:600c:5492:b0:47d:885d:d2ff with SMTP id 5b1f17b1804b1-4801e34176dmr4534205e9.29.1768495891423; Thu, 15 Jan 2026 08:51:31 -0800 (PST) X-Received: by 2002:a05:600c:5492:b0:47d:885d:d2ff with SMTP id 5b1f17b1804b1-4801e34176dmr4534015e9.29.1768495891061; Thu, 15 Jan 2026 08:51:31 -0800 (PST) Received: from localhost (13.81.93.209.dyn.plus.net. [209.93.81.13]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-47ee2840b7csm46133785e9.14.2026.01.15.08.51.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Jan 2026 08:51:30 -0800 (PST) From: Andrew Burgess To: Tom Tromey Cc: gdb-patches@sourceware.org, Patryk Sondej Subject: Re: [PATCH] gdb: fix handling of raw ANSI escape sequences printed from Python In-Reply-To: <87h5smg92i.fsf@tromey.com> References: <2b96eaf47bcb84cf955f4e59ec34c8582b5ceb81.1768475197.git.aburgess@redhat.com> <87h5smg92i.fsf@tromey.com> Date: Thu, 15 Jan 2026 16:51:29 +0000 Message-ID: <877btiu8dq.fsf@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: 7K93fc3STpktz74m7DIn-egNfkuGzYyh-zPyqIcc2mQ_1768495891 X-Mimecast-Originator: redhat.com Content-Type: text/plain 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 Tom Tromey writes: >>>>>> "Andrew" == Andrew Burgess writes: > > Andrew> Prior to this commit GDB would always forward any ANSI escape > Andrew> sequences directly to the output stream, but this meant that GDB > Andrew> didn't know which style was currently in effect. > > Andrew> The above commit changed GDB so that we would parse the ANSI escape > Andrew> sequence, and then apply it to the output stream, this allowed GDB to > Andrew> track which style was in use, which in turn meant that GDB could > Andrew> correctly suspend the style and reapply it when the pager was > Andrew> activated. > > I think I probably didn't fully understand this patch in retrospect. > > If the pager is already parsing escape sequences and reacting > accordingly, then I wonder if there's any need at all for > ui_file::emit_style_escape. I'm not entirely sure what you mean here, but I do wonder if the m_applied_style should be moved from ui_file, and ui_file should become a pure interface class. It's kind-of weird that the pager class ends up tracking some state within its grandparent's ui_file::m_applied_style, but then it also needs to track and mirror some state from within m_stream::m_applied_state. I wonder if there should be a new class which inherits from ui_file which actually implements styling, and would be used for the basic streams. Then for pager, more of the state would actually reside within that class, which I think would simplify the code slightly. > > Andrew> This can be easily fixed by starting from the current style, rather > Andrew> than the default style. > > Approved-By: Tom Tromey I'm going to check this in to both master, and the 17 branch. Thanks, Andrew