This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
[RFA/REPOST] Move some funcs from top.c to completer.c
- To: gdb-patches at sources dot redhat dot com
- Subject: [RFA/REPOST] Move some funcs from top.c to completer.c
- From: Elena Zannoni <ezannoni at cygnus dot com>
- Date: Fri, 13 Jul 2001 18:33:10 -0400
This is a repost of a patch I submitted long time ago.
http://sources.redhat.com/ml/gdb-patches/2001-05/msg00136.html
I modified it slightly to adapt it to the current sources.
Elena
2001-07-13 Elena Zannoni <ezannoni@redhat.com>
* top.c (readline_line_completion_function, noop_completer): Move
from here...
* completer.c (readline_line_completion_function, noop_completer):
...to here.
* gdbcmd.h (readline_line_completion_function, noop_completer):
Move declarations from here...
* completer.h (readline_line_completion_function, noop_completer):
...to here.
* corefile.c: Include completer.h.
* source.c: Ditto.
* symfile.c: Ditto.
* Makefile.in: Update dependencies.
Index: Makefile.in
===================================================================
RCS file: /cvs/src/src/gdb/Makefile.in,v
retrieving revision 1.96
diff -u -p -r1.96 Makefile.in
--- Makefile.in 2001/07/13 20:03:52 1.96
+++ Makefile.in 2001/07/13 21:21:39
@@ -610,8 +610,9 @@ remote_h = remote.h
version_h = version.h
ui_out_h = ui-out.h
cli_out_h = cli-out.h
-arch_utils_h = arch-utils.h
+arch_utils_h = arch-utils.h
gdb_string_h = gdb_string.h
+completer_h = completer.h
cli_decode_h = $(srcdir)/cli/cli-decode.h
cli_cmds_h = $(srcdir)/cli/cli-cmds.h
@@ -1222,7 +1223,7 @@ blockframe.o: blockframe.c $(defs_h) $(g
breakpoint.o: breakpoint.c $(defs_h) $(gdbcmd_h) $(gdbcore_h) \
$(inferior_h) language.h target.h gdbthread.h $(gdb_string_h) \
- gdb-events.h linespec.h $(ui_out_h)
+ gdb-events.h linespec.h $(ui_out_h) $(completer_h)
buildsym.o: buildsym.c $(bfd_h) buildsym.h complaints.h $(defs_h) \
objfiles.h symfile.h $(symtab_h) $(gdb_string_h)
@@ -1282,7 +1283,7 @@ core-regset.o: core-regset.c $(command_h
$(inferior_h) target.h $(gdb_string_h)
corefile.o: corefile.c $(dis-asm_h) $(defs_h) $(gdbcmd_h) $(gdbcore_h) \
- $(inferior_h) target.h language.h $(gdb_string_h) completer.h \
+ $(inferior_h) target.h language.h $(gdb_string_h) $(completer_h) \
symfile.h
corelow.o: corelow.c $(command_h) $(defs_h) $(gdbcore_h) $(inferior_h) \
@@ -1341,7 +1342,7 @@ inf-loop.o: inf-loop.c $(defs_h) $(infer
$(event_top_h)
exec.o: exec.c $(defs_h) $(gdbcmd_h) $(gdbcore_h) $(inferior_h) \
- target.h language.h $(gdb_string_h) completer.h
+ target.h language.h $(gdb_string_h) $(completer_h)
expprint.o: expprint.c $(defs_h) $(expression_h) $(gdbtypes_h) \
language.h parser-defs.h $(symtab_h) $(value_h)
@@ -1475,7 +1476,7 @@ v850-tdep.o: v850-tdep.c $(defs_h) $(fra
tracepoint.o: tracepoint.c $(defs_h) $(symtab_h) $(frame_h) $(tracepoint_h) \
$(gdbtypes_h) $(expression_h) $(gdbcmd_h) $(value_h) target.h \
language.h $(gdb_string_h) $(readline_headers) $(remote_h) linespec.h \
- $(regcache_h)
+ $(regcache_h) $(completer_h)
gdbarch.o: gdbarch.c $(defs_h) $(bfd_h) $(gdbcmd_h)
@@ -1570,7 +1571,7 @@ ia64-tdep.o: ia64-tdep.c $(defs_h) $(inf
infcmd.o: infcmd.c $(defs_h) environ.h $(gdbcmd_h) $(gdbcore_h) \
$(inferior_h) target.h language.h symfile.h $(gdb_string_h) \
- $(ui_out_h)
+ $(ui_out_h) $(completer_h)
inflow.o: inflow.c $(bfd_h) $(command_h) $(defs_h) $(inferior_h) \
target.h terminal.h gdbthread.h $(gdb_string_h)
@@ -1776,7 +1777,8 @@ ppcbug-rom.o: ppcbug-rom.c monitor.h $(b
printcmd.o: printcmd.c $(breakpoint_h) $(defs_h) $(expression_h) \
$(gdbcmd_h) $(gdbcore_h) $(gdbtypes_h) language.h objfiles.h \
- symfile.h $(symtab_h) target.h $(gdb_string_h) $(ui_out_h)
+ symfile.h $(symtab_h) target.h $(gdb_string_h) $(ui_out_h) \
+ $(completer_h)
# FIXME: Procfs.o gets -Wformat errors because things like pid_t don't
# match output format strings.
@@ -1784,7 +1786,7 @@ procfs.o: procfs.c $(command_h) $(defs_h
target.h $(gdb_string_h) gdbthread.h proc-utils.h
$(CC) -c $(INTERNAL_WARN_CFLAGS) $(NO_WERROR_CFLAGS) $<
-proc-api.o: proc-api.c $(defs_h) $(gdbcmd_h) proc-utils.h
+proc-api.o: proc-api.c $(defs_h) $(gdbcmd_h) proc-utils.h $(completer_h)
proc-events.o: proc-events.c $(defs_h)
@@ -1818,7 +1820,7 @@ remote-array.o: remote-array.c $(defs_h)
$(version_h) $(regcache_h)
remote-rdi.o: remote-rdi.c $(defs_h) $(gdbcore_h) \
- $(inferior_h) $(gdb_string_h)
+ $(inferior_h) $(gdb_string_h) $(completer_h)
rdi-share/libangsd.a: force
@dir=rdi-share; \
@@ -1953,7 +1955,8 @@ mon960-rom.o: mon960-rom.c monitor.h $(b
$(inferior_h) target.h serial.h terminal.h
solib.o: solib.c $(command_h) $(defs_h) $(gdbcore_h) $(inferior_h) \
- objfiles.h gnu-regex.h symfile.h target.h $(gdb_string_h) solist.h
+ objfiles.h gnu-regex.h symfile.h target.h $(gdb_string_h) solist.h \
+ $(completer_h)
solib-svr4.o: solib-svr4.c $(command_h) $(defs_h) $(gdbcore_h) $(inferior_h) \
objfiles.h gnu-regex.h symfile.h target.h $(gdb_string_h) solist.h \
@@ -1963,7 +1966,7 @@ solib-legacy.o: solib-legacy.c $(defs_h)
source.o: source.c $(defs_h) $(expression_h) $(frame_h) $(gdbcmd_h) \
$(gdbcore_h) language.h objfiles.h gnu-regex.h symfile.h $(symtab_h) \
- $(gdb_string_h) source.h completer.h linespec.h $(ui_out_h)
+ $(gdb_string_h) source.h $(completer_h) linespec.h $(ui_out_h)
sparc-nat.o: sparc-nat.c $(bfd_h) $(defs_h) $(inferior_h) $(gdbcore_h) \
target.h $(regcache_h)
@@ -1999,7 +2002,7 @@ sun3-nat.o: sun3-nat.c $(defs_h) $(gdbco
symfile.o: symfile.c $(breakpoint_h) complaints.h $(defs_h) \
$(expression_h) gdb-stabs.h $(gdbcmd_h) $(gdbcore_h) \
$(gdbtypes_h) language.h objfiles.h symfile.h $(symtab_h) \
- target.h $(gdb_string_h) completer.h
+ target.h $(gdb_string_h) $(completer_h)
symm-tdep.o: symm-tdep.c $(defs_h) $(gdbcore_h) $(inferior_h)
@@ -2015,7 +2018,7 @@ symtab.o: symtab.c call-cmds.h $(defs_h)
$(gdb_string_h) linespec.h $(cp_abi_h)
linespec.o: linespec.c linespec.h $(defs_h) $(frame_h) $(value_h) \
- objfiles.h symfile.h completer.h $(symtab_h) \
+ objfiles.h symfile.h $(completer_h) $(symtab_h) \
$(demangle_h) command.h $(cp_abi_h)
tic80-tdep.o: tic80-tdep.c $(defs_h) $(regcache_h)
@@ -2026,13 +2029,13 @@ target.o: target.c $(bfd_h) $(defs_h) $(
thread.o: thread.c $(defs_h) gdbthread.h $(gdbcmd_h) target.h \
$(regcache_h) $(ui_out_h)
-completer.o: completer.c completer.h $(gdbtypes_h) $(symtab_h) \
+completer.o: completer.c $(completer_h) $(gdbtypes_h) $(symtab_h) \
$(defs_h) $(gdbcmd_h) $(expression_h) $(readline_headers)
top.o: top.c top.h $(bfd_h) $(getopt_h) $(readline_headers) call-cmds.h \
$(defs_h) $(gdbcmd_h) $(inferior_h) language.h \
$(remote_utils_h) $(gdb_string_h) $(event_loop_h) $(event_top_h) \
- completer.h $(version_h) $(ui_out_h)
+ $(completer_h) $(version_h) $(ui_out_h)
typeprint.o: typeprint.c $(defs_h) $(expression_h) $(gdbcmd_h) \
$(gdbcore_h) $(gdbtypes_h) language.h $(symtab_h) target.h \
@@ -2068,7 +2071,7 @@ vax-tdep.o: vax-tdep.c $(OP_INCLUDE)/vax
w65-tdep.o : w65-tdep.c $(gdbcore_h) $(regcache_h)
win32-nat.o: win32-nat.c $(gdbcmd_h) $(gdbcore_h) $(inferior_h) $(defs_h) \
- $(gdb_string_h) $(regcache_h)
+ $(gdb_string_h) $(regcache_h) $(completer_h)
xdr_ld.o: vx-share/xdr_ld.c $(defs_h) vx-share/vxTypes.h \
vx-share/vxWorks.h vx-share/xdr_ld.h
@@ -2140,7 +2143,7 @@ cli-decode.o: $(srcdir)/cli/cli-decode.c
$(CC) -c $(INTERNAL_CFLAGS) $(srcdir)/cli/cli-decode.c
cli-cmds.o: $(srcdir)/cli/cli-cmds.c $(cli_cmds_h) $(cli_decode_h) \
- $(cli_script_h) $(cli_setshow_h) top.h completer.h $(defs_h) \
+ $(cli_script_h) $(cli_setshow_h) top.h $(completer_h) $(defs_h) \
$(target_h) gdb_wait.h gnu-regex.h $(ui_out_h)
$(CC) -c $(INTERNAL_CFLAGS) $(srcdir)/cli/cli-cmds.c
Index: completer.c
===================================================================
RCS file: /cvs/src/src/gdb/completer.c,v
retrieving revision 1.7
diff -u -p -r1.7 completer.c
--- completer.c 2001/06/11 16:05:24 1.7
+++ completer.c 2001/07/13 21:21:47
@@ -38,6 +38,8 @@
#include "completer.h"
/* Prototypes for local functions */
+char *line_completion_function (char *text, int matches, char *line_buffer,
+ int point);
/* readline uses the word breaks for two things:
(1) In figuring out where to point the TEXT parameter to the
@@ -95,6 +97,22 @@ char *
get_gdb_completer_quote_characters (void)
{
return gdb_completer_quote_characters;
+}
+
+/* Line completion interface function for readline. */
+
+char *
+readline_line_completion_function (char *text, int matches)
+{
+ return line_completion_function (text, matches, rl_line_buffer, rl_point);
+}
+
+/* This can be used for functions which don't want to complete on symbols
+ but don't want to complete on anything else either. */
+char **
+noop_completer (char *text, char *prefix)
+{
+ return NULL;
}
/* Complete on filenames. */
Index: completer.h
===================================================================
RCS file: /cvs/src/src/gdb/completer.h,v
retrieving revision 1.3
diff -u -p -r1.3 completer.h
--- completer.h 2001/06/11 16:05:24 1.3
+++ completer.h 2001/07/13 21:21:47
@@ -21,6 +21,10 @@
extern char *line_completion_function (char *, int, char *, int);
+extern char *readline_line_completion_function (char *text, int matches);
+
+extern char **noop_completer (char *, char *);
+
extern char **filename_completer (char *, char *);
extern char **location_completer (char *, char *);
Index: corefile.c
===================================================================
RCS file: /cvs/src/src/gdb/corefile.c,v
retrieving revision 1.13
diff -u -p -r1.13 corefile.c
--- corefile.c 2001/04/14 19:23:02 1.13
+++ corefile.c 2001/07/13 21:21:47
@@ -34,6 +34,7 @@
#include "gdbcore.h"
#include "dis-asm.h"
#include "gdb_stat.h"
+#include "completer.h"
/* Local function declarations. */
Index: gdbcmd.h
===================================================================
RCS file: /cvs/src/src/gdb/gdbcmd.h,v
retrieving revision 1.5
diff -u -p -r1.5 gdbcmd.h
--- gdbcmd.h 2001/03/06 08:21:07 1.5
+++ gdbcmd.h 2001/07/13 21:21:48
@@ -125,8 +125,4 @@ extern void print_command_lines (struct
struct command_line *, unsigned int);
#endif
-extern char **noop_completer (char *, char *);
-
-extern char **filename_completer (char *, char *);
-
#endif /* !defined (GDBCMD_H) */
Index: source.c
===================================================================
RCS file: /cvs/src/src/gdb/source.c,v
retrieving revision 1.18
diff -u -p -r1.18 source.c
--- source.c 2001/07/07 17:19:50 1.18
+++ source.c 2001/07/13 21:21:59
@@ -41,6 +41,7 @@
#include "gdbtypes.h"
#include "linespec.h"
#include "filenames.h" /* for DOSish file names */
+#include "completer.h"
#ifdef UI_OUT
#include "ui-out.h"
#endif
Index: symfile.c
===================================================================
RCS file: /cvs/src/src/gdb/symfile.c,v
retrieving revision 1.34
diff -u -p -r1.34 symfile.c
--- symfile.c 2001/06/06 17:12:30 1.34
+++ symfile.c 2001/07/13 21:22:03
@@ -37,6 +37,7 @@
#include "inferior.h" /* for write_pc */
#include "gdb-stabs.h"
#include "obstack.h"
+#include "completer.h"
#include <sys/types.h>
#include <fcntl.h>
Index: top.c
===================================================================
RCS file: /cvs/src/src/gdb/top.c,v
retrieving revision 1.35
diff -u -p -r1.35 top.c
--- top.c 2001/05/17 15:05:32 1.35
+++ top.c 2001/07/13 21:22:14
@@ -95,8 +95,6 @@ static void init_signals (void);
static void stop_sig (int);
#endif
-static char *readline_line_completion_function (char *, int);
-
static void init_main (void);
static void float_handler (int);
@@ -1050,24 +1048,6 @@ static int write_history_p;
static int history_size;
static char *history_filename;
-/* Functions that are used as part of the fancy command line editing. */
-
-/* This can be used for functions which don't want to complete on symbols
- but don't want to complete on anything else either. */
-/* ARGSUSED */
-char **
-noop_completer (char *text, char *prefix)
-{
- return NULL;
-}
-
-/* Line completion interface function for readline. */
-
-static char *
-readline_line_completion_function (char *text, int matches)
-{
- return line_completion_function (text, matches, rl_line_buffer, rl_point);
-}
#ifdef STOP_SIGNAL
static void