aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorAndrew Cagney <cagney@redhat.com>2002-03-18 02:26:32 +0000
committerAndrew Cagney <cagney@redhat.com>2002-03-18 02:26:32 +0000
commit1868c04ebae02e64e51631c2614703b4a294be6b (patch)
tree6e28234f7e1e80582ef5283f375dc9144bf256d5 /gdb
parent4dae1ae7485e87401ae69bcc4f399c11a089b0d8 (diff)
downloadgdb-1868c04ebae02e64e51631c2614703b4a294be6b.zip
gdb-1868c04ebae02e64e51631c2614703b4a294be6b.tar.gz
gdb-1868c04ebae02e64e51631c2614703b4a294be6b.tar.bz2
* 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.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog7
-rw-r--r--gdb/cli/cli-decode.c6
-rw-r--r--gdb/command.h12
-rw-r--r--gdb/cris-tdep.c33
-rw-r--r--gdb/infrun.c10
-rw-r--r--gdb/kod.c17
6 files changed, 74 insertions, 11 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index d6dc6dc..682cc5c 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,12 @@
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.
+
* command.h: (execute_cmd_post_hook): Declare.
(execute_cmd_pre_hook): Declare.
* cli/cli-script.c (clear_hook_in_cleanup): New function.
diff --git a/gdb/cli/cli-decode.c b/gdb/cli/cli-decode.c
index f68064e..1568e31 100644
--- a/gdb/cli/cli-decode.c
+++ b/gdb/cli/cli-decode.c
@@ -86,6 +86,12 @@ cmd_cfunc_eq (struct cmd_list_element *cmd,
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))
diff --git a/gdb/command.h b/gdb/command.h
index 58574f4..fffa3be 100644
--- a/gdb/command.h
+++ b/gdb/command.h
@@ -306,6 +306,18 @@ extern int cmd_cfunc_eq (struct cmd_list_element *cmd,
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);
diff --git a/gdb/cris-tdep.c b/gdb/cris-tdep.c
index 4662eba..9a52611 100644
--- a/gdb/cris-tdep.c
+++ b/gdb/cris-tdep.c
@@ -3925,8 +3925,17 @@ cris_version_update (char *ignore_args, int from_tty,
{
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 @@ cris_mode_update (char *ignore_args, int from_tty,
{
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 @@ cris_abi_update (char *ignore_args, int from_tty,
{
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;
diff --git a/gdb/infrun.c b/gdb/infrun.c
index 466305f..2415e8a 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -749,7 +749,15 @@ static const char *scheduler_enums[] =
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;
diff --git a/gdb/kod.c b/gdb/kod.c
index 8e8a716..8f565bb 100644
--- a/gdb/kod.c
+++ b/gdb/kod.c
@@ -132,13 +132,16 @@ kod_set_os (char *arg, int from_tty, struct cmd_list_element *command)
{
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. */