From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23065 invoked by alias); 12 Jun 2007 11:29:38 -0000 Received: (qmail 23051 invoked by uid 22791); 12 Jun 2007 11:29:37 -0000 X-Spam-Check-By: sourceware.org Received: from mail.artimi.com (HELO mail.artimi.com) (194.72.81.2) by sourceware.org (qpsmtpd/0.31) with ESMTP; Tue, 12 Jun 2007 11:29:35 +0000 Received: from rainbow ([192.168.8.46]) by mail.artimi.com with Microsoft SMTPSVC(6.0.3790.3959); Tue, 12 Jun 2007 12:28:06 +0100 From: "Dave Korn" To: "'Daniel Jacobowitz'" , Cc: "'Jim Blandy'" , References: <20070612111935.GA29495@caradoc.them.org> Subject: RE: gdb breakpoint problem Date: Tue, 12 Jun 2007 11:29:00 -0000 Message-ID: <00c001c7ace5$072dd180$2e08a8c0@CAM.ARTIMI.COM> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook 11 In-Reply-To: <20070612111935.GA29495@caradoc.them.org> 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: 2007-06/txt/msg00094.txt.bz2 On 12 June 2007 12:20, Daniel Jacobowitz wrote: > On Mon, Jun 11, 2007 at 11:33:15PM -0400, kdsfinger@gmail.com wrote: >> The breakpoints set at line 22, 23, 24 are all ignored. However, the >> breakpoints set at line 16, 17, 18 are all good to break the program. >> What's the difference? They are doing the same thing. Why gdb treated >> them differently? Thanks for your comments. > > That's a known bug in GDB - it has trouble with the way GCC generates > constructors for C++ classes. Specifically, it's down to the fact that GCC emits two constructor functions which are called in different circumstances, but they both have the same name and function signature (when unmangled - there is a difference in the mangled names) so GDB is unable to distinguish them. NB that you can work around this; here's your testcase again: /tmp/dosfs $ cat test.cpp /* Test.cpp -- Test C++ program to be debugged with ddd */ #include #include #include #include class Test{ public: Test(); private: void donothing(); }; void Test::donothing(){ std::string s = "abc"; // line 16 s = s+s; // line 17 std::cout<