diff options
author | Fernando Nasser <fnasser@redhat.com> | 2000-11-06 22:44:34 +0000 |
---|---|---|
committer | Fernando Nasser <fnasser@redhat.com> | 2000-11-06 22:44:34 +0000 |
commit | 0e5bed8897b0b4e6b3bcf34297644e2af656dd12 (patch) | |
tree | 44d10c81efdc640da1a46fb09cfd2d050f90e195 /gdb/command.h | |
parent | c37248db172e57d80ab41a33a638ddf7224a4ed1 (diff) | |
download | gdb-0e5bed8897b0b4e6b3bcf34297644e2af656dd12.tar.gz |
2000-11-06 Fernando Nasser <fnasser@cygnus.com>
From Steven Johnson <sbjohnson@ozemail.com.au>:
This set of changes add "hookpost-" as an expansion on the original
hooking of commands to GDB. A Hook may now be run "AFTER" execution of
a command as well as before.
* command.h (struct cmd_list_element): Changed elements hook and hookee
to hook_pre and hookee_pre respectively. Added hook_post and hookee_post
for the post hook command operation. Added hook_in so that an executing
hook can be flagged to prevent recursion.
* command.c (add_cmd): Changed initilization of cmd_list_element to
reflect above changes.
(delete_cmd): Remove both pre and post hooks.
(help_cmd): Notify that the command has pre and/or post hooks.
* infrun.c (normal_stop): Change references to hook_pre from hook.
* top.c (execute_command): Run both pre and post hooks.
(define_command): Allow definition of both pre and post hooks.
The definition of pre-hooks is done as before, with the "hook-"
prefix for backward compatibility.
Diffstat (limited to 'gdb/command.h')
-rw-r--r-- | gdb/command.h | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/gdb/command.h b/gdb/command.h index bbafe1bc648..ab678a23152 100644 --- a/gdb/command.h +++ b/gdb/command.h @@ -165,7 +165,14 @@ struct cmd_list_element char *replacement; /* Hook for another command to be executed before this command. */ - struct cmd_list_element *hook; + struct cmd_list_element *hook_pre; + + /* Hook for another command to be executed after this command. */ + struct cmd_list_element *hook_post; + + /* Flag that specifies if this command is already running it's hook. */ + /* Prevents the possibility of hook recursion. */ + int hook_in; /* Nonzero identifies a prefix command. For them, the address of the variable containing the list of subcommands. */ @@ -220,9 +227,13 @@ struct cmd_list_element /* Pointer to command strings of user-defined commands */ struct command_line *user_commands; - /* Pointer to command that is hooked by this one, + /* Pointer to command that is hooked by this one, (by hook_pre) + so the hook can be removed when this one is deleted. */ + struct cmd_list_element *hookee_pre; + + /* Pointer to command that is hooked by this one, (by hook_post) so the hook can be removed when this one is deleted. */ - struct cmd_list_element *hookee; + struct cmd_list_element *hookee_post; /* Pointer to command that is aliased by this one, so the aliased command can be located in case it has been hooked. */ |