diff options
author | Tom Tromey <tromey@adacore.com> | 2019-05-15 13:06:59 -0600 |
---|---|---|
committer | Tom Tromey <tromey@adacore.com> | 2019-05-29 08:25:38 -0600 |
commit | 000439d52897541ad00a84026ac471b4f8cb3c97 (patch) | |
tree | e6aa4c015ea8da9b59e6127f9efcc84a49af61d2 /gdb/infcmd.c | |
parent | e33f2313bf63b77763739732be14b469b4b647b7 (diff) | |
download | fsf-binutils-gdb-000439d52897541ad00a84026ac471b4f8cb3c97.zip fsf-binutils-gdb-000439d52897541ad00a84026ac471b4f8cb3c97.tar.gz fsf-binutils-gdb-000439d52897541ad00a84026ac471b4f8cb3c97.tar.bz2 |
Add "set print finish"
A user wanted to be able to disable the display of the value when
using "finish" -- but still have the value entered into the value
history in case it was useful later on. Part of the rationale here is
that sometimes the value might be quite large, or expensive to display
(in their case this was compounded by a rogue pretty-printer).
This patch implements this idea.
gdb/ChangeLog
2019-05-29 Tom Tromey <tromey@adacore.com>
* NEWS: Add entry.
* infcmd.c (print_return_value_1): Handle finish_print
option.
(show_print_finish): New function.
(_initialize_infcmd): Add "set/show print finish" commands.
* valprint.c (user_print_options): Initialize new member.
* valprint.h (struct value_print_options) <finish_print>: New
member.
gdb/doc/ChangeLog
2019-05-29 Tom Tromey <tromey@adacore.com>
* gdb.texinfo (Continuing and Stepping): Document new
commands.
gdb/testsuite/ChangeLog
2019-05-29 Tom Tromey <tromey@adacore.com>
* gdb.base/finish.exp (finish_no_print): New proc.
(finish_tests): Call it.
Diffstat (limited to 'gdb/infcmd.c')
-rw-r--r-- | gdb/infcmd.c | 33 |
1 files changed, 29 insertions, 4 deletions
diff --git a/gdb/infcmd.c b/gdb/infcmd.c index 178f89e..1dfbe23 100644 --- a/gdb/infcmd.c +++ b/gdb/infcmd.c @@ -1621,10 +1621,14 @@ print_return_value_1 (struct ui_out *uiout, struct return_value_info *rv) uiout->text (" = "); get_user_print_options (&opts); - string_file stb; - - value_print (rv->value, &stb, &opts); - uiout->field_stream ("return-value", stb); + if (opts.finish_print) + { + string_file stb; + value_print (rv->value, &stb, &opts); + uiout->field_stream ("return-value", stb); + } + else + uiout->field_string ("return-value", _("<not displayed>")); uiout->text ("\n"); } else @@ -3096,6 +3100,19 @@ info_proc_cmd_all (const char *args, int from_tty) info_proc_cmd_1 (args, IP_ALL, from_tty); } +/* Implement `show print finish'. */ + +static void +show_print_finish (struct ui_file *file, int from_tty, + struct cmd_list_element *c, + const char *value) +{ + fprintf_filtered (file, _("\ +Printing of return value after `finish' is %s.\n"), + value); +} + + /* This help string is used for the run, start, and starti commands. It is defined as a macro to prevent duplication. */ @@ -3420,4 +3437,12 @@ List files opened by the specified process."), add_cmd ("all", class_info, info_proc_cmd_all, _("\ List all available info about the specified process."), &info_proc_cmdlist); + + add_setshow_boolean_cmd ("finish", class_support, + &user_print_options.finish_print, _("\ +Set whether `finish' prints the return value."), _("\ +Show whether `finish' prints the return value."), NULL, + NULL, + show_print_finish, + &setprintlist, &showprintlist); } |