From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15257 invoked by alias); 9 Mar 2005 23:45:31 -0000 Mailing-List: contact gdb-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sources.redhat.com Received: (qmail 15011 invoked from network); 9 Mar 2005 23:45:12 -0000 Received: from unknown (HELO frank.idealab.com) (64.208.8.4) by sourceware.org with SMTP; 9 Mar 2005 23:45:12 -0000 Received: (qmail 39261 invoked by uid 72); 9 Mar 2005 23:45:11 -0000 Received: from stout@evolution.com by frank.idealab.com by uid 70 with qmail-scanner-1.22 (sweep: 2.20/3.84. Clear:RC:1(10.1.22.14):. Processed in 3.602659 secs); 09 Mar 2005 23:45:11 -0000 X-Qmail-Scanner-Mail-From: stout@evolution.com via frank.idealab.com X-Qmail-Scanner: 1.22 (Clear:RC:1(10.1.22.14):. Processed in 3.602659 secs) Received: from unknown (HELO [10.1.22.14]) (10.1.22.14) by 172.31.30.235 with SMTP; Wed, 09 Mar 2005 23:45:07 +0000 Message-ID: <422F8A83.4000303@evolution.com> Date: Wed, 09 Mar 2005 23:45:00 -0000 From: Michael Stout User-Agent: Mozilla Thunderbird 0.9 (Windows/20041103) MIME-Version: 1.0 To: David Lecomber CC: gdb Subject: Re: Re. How to setup a breakpoint on constructor References: <422F7A0B.6080807@evolution.com> <1110409385.8084.24.camel@cpc2-oxfd5-5-0-cust103.oxfd.cable.ntl.com> In-Reply-To: <1110409385.8084.24.camel@cpc2-oxfd5-5-0-cust103.oxfd.cable.ntl.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-SW-Source: 2005-03/txt/msg00090.txt.bz2 I didn't modify the linetable_entry structure, but just changed the signature of find_line_common from /* Given a line table and a line number, return the index into the line table for the pc of the nearest line whose number is >= the specified one. Return -1 if none is found. The value is >= 0 if it is an index. Set *EXACT_MATCH nonzero if the value returned is an exact match. */ static int find_line_common (struct linetable *l, int lineno, int *exact_match) to static int find_line_common (struct linetable *l, int lineno, int *exact_match,int **returned_entries); The current signature is just plain wrong or at best misleading since there can be multiple linetable entries that share a common linenumber. The same is true for find_line_pc. The first change I would recommend is renaming find_line_common to find_first_line_common and implementing it using a correct version of find_line_common. Mike David Lecomber wrote: >Hi Michael, > >I tried the same -- and am happily using a GDB with working constructors >- and (bonus) working breakpoints for compilers that generate different >versions of the same function in the same executable - eg. Intel's >compiler which has specific optimizations depending on what's under the >hood. > >http://sources.redhat.com/ml/gdb-patches/2004-10/msg00241.html > >The general consensus back then to my solution was "ok, it works, but it >ain't how we'd like to fix it". Looks like we've both come up with >broadly the same. > >We're still waiting for the "Right Thing" [TM] to appear... sigh.. not >sure who's thinking about this one at the moment. > >d. > > > >On Wed, 2005-03-09 at 14:34 -0800, Michael Stout wrote: > > >>I've hacked my gdb sources to get breakpoints to work on constructors. >>Well it seems to work. >>see >> >>http://sources.redhat.com/ml/gdb/2004-07/msg00162.html >> >>and >> >>http://sources.redhat.com/ml/gdb/2004-07/msg00163.html >> >>which explains the issue with multiple copies of the constructor >> >>Here is my analysis from someone who is completely unfamiliar with gdb: >>There are two essential problems >> >>1) gdb assumes there is a one-to-one mapping between a >>file-linenumber-symbol-table and file:linenumber entered by >>the user. >> >>a) find_line_common in symtab.c currently only returns one index into >>the linnumber-symbol-table where it should >>be able to return multiple line numbers. >>b) the same is true for find_line_symtab >>c) decode_all_digits in linespec.c calls fine_line_symtab needs to >>handle the multiple values returned by find_line_symtab >> >>2) gdb assumes a one-to-one mapping between a breakpoint number and a >>breakpoint address. I hacked my fix by >>using the breakpoint::releated_breakpoint but I don't think this is not >>a good fix. >> >> >>To fix this requires a load of changes. I'm willing to start submitting >>patches to get this to work, but I need to have someone >>look over my shoulder. The first step would be to modify modify >>find_line_common to return multiple indexes. >> >>Here is a simple sample program that illustrates the problem >> >>class gobo >>{ >>public: >> gobo(); >> int i; >>}; >> >>gobo ::gobo() >>{ >> i = 4; >>} >> >>int main(int argc,int **argv) >>{ >> gobo flagger; >>} >> >>g++ -g -o foo foo.cpp (g++ 3.3.5 debian) >>gdb foo >>break foo.cpp:10 >>run >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >>