RE: [RFA] Add ObjC recognition to linespec.c [5/5]

Adam Fedor
2003-01-07T13:59:17Z

> -----Original Message-----
> From: Michael Snyder [mailto:msnyder@redhat.com]
> Sent: Monday, January 06, 2003 3:32 PM
> To: Adam Fedor
> Cc: GDB Patches
> Subject: Re: [RFA] Add ObjC recognition to linespec.c [5/5]
>
> > >>+
> > >>+ /* Is it an Objective-C selector? */
> > >>+
> > >>+ {
> > >>+ struct symtabs_and_lines values;
> > >>+ values = decode_objc (argptr, funfirstline, NULL,
> > >>+ canonical, saved_arg);
> > >>+ if (values.sals != NULL)
> > >>+ return values;
> > >>+ }
> > >
> > >
> > > Was this meant to be an if? It seems to be a naked block.
> > > I'd feel better if there was an if around it, eg. is there
> > > a simple way to test for a selector name? Do I remember
> > > that they begin with a unique prefix such as '@'?
> > >
> > >
> >
> > No. Because the user can do things like 'break init' or 'break
> > isAnImage', and this will determine that these are really
> Objective-C
> > methods and not regular C functions. It's really just a way
> to keep the
> > variable local to where it is really used.
>
> OK, so if there is a C function init and an objc selector init,
> how do we resolve the conflict? Which one wins? In other words,
> will this un-protected code (not inside an if) ever obscure a
> C function when it shouldn't?
>

You get presented with a choice:

(gdb) break init
[0] cancel
[1] all
[2] -[MyObject init] at testit.m:27
[3] -[NewObject init] at testit.m:13
[4] init at testit.m:33
>

So you can choose which init you want.