From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id eJSLOSeHnGhiaQIAWB0awg (envelope-from ) for ; Wed, 13 Aug 2025 08:37:59 -0400 Authentication-Results: simark.ca; dkim=pass (2048-bit key; unprotected) header.d=gnu.org header.i=@gnu.org header.a=rsa-sha256 header.s=fencepost-gnu-org header.b=gJnwmfQM; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id D9D9E1E04C; Wed, 13 Aug 2025 08:37:59 -0400 (EDT) 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 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 260941E04C for ; Wed, 13 Aug 2025 08:37:59 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id A85383858402 for ; Wed, 13 Aug 2025 12:37:58 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A85383858402 Authentication-Results: sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=gnu.org header.i=@gnu.org header.a=rsa-sha256 header.s=fencepost-gnu-org header.b=gJnwmfQM Received: from eggs.gnu.org (eggs.gnu.org [IPv6:2001:470:142:3::10]) by sourceware.org (Postfix) with ESMTPS id CC10C3858D20 for ; Wed, 13 Aug 2025 12:37:28 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org CC10C3858D20 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gnu.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gnu.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org CC10C3858D20 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2001:470:142:3::10 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1755088648; cv=none; b=dmn6367cwkteVOIlWjBdN5e/TmMQjB3JP9/9JLQSFUD14Fa8hd/5t2x7z5uMWWpGVE2ZSUvNzYmY4V+GyI30EYCzWlg2FZKFDWSN2Ks6O7zZxCEWoZNNCgN/g2bjTObzeuxOVKvuQCDqww4gkvFEN/1Bur9UXy9pwvlBRlboIVs= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1755088648; c=relaxed/simple; bh=KdoLbRSz7WtEX47qym9wG6+9pfxIB5GhteDsIuIVlYg=; h=DKIM-Signature:Date:Message-Id:From:To:Subject; b=sn8sZKf9r1AECgh+++pYAoiKS+ehFC/w9mpwYr3L6nigwNmjwh7iZs5aC0zgzU+gwxUz/7s2Uq+g7Q4QbbWobYNNJn9yFTWlDELrVodbjRvjKvw7SmyulH3uLNNdWPgjgy12B5iXMeN2Nqr4P7kvkGrSkzY/I73Ed2Xp6PXg8RM= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org CC10C3858D20 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1umAjO-0000D0-FX; Wed, 13 Aug 2025 08:37:26 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=WsRgZp3lx8cHELeHTIxpPz/O0SNjVJmX78UAyRCRNnI=; b=gJnwmfQM4JZz JL4hW4OLeE+ZWwHoiEIPUHjedaLcsQA6UiFR5GRn/N0UIbndzG1JOUeSrujaroM++c180w4bTrc8k C5zbqgZntHps72IodvaEsCakgipbXrTJcj+a+5FEGzu7t3vR6YZZrMRFD0ppKMUz4YNW6bleHysLy T78lbd5Tv/HSs01E/FV8+3aWiosrSdZEy613IIKrP7/3Pbs7NP8UVtHiTC8lSCg1vZetwHh49LDwo KQK1/bHR+i5XaszFddjBH0XsHQzC85so5WijuWa+Tb9VcPAVznr9nuTwgZ7FHeK8A66K9CAsnXPk4 xPC9qoB52vGQXgG8DkhP0A==; Date: Wed, 13 Aug 2025 15:37:22 +0300 Message-Id: <86zfc3mm7x.fsf@gnu.org> From: Eli Zaretskii To: Andrew Burgess Cc: gdb-patches@sourceware.org In-Reply-To: <6f0201ff39f0f485bb447e7c3953c1aa751c9474.1755080429.git.aburgess@redhat.com> (message from Andrew Burgess on Wed, 13 Aug 2025 11:30:52 +0100) Subject: Re: [PATCHv7 4/4] gdb/python: extend gdb.write to support styled output References: <6f0201ff39f0f485bb447e7c3953c1aa751c9474.1755080429.git.aburgess@redhat.com> 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 > From: Andrew Burgess > Cc: Andrew Burgess > Date: Wed, 13 Aug 2025 11:30:52 +0100 > > It is already possible to produce styled output from Python by > converting the gdb.Style to its escape code sequence, and writing that > to the output stream. > > But this commit adds an alternative option to the mix by extending the > existing gdb.write() function to accept a 'style' argument. The value > of this argument can be 'None' to indicate no style change should be > performed, this is the default, and matches the existing behaviour. > > Or the new 'style' argument can be a gdb.Style object, in which case > the specified style is applied only for the string passed to > gdb.write, after which the default style is re-applied. > > Using gdb.write with a style object more closely matches how GDB > handles styling internally, and has the benefit that the user doesn't > need to remember to restore the default style when they are done. > --- > gdb/NEWS | 3 ++ > gdb/doc/python.texi | 9 +++- > gdb/python/py-style.c | 27 ++++++++++ > gdb/python/python-internal.h | 15 ++++++ > gdb/python/python.c | 30 ++++++++++-- > .../gdb.python/py-color-pagination.exp | 49 +++++++++++++++++++ > .../gdb.python/py-color-pagination.py | 16 ++++++ > gdb/testsuite/gdb.python/py-style.exp | 29 +++++++++++ > 8 files changed, 172 insertions(+), 6 deletions(-) The documentation parts are okay, thanks. Reviewed-By: Eli Zaretskii