From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7854 invoked by alias); 27 Aug 2008 07:30:16 -0000 Received: (qmail 7839 invoked by uid 22791); 27 Aug 2008 07:30:14 -0000 X-Spam-Check-By: sourceware.org Received: from relay-pt1.poste.it (HELO relay-pt1.poste.it) (62.241.4.164) by sourceware.org (qpsmtpd/0.31) with ESMTP; Wed, 27 Aug 2008 07:29:35 +0000 Received: from geppetto.reilabs.com (212.123.91.176) by relay-pt1.poste.it (7.3.122) (authenticated as stefano.sabatini-lala@poste.it) id 48B4994700001649 for gdb@sources.redhat.com; Wed, 27 Aug 2008 09:29:32 +0200 Received: from stefano by geppetto.reilabs.com with local (Exim 4.67) (envelope-from ) id 1KYFSD-0002xb-VN for gdb@sources.redhat.com; Wed, 27 Aug 2008 09:28:33 +0200 Date: Wed, 27 Aug 2008 22:46:00 -0000 From: Stefano Sabatini To: gdb Mailing List Subject: Re: C++ debugging pain Message-ID: <20080827072833.GA7859@geppetto> Mail-Followup-To: gdb Mailing List References: <20080826162251.GA24398@geppetto> <8ac60eac0808260936p247e0b92k38384ea54edbaa51@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <8ac60eac0808260936p247e0b92k38384ea54edbaa51@mail.gmail.com> User-Agent: Mutt/1.5.18 (2008-05-17) 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-08/txt/msg00280.txt.bz2 On date Tuesday 2008-08-26 09:36:35 -0700, Paul Pluzhnikov wrote: > On Tue, Aug 26, 2008 at 9:22 AM, Stefano Sabatini > wrote: > > > * "class X does not have any method named Y": this happens with > > virtual methods defined in a parent class rather than in the class > > of the instance debugged > > Try "set print object on". > (I am working on a fix which would make that unnecessary). I checked my gdbinit, I already had the command: set print object I think it should be equivalent to your command. BTW I forgot to give my gdb version: gdb --version GNU gdb 6.8-debian > > * "Cannot resolve method (null)X to any overloaded instance": > > this happen when I try to invoke a method on some object > > This usually happens when you have a pointer to Foo, and do: > > print p.virtfn() > > Instead, try: > > print p->virtfn() > > (I am also working on that fix). > > > I've been already advised by Daniel Jacobowitz (thanks Daniel) that > > it could depend on the method invoked being inlined. Another problem which I'm facing is that I sometimes can't set breakpoints on some functions, for example: (gdb) b PUDPSocket::WriteTo() Function "PUDPSocket::WriteTo()" not defined. (gdb) b PUDPSocket::WriteTo the class PUDPSocket does not have any method named WriteTo Hint: try 'PUDPSocket::WriteTo or 'PUDPSocket::WriteTo (Note leading single quote.) Note also the inconsistency in the feedback message. These are classes from the libpt, but now I'm not sure they've been compiled with the right options (-O0 -ggdb) due to messy build system implemented for that library. > If you compiled without '-O*', no inlining should have happened. > If you do compile with '-g -O2', you are inflicting pain on yourself. Well being a programmer I like to inflict myself pain, but I'm not that masochistic ;-), always use -O0 -ggdb when compiling. BTW I'd be glad to help testing, feel free to contact me if you need some tester for those fixes. Thanks for your precious help. Regards.