From patchwork Wed May 29 18:30:21 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pedro Alves X-Patchwork-Id: 32904 Received: (qmail 129564 invoked by alias); 29 May 2019 18:30:38 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 129167 invoked by uid 89); 29 May 2019 18:30:29 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 spammy=H*RU:209.85.128.65, HX-Spam-Relays-External:209.85.128.65 X-HELO: mail-wm1-f65.google.com Received: from mail-wm1-f65.google.com (HELO mail-wm1-f65.google.com) (209.85.128.65) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 29 May 2019 18:30:25 +0000 Received: by mail-wm1-f65.google.com with SMTP id d17so2326988wmb.3 for ; Wed, 29 May 2019 11:30:24 -0700 (PDT) Return-Path: Received: from ?IPv6:2001:8a0:f913:f700:4eeb:42ff:feef:f164? ([2001:8a0:f913:f700:4eeb:42ff:feef:f164]) by smtp.gmail.com with ESMTPSA id 74sm193518wma.7.2019.05.29.11.30.22 (version=TLS1_3 cipher=AEAD-AES128-GCM-SHA256 bits=128/128); Wed, 29 May 2019 11:30:22 -0700 (PDT) Subject: Re: [PATCH 15/24] Introduce rename_cmd To: Philippe Waroquiers , gdb-patches@sourceware.org References: <20190522205327.2568-1-palves@redhat.com> <20190522205327.2568-16-palves@redhat.com> <1558814323.1454.22.camel@skynet.be> <3db59d5f-481b-64d0-5684-060b9585c3ac@redhat.com> From: Pedro Alves Message-ID: Date: Wed, 29 May 2019 19:30:21 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 MIME-Version: 1.0 In-Reply-To: <3db59d5f-481b-64d0-5684-060b9585c3ac@redhat.com> On 5/29/19 5:03 PM, Pedro Alves wrote: > There are other ways to implement this. I could move the > "raw-frame-arguments" option_def out of the frame_print_option_defs > array, so that it doesn't get installed as a command, and leave the > "set print raw frame-arguments" add_setshow... call in place. > I guess it wouldn't be a big deal. So turns out the change would be pretty simple. I'm undecided which version to use... I suppose this version is simpler and a little bit more efficient. Preferences? From fcbbc6a33276a8ec59425174f6868379d0a239a3 Mon Sep 17 00:00:00 2001 From: Pedro Alves Date: Wed, 29 May 2019 19:04:05 +0100 Subject: [PATCH] no-rename --- gdb/stack.c | 44 ++++++++++++++++++++++++-------------------- 1 file changed, 24 insertions(+), 20 deletions(-) diff --git a/gdb/stack.c b/gdb/stack.c index 3054c797c74..2c58b0d728b 100644 --- a/gdb/stack.c +++ b/gdb/stack.c @@ -126,16 +126,16 @@ or both. Note that one or both of these values may be ."), N_("Show printing of non-scalar frame arguments"), NULL /* help_doc */ }, +}; - boolean_option_def { - "raw-frame-arguments", - [] (frame_print_options *opt) { return &opt->print_raw_frame_arguments; }, - NULL, /* show_cmd_cb */ - N_("Set whether to print frame arguments in raw form."), - N_("Show whether to print frame arguments in raw form."), - N_("If set, frame arguments are printed in raw form, bypassing any\n\ -pretty-printers for that value.") - }, +/* The "raw-frame-arguments" option. Defined separately because the + corresponding "set" command is called "set print raw + frame-arguments", with space instead of dash. */ +static const boolean_option_def raw_frame_arguments_option_def { + "raw-frame-arguments", + [] (frame_print_options *opt) { return &opt->print_raw_frame_arguments; }, + NULL, /* show_cmd_cb */ + N_("Set whether to print frame arguments in raw form."), }; /* Options for the "backtrace" command. */ @@ -2015,13 +2015,14 @@ backtrace_command_1 (const frame_print_options &fp_opts, /* Create an option_def_group array grouping all the "backtrace" options, with FP_OPTS, BT_CMD_OPT, SET_BT_OPTS as contexts. */ -static inline std::array +static inline std::array make_backtrace_options_def_group (frame_print_options *fp_opts, backtrace_cmd_options *bt_cmd_opts, set_backtrace_options *set_bt_opts) { return {{ { {frame_print_option_defs}, fp_opts }, + { raw_frame_arguments_option_def.def (), fp_opts }, { {set_backtrace_option_defs}, set_bt_opts }, { {backtrace_command_option_defs}, bt_cmd_opts } }}; @@ -3288,14 +3289,17 @@ source line."), (class_stack, &user_frame_print_options, frame_print_option_defs, &setprintlist, &showprintlist); - /* The above installs a "set print raw-frame-arguments" command, - because there's an option called "print -raw-frame-arguments". - Rename the command to "set print raw frame-arguments" (space - instead of dash), to keep backward compatibility -- the "raw - frame-arguments" command already existed when print options were - first added. */ - rename_cmd ("raw-frame-arguments", &setprintlist, - "frame-arguments", &setprintrawlist); - rename_cmd ("raw-frame-arguments", &showprintlist, - "frame-arguments", &showprintrawlist); + /* This one is not defined by the add_setshow_cmds_for_options call + above, because the option is called "raw-frame-arguments", while + the command is called "set print raw frame-arguments", with space + instead of dash. */ + add_setshow_boolean_cmd ("frame-arguments", no_class, + &user_frame_print_options.print_raw_frame_arguments, + _("\ +Set whether to print frame arguments in raw form."), _("\ +Show whether to print frame arguments in raw form."), _("\ +If set, frame arguments are printed in raw form, bypassing any\n\ +pretty-printers for that value."), + NULL, NULL, + &setprintrawlist, &showprintrawlist); }