]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
* main.c (filename_completer): Don't complete to files ending in ~.
authorJim Kingdon <jkingdon@engr.sgi.com>
Fri, 25 Jun 1993 03:47:12 +0000 (03:47 +0000)
committerJim Kingdon <jkingdon@engr.sgi.com>
Fri, 25 Jun 1993 03:47:12 +0000 (03:47 +0000)
* NEWS: Mention filename completion and "info line" enhancements.

* main.c (symbol_completion_function): On "info t foo", return NULL,
don't error().

* main.c (symbol_completion_function): Don't use readline word
breaking.  Use new calling convention for c->completer and
complete_on_cmdlist.
* command.h (struct command): Change arguments; now the text passed
to completer does not have any word breaking done.  New arg word.
* symtab.{c,h} (make_symbol_completion_list): Do word breaking.  Take
word argument.
* {main.c,gdbcmd.h} ({filename,noop}_completer): Take word argument.
* command.{c,h} (complete_on_cmdlist): Take word argument.

* command.c (lookup_cmd_1): Doc fix.

gdb/ChangeLog
gdb/NEWS
gdb/command.c

index 18164e9b83f4ac6efd00abfb22c71da7079e4f8f..b3352382498f3f10cc89e0b58740e0aa35860e4d 100644 (file)
@@ -1,3 +1,24 @@
+Thu Jun 24 14:52:45 1993  Jim Kingdon  (kingdon@lioth.cygnus.com)
+
+       * main.c (filename_completer): Don't complete to files ending in ~.
+
+       * NEWS: Mention filename completion and "info line" enhancements.
+
+       * main.c (symbol_completion_function): On "info t foo", return NULL,
+       don't error().
+
+       * main.c (symbol_completion_function): Don't use readline word
+       breaking.  Use new calling convention for c->completer and
+       complete_on_cmdlist.
+       * command.h (struct command): Change arguments; now the text passed
+       to completer does not have any word breaking done.  New arg word.
+       * symtab.{c,h} (make_symbol_completion_list): Do word breaking.  Take
+       word argument.
+       * {main.c,gdbcmd.h} ({filename,noop}_completer): Take word argument.
+       * command.{c,h} (complete_on_cmdlist): Take word argument.
+
+       * command.c (lookup_cmd_1): Doc fix.
+
 Thu Jun 24 13:26:04 1993  K. Richard Pixley  (rich@sendai.cygnus.com)
 
        * Makefile.in (OP_INCLUDE): define.
index 7c285325410326dafbabd1ebe3ed63201064327f..3bc81f41b2ce5ef112f25b3d813fff698ff8a4dc 100644 (file)
--- a/gdb/NEWS
+++ b/gdb/NEWS
@@ -5,6 +5,12 @@
 
  * User visible changes:
 
+Filename completion now works.
+
+When run under emacs mode, the "info line" command now causes the
+arrow to point to the line specified.  Also, "info line" prints
+addresses in symbolic form.
+
 All vxworks based targets now support a user settable option, called
 vxworks-timeout.  This option represents the number of seconds gdb
 should wait for responses to rpc's.  You might want to use this if
index dc5a92f571280d6141007a6a438e12bc150b86f0..abc2d84499c0eb0f8b78be31ecb20e1aaa2aa111 100644 (file)
@@ -504,7 +504,10 @@ help_cmd_list (list, class, prefix, recurse, stream)
    "info" matches without ambiguity, but "a" could be "args" or "address", so
    *RESULT_LIST is set to the cmd_list_element for "info".  So in this case
    RESULT_LIST should not be interpeted as a pointer to the beginning of a
-   list; it simply points to a specific command.
+   list; it simply points to a specific command.  In the case of an ambiguous
+   return *TEXT is advanced past the last non-ambiguous prefix (e.g.
+   "info t" can be "info types" or "info target"; upon return *TEXT has been
+   advanced past "info ").
 
    If RESULT_LIST is NULL, don't set *RESULT_LIST (but don't otherwise
    affect the operation).
@@ -906,12 +909,18 @@ lookup_cmd (line, list, cmdtype, allow_unknown)
 /* Helper function for SYMBOL_COMPLETION_FUNCTION.  */
 
 /* Return a vector of char pointers which point to the different
-   possible completions in LIST of TEXT.  */
+   possible completions in LIST of TEXT.  
+
+   WORD points in the same buffer as TEXT, and completions should be
+   returned relative to this position.  For example, suppose TEXT is "foo"
+   and we want to complete to "foobar".  If WORD is "oo", return
+   "oobar"; if WORD is "baz/foo", return "baz/foobar".  */
 
 char **
-complete_on_cmdlist (list, text)
+complete_on_cmdlist (list, text, word)
      struct cmd_list_element *list;
      char *text;
+     char *word;
 {
   struct cmd_list_element *ptr;
   char **matchlist;
@@ -938,8 +947,22 @@ complete_on_cmdlist (list, text)
          }
 
        matchlist[matches] = (char *) 
-         xmalloc (strlen (ptr->name) + 1);
-       strcpy (matchlist[matches++], ptr->name);
+         xmalloc (strlen (word) + strlen (ptr->name) + 1);
+       if (word == text)
+         strcpy (matchlist[matches], ptr->name);
+       else if (word > text)
+         {
+           /* Return some portion of ptr->name.  */
+           strcpy (matchlist[matches], ptr->name + (word - text));
+         }
+       else
+         {
+           /* Return some of text plus ptr->name.  */
+           strncpy (matchlist[matches], word, text - word);
+           matchlist[matches][text - word] = '\0';
+           strcat (matchlist[matches], ptr->name);
+         }
+       ++matches;
       }
 
   if (matches == 0)