From: Jim Kingdon Date: Fri, 25 Jun 1993 03:47:12 +0000 (+0000) Subject: * main.c (filename_completer): Don't complete to files ending in ~. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=a32ebcfd6be0565b4b2df1386025d415caf0f02a;p=binutils-gdb.git * 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. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 18164e9b83f..b3352382498 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -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. diff --git a/gdb/NEWS b/gdb/NEWS index 7c285325410..3bc81f41b2c 100644 --- 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 diff --git a/gdb/command.c b/gdb/command.c index dc5a92f5712..abc2d84499c 100644 --- a/gdb/command.c +++ b/gdb/command.c @@ -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)