From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11560 invoked by alias); 7 Jan 2003 13:56:30 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 11546 invoked from network); 7 Jan 2003 13:56:30 -0000 Received: from unknown (63.119.183.65) by 209.249.29.67 with QMTP; 7 Jan 2003 13:56:30 -0000 Received: (qmail 23701 invoked from network); 7 Jan 2003 13:54:46 -0000 Received: from unknown (HELO exchange1.urp.doc.com) (192.168.8.5) by external1 with SMTP; 7 Jan 2003 13:54:46 -0000 X-MIMEOLE: Produced By Microsoft Exchange V6.0.5762.3 Content-Class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Subject: RE: [RFA] Add ObjC recognition to linespec.c [5/5] Date: Tue, 07 Jan 2003 13:56:00 -0000 Message-ID: X-MS-Has-Attach: X-MS-TNEF-Correlator: From: "Adam Fedor" To: "Elena Zannoni" Cc: "GDB Patches" X-SW-Source: 2003-01/txt/msg00271.txt.bz2 > -----Original Message----- > From: Elena Zannoni [mailto:ezannoni@redhat.com] > Sent: Monday, January 06, 2003 3:27 PM > To: Adam Fedor > Cc: GDB Patches > Subject: Re: [RFA] Add ObjC recognition to linespec.c [5/5] >=20 >=20 [...skipped...] >=20 > > + if (*p && (p[0] =3D=3D ':') && (strchr ("+-", p[1]) !=3D NULL)=20 > > + && (p[2] =3D=3D '[')) > > + { > > + is_objc_method =3D 1; > > + paren_pointer =3D NULL; /* Probably just a category=20 > name. Ignore it */ > > + } > > + >=20 > If you find a parenthesis what exactly does that mean? I.e. why are > you making it null again, ignoring what set_flags has found? >=20 The paren_pointer is (I think) used for C++ overload checking, in Objective= -C that isn't necessary, but you may have something like break -[MyObject(PrivateCategory) someMethod:] where the paren_pointer code gets hung up on the 'PrivateCategory' specific= ation when it should just ignore this and skip past the whole method specif= ication (The whole thing gets handled in decode_objc.) > > + /* Is it an Objective-C selector? */ > > + >=20 > What form does a selector have? Could you add that in the comment? >=20 I could, but a selector can have almost any form, from completly unqualifie= d ('break isFlipped') to fullly qualified ('break -[MyObject isFlipped]'). > > + { > > + struct symtabs_and_lines values; > > + values =3D decode_objc (argptr, funfirstline, NULL, > > + canonical, saved_arg); > > + if (values.sals !=3D NULL) > > + return values; > > + } > > + > > /* Does it look like there actually were two parts? */ > >=20=20 > > if ((p[0] =3D=3D ':' || p[0] =3D=3D '.') && paren_pointer =3D=3D NU= LL) >=20 > this check above will trigger for the objc methods, right? If so, do > decode_compound and symtab_from_filename do the right things for objc > methods? >=20 If it's an objc method it gets handled in decode_objc, otherwise it is hand= led correctly in decode_compound, etc. > > @@ -669,13 +699,21 @@ decode_line_1 (char **argptr, int funfir > > Find the next token (everything up to end or next=20 > whitespace). */ > >=20=20 > > if (**argptr =3D=3D '$') /* May be a convenience=20 > variable */ > > - p =3D skip_quoted (*argptr + (((*argptr)[1] =3D=3D '$') ? 2=20 > : 1)); /* One or two $ chars possible */ > > + { > > + /* One or two $ chars possible */ > > + p =3D skip_quoted (*argptr + (((*argptr)[1] =3D=3D '$') ? 2 : 1= )); > > + } > > else if (is_quoted) > > { > > p =3D skip_quoted (*argptr); > > if (p[-1] !=3D '\'') > > error ("Unmatched single quote."); > > } > > + else if (is_objc_method) >=20 > I wonder if the check above that sets is_objc_method needs to be done > that early, and couldn't be instead moved to here (thinking out > loud). >=20 Yes you could, except it's also needed for the paren_pointer check. > > + { > > + /* allow word separators in method names for Obj-C */ > > + p =3D skip_quoted_chars (*argptr, NULL, ""); > > + } > > else if (paren_pointer !=3D NULL) > > { > > p =3D paren_pointer + 1; > > @@ -952,6 +990,13 @@ locate_first_half (char **argptr, int *i > > error ("malformed template specification in command"); > > p =3D temp_end; > > } > > + /* Check for a colon and a plus or minus and a [ (which > > + indicates an Objective-C method) */ > > + if (*p && (p[0] =3D=3D ':') && (strchr ("+-", p[1]) !=3D NULL)= =20 > > + && (p[2] =3D=3D '[')) > > + { > > + break; > > + } > > /* Check for the end of the first half of the=20 > linespec. End of line, > > a tab, a double colon or the last single colon,=20 > or a space. But > > if enclosed in double quotes we do not break on=20 > enclosed spaces */ > > @@ -993,6 +1038,98 @@ locate_first_half (char **argptr, int *i > > } > >=20=20 > > =0C>=20 > > + > > +struct symtabs_and_lines > > +decode_objc (char **argptr, int funfirstline, struct=20 > symtab *file_symtab, > > + char ***canonical, char *saved_arg) > > +{ > > + /* here's where we recognise an Objective-C Selector. An > > + * Objective C selector may be implemented by more than one > > + * class, therefore it may represent more than one > > + * method/function. This gives us a situation somewhat > > + * analogous to C++ overloading. If there's more than one > > + * method that could represent the selector, then use some of > > + * the existing C++ code to let the user choose one. > > + */ > > + >=20 > Comments should go before the function. Also, sentences should be > capitalized, end with a '.' and 2 spaces after the period.=20 > (yes, it's a > pain). (No asterisks either). >=20 [...] OK. I'll update the patch (splitting the two functions into separate patche= s also).