From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id ke/VLBsXLGpxTAMAWB0awg (envelope-from ) for ; Fri, 12 Jun 2026 10:26:35 -0400 Authentication-Results: simark.ca; dkim=fail reason="signature verification failed" (768-bit key; unprotected) header.d=tromey.com header.i=@tromey.com header.a=rsa-sha256 header.s=default header.b=snSg4KKL; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id B2C6F1E098; Fri, 12 Jun 2026 10:26:35 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-5.1 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIM_INVALID,DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham autolearn_force=no version=4.0.1 Received: from vm01.sourceware.org (vm01.sourceware.org [IPv6:2620:52:6:3111::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 11F661E070 for ; Fri, 12 Jun 2026 10:26:35 -0400 (EDT) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 1DAD74BB24C5 for ; Fri, 12 Jun 2026 14:26:34 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1DAD74BB24C5 Authentication-Results: sourceware.org; dkim=fail reason="signature verification failed" (768-bit key, unprotected) header.d=tromey.com header.i=@tromey.com header.a=rsa-sha256 header.s=default header.b=snSg4KKL Received: from omta38.uswest2.a.cloudfilter.net (omta38.uswest2.a.cloudfilter.net [35.89.44.37]) by sourceware.org (Postfix) with ESMTPS id DB7BF4BA23CA for ; Fri, 12 Jun 2026 14:25:26 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org DB7BF4BA23CA Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=tromey.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=tromey.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org DB7BF4BA23CA Authentication-Results: sourceware.org; arc=none smtp.remote-ip=35.89.44.37 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1781274327; cv=none; b=TI9h+psUAyNe14F1CghHXT+DH+o4FBucDFWw3fVVGwJfSI1aXVfqBo5Flnc6q1zr5fspJnTyp+cDfqKKuy526NaDfsTWE2aPSvPZCcWh+JUwq4NKwhs792HbA7W3MyJjANLSmkt3kGG5owIltvVtr7/iC36AIXBXwu+1OiiVYP8= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1781274327; c=relaxed/simple; bh=RjeaSjSPtpH5XuDd3v5hlyftL71Iz1Ov5W0gupth6Ss=; h=DKIM-Signature:From:Date:Subject:MIME-Version:Message-Id:To; b=et1o5IhsipfDTE1THfFEpNLMUu7coJVtYws1Mw5AleZiR1yfrybnwtxvLn4MHOcdcNhnYTUTdYruLcVIE5xzpDOlQSdc9sS9SCB9bEOZfM0XtHKJgvJpIY/m6QlLq1sgv8ZtCj6WjIbXmAOZIGAV9JN33fdSQJ5XVLqXM0mAlAo= ARC-Authentication-Results: i=1; sourceware.org; dkim=policy (768-bit key, unprotected) header.d=tromey.com header.i=@tromey.com header.a=rsa-sha256 header.s=default header.b=snSg4KKL reason="signing key too small" DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org DB7BF4BA23CA Received: from eig-obgw-5006b.ext.cloudfilter.net ([10.0.29.217]) by cmsmtp with ESMTPS id Xtzww3nGIMFEgY2p3wwZcE; Fri, 12 Jun 2026 14:25:25 +0000 Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTPS id Y2p2wyLiQhFZUY2p3wJt5C; Fri, 12 Jun 2026 14:25:25 +0000 X-Authority-Analysis: v=2.4 cv=RduQC0tv c=1 sm=1 tr=0 ts=6a2c16d5 a=ApxJNpeYhEAb1aAlGBBbmA==:117 a=ApxJNpeYhEAb1aAlGBBbmA==:17 a=IkcTkHD0fZMA:10 a=FelO9ux0wxsA:10 a=ItBw4LHWJt0A:10 a=ssTsSFuV0ImknHnEGWUA:9 a=QEXdDO2ut3YA:10 a=DCx65vhANUyCzuf5D8fC:22 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=Cc:To:In-Reply-To:References:Message-Id: Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date:From:Sender: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=e+de4D1uPy5ssDKKaTAP4gGuozeJS9aIZ+ytQUcZJD4=; b=snSg4KKLA1MZGoP+3rYVPiS7Oq NyB3cFZQrPQejjeirN4Z/u74K7lAjuPB8LpnO450rnD55BbarEQsbMsSSFFEzxTRdShQzrmUuaOnv N+4W0837N8P6sr072LCUNo51l; Received: from 75-166-225-82.hlrn.qwest.net ([75.166.225.82]:50348 helo=[192.168.122.1]) by box5379.bluehost.com with esmtpsa (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.99.2) (envelope-from ) id 1wY2p2-00000001fM4-26Qd; Fri, 12 Jun 2026 08:25:24 -0600 From: Tom Tromey Date: Fri, 12 Jun 2026 08:25:23 -0600 Subject: [PATCH 3/5] Allow "phony" ui-out tables MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20260612-submit-zebra-style-v1-3-cfd00b5c984c@tromey.com> References: <20260612-submit-zebra-style-v1-0-cfd00b5c984c@tromey.com> In-Reply-To: <20260612-submit-zebra-style-v1-0-cfd00b5c984c@tromey.com> To: gdb-patches@sourceware.org Cc: Tom Tromey X-Mailer: b4 0.14.3 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - box5379.bluehost.com X-AntiAbuse: Original Domain - sourceware.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - tromey.com X-BWhitelist: no X-Source-IP: 75.166.225.82 X-Source-L: No X-Exim-ID: 1wY2p2-00000001fM4-26Qd X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 75-166-225-82.hlrn.qwest.net ([192.168.122.1]) [75.166.225.82]:50348 X-Source-Auth: tom+tromey.com X-Email-Count: 4 X-Org: HG=bhshared;ORG=bluehost; X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-CMAE-Envelope: MS4xfF1hNU1j6ZOdIfGskpdyZ8WPE62n+tb0R8K5nVT+QzKOJg9CMf/btcxLKzH5OfquuiJngKf/WwqHLLtBBGvPzHpuePUwkYObffXnoVubCnGHjwp01BFd pxlMnaddurUo2Xe2XtxU87Ew8WIC0uLgLHQ1DqLy3z44aaGKc8Pofo+hroLu5y/yxZQdy/3yYuHVedgP7mLubynT47MmqpjR9aY= 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 In the zebra-striping patch, it's convenient to wrap a stack trace in a ui-out table. However, using a real table isn't really desirable, because that would mean printing headers. So, this patch adds a hack specifically for stack traces: a phony table, that does not have field headers at all. --- gdb/cli-out.c | 2 +- gdb/cli-out.h | 8 +++++++- gdb/mi/mi-out.c | 9 ++++++--- gdb/mi/mi-out.h | 2 +- gdb/python/py-uiout.h | 5 +++-- gdb/ui-out.c | 25 ++++++++++++++++++++++--- gdb/ui-out.h | 18 +++++++++++++++++- 7 files changed, 57 insertions(+), 12 deletions(-) diff --git a/gdb/cli-out.c b/gdb/cli-out.c index d8ac13ab827..e1501f5c652 100644 --- a/gdb/cli-out.c +++ b/gdb/cli-out.c @@ -59,7 +59,7 @@ cli_ui_out::do_table_body () /* Mark end of a table */ void -cli_ui_out::do_table_end () +cli_ui_out::do_table_end (bool phony) { m_suppress_output = false; } diff --git a/gdb/cli-out.h b/gdb/cli-out.h index 74307074a7c..ca138e5ad9a 100644 --- a/gdb/cli-out.h +++ b/gdb/cli-out.h @@ -44,8 +44,14 @@ class cli_ui_out : public ui_out virtual void do_table_begin (int nbrofcols, int nr_rows, const char *tblid) override; + + /* This overload is used for "phony" tables. */ + void do_table_begin () override + { + } + virtual void do_table_body () override; - virtual void do_table_end () override; + virtual void do_table_end (bool phony) override; virtual void do_table_header (int width, ui_align align, const std::string &col_name, const std::string &col_hdr) override; diff --git a/gdb/mi/mi-out.c b/gdb/mi/mi-out.c index 41b0ee8cdbd..0d60c2557e7 100644 --- a/gdb/mi/mi-out.c +++ b/gdb/mi/mi-out.c @@ -53,10 +53,13 @@ mi_ui_out::do_table_body () /* Mark end of a table. */ void -mi_ui_out::do_table_end () +mi_ui_out::do_table_end (bool phony) { - close (ui_out_type_list); /* body */ - close (ui_out_type_tuple); + if (!phony) + { + close (ui_out_type_list); /* body */ + close (ui_out_type_tuple); + } } /* Specify table header. */ diff --git a/gdb/mi/mi-out.h b/gdb/mi/mi-out.h index d1d26718ac4..6dece4d42b8 100644 --- a/gdb/mi/mi-out.h +++ b/gdb/mi/mi-out.h @@ -57,7 +57,7 @@ class mi_ui_out : public ui_out virtual void do_table_header (int width, ui_align align, const std::string &col_name, const std::string &col_hdr) override; - virtual void do_table_end () override; + virtual void do_table_end (bool phony) override; virtual void do_begin (ui_out_type type, const char *id) override; virtual void do_end (ui_out_type type) override; diff --git a/gdb/python/py-uiout.h b/gdb/python/py-uiout.h index 21c068e9077..2bf0c3a7b46 100644 --- a/gdb/python/py-uiout.h +++ b/gdb/python/py-uiout.h @@ -73,9 +73,10 @@ class py_ui_out : public ui_out } void do_table_body () override { } - void do_table_end () override + void do_table_end (bool phony) override { - do_end (ui_out_type_list); + if (!phony) + do_end (ui_out_type_list); } void do_table_header (int width, ui_align align, const std::string &col_name, diff --git a/gdb/ui-out.c b/gdb/ui-out.c index ac792b43905..1c8ceaa90ee 100644 --- a/gdb/ui-out.c +++ b/gdb/ui-out.c @@ -184,6 +184,12 @@ class ui_out_table int entry_level () const; + /* True if this is a "phony" table. */ + bool phony () const + { + return m_nr_cols == 0; + } + private: state m_state; @@ -356,9 +362,20 @@ previous table_end.")); m_table_up = std::make_unique (level () + 1, nr_cols, tblid); + gdb_assert (!m_table_up->phony ()); do_table_begin (nr_cols, nr_rows, tblid.c_str ()); } +/* See ui-out.h. */ + +void +ui_out::table_begin () +{ + gdb_assert (m_table_up == nullptr); + m_table_up = std::make_unique (level () + 1, 0, ""); + do_table_begin (); +} + void ui_out::table_header (int width, ui_align alignment, const std::string &col_name, const std::string &col_hdr) @@ -369,7 +386,8 @@ after a table_begin and before a table_body.")); m_table_up->append_header (width, alignment, col_name, col_hdr); - do_table_header (width, alignment, col_name, col_hdr); + if (!m_table_up->phony ()) + do_table_header (width, alignment, col_name, col_hdr); } void @@ -381,7 +399,8 @@ ui_out::table_body () m_table_up->start_body (); - do_table_body (); + if (!m_table_up->phony ()) + do_table_body (); } void @@ -390,7 +409,7 @@ ui_out::table_end () if (m_table_up == nullptr) internal_error (_("misplaced table_end or missing table_begin.")); - do_table_end (); + do_table_end (m_table_up->phony ()); m_table_up = nullptr; } diff --git a/gdb/ui-out.h b/gdb/ui-out.h index a7230846115..12da0084332 100644 --- a/gdb/ui-out.h +++ b/gdb/ui-out.h @@ -341,8 +341,14 @@ class ui_out virtual void do_table_begin (int nbrofcols, int nr_rows, const char *tblid) = 0; + + /* This is only used for phony tables. */ + virtual void do_table_begin () + { + } + virtual void do_table_body () = 0; - virtual void do_table_end () = 0; + virtual void do_table_end (bool phony) = 0; virtual void do_table_header (int width, ui_align align, const std::string &col_name, const std::string &col_hdr) = 0; @@ -396,6 +402,8 @@ class ui_out /* A table can only be started or ended by ui_out_emit_table. */ friend class ui_out_emit_table; void table_begin (int nr_cols, int nr_rows, const std::string &tblid); + /* This overload is only used for phony tables. */ + void table_begin (); void table_end (); /* A helper for vmessage that wraps a call to do_message. This will @@ -460,6 +468,14 @@ class ui_out_emit_table m_uiout->table_begin (nr_cols, nr_rows, tblid); } + /* This constructor creates a "phony" table -- this is a hack + intended for use just by the stack-generation code. */ + explicit ui_out_emit_table (ui_out *uiout) + : m_uiout (uiout) + { + m_uiout->table_begin (); + } + ~ui_out_emit_table () { m_uiout->table_end (); -- 2.49.0