This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
Re: [PATCH] Redefine skip_quoted
- From: Michael Snyder <msnyder at redhat dot com>
- To: Adam Fedor <fedor at doc dot com>
- Cc: gdb-patches at sources dot redhat dot com, jimb at redhat dot com
- Date: Tue, 08 Oct 2002 16:21:01 -0700
- Subject: Re: [PATCH] Redefine skip_quoted
- Organization: Red Hat, Inc.
- References: <3D9E541D.8010007@doc.com>
Adam Fedor wrote:
>
> Objective-C has a different idea of what word break characters are.
> Hence this patch (although the new usage isn't actually apparent in this
> patch).
I think you need Jim or Elena's buy-in for the change in linespec.c,
but I'll approve the rest. Jim, Elena's on vacation -- can you give
a quick look at this?
>
> 2002-10-04 Adam Fedor <fedor@gnu.org>
>
> * Makefile.in (c-exp.tab.o): Add $(completer_h) to dependancies.
> (jv-exp.tarb.o): Likewise.
> (p-exp.tab.o): Likewise.
> * completer.c (skip_quoted): Take additional "word break
> characters" argument.
> * completer.h: Update definition of skip_quoted.
> * defs.h (skip_quoted): Delete, declared in completer.h.
> * c-exp.y: Include completer.h. Update definition of skip_quoted.
> * p-exp.y: Likewise.
> * jv-exp.y: Likewise.
> * linespec.c (decode_line_1): Likewise.
>
> -------------------------------------------------------------------------------
> Index: gdb/Makefile.in
> ===================================================================
> RCS file: /cvs/src/src/gdb/Makefile.in,v
> retrieving revision 1.268
> diff -u -p -r1.268 Makefile.in
> --- gdb/Makefile.in 2 Oct 2002 21:33:58 -0000 1.268
> +++ gdb/Makefile.in 5 Oct 2002 02:49:03 -0000
> @@ -1433,12 +1433,12 @@ z8k-tdep.o: $(srcdir)/z8k-tdep.c
>
> c-exp.tab.o: c-exp.tab.c $(defs_h) $(gdb_string_h) $(expression_h) \
> $(value_h) $(parser_defs_h) $(language_h) $(c_lang_h) $(bfd_h) \
> - $(charset_h) \
> + $(charset_h) $(completer_h) \
> $(symfile_h) $(objfiles_h)
>
> jv-exp.tab.o: jv-exp.tab.c jv-lang.h $(defs_h) $(expression_h) \
> $(gdbtypes_h) $(language_h) $(parser_defs_h) $(symtab_h) $(value_h) \
> - $(bfd_h) $(objfiles_h) $(symfile_h)
> + $(bfd_h) $(objfiles_h) $(symfile_h) $(completer_h)
>
> f-exp.tab.o: f-exp.tab.c f-lang.h $(defs_h) $(expression_h) \
> $(language_h) $(parser_defs_h) $(value_h) $(bfd_h) $(objfiles_h) \
> @@ -1450,7 +1450,7 @@ m2-exp.tab.o: m2-exp.tab.c $(defs_h) $(e
>
> p-exp.tab.o: p-exp.tab.c $(defs_h) $(expression_h) $(gdbtypes_h) \
> $(language_h) p-lang.h $(parser_defs_h) $(symtab_h) $(value_h) \
> - $(bfd_h) $(objfiles_h) $(symfile_h)
> + $(bfd_h) $(objfiles_h) $(symfile_h) $(completer_h)
>
> ada-exp.tab.o: ada-exp.tab.c ada-lex.c ada-lang.h \
> $(defs_h) $(expression_h) \
> Index: gdb/c-exp.y
> ===================================================================
> RCS file: /cvs/src/src/gdb/c-exp.y,v
> retrieving revision 1.15
> diff -u -p -r1.15 c-exp.y
> --- gdb/c-exp.y 20 Sep 2002 00:24:01 -0000 1.15
> +++ gdb/c-exp.y 5 Oct 2002 02:49:10 -0000
> @@ -50,6 +50,7 @@ Foundation, Inc., 59 Temple Place - Suit
> #include "symfile.h" /* Required by objfiles.h. */
> #include "objfiles.h" /* For have_full_symbols and have_partial_symbols */
> #include "charset.h"
> +#include "completer.h"
>
> /* Flag indicating we're dealing with HP-compiled objects */
> extern int hp_som_som_object_present;
> @@ -1331,7 +1332,9 @@ yylex ()
> c = *lexptr++;
> if (c != '\'')
> {
> - namelen = skip_quoted (tokstart) - tokstart;
> + namelen = skip_quoted (tokstart,
> + get_gdb_completer_word_break_characters())
> + - tokstart;
> if (namelen > 2)
> {
> lexptr = tokstart + namelen;
> Index: gdb/completer.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/completer.c,v
> retrieving revision 1.11
> diff -u -p -r1.11 completer.c
> --- gdb/completer.c 24 Mar 2002 00:40:35 -0000 1.11
> +++ gdb/completer.c 5 Oct 2002 02:49:11 -0000
> @@ -683,7 +683,7 @@ line_completion_function (char *text, in
> location after the "word". */
>
> char *
> -skip_quoted (char *str)
> +skip_quoted (char *str, char *breakchars)
> {
> char quote_char = '\0';
> char *scan;
> @@ -705,7 +705,7 @@ skip_quoted (char *str)
> /* Found start of a quoted string. */
> quote_char = *scan;
> }
> - else if (strchr (gdb_completer_word_break_characters, *scan))
> + else if (strchr (breakchars, *scan))
> {
> break;
> }
> Index: gdb/completer.h
> ===================================================================
> RCS file: /cvs/src/src/gdb/completer.h,v
> retrieving revision 1.6
> diff -u -p -r1.6 completer.h
> --- gdb/completer.h 18 Feb 2002 01:12:38 -0000 1.6
> +++ gdb/completer.h 5 Oct 2002 02:49:11 -0000
> @@ -39,6 +39,6 @@ extern char *get_gdb_completer_quote_cha
>
> /* Exported to linespec.c */
>
> -extern char *skip_quoted (char *str);
> +extern char *skip_quoted (char *str, char *);
>
> #endif /* defined (COMPLETER_H) */
> Index: gdb/defs.h
> ===================================================================
> RCS file: /cvs/src/src/gdb/defs.h,v
> retrieving revision 1.99
> diff -u -p -r1.99 defs.h
> --- gdb/defs.h 27 Sep 2002 22:08:51 -0000 1.99
> +++ gdb/defs.h 5 Oct 2002 02:49:13 -0000
> @@ -532,8 +532,6 @@ extern void print_transfer_performance (
>
> typedef void initialize_file_ftype (void);
>
> -extern char *skip_quoted (char *);
> -
> extern char *gdb_readline (char *);
>
> extern char *gdb_readline_wrapper (char *);
> Index: gdb/jv-exp.y
> ===================================================================
> RCS file: /cvs/src/src/gdb/jv-exp.y,v
> retrieving revision 1.11
> diff -u -p -r1.11 jv-exp.y
> --- gdb/jv-exp.y 19 Sep 2002 03:58:41 -0000 1.11
> +++ gdb/jv-exp.y 5 Oct 2002 02:49:14 -0000
> @@ -48,6 +48,7 @@ Foundation, Inc., 59 Temple Place - Suit
> #include "bfd.h" /* Required by objfiles.h. */
> #include "symfile.h" /* Required by objfiles.h. */
> #include "objfiles.h" /* For have_full_symbols and have_partial_symbols */
> +#include "completer.h"
>
> /* Remap normal yacc parser interface names (yyparse, yylex, yyerror, etc),
> as well as gratuitiously global symbol names, so we can have multiple
> @@ -918,7 +919,9 @@ yylex ()
> c = *lexptr++;
> if (c != '\'')
> {
> - namelen = skip_quoted (tokstart) - tokstart;
> + namelen = skip_quoted (tokstart,
> + get_gdb_completer_word_break_characters())
> + - tokstart;
> if (namelen > 2)
> {
> lexptr = tokstart + namelen;
> Index: gdb/linespec.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/linespec.c,v
> retrieving revision 1.23
> diff -u -p -r1.23 linespec.c
> --- gdb/linespec.c 22 Sep 2002 22:18:41 -0000 1.23
> +++ gdb/linespec.c 5 Oct 2002 02:49:14 -0000
> @@ -761,7 +761,8 @@ decode_line_1 (char **argptr, int funfir
> && strchr (get_gdb_completer_quote_characters (),
> **argptr) != NULL)
> {
> - p = skip_quoted (*argptr);
> + p = skip_quoted (*argptr,
> + get_gdb_completer_word_break_characters());
> *argptr = *argptr + 1;
> }
> else
> @@ -1094,10 +1095,14 @@ decode_line_1 (char **argptr, int funfir
> Find the next token (everything up to end or next whitespace). */
>
> if (**argptr == '$') /* May be a convenience variable */
> - p = skip_quoted (*argptr + (((*argptr)[1] == '$') ? 2 : 1)); /* One or two $ chars possible */
> + {
> + /* One or two $ chars possible */
> + p = skip_quoted (*argptr + (((*argptr)[1] == '$') ? 2 : 1),
> + get_gdb_completer_word_break_characters());
> + }
> else if (is_quoted)
> {
> - p = skip_quoted (*argptr);
> + p = skip_quoted (*argptr, get_gdb_completer_word_break_characters());
> if (p[-1] != '\'')
> error ("Unmatched single quote.");
> }
> @@ -1107,7 +1112,7 @@ decode_line_1 (char **argptr, int funfir
> }
> else
> {
> - p = skip_quoted (*argptr);
> + p = skip_quoted (*argptr, get_gdb_completer_word_break_characters());
> }
>
> copy = (char *) alloca (p - *argptr + 1);
> Index: gdb/p-exp.y
> ===================================================================
> RCS file: /cvs/src/src/gdb/p-exp.y,v
> retrieving revision 1.15
> diff -u -p -r1.15 p-exp.y
> --- gdb/p-exp.y 19 Sep 2002 03:58:41 -0000 1.15
> +++ gdb/p-exp.y 5 Oct 2002 02:49:15 -0000
> @@ -56,6 +56,7 @@ Foundation, Inc., 59 Temple Place - Suit
> #include "bfd.h" /* Required by objfiles.h. */
> #include "symfile.h" /* Required by objfiles.h. */
> #include "objfiles.h" /* For have_full_symbols and have_partial_symbols */
> +#include "completer.h"
>
> /* Remap normal yacc parser interface names (yyparse, yylex, yyerror, etc),
> as well as gratuitiously global symbol names, so we can have multiple
> @@ -1100,8 +1101,10 @@ yylex ()
> c = *lexptr++;
> if (c != '\'')
> {
> - namelen = skip_quoted (tokstart) - tokstart;
> - if (namelen > 2)
> + namelen = skip_quoted (tokstart,
> + get_gdb_completer_word_break_characters())
> + - tokstart;
> + if (namelen > 2)
> {
> lexptr = tokstart + namelen;
> if (lexptr[-1] != '\'')