* cli/cli-decode.c (cmd_cfunc_eq): New function.
* command.h (cmd_cfunc_eq): Declare. * cli/cli-decode.h (cmd_cfunc_eq): Ditto. * cli/cli-cmds.h (is_complete_command): Change parameter to a ``struct cmd_list_element *''. * cli/cli-cmds.c (is_complete_command): Update. Use cmd_cfunc_eq. * top.c (execute_command): Pass the command to is_complete_command. * tracepoint.c: Replace function.cfunc with cmd_cfunc_eq.
This commit is contained in:
parent
b8b8b04721
commit
bbaca940eb
8 changed files with 45 additions and 15 deletions
|
@ -1,3 +1,17 @@
|
||||||
|
2002-02-23 Andrew Cagney <ac131313@redhat.com>
|
||||||
|
|
||||||
|
* cli/cli-decode.c (cmd_cfunc_eq): New function.
|
||||||
|
* command.h (cmd_cfunc_eq): Declare.
|
||||||
|
* cli/cli-decode.h (cmd_cfunc_eq): Ditto.
|
||||||
|
|
||||||
|
* cli/cli-cmds.h (is_complete_command): Change parameter to a
|
||||||
|
``struct cmd_list_element *''.
|
||||||
|
* cli/cli-cmds.c (is_complete_command): Update. Use
|
||||||
|
cmd_cfunc_eq.
|
||||||
|
* top.c (execute_command): Pass the command to
|
||||||
|
is_complete_command.
|
||||||
|
* tracepoint.c: Replace function.cfunc with cmd_cfunc_eq.
|
||||||
|
|
||||||
2002-02-23 Andrew Cagney <ac131313@redhat.com>
|
2002-02-23 Andrew Cagney <ac131313@redhat.com>
|
||||||
|
|
||||||
From 2002-02-20 Martin Schwidefsky <schwidefsky@de.ibm.com>:
|
From 2002-02-20 Martin Schwidefsky <schwidefsky@de.ibm.com>:
|
||||||
|
|
|
@ -259,9 +259,10 @@ complete_command (char *arg, int from_tty)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int is_complete_command (void (*func) (char *args, int from_tty))
|
int
|
||||||
|
is_complete_command (struct cmd_list_element *c)
|
||||||
{
|
{
|
||||||
return func == complete_command;
|
return cmd_cfunc_eq (c, complete_command);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ARGSUSED */
|
/* ARGSUSED */
|
||||||
|
|
|
@ -105,7 +105,7 @@ void init_cmd_lists (void);
|
||||||
|
|
||||||
void init_cli_cmds (void);
|
void init_cli_cmds (void);
|
||||||
|
|
||||||
int is_complete_command (void (*func) (char *args, int from_tty));
|
int is_complete_command (struct cmd_list_element *cmd);
|
||||||
|
|
||||||
/* Exported to gdb/main.c */
|
/* Exported to gdb/main.c */
|
||||||
|
|
||||||
|
|
|
@ -79,6 +79,13 @@ set_cmd_sfunc (struct cmd_list_element *cmd,
|
||||||
cmd->function.sfunc = sfunc; /* Ok. */
|
cmd->function.sfunc = sfunc; /* Ok. */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
cmd_cfunc_eq (struct cmd_list_element *cmd,
|
||||||
|
void (*cfunc) (char *args, int from_tty))
|
||||||
|
{
|
||||||
|
return cmd->func == do_cfunc && cmd->function.cfunc == cfunc;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Add element named NAME.
|
/* Add element named NAME.
|
||||||
CLASS is the top level category into which commands are broken down
|
CLASS is the top level category into which commands are broken down
|
||||||
|
|
|
@ -286,6 +286,10 @@ extern void set_cmd_sfunc (struct cmd_list_element *cmd,
|
||||||
void (*sfunc) (char *args, int from_tty,
|
void (*sfunc) (char *args, int from_tty,
|
||||||
struct cmd_list_element * c));
|
struct cmd_list_element * c));
|
||||||
|
|
||||||
|
/* HACK: cagney/2002-02-23: Code, mostly in tracepoints.c, grubs
|
||||||
|
around in cmd objects to test the value of the commands sfunc(). */
|
||||||
|
extern int cmd_cfunc_eq (struct cmd_list_element *cmd,
|
||||||
|
void (*cfunc) (char *args, int from_tty));
|
||||||
|
|
||||||
extern struct cmd_list_element *lookup_cmd (char **,
|
extern struct cmd_list_element *lookup_cmd (char **,
|
||||||
struct cmd_list_element *, char *,
|
struct cmd_list_element *, char *,
|
||||||
|
|
|
@ -292,6 +292,10 @@ extern void set_cmd_sfunc (struct cmd_list_element *cmd,
|
||||||
void (*sfunc) (char *args, int from_tty,
|
void (*sfunc) (char *args, int from_tty,
|
||||||
struct cmd_list_element * c));
|
struct cmd_list_element * c));
|
||||||
|
|
||||||
|
/* HACK: cagney/2002-02-23: Code, mostly in tracepoints.c, grubs
|
||||||
|
around in cmd objects to test the value of the commands sfunc(). */
|
||||||
|
extern int cmd_cfunc_eq (struct cmd_list_element *cmd,
|
||||||
|
void (*cfunc) (char *args, int from_tty));
|
||||||
|
|
||||||
extern struct cmd_list_element *lookup_cmd (char **,
|
extern struct cmd_list_element *lookup_cmd (char **,
|
||||||
struct cmd_list_element *, char *,
|
struct cmd_list_element *, char *,
|
||||||
|
|
|
@ -684,7 +684,7 @@ execute_command (char *p, int from_tty)
|
||||||
command. */
|
command. */
|
||||||
if (arg
|
if (arg
|
||||||
&& c->type != set_cmd
|
&& c->type != set_cmd
|
||||||
&& !is_complete_command (c->function.cfunc))
|
&& !is_complete_command (c))
|
||||||
{
|
{
|
||||||
p = arg + strlen (arg) - 1;
|
p = arg + strlen (arg) - 1;
|
||||||
while (p >= arg && (*p == ' ' || *p == '\t'))
|
while (p >= arg && (*p == ' ' || *p == '\t'))
|
||||||
|
|
|
@ -939,7 +939,7 @@ validate_actionline (char **line, struct tracepoint *t)
|
||||||
return BADLINE;
|
return BADLINE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (c->function.cfunc == collect_pseudocommand)
|
if (cmd_cfunc_eq (c, collect_pseudocommand))
|
||||||
{
|
{
|
||||||
struct agent_expr *aexpr;
|
struct agent_expr *aexpr;
|
||||||
struct agent_reqs areqs;
|
struct agent_reqs areqs;
|
||||||
|
@ -1006,7 +1006,7 @@ validate_actionline (char **line, struct tracepoint *t)
|
||||||
while (p && *p++ == ',');
|
while (p && *p++ == ',');
|
||||||
return GENERIC;
|
return GENERIC;
|
||||||
}
|
}
|
||||||
else if (c->function.cfunc == while_stepping_pseudocommand)
|
else if (cmd_cfunc_eq (c, while_stepping_pseudocommand))
|
||||||
{
|
{
|
||||||
char *steparg; /* in case warning is necessary */
|
char *steparg; /* in case warning is necessary */
|
||||||
|
|
||||||
|
@ -1022,7 +1022,7 @@ validate_actionline (char **line, struct tracepoint *t)
|
||||||
}
|
}
|
||||||
return STEPPING;
|
return STEPPING;
|
||||||
}
|
}
|
||||||
else if (c->function.cfunc == end_actions_pseudocommand)
|
else if (cmd_cfunc_eq (c, end_actions_pseudocommand))
|
||||||
return END;
|
return END;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1520,7 +1520,7 @@ encode_actions (struct tracepoint *t, char ***tdp_actions,
|
||||||
if (cmd == 0)
|
if (cmd == 0)
|
||||||
error ("Bad action list item: %s", action_exp);
|
error ("Bad action list item: %s", action_exp);
|
||||||
|
|
||||||
if (cmd->function.cfunc == collect_pseudocommand)
|
if (cmd_cfunc_eq (cmd, collect_pseudocommand))
|
||||||
{
|
{
|
||||||
do
|
do
|
||||||
{ /* repeat over a comma-separated list */
|
{ /* repeat over a comma-separated list */
|
||||||
|
@ -1630,11 +1630,11 @@ encode_actions (struct tracepoint *t, char ***tdp_actions,
|
||||||
}
|
}
|
||||||
while (action_exp && *action_exp++ == ',');
|
while (action_exp && *action_exp++ == ',');
|
||||||
} /* if */
|
} /* if */
|
||||||
else if (cmd->function.cfunc == while_stepping_pseudocommand)
|
else if (cmd_cfunc_eq (cmd, while_stepping_pseudocommand))
|
||||||
{
|
{
|
||||||
collect = &stepping_list;
|
collect = &stepping_list;
|
||||||
}
|
}
|
||||||
else if (cmd->function.cfunc == end_actions_pseudocommand)
|
else if (cmd_cfunc_eq (cmd, end_actions_pseudocommand))
|
||||||
{
|
{
|
||||||
if (collect == &stepping_list) /* end stepping actions */
|
if (collect == &stepping_list) /* end stepping actions */
|
||||||
collect = &tracepoint_list;
|
collect = &tracepoint_list;
|
||||||
|
@ -2315,9 +2315,9 @@ tracepoint_save_command (char *args, int from_tty)
|
||||||
cmd = lookup_cmd (&actionline, cmdlist, "", -1, 1);
|
cmd = lookup_cmd (&actionline, cmdlist, "", -1, 1);
|
||||||
if (cmd == 0)
|
if (cmd == 0)
|
||||||
error ("Bad action list item: %s", actionline);
|
error ("Bad action list item: %s", actionline);
|
||||||
if (cmd->function.cfunc == while_stepping_pseudocommand)
|
if (cmd_cfunc_eq (cmd, while_stepping_pseudocommand))
|
||||||
indent = i2;
|
indent = i2;
|
||||||
else if (cmd->function.cfunc == end_actions_pseudocommand)
|
else if (cmd_cfunc_eq (cmd, end_actions_pseudocommand))
|
||||||
indent = i1;
|
indent = i1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2534,11 +2534,11 @@ trace_dump_command (char *args, int from_tty)
|
||||||
if (cmd == 0)
|
if (cmd == 0)
|
||||||
error ("Bad action list item: %s", action_exp);
|
error ("Bad action list item: %s", action_exp);
|
||||||
|
|
||||||
if (cmd->function.cfunc == while_stepping_pseudocommand)
|
if (cmd_cfunc_eq (cmd, while_stepping_pseudocommand))
|
||||||
stepping_actions = 1;
|
stepping_actions = 1;
|
||||||
else if (cmd->function.cfunc == end_actions_pseudocommand)
|
else if (cmd_cfunc_eq (cmd, end_actions_pseudocommand))
|
||||||
stepping_actions = 0;
|
stepping_actions = 0;
|
||||||
else if (cmd->function.cfunc == collect_pseudocommand)
|
else if (cmd_cfunc_eq (cmd, collect_pseudocommand))
|
||||||
{
|
{
|
||||||
/* Display the collected data.
|
/* Display the collected data.
|
||||||
For the trap frame, display only what was collected at the trap.
|
For the trap frame, display only what was collected at the trap.
|
||||||
|
|
Loading…
Reference in a new issue