public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Rustam Kovhaev <rkovhaev@gmail.com>
To: gdb-patches@sourceware.org
Cc: rkovhaev@gmail.com
Subject: [RFC PATCH] gdb: add command to clear value history
Date: Tue, 18 Oct 2022 20:39:28 -0700	[thread overview]
Message-ID: <20221019033925.86910-1-rkovhaev@gmail.com> (raw)

Hello,

While debugging an application I wanted to clear the value history and I
could not find an option to do it. 
I might be the only one who gets lost in the value history and I am not
sure if anyone else needs it, but I thought it would be nice to have it.
And I hope this does not break anything.
Please let me know what you think. Thanks!

Let's have the functionality to clear the value history.
Introduce 'set values clear' command to clear the value history.

Signed-off-by: Rustam Kovhaev <rkovhaev@gmail.com>
---
 gdb/value.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/gdb/value.c b/gdb/value.c
index 605e52dee82..726b5ef9084 100644
--- a/gdb/value.c
+++ b/gdb/value.c
@@ -1971,6 +1971,15 @@ show_values (const char *num_exp, int from_tty)
   if (from_tty && num_exp)
     set_repeat_arguments ("+");
 }
+
+static struct cmd_list_element *setvallist;
+
+static void
+clear_values (const char *ignore, int from_tty)
+{
+    value_history.clear ();
+}
+
 \f
 enum internalvar_kind
 {
@@ -4343,6 +4352,13 @@ Convenience functions are defined via the Python API."
 Elements of value history around item number IDX (or last ten)."),
 	   &showlist);
 
+  add_cmd("clear", no_class, clear_values, _("\
+Clear value history."), &setvallist);
+
+  add_basic_prefix_cmd ("values", class_support, _("\
+Generic command for setting value history parameters"),
+		  &setvallist, 0, &setlist);
+
   add_com ("init-if-undefined", class_vars, init_if_undefined_command, _("\
 Initialize a convenience variable if necessary.\n\
 init-if-undefined VARIABLE = EXPRESSION\n\
-- 
2.37.3


             reply	other threads:[~2022-10-19  3:48 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-19  3:39 Rustam Kovhaev [this message]
2022-10-19  8:30 ` Bruno Larsen
2022-10-20 18:44 ` Tom Tromey
2022-10-23 19:53   ` Rustam Kovhaev

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221019033925.86910-1-rkovhaev@gmail.com \
    --to=rkovhaev@gmail.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).