From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 31361 invoked by alias); 30 Jul 2002 02:56:52 -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 31354 invoked from network); 30 Jul 2002 02:56:51 -0000 Received: from unknown (HELO smtp01.mrf.mail.rcn.net) (207.172.4.60) by sources.redhat.com with SMTP; 30 Jul 2002 02:56:51 -0000 Received: from 209-6-138-137.s137.tnt2.mnh.nh.dialup.rcn.com ([209.6.138.137] helo=rcn.com) by smtp01.mrf.mail.rcn.net with esmtp (Exim 3.35 #5) id 17ZNBp-0000UE-00 for gdb@sources.redhat.com; Mon, 29 Jul 2002 22:56:50 -0400 Message-ID: <3D46008C.DCD89FAF@rcn.com> Date: Mon, 29 Jul 2002 19:56:00 -0000 From: Peter Thompson/Amy Kirschner X-Accept-Language: en MIME-Version: 1.0 To: gdb@sources.redhat.com Subject: Is c++ debugging really "this" bad? Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-SW-Source: 2002-07/txt/msg00303.txt.bz2 I'm doing some contract work helping a small company with their tool issues and have run across a nasty c++/gdb interaction. I've been checking the archives and I find some related bugs in the c++ area, but not the specific issue I'm running into. The basic problem. Printing the value of 'this', the c++ object pointer, does not agree with a simple printf of 'this' in the same routine. The particular routine I'm looking at is a destructor routine, and I have seen reasonable values of 'this' in other routines, but the wrong behavior seems to occur more often. Or maybe just gets reported to me more often... Some details: We're using the 3.0.1 version of gcc and gdb with a mips 32 instruction set. We do have a version of 3.0.4 available, but have not done extensive testing with that. Gdb first looks for a local variable, $this, but doesn't find it in the current scope, or any containing scope. Then it attempts to find 'this' in the local scope, and, failing that, looks to the outer scope where it does eventually find a 'this' variable, which is of course totally unrelated. Our standard compilation options are (among a variety of others) -g and -O1. I've tried -g -O0, -g by itself (pretty much the same, eh?), -g3 -O1, and while -O0 produces a local copy of 'this', it still doesn't find the right value. The gcc compiler I'm using produces a .mdebug section, which contains ecoff data, and does not recognize a -gdwarf or -gdwarf-2 option. I keep getting the feeling that maybe I'm just missing something basic, or the debugger is. Certainly the compiler knows where the real value is, and I can track it via the machine code for any line that manipulates 'this', but I don't expect all the users to be able to do that readily. Does this ring any bells with anyone? Thanks, PeterT