mirror of
https://github.com/bminor/binutils-gdb.git
synced 2025-12-26 17:18:55 +00:00
* main.c, gdbcmd.h: Add function filename_completer.
source.c: Use it for "directory" command. (But '/' is a word break, limiting usefulness; see comments). * source.c (mod_path): Warning not error if can't find directory.
This commit is contained in:
@@ -1,5 +1,11 @@
|
||||
Mon Jun 14 09:23:51 1993 Jim Kingdon (kingdon@cygnus.com)
|
||||
|
||||
* main.c, gdbcmd.h: Add function filename_completer.
|
||||
source.c: Use it for "directory" command.
|
||||
(This will be more useful if the word break stuff is fixed).
|
||||
|
||||
* source.c (mod_path): Warning not error if can't find directory.
|
||||
|
||||
* isi-xdep.c: New file.
|
||||
* config/m68k/isi.mh (XDEPFILES): Add isi-xdep.o
|
||||
|
||||
|
||||
47
gdb/main.c
47
gdb/main.c
@@ -1148,6 +1148,48 @@ noop_completer (text)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Complete on filenames. */
|
||||
/* FIXME: This would be a lot more useful if the word breaks got set
|
||||
to not include '/'. Probably best to make it up to each completer
|
||||
to do its own word breaking. */
|
||||
char **
|
||||
filename_completer (text)
|
||||
char *text;
|
||||
{
|
||||
/* From readline. */
|
||||
extern char *filename_completion_function ();
|
||||
int subsequent_name;
|
||||
char **return_val;
|
||||
int return_val_used;
|
||||
int return_val_alloced;
|
||||
|
||||
return_val_used = 0;
|
||||
/* Small for testing. */
|
||||
return_val_alloced = 1;
|
||||
return_val = (char **) xmalloc (return_val_alloced * sizeof (char *));
|
||||
|
||||
subsequent_name = 0;
|
||||
while (1)
|
||||
{
|
||||
char *p;
|
||||
p = filename_completion_function (text, subsequent_name);
|
||||
if (return_val_used >= return_val_alloced)
|
||||
{
|
||||
return_val_alloced *= 2;
|
||||
return_val =
|
||||
(char **) xrealloc (return_val,
|
||||
return_val_alloced * sizeof (char *));
|
||||
}
|
||||
/* The string itself has already been stored in newly malloc'd space
|
||||
for us by filename_completion_function. */
|
||||
return_val[return_val_used++] = p;
|
||||
if (p == NULL)
|
||||
break;
|
||||
subsequent_name = 1;
|
||||
}
|
||||
return return_val;
|
||||
}
|
||||
|
||||
/* Generate symbol names one by one for the completer. Each time we are
|
||||
called return another potential completion to the caller.
|
||||
|
||||
@@ -1200,6 +1242,11 @@ symbol_completion_function (text, matches)
|
||||
special word break set for command strings, which leaves out the
|
||||
'-' character used in some commands. */
|
||||
|
||||
/* FIXME: Using rl_completer_word_break_characters is the wrong
|
||||
approach, because "show foo-bar<TAB>" won't know to use the
|
||||
new set until too late. Better approach is to do the word breaking
|
||||
ourself. */
|
||||
|
||||
rl_completer_word_break_characters =
|
||||
gdb_completer_word_break_characters;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user