This is the mail archive of the gdb-patches@sources.redhat.com 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]

[patch] replace cmd->type with cmd_type()


Hello,

This patch introduces the function cmd_type() to replace code looking at 
cmd->type().

Committed,
Andrew
2002-03-17  Andrew Cagney  <ac131313@redhat.com>

	* cli/cli-decode.c (cmd_type): New function.
	* command.h (cmd_type): Declare.
	* infrun.c (set_schedlock_func): Call function cmd_type.
	* kod.c (kod_set_os): Call cmd_type.
	* cris-tdep.c (cris_version_update): Use function cmd_type.
	(cris_mode_update, cris_abi_update): Ditto.

Index: command.h
===================================================================
RCS file: /cvs/src/src/gdb/command.h,v
retrieving revision 1.26
diff -u -r1.26 command.h
--- command.h	2002/03/17 19:53:38	1.26
+++ command.h	2002/03/18 01:11:30
@@ -306,6 +306,18 @@
 extern void execute_cmd_pre_hook (struct cmd_list_element *cmd);
 extern void execute_cmd_post_hook (struct cmd_list_element *cmd);
 
+/* Return the type of the command.  */
+/* NOTE: cagney/2002-03-17: The add_show_from_set() function clones
+   the set command passed as a parameter.  The clone operation will
+   include (BUG?) any ``set'' command callback, if present.  Commands
+   like ``info set'' call all the ``show'' command callbacks.
+   Unfortunatly, for ``show'' commands cloned from ``set'', this
+   includes callbacks belonging to ``set'' commands.  Making this
+   worse, this only occures if add_show_from_set() is called after
+   add_cmd_sfunc() (BUG?).  */
+extern enum cmd_types cmd_type (struct cmd_list_element *cmd);
+
+
 extern struct cmd_list_element *lookup_cmd (char **,
 					    struct cmd_list_element *, char *,
 					    int, int);
Index: cris-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/cris-tdep.c,v
retrieving revision 1.13
diff -u -r1.13 cris-tdep.c
--- cris-tdep.c	2002/02/24 21:53:01	1.13
+++ cris-tdep.c	2002/03/18 01:11:40
@@ -3925,8 +3925,17 @@
 {
   struct gdbarch_info info;
 
+  /* NOTE: cagney/2002-03-17: The add_show_from_set() function clones
+     the set command passed as a parameter.  The clone operation will
+     include (BUG?) any ``set'' command callback, if present.
+     Commands like ``info set'' call all the ``show'' command
+     callbacks.  Unfortunatly, for ``show'' commands cloned from
+     ``set'', this includes callbacks belonging to ``set'' commands.
+     Making this worse, this only occures if add_show_from_set() is
+     called after add_cmd_sfunc() (BUG?).  */
+
   /* From here on, trust the user's CRIS version setting.  */
-  if (c->type == set_cmd)
+  if (cmd_type (c) == set_cmd)
     {
       usr_cmd_cris_version_valid = 1;
   
@@ -3943,8 +3952,17 @@
 {
   struct gdbarch_info info;
   
+  /* NOTE: cagney/2002-03-17: The add_show_from_set() function clones
+     the set command passed as a parameter.  The clone operation will
+     include (BUG?) any ``set'' command callback, if present.
+     Commands like ``info set'' call all the ``show'' command
+     callbacks.  Unfortunatly, for ``show'' commands cloned from
+     ``set'', this includes callbacks belonging to ``set'' commands.
+     Making this worse, this only occures if add_show_from_set() is
+     called after add_cmd_sfunc() (BUG?).  */
+
   /* From here on, trust the user's CRIS mode setting.  */
-  if (c->type == set_cmd)
+  if (cmd_type (c) == set_cmd)
     {
       usr_cmd_cris_mode_valid = 1;
   
@@ -3961,8 +3979,17 @@
 {
   struct gdbarch_info info;
   
+  /* NOTE: cagney/2002-03-17: The add_show_from_set() function clones
+     the set command passed as a parameter.  The clone operation will
+     include (BUG?) any ``set'' command callback, if present.
+     Commands like ``info set'' call all the ``show'' command
+     callbacks.  Unfortunatly, for ``show'' commands cloned from
+     ``set'', this includes callbacks belonging to ``set'' commands.
+     Making this worse, this only occures if add_show_from_set() is
+     called after add_cmd_sfunc() (BUG?).  */
+
   /* From here on, trust the user's CRIS ABI setting.  */
-  if (c->type == set_cmd)
+  if (cmd_type (c) == set_cmd)
     {
       usr_cmd_cris_abi_valid = 1;
   
Index: infrun.c
===================================================================
RCS file: /cvs/src/src/gdb/infrun.c,v
retrieving revision 1.55
diff -u -r1.55 infrun.c
--- infrun.c	2002/03/17 19:53:38	1.55
+++ infrun.c	2002/03/18 01:11:56
@@ -749,7 +749,15 @@
 static void
 set_schedlock_func (char *args, int from_tty, struct cmd_list_element *c)
 {
-  if (c->type == set_cmd)
+  /* NOTE: cagney/2002-03-17: The add_show_from_set() function clones
+     the set command passed as a parameter.  The clone operation will
+     include (BUG?) any ``set'' command callback, if present.
+     Commands like ``info set'' call all the ``show'' command
+     callbacks.  Unfortunatly, for ``show'' commands cloned from
+     ``set'', this includes callbacks belonging to ``set'' commands.
+     Making this worse, this only occures if add_show_from_set() is
+     called after add_cmd_sfunc() (BUG?).  */
+  if (cmd_type (c) == set_cmd)
     if (!target_can_lock_scheduler)
       {
 	scheduler_mode = schedlock_off;
Index: kod.c
===================================================================
RCS file: /cvs/src/src/gdb/kod.c,v
retrieving revision 1.7
diff -u -r1.7 kod.c
--- kod.c	2002/03/17 19:29:37	1.7
+++ kod.c	2002/03/18 01:11:56
@@ -132,13 +132,16 @@
 {
   char *p;
 
-  /* NOTE: cagney/2002-03-17: This function gets called by the command
-     ``info set'' with COMMAND pointing to a show_cmd rather than a
-     set command.  This the test below is removed, a core dump results
-     (think about what happens when OPERATING_SYSTEM is NULL).  The
-     wiered thing is that all other ``set'' handlers don't need this
-     test.  */
-  if (command->type != set_cmd)
+  /* NOTE: cagney/2002-03-17: The add_show_from_set() function clones
+     the set command passed as a parameter.  The clone operation will
+     include (BUG?) any ``set'' command callback, if present.
+     Commands like ``info set'' call all the ``show'' command
+     callbacks.  Unfortunatly, for ``show'' commands cloned from
+     ``set'', this includes callbacks belonging to ``set'' commands.
+     Making this worse, this only occures if add_show_from_set() is
+     called after add_cmd_sfunc() (BUG?).  */
+
+  if (cmd_type (command) != set_cmd)
     return;
 
   /* If we had already had an open OS, close it.  */
Index: cli/cli-decode.c
===================================================================
RCS file: /cvs/src/src/gdb/cli/cli-decode.c,v
retrieving revision 1.15
diff -u -r1.15 cli-decode.c
--- cli-decode.c	2002/03/06 06:28:35	1.15
+++ cli-decode.c	2002/03/18 01:12:01
@@ -86,6 +86,12 @@
   return cmd->func == do_cfunc && cmd->function.cfunc == cfunc;
 }
 
+enum cmd_types
+cmd_type (struct cmd_list_element *cmd)
+{
+  return cmd->type;
+}
+
 void
 set_cmd_completer (struct cmd_list_element *cmd,
 		   char **(*completer) (char *text, char *word))

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