Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH] Redefine skip_quoted
@ 2002-10-04 19:53 Adam Fedor
  2002-10-08 16:22 ` Michael Snyder
  0 siblings, 1 reply; 17+ messages in thread
From: Adam Fedor @ 2002-10-04 19:53 UTC (permalink / raw)
  To: gdb-patches

[-- Attachment #1: Type: text/plain, Size: 658 bytes --]

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).

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.



[-- Attachment #2: objc3.patch --]
[-- Type: text/plain, Size: 7511 bytes --]

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] != '\'')

^ permalink raw reply	[flat|nested] 17+ messages in thread
* RE: [PATCH] Redefine skip_quoted
@ 2002-10-14 16:17 Adam Fedor
  0 siblings, 0 replies; 17+ messages in thread
From: Adam Fedor @ 2002-10-14 16:17 UTC (permalink / raw)
  To: Klee Dienes, Jim Blandy; +Cc: Michael Snyder, gdb-patches

> From: Klee Dienes [mailto:klee@apple.com]
> 
> In the Apple code, we use skip_quoted to allow for the possibility of 
> spaces in Objective-C function names.
> 
> I'm actually coming to think that allowing people to break on 
> unquoted 
> Objective-C methods was a mistake: it's caused us no end of trouble 
> trying to shoehorn decode_line_1() into handling every possible 
> edge-case.  I'm not sure how practical it is for us to remove it at 
> this point, though --- we'd have to do some research among our 
> Objective-C developers to find out how important a feature it is to 
> them, I think.
> 
> Here's the appropriate diff from our linespec.c:
>
In the patch I made also, the only place this change is used is in decode_line_1. I must say that 99% of the problems I had getting Objective-C to work in gdb on multiple platforms was in this function. It's a nightmare, at least for Objective-C method names.
 


^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2002-11-07 20:36 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-10-04 19:53 [PATCH] Redefine skip_quoted Adam Fedor
2002-10-08 16:22 ` Michael Snyder
2002-10-14 13:47   ` Jim Blandy
2002-10-14 14:30     ` Michael Snyder
2002-10-14 14:33     ` Klee Dienes
2002-10-16  0:44       ` Jim Blandy
2002-10-16  3:29         ` [PATCH] minor nit in read_tilde_fields Klee Dienes
2002-10-16  6:54           ` Daniel Jacobowitz
2002-10-17 23:33         ` [PATCH] Redefine skip_quoted Adam Fedor
2002-10-18 14:52           ` Elena Zannoni
2002-10-18 15:54             ` Adam Fedor
2002-10-22  8:04               ` Elena Zannoni
2002-10-25 12:43                 ` Adam Fedor
2002-11-03 16:20                   ` Elena Zannoni
2002-11-03 18:54                     ` GDB ObjC plan (was: Re: [PATCH] Redefine skip_quoted) Adam Fedor
2002-11-07 12:36               ` [PATCH] Redefine skip_quoted Jim Blandy
2002-10-14 16:17 Adam Fedor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox