From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32727 invoked by alias); 6 Sep 2003 03:51:48 -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 32713 invoked from network); 6 Sep 2003 03:51:47 -0000 Received: from unknown (199.72.38.5) by sources.redhat.com with QMTP; 6 Sep 2003 03:51:47 -0000 Received: (qmail 1018 invoked from network); 6 Sep 2003 03:49:31 -0000 Received: from cpe-24-221-209-215.co.sprintbbd.net (HELO ?192.168.1.101?) (24.221.209.215) by external1.doc.com with SMTP; 6 Sep 2003 03:49:31 -0000 Subject: Re: rbreak works poorly with ObjC methods From: Adam Fedor To: Jason Molenda Cc: "fedor@gnu.org" , "gdb-patches@sources.redhat.com" In-Reply-To: <20030904143519.A13676@molenda.com> References: <20030904143519.A13676@molenda.com> Content-Type: text/plain Organization: Message-Id: <1062820167.1147.1.camel@localhost.localdomain> Mime-Version: 1.0 Date: Sat, 06 Sep 2003 03:51:00 -0000 Content-Transfer-Encoding: 7bit X-SW-Source: 2003-09/txt/msg00086.txt.bz2 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