From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32767 invoked by alias); 2 Dec 2011 13:48:37 -0000 Received: (qmail 32753 invoked by uid 22791); 2 Dec 2011 13:48:36 -0000 X-SWARE-Spam-Status: No, hits=-0.6 required=5.0 tests=AWL,BAYES_00,KAM_STOCKGEN,SPF_FAIL X-Spam-Check-By: sourceware.org Received: from gbenson.demon.co.uk (HELO gbenson.demon.co.uk) (80.177.220.214) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 02 Dec 2011 13:48:20 +0000 Date: Fri, 02 Dec 2011 13:48:00 -0000 From: Gary Benson To: Tom Tromey Cc: gdb-patches@sourceware.org Subject: Re: [RFA] Allow setting breakpoints on inline functions (PR 10738) Message-ID: <20111202134817.GB2862@redhat.com> Mail-Followup-To: Tom Tromey , gdb-patches@sourceware.org References: <20111129150200.GB3425@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2011-12/txt/msg00039.txt.bz2 Tom Tromey wrote: > >>>>> "Gary" == Gary Benson writes: > > Gary> This patch, which applies on top of Tom's ambiguous linespec work, > Gary> allows you to set breakpoints on inlined functions. Although it > Gary> can't be committed until Tom's stuff goes in, I'm posting it for > Gary> feedback now. > > I noticed that the manual node "Inline Functions" says: > > There are some ways that GDB does not pretend that inlined function > calls are the same as normal calls: > > * You cannot set breakpoints on inlined functions. GDB > either reports that there is no symbol with that name, or > else sets the breakpoint only on non-inlined copies of the > function. This limitation will be removed in a future > version of GDB; until then, set a breakpoint by line number > on the first line of the inlined function instead. > [...] > > I think this needs a small update. I removed that entire bullet point. > Also I think this feature deserves a NEWS entry. I added "* GDB can now set breakpoints on inlined functions." on the branch. > I checked it out and played with it a little. I found one little > bug. Using the inline-break test case from the patch: > > (gdb) p &func1 > $1 = (int (*)(int)) 0x4003d8 > > That is, it chooses the location of the inline function as the > address of the function when evaluating an expression. I think > this is wrong. Instead, it should ignore inline instances here, > returning the address of the out-of-line instance. And, if there > is no out-of-line (as in this case), it should error. > > I think one possible way to do this would be to put a flag on > symbols, marking inline instances, and then have ordinary symbol > lookup ignore such symbols. I am not sure how hard this would be. > There might also be other approaches. There already is such a flag: SYMBOL_INLINED (sym). I've pushed a fix to the branch to make lookup_block_symbol skip over inlined symbols. It works as you ask with no regressions. I won't make a new patch yet as I need to look at some of Jan's suggestions. Thanks, Gary -- http://gbenson.net/