From patchwork Thu May 30 19:53:24 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pedro Alves X-Patchwork-Id: 32936 Received: (qmail 125895 invoked by alias); 30 May 2019 19:53:51 -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 125859 invoked by uid 89); 30 May 2019 19:53:51 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-25.3 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, SPF_HELO_PASS autolearn=ham version=3.3.1 spammy=renames, displayed X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 30 May 2019 19:53:48 +0000 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 29EBB308A968 for ; Thu, 30 May 2019 19:53:47 +0000 (UTC) Received: from localhost.localdomain (ovpn04.gateway.prod.ext.ams2.redhat.com [10.39.146.4]) by smtp.corp.redhat.com (Postfix) with ESMTP id B861B5D9E1 for ; Thu, 30 May 2019 19:53:46 +0000 (UTC) From: Pedro Alves To: gdb-patches@sourceware.org Subject: [PATCH v2 15/24] "set print raw frame-arguments" -> "set print raw-frame-arguments" Date: Thu, 30 May 2019 20:53:24 +0100 Message-Id: <20190530195333.20448-16-palves@redhat.com> In-Reply-To: <20190530195333.20448-1-palves@redhat.com> References: <20190530195333.20448-1-palves@redhat.com> A following patch will introduce options for the "backtrace" command, based on some "set print" and "set backtrace" settings. There's one setting in particular that is a bit annoying if we want to describe the backtrace options and the settings commands using the same data structures: "set print raw frame-arguments" The problem is that space between "raw" and "frame-arguments". Calling the option "bt -raw frame-arguments" would be odd. So I'm calling the option "bt -raw-frame-arguments" instead. And for consistency, this patch renames the set/show commands to: "set print raw-frame-arguments" "show print raw-frame-arguments" I.e., dash instead of space. The old commands are left in place, but marked deprecated. We need to adjust a couple testcases, because the relevant tests use gdb_test_no_output and the old commands are no longer silent: (gdb) set print raw frame-arguments on Warning: command 'set print raw frame-arguments' is deprecated. Use 'set print raw-frame-arguments'. gdb/ChangeLog: yyyy-mm-dd Pedro Alves * NEWS (New commands): Mention set/show print raw-frame-arguments, and that "set/show print raw frame-arguments" are now deprecated. * cli/cli-decode.c (add_setshow_boolean_cmd): Now returns the command. * command.h (add_setshow_boolean_cmd): Return cmd_list_element *. * stack.c (_initialize_stack): Install "set/show print raw-frame-arguments", and deprecate "set/show print raw frame-arguments". * valprint.c (_initialize_valprint): Deprecate "set/show print raw". gdb/doc/ChangeLog: yyyy-mm-dd Pedro Alves * gdb.texinfo (Print Settings): Document "set/show print raw-frame-arguments" instead of "set/show print raw frame-arguments". gdb/testsuite/ChangeLog: yyyy-mm-dd Pedro Alves * gdb.guile/scm-frame-args.exp: Use "set print raw-frame-arguments" instead of "set print raw frame-arguments". * gdb.python/py-frame-args.exp: Likewise. --- gdb/doc/gdb.texinfo | 6 +++--- gdb/NEWS | 8 ++++++++ gdb/cli/cli-decode.c | 8 ++++++-- gdb/command.h | 19 ++++++++++--------- gdb/stack.c | 16 ++++++++++++++-- gdb/testsuite/gdb.guile/scm-frame-args.exp | 4 ++-- gdb/testsuite/gdb.python/py-frame-args.exp | 4 ++-- gdb/valprint.c | 19 +++++++++++++------ 8 files changed, 58 insertions(+), 26 deletions(-) diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo index 72dd826d373..92d1aae40a2 100644 --- a/gdb/doc/gdb.texinfo +++ b/gdb/doc/gdb.texinfo @@ -10441,16 +10441,16 @@ thus speeding up the display of each Ada frame. @item show print frame-arguments Show how the value of arguments should be displayed when printing a frame. -@item set print raw frame-arguments on +@item set print raw-frame-arguments on Print frame arguments in raw, non pretty-printed, form. -@item set print raw frame-arguments off +@item set print raw-frame-arguments off Print frame arguments in pretty-printed form, if there is a pretty-printer for the value (@pxref{Pretty Printing}), otherwise print the value in raw form. This is the default. -@item show print raw frame-arguments +@item show print raw-frame-arguments Show whether to print frame arguments in raw form. @anchor{set print entry-values} diff --git a/gdb/NEWS b/gdb/NEWS index 4b5bd07d0af..969c4c4ea88 100644 --- a/gdb/NEWS +++ b/gdb/NEWS @@ -61,6 +61,14 @@ maint test-settings KIND A set of commands used by the testsuite for exercising the settings infrastructure. +set print raw-frame-arguments +show print raw-frame-arguments + + These commands replace the similarly-named "set/show print raw + frame-arguments" commands (now with a dash instead of a space). The + old commands are now deprecated and may be removed in a future + release. + * New MI commands -complete diff --git a/gdb/cli/cli-decode.c b/gdb/cli/cli-decode.c index 0370b125615..2cd2f14207a 100644 --- a/gdb/cli/cli-decode.c +++ b/gdb/cli/cli-decode.c @@ -584,8 +584,10 @@ const char * const boolean_enums[] = { "on", "off", NULL }; /* Add element named NAME to both the set and show command LISTs (the list for set/show or some sublist thereof). CLASS is as in add_cmd. VAR is address of the variable which will contain the - value. SET_DOC and SHOW_DOC are the documentation strings. */ -void + value. SET_DOC and SHOW_DOC are the documentation strings. + Returns the new command element. */ + +cmd_list_element * add_setshow_boolean_cmd (const char *name, enum command_class theclass, int *var, const char *set_doc, const char *show_doc, const char *help_doc, @@ -602,6 +604,8 @@ add_setshow_boolean_cmd (const char *name, enum command_class theclass, int *var set_list, show_list, &c, NULL); c->enums = boolean_enums; + + return c; } /* Add element named NAME to both the set and show command LISTs (the diff --git a/gdb/command.h b/gdb/command.h index 35006cc339e..cf3b0ca61e8 100644 --- a/gdb/command.h +++ b/gdb/command.h @@ -328,15 +328,16 @@ extern void add_setshow_auto_boolean_cmd (const char *name, struct cmd_list_element **set_list, struct cmd_list_element **show_list); -extern void add_setshow_boolean_cmd (const char *name, - enum command_class theclass, - int *var, - const char *set_doc, const char *show_doc, - const char *help_doc, - cmd_const_sfunc_ftype *set_func, - show_value_ftype *show_func, - struct cmd_list_element **set_list, - struct cmd_list_element **show_list); +extern cmd_list_element * + add_setshow_boolean_cmd (const char *name, + enum command_class theclass, + int *var, + const char *set_doc, const char *show_doc, + const char *help_doc, + cmd_const_sfunc_ftype *set_func, + show_value_ftype *show_func, + struct cmd_list_element **set_list, + struct cmd_list_element **show_list); extern void add_setshow_filename_cmd (const char *name, enum command_class theclass, diff --git a/gdb/stack.c b/gdb/stack.c index 408c795e385..d1b195c84d6 100644 --- a/gdb/stack.c +++ b/gdb/stack.c @@ -3106,14 +3106,26 @@ Usage: func NAME")); _("Show printing of non-scalar frame arguments"), NULL, NULL, NULL, &setprintlist, &showprintlist); - add_setshow_boolean_cmd ("frame-arguments", no_class, + /* Install "set print raw frame-arguments", a deprecated spelling of + "set print raw-frame-arguments". */ + cmd = add_setshow_boolean_cmd ("frame-arguments", no_class, + &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); + deprecate_cmd (cmd, "set print raw-frame-arguments"); + + add_setshow_boolean_cmd ("raw-frame-arguments", no_class, &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); + &setprintlist, &showprintlist); add_setshow_auto_boolean_cmd ("disassemble-next-line", class_stack, &disassemble_next_line, _("\ diff --git a/gdb/testsuite/gdb.guile/scm-frame-args.exp b/gdb/testsuite/gdb.guile/scm-frame-args.exp index 9a531f08e8d..cae21677eaf 100644 --- a/gdb/testsuite/gdb.guile/scm-frame-args.exp +++ b/gdb/testsuite/gdb.guile/scm-frame-args.exp @@ -38,7 +38,7 @@ gdb_continue_to_breakpoint "break-here" ".* break-here .*" # Test all combinations with raw off. -gdb_test_no_output "set print raw frame-arguments off" +gdb_test_no_output "set print raw-frame-arguments off" gdb_test_no_output "set print frame-arguments none" gdb_test "frame" ".*foo \\(x=\[.\]{3}, ss=\[.\]{3}\\).*" \ @@ -57,7 +57,7 @@ gdb_test "frame" \ # Test all combinations with raw on. -gdb_test_no_output "set print raw frame-arguments on" +gdb_test_no_output "set print raw-frame-arguments on" gdb_test_no_output "set print frame-arguments none" gdb_test "frame" ".*foo \\(x=\[.\]{3}, ss=\[.\]{3}\\).*" \ diff --git a/gdb/testsuite/gdb.python/py-frame-args.exp b/gdb/testsuite/gdb.python/py-frame-args.exp index a32473568bb..b921330ddb6 100644 --- a/gdb/testsuite/gdb.python/py-frame-args.exp +++ b/gdb/testsuite/gdb.python/py-frame-args.exp @@ -36,7 +36,7 @@ gdb_continue_to_breakpoint "break-here" ".* break-here .*" # Test all combinations with raw off. -gdb_test_no_output "set print raw frame-arguments off" +gdb_test_no_output "set print raw-frame-arguments off" gdb_test_no_output "set print frame-arguments none" gdb_test "frame" ".*foo \\(x=\[.\]{3}, ss=\[.\]{3}\\).*" \ @@ -53,7 +53,7 @@ gdb_test "frame" \ # Test all combinations with raw on. -gdb_test_no_output "set print raw frame-arguments on" +gdb_test_no_output "set print raw-frame-arguments on" gdb_test_no_output "set print frame-arguments none" gdb_test "frame" ".*foo \\(x=\[.\]{3}, ss=\[.\]{3}\\).*" \ diff --git a/gdb/valprint.c b/gdb/valprint.c index e3197e69192..6f9b47da80c 100644 --- a/gdb/valprint.c +++ b/gdb/valprint.c @@ -3248,6 +3248,8 @@ make_value_print_options_def_group (value_print_options *opts) void _initialize_valprint (void) { + cmd_list_element *cmd; + add_prefix_cmd ("print", no_class, set_print, _("Generic command for setting how things print."), &setprintlist, "set print ", 0, &setlist); @@ -3261,13 +3263,18 @@ _initialize_valprint (void) add_alias_cmd ("p", "print", no_class, 1, &showlist); add_alias_cmd ("pr", "print", no_class, 1, &showlist); - add_prefix_cmd ("raw", no_class, set_print_raw, - _("\ + cmd = add_prefix_cmd ("raw", no_class, set_print_raw, + _("\ Generic command for setting what things to print in \"raw\" mode."), - &setprintrawlist, "set print raw ", 0, &setprintlist); - add_prefix_cmd ("raw", no_class, show_print_raw, - _("Generic command for showing \"print raw\" settings."), - &showprintrawlist, "show print raw ", 0, &showprintlist); + &setprintrawlist, "set print raw ", 0, + &setprintlist); + deprecate_cmd (cmd, nullptr); + + cmd = add_prefix_cmd ("raw", no_class, show_print_raw, + _("Generic command for showing \"print raw\" settings."), + &showprintrawlist, "show print raw ", 0, + &showprintlist); + deprecate_cmd (cmd, nullptr); gdb::option::add_setshow_cmds_for_options (class_support, &user_print_options, value_print_option_defs,