From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Received: (qmail 31890 invoked from network); 11 Nov 2002 22:30:51 -0000 Received: from unknown (HELO dc-mx01.cluster1.charter.net) (209.225.8.11) by sources.redhat.com with SMTP; 11 Nov 2002 22:30:51 -0000 Received: from [66.189.46.2] (HELO platinum.localnet) by dc-mx01.cluster1.charter.net (CommuniGate Pro SMTP 3.5.9) with ESMTP id 3304553; Mon, 11 Nov 2002 17:30:43 -0500 Date: Mon, 11 Nov 2002 17:15:00 -0000 Subject: Re: [rfa] linespec.c, part 3 Content-Type: multipart/mixed; boundary=Apple-Mail-4-764583114 Mime-Version: 1.0 (Apple Message framework v543) Cc: Jim Blandy , Fernando Nasser , Elena Zannoni , gdb-patches@sources.redhat.com To: David Carlton From: Klee Dienes In-Reply-To: Message-Id: <35E8C110-F5C5-11D6-AA35-00039396EEB8@apple.com> X-SW-Source: 2002-11/txt/msg00327.txt.bz2 --Apple-Mail-4-764583114 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII; format=flowed Content-length: 1230 I'm not sure if you want to deal with this now, or if you'd rather I wait until you're done with merging your changes, but I figured I'd mention it now while you were looking at set_flags stuff: The linespec.c changes you posted looked so cool, we couldn't resist using them. So rather than try to deal with the merge conflicts from the upcoming stream of linespec.c patches, we decided to re-add our Objective-C support to the linespec.c from your branch and use that as our linespec.c. One issue that came up was that the part of our code that decodes an Objective-C function needs to have the if-clause removed from the breakpoint expression (since Objective-C functions can contain spaces). We did this by extending set_flags to pass back a pointer to the if-clause, if there was one, and by splitting decode_line_1 into two functions, one of which sets the defaults, calls set_flags, strips off the if-clause and calls decode_line_2, which does the actual parsing. The downside to this is that there's yet one more function to be called in the parsing process; the upside is that the actual parsing code doesn't have to worry about the presence of the if-clause, and that decode_line_1 gets even shorter. --Apple-Mail-4-764583114 Content-Disposition: attachment; filename=linespec.txt Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; x-unix-mode=0644; name="linespec.txt" Content-length: 4092 --- /Volumes/Storage/Users/kdienes/source/cygnus.cygnus/src/gdb/linespec.c = Mon Nov 11 16:47:45 2002 +++ linespec.c Mon Nov 11 17:00:39 2002 @@ -39,7 +39,8 @@ static void initialize_defaults (struct symtab **default_symtab, int *default_line); =20 -static void set_flags (char *arg, int *is_quoted, char **paren_pointer); +static void set_flags (char *arg, int *is_quoted, char **paren_pointer, + char **if_pointer); =20 static struct symtabs_and_lines decode_indirect (char **argptr); =20 @@ -203,38 +204,33 @@ from char ** to const char **. */ =20 struct symtabs_and_lines -decode_line_1 (char **argptr, int funfirstline, struct symtab *default_sym= tab, - int default_line, char ***canonical) +decode_line_2 (char **argptr, int funfirstline, struct symtab *default_sym= tab, + int default_line, char ***canonical, + int is_quoted, char *paren_pointer) { - /* This is NULL if there are no parens in *ARGPTR, or a pointer to - the closing parenthesis if there are parens. */ - char *paren_pointer; - /* This says whether or not something in *ARGPTR is quoted with - completer_quotes (i.e. with single quotes). */ - int is_quoted; /* If a file name is specified, this is its symtab. */ struct symtab *file_symtab =3D NULL; /* This function advances *ARGPTR, but, for error messages, we want to remember what it pointed to initially. */ char *saved_arg =3D *argptr; =20 - /* Defaults have defaults. */ - - initialize_defaults (&default_symtab, &default_line); -=20=20 - /* Set various flags. - * 'paren_pointer' is important for overload checking, where - * we allow things like:=20 - * (gdb) break c::f(int) - */ - - set_flags (*argptr, &is_quoted, &paren_pointer); - /* See if arg is *PC. */ =20 if (**argptr =3D=3D '*') return decode_indirect (argptr); =20 + /* Is it an Objective-C selector? */ + +#if 0 + { + struct symtabs_and_lines values; + values =3D decode_objc (argptr, funfirstline, file_symtab, + canonical, saved_arg); + if (values.sals !=3D NULL) + return values; + } +#endif + /* Check to see if it's a multipart linespec (with colons or periods). */ { @@ -289,6 +285,48 @@ paren_pointer, file_symtab); } =20 +struct symtabs_and_lines +decode_line_1 (char **argptr, int funfirstline, struct symtab *default_sym= tab, + int default_line, char ***canonical) +{ + /* This says whether or not something in *ARGPTR is quoted with + completer_quotes (i.e. with single quotes). */ + int is_quoted; + + /* This is NULL if there are no parens in *ARGPTR, or a pointer to + the closing parenthesis if there are parens. */ + char *paren_pointer; + + /* This is NULL if there is no if-clause at the end of *ARGPTR, or a + pointer to the whitespace before the 'if' if there is. */ + char *if_pointer; + + struct symtabs_and_lines values; + + /* Defaults have defaults. */ + + initialize_defaults (&default_symtab, &default_line); +=20=20 + /* Set various flags. + * 'paren_pointer' is important for overload checking, where + * we allow things like:=20 + * (gdb) break c::f(int) + */ +=20=20 + set_flags (*argptr, &is_quoted, &paren_pointer, &if_pointer); + + if (if_pointer !=3D NULL) + *if_pointer =3D '\0'; + + values =3D decode_line_2 (argptr, funfirstline, default_symtab, default_= line, + canonical, is_quoted, paren_pointer); + + if (if_pointer !=3D NULL) + *if_pointer =3D ' '; + + return values; +} + =0C =20 /* Now, the helper functions. */ @@ -326,7 +364,7 @@ } =20 static void -set_flags (char *arg, int *is_quoted, char **paren_pointer) +set_flags (char *arg, int *is_quoted, char **paren_pointer, char **if_poin= ter) { char *if_index; char *paren_start; @@ -372,7 +410,12 @@ /* Now that we're safely past the has_parens check, put back " if (condition)" so outer layers can see it. */ if (has_if) - *if_index =3D ' '; + { + *if_pointer =3D if_index; + *if_index =3D ' '; + } + else + *if_pointer =3D NULL; } =20 =0C --Apple-Mail-4-764583114--