From patchwork Sat May 27 18:28:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom de Vries X-Patchwork-Id: 70184 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 281283857717 for ; Sat, 27 May 2023 18:28:24 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 281283857717 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1685212104; bh=RaEtGTGJ2KqNASOpipeHy7TY35y+2ZZ0jdiI/IrOF9E=; h=To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=Icup0A1VNeoSESA8PEGmd1HZs+k9emBguXTZ87F+rvRBHOIZ3olNSoxhb6MUtyac0 Qa2wqTZtJewz5ZNJC5EQ1aTX+MndDeDQS4mPsAp5m9uncsGJAlzQ/G6X7ZmBIYXgVE SNwX8qkQ8CPb11McQZmlwvQdLGGP2+pDgRKQmpyU= X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from smtp-out1.suse.de (smtp-out1.suse.de [IPv6:2001:67c:2178:6::1c]) by sourceware.org (Postfix) with ESMTPS id 457693858C66 for ; Sat, 27 May 2023 18:27:57 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 457693858C66 Received: from imap1.suse-dmz.suse.de (imap1.suse-dmz.suse.de [192.168.254.73]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id C448C21AEF; Sat, 27 May 2023 18:27:55 +0000 (UTC) Received: from imap1.suse-dmz.suse.de (imap1.suse-dmz.suse.de [192.168.254.73]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap1.suse-dmz.suse.de (Postfix) with ESMTPS id AF05913532; Sat, 27 May 2023 18:27:55 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap1.suse-dmz.suse.de with ESMTPSA id yH2zKatLcmSeCwAAGKfGzw (envelope-from ); Sat, 27 May 2023 18:27:55 +0000 To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [PATCH 2/3] [gdb/tui] Add tui_get_cmd_set/show_list Date: Sat, 27 May 2023 20:28:08 +0200 Message-Id: <20230527182809.20569-3-tdevries@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20230527182809.20569-1-tdevries@suse.de> References: <20230527182809.20569-1-tdevries@suse.de> MIME-Version: 1.0 X-Spam-Status: No, score=-12.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, 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.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Tom de Vries via Gdb-patches From: Tom de Vries Reply-To: Tom de Vries Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org Sender: "Gdb-patches" Add new functions: - tui_get_cmd_set_list, and - tui_get_cmd_show_list, similar to tui_get_cmd_list that allow introducing "set/show tui" commands in files other than tui/tui-win.c. No functional changes. No users in this patch. Tested on x86_64-linux. --- gdb/tui/tui-win.c | 50 ++++++++++++++++++++++++++++++++++++++++------- gdb/tui/tui-win.h | 6 ++++++ 2 files changed, 49 insertions(+), 7 deletions(-) diff --git a/gdb/tui/tui-win.c b/gdb/tui/tui-win.c index 7abd1e225b9..c187f7c33ad 100644 --- a/gdb/tui/tui-win.c +++ b/gdb/tui/tui-win.c @@ -336,6 +336,47 @@ tui_get_cmd_list (void) return &tuilist; } +/* The "tui set" command list. */ + +static struct cmd_list_element *tui_setlist; + +/* The "tui show" command list. */ + +static struct cmd_list_element *tui_showlist; + +/* Initialize the tui_setlist and tui_showlist variables. */ + +static void +init_tui_set_show_lists () +{ + if (tui_setlist != nullptr) + return; + + add_setshow_prefix_cmd ("tui", class_tui, + _("TUI configuration variables."), + _("TUI configuration variables."), + &tui_setlist, &tui_showlist, + &setlist, &showlist); +} + +/* See tui-win.h. */ + +struct cmd_list_element ** +tui_get_cmd_set_list () +{ + init_tui_set_show_lists (); + return &tui_setlist; +} + +/* See tui-win.h. */ + +struct cmd_list_element ** +tui_get_cmd_show_list () +{ + init_tui_set_show_lists (); + return &tui_showlist; +} + /* The set_func hook of "set tui ..." commands that affect the window borders on the TUI display. */ @@ -1127,16 +1168,11 @@ void _initialize_tui_win (); void _initialize_tui_win () { - static struct cmd_list_element *tui_setlist; - static struct cmd_list_element *tui_showlist; + /* Initialize tui_setlist and tui_showlist. */ + init_tui_set_show_lists (); /* Define the classes of commands. They will appear in the help list in the reverse of this order. */ - add_setshow_prefix_cmd ("tui", class_tui, - _("TUI configuration variables."), - _("TUI configuration variables."), - &tui_setlist, &tui_showlist, - &setlist, &showlist); cmd_list_element *refresh_cmd = add_cmd ("refresh", class_tui, tui_refresh_all_command, diff --git a/gdb/tui/tui-win.h b/gdb/tui/tui-win.h index 3d35f1dfb7f..4de938fa280 100644 --- a/gdb/tui/tui-win.h +++ b/gdb/tui/tui-win.h @@ -48,6 +48,12 @@ extern void tui_update_gdb_sizes (void); /* Create or get the TUI command list. */ struct cmd_list_element **tui_get_cmd_list (void); +/* Create or get the TUI set command list. */ +extern struct cmd_list_element **tui_get_cmd_set_list (); + +/* Create or get the TUI show command list. */ +extern struct cmd_list_element **tui_get_cmd_show_list (); + /* Whether compact source display should be used. */ extern bool compact_source;