From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 31933 invoked by alias); 16 Oct 2008 13:51:28 -0000 Received: (qmail 31924 invoked by uid 22791); 16 Oct 2008 13:51:27 -0000 X-Spam-Check-By: sourceware.org Received: from main.gmane.org (HELO ciao.gmane.org) (80.91.229.2) by sourceware.org (qpsmtpd/0.31) with ESMTP; Thu, 16 Oct 2008 13:50:48 +0000 Received: from list by ciao.gmane.org with local (Exim 4.43) id 1KqTFT-0004oS-9V for gdb@sources.redhat.com; Thu, 16 Oct 2008 13:50:43 +0000 Received: from 78.158.192.230 ([78.158.192.230]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 16 Oct 2008 13:50:43 +0000 Received: from vladimir by 78.158.192.230 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 16 Oct 2008 13:50:43 +0000 To: gdb@sources.redhat.com From: Vladimir Prus Subject: Re: multiple location in C++ constructors Date: Thu, 16 Oct 2008 13:51:00 -0000 Message-ID: References: <48F4B6F7.2010109@st.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7Bit User-Agent: KNode/0.10.9 X-IsSubscribed: yes Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2008-10/txt/msg00066.txt.bz2 Denis PILAT wrote: > We (at ST) have a compiler that generates DW_AT_MIPS_linkage_name > attributes for constructors. > Unfortunately, that prevents breakpoint in constructor to have multiple > locations since the gdb heuristics eliminates one location in the > expand_line_sal_maybe() function of breakpoint.c: see bellow, we go thru > the remove_sal () line. > > (from breakpoint.c) > struct symtabs_and_lines > expand_line_sal_maybe (struct symtab_and_line sal) > ... > if (find_pc_partial_function (pc, &this_function, > &func_addr, &func_end)) > { > if (this_function && > strcmp (this_function, original_function) != 0) > { > remove_sal (&expanded, i); > --i; > } > else if (func_addr == pc) > ... > > > > If present into dwarf2 debug information, the find_pc_partial_function() > returns the DW_AT_MIPS_linkage_name in this_function, which is alway > different from the original_function. Therefore there is always only one > location for constructor breakpoints since the DW_AT_MIPS_linkage_name > is filled with the mangled function name. > > > My question is: > Is the GDB heuristic to find multiple location for breakpoint wrong ? An heuristic, by definition, is sometimes wrong. > Or is the DW_AT_MIPS_linkage_name attribute for constructors useless in > debug informations ? I don't really know the answer to this question, but I think the right answer is to make sure that all ways GDB has to search a function for PC should return the same name. And probably, breakpoint setting code should resolve back from PC to name, so that if you put breakpoint on C::C where C is a class in some namespace, the 'info break' will report: some_namespace::C::C and find_partial_function will report same, and comparison will yield true. Alternatively, somebody should come up with a better way to tell if PC1 and PC2 belong to instantination of a template function with different parameters. - Volodya