aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Gilmore <gnu@cygnus>1992-10-01 09:57:36 +0000
committerJohn Gilmore <gnu@cygnus>1992-10-01 09:57:36 +0000
commita65841d7681adbf2d768b49a84de314ffadf3cfe (patch)
tree1c5220a7d8cc4ce210239a7785bfd7192286e09a
parent0843ea632e5c3c8d9ae6a2b909939474e5dfa180 (diff)
downloadgdb-a65841d7681adbf2d768b49a84de314ffadf3cfe.zip
gdb-a65841d7681adbf2d768b49a84de314ffadf3cfe.tar.gz
gdb-a65841d7681adbf2d768b49a84de314ffadf3cfe.tar.bz2
Add `command hooks' and a hook for inferior program stopping.
* command.h (struct cmd_list_element): Remove unused `aux' field. Add new `hook', `hookee', and `cmd_pointer' fields. * command.c (add_cmd): Initialize new fields, elim old. (add_alias_cmd): Clone new fields. (delete_cmd): Un-hook hookee if we're deleting hook. (help_cmd): Tell user the command is hooked, if it is. (lookup_cmd_1): Abbreviations return the original command instead of themselves, so that hooks on the original cmd will be run. * defs.h (enum command_class): Add class_pseudo and comments. * gdbcmd.h (execute_user_command): Add prototype. * infrun.c (normal_stop): If the stop command is hooked, run the hook whenever we stop. (hook_stop_stub): Stub for catch_errors. (_initialize_infrun): Set up pseudo "stop" command. * main.c (execute_user_command): Code extracted from execute_command. (execute_command): If hooked, run the hook before the command. (define_command): If defining a new hook, check the command it is hooking, and warn if none. Install the hook. * source.c (_initialize_source): "l" is an abbrev for "list". * doc/gdb.texinfo: Document command hooks. * Makefile.in (VERSION): Roll to 4.6.7. * config/sun4os4.mh: Remove dup inftarg.o from NATDEPFILES. * infrun.c (breakpoints_inserted): Make it static again. * tm-symmetry.h (FLOAT_INFO): #if 0 it for cross-ptrace abuse.
-rw-r--r--gdb/ChangeLog33
-rw-r--r--gdb/command.c25
-rw-r--r--gdb/tm-symmetry.h4
3 files changed, 59 insertions, 3 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 2f28946..2e64487 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,34 @@
+Thu Oct 1 01:57:56 1992 John Gilmore (gnu@cygnus.com)
+
+ Add `command hooks' and a hook for inferior program stopping.
+
+ * command.h (struct cmd_list_element): Remove unused `aux'
+ field. Add new `hook', `hookee', and `cmd_pointer' fields.
+ * command.c (add_cmd): Initialize new fields, elim old.
+ (add_alias_cmd): Clone new fields.
+ (delete_cmd): Un-hook hookee if we're deleting hook.
+ (help_cmd): Tell user the command is hooked, if it is.
+ (lookup_cmd_1): Abbreviations return the original command
+ instead of themselves, so that hooks on the original cmd will be
+ run.
+ * defs.h (enum command_class): Add class_pseudo and comments.
+ * gdbcmd.h (execute_user_command): Add prototype.
+ * infrun.c (normal_stop): If the stop command is hooked,
+ run the hook whenever we stop.
+ (hook_stop_stub): Stub for catch_errors.
+ (_initialize_infrun): Set up pseudo "stop" command.
+ * main.c (execute_user_command): Code extracted from execute_command.
+ (execute_command): If hooked, run the hook before the command.
+ (define_command): If defining a new hook, check the command it
+ is hooking, and warn if none. Install the hook.
+ * source.c (_initialize_source): "l" is an abbrev for "list".
+ * doc/gdb.texinfo: Document command hooks.
+
+ * Makefile.in (VERSION): Roll to 4.6.7.
+ * config/sun4os4.mh: Remove dup inftarg.o from NATDEPFILES.
+ * infrun.c (breakpoints_inserted): Make it static again.
+ * tm-symmetry.h (FLOAT_INFO): #if 0 it for cross-ptrace abuse.
+
Wed Sep 30 15:33:22 1992 K. Richard Pixley (rich@sendai.cygnus.com)
Native file renaming.
@@ -954,7 +985,7 @@ Sat Aug 8 23:12:22 1992 Fred Fish (fnf@cygnus.com)
Fri Aug 7 11:18:23 1992 Steve Chamberlain (sac@thepub.cygnus.com)
* xm-go32.h: Define LSEEK_NOT_LINEAR
- * serial.c (find_source_lines): if LSEEK_NOT_LINEAR is defined
+ * source.c (find_source_lines): if LSEEK_NOT_LINEAR is defined
then work out the lseek positions of newlines by running through
the file and `tell'ing. This makes source file listing work on
OS's where the relationship between physical position in file and
diff --git a/gdb/command.c b/gdb/command.c
index 5327a4c..92d83ec 100644
--- a/gdb/command.c
+++ b/gdb/command.c
@@ -78,8 +78,10 @@ add_cmd (name, class, fun, doc, list)
c->prefixlist = 0;
c->prefixname = (char *)NULL;
c->allow_unknown = 0;
+ c->hook = 0;
+ c->hookee = 0;
+ c->cmd_pointer = 0;
c->abbrev_flag = 0;
- c->aux = 0;
c->type = not_set_cmd;
c->completer = make_symbol_completion_list;
c->var = 0;
@@ -137,7 +139,7 @@ add_alias_cmd (name, oldname, class, abbrev_flag, list)
c->prefixname = old->prefixname;
c->allow_unknown = old->allow_unknown;
c->abbrev_flag = abbrev_flag;
- c->aux = old->aux;
+ c->cmd_pointer = old;
return c;
}
@@ -263,6 +265,8 @@ delete_cmd (name, list)
while (*list && !strcmp ((*list)->name, name))
{
+ if ((*list)->hookee)
+ (*list)->hookee->hook = 0; /* Hook slips out of its mouth */
p = (*list)->next;
free ((PTR)*list);
*list = p;
@@ -273,6 +277,8 @@ delete_cmd (name, list)
{
if (!strcmp (c->next->name, name))
{
+ if (c->next->hookee)
+ c->next->hookee->hook = 0; /* hooked cmd gets away. */
p = c->next->next;
free ((PTR)c->next);
c->next = p;
@@ -338,6 +344,10 @@ help_cmd (command, stream)
/* If this is a class name, print all of the commands in the class */
if (c->function.cfunc == NULL)
help_list (cmdlist, "", c->class, stream);
+
+ if (c->hook)
+ fprintf_filtered (stream, "\nThis command has a hook defined: %s\n",
+ c->hook->name);
}
/*
@@ -481,6 +491,9 @@ help_cmd_list (list, class, prefix, recurse, stream)
the list in which there are ambiguous choices (and *TEXT will be set to
the ambiguous text string).
+ If the located command was an abbreviation, this routine returns the base
+ command of the abbreviation.
+
It does no error reporting whatsoever; control will always return
to the superior routine.
@@ -572,6 +585,14 @@ lookup_cmd_1 (text, clist, result_list, ignore_help_classes)
/* We've matched something on this list. Move text pointer forward. */
*text = p;
+
+ /* If this was an abbreviation, use the base command instead. */
+
+ if (found->cmd_pointer)
+ found = found->cmd_pointer;
+
+ /* If we found a prefix command, keep looking. */
+
if (found->prefixlist)
{
c = lookup_cmd_1 (text, *found->prefixlist, result_list,
diff --git a/gdb/tm-symmetry.h b/gdb/tm-symmetry.h
index 389d4eb..90c212e 100644
--- a/gdb/tm-symmetry.h
+++ b/gdb/tm-symmetry.h
@@ -84,10 +84,14 @@ i386_skip_prologue PARAMS ((int));
#define INVALID_FLOAT(p, len) (0)
+#if 0
+ --- this code can't be used unless we know we are running native,
+ since it uses host specific ptrace calls.
/* code for 80387 fpu. Functions are from i386-dep.c, copied into
* symm-dep.c.
*/
#define FLOAT_INFO { i386_float_info(); }
+#endif
/* Say how long (ordinary) registers are. */