This is the mail archive of the gdb-cvs@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[binutils-gdb] Add a "context" argument to add_setshow_enum_cmd


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=7170dadf5950e1444ab09cdfc4e07dd2698fc275

commit 7170dadf5950e1444ab09cdfc4e07dd2698fc275
Author: Tom Tromey <tom@tromey.com>
Date:   Thu Sep 6 14:03:38 2018 -0600

    Add a "context" argument to add_setshow_enum_cmd
    
    This adds a "context" argument to add_setshow_enum_cmd.  Now
    add_setshow_enum_cmd will call set_cmd_context on both of the new
    commands.  This is used in a later patch.
    
    gdb/ChangeLog
    2018-12-28  Tom Tromey  <tom@tromey.com>
    
    	* command.h (add_setshow_enum_cmd): Add "context" argument.
    	* cli/cli-decode.c (add_setshow_enum_cmd): Add "context"
    	argument.  Call set_cmd_context.

Diff:
---
 gdb/ChangeLog        |  6 ++++++
 gdb/cli/cli-decode.c | 10 +++++++---
 gdb/command.h        |  3 ++-
 3 files changed, 15 insertions(+), 4 deletions(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index e942084..0616275 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,11 @@
 2018-12-28  Tom Tromey  <tom@tromey.com>
 
+	* command.h (add_setshow_enum_cmd): Add "context" argument.
+	* cli/cli-decode.c (add_setshow_enum_cmd): Add "context"
+	argument.  Call set_cmd_context.
+
+2018-12-28  Tom Tromey  <tom@tromey.com>
+
 	* utils.c (filter_initialized): New global.
 	(wrap_buffer): Now a std::string.
 	(wrap_pointer): Remove.
diff --git a/gdb/cli/cli-decode.c b/gdb/cli/cli-decode.c
index 5d798e8..e7b7a11 100644
--- a/gdb/cli/cli-decode.c
+++ b/gdb/cli/cli-decode.c
@@ -531,16 +531,20 @@ add_setshow_enum_cmd (const char *name,
 		      cmd_const_sfunc_ftype *set_func,
 		      show_value_ftype *show_func,
 		      struct cmd_list_element **set_list,
-		      struct cmd_list_element **show_list)
+		      struct cmd_list_element **show_list,
+		      void *context)
 {
-  struct cmd_list_element *c;
+  struct cmd_list_element *c, *show;
 
   add_setshow_cmd_full (name, theclass, var_enum, var,
 			set_doc, show_doc, help_doc,
 			set_func, show_func,
 			set_list, show_list,
-			&c, NULL);
+			&c, &show);
   c->enums = enumlist;
+
+  set_cmd_context (c, context);
+  set_cmd_context (show, context);
 }
 
 const char * const auto_boolean_enums[] = { "on", "off", "auto", NULL };
diff --git a/gdb/command.h b/gdb/command.h
index e3d55c2..6851440 100644
--- a/gdb/command.h
+++ b/gdb/command.h
@@ -314,7 +314,8 @@ extern void add_setshow_enum_cmd (const char *name,
 				  cmd_const_sfunc_ftype *set_func,
 				  show_value_ftype *show_func,
 				  struct cmd_list_element **set_list,
-				  struct cmd_list_element **show_list);
+				  struct cmd_list_element **show_list,
+				  void *context = nullptr);
 
 extern void add_setshow_auto_boolean_cmd (const char *name,
 					  enum command_class theclass,


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]