This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
Re: rbreak works poorly with ObjC methods
- From: Adam Fedor <fedor at doc dot com>
- To: Jason Molenda <jason-swarelist at molenda dot com>
- Cc: "fedor at gnu dot org" <fedor at gnu dot org>, "gdb-patches at sources dot redhat dot com" <gdb-patches at sources dot redhat dot com>
- Date: 05 Sep 2003 21:49:28 -0600
- Subject: Re: rbreak works poorly with ObjC methods
- Organization:
- References: <20030904143519.A13676@molenda.com>
On Thu, 2003-09-04 at 15:35, Jason Molenda wrote:
> Hey gdb'ers,
>
> rbreak_command gets a list of functions matching a regular expression,
> then caonicalizes those into filename:function-name and sets
> breakpoints on the canonicalized form. For an Objective-C method
> that takes an argument, this form sent to break_command will be
> something like
> basicclass.m:'+[BasicClass newWithArg:]'
>
> The filename is separated out by linespec.c:locate_first_half().
> locate_first_half will correctly handle filename.m:+[classname
> arg:] type arguments, but it cannot cope when the apostrophy is
> added and there is a second ":" after the filename-function name
> separator.
>
> Unfortunately this can be fixed in several ways. :-) I believe
> the best is to change the way rbreak_command canonicalizes its
> arguments to be in the form
> "basicclass.m:+[BasicClass newWithArg:]"
>
> An example patch of this is attached.
>
> Another way to fix this is to modify linespec.c's is_objc_method_format
> to recognize a third ObjC method pattern -- :'-[ ... ] -- in addition
> to the two it already does. This fix seems pretty lame in my
> opinion--it's pushing the ObjC method spotter in the direction of
> being its own little decode_line_1. A patch showing how this would look
> is also attached to this mail note.
>
> The third way to fix this is to add the smarts to detect filename:' ... '
> to locate_first_half() itself. This has the benefit that
> is_objc_method_format is still used to detect the actual objc method
> and the smarts about the added apostrphy are pushed up to this function.
> An example of this approach is also attached. (Ignore the APPLE LOCAL
> markers - this just happens to be the first one I tried)
>
>
I probably don't have much say in the final outcome, but I think
changing rbreak is the best also - it seems more consistent with the way
other things are canonicalized