delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2002/07/21/09:45:02

From: Richard Dawe <rich AT phekda DOT freeserve DOT co DOT uk>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Examining C++'s this in gdb
Date: Sun, 21 Jul 2002 14:33:12 +0100
Lines: 21
Message-ID: <3D3AB818.69EDDA1E@phekda.freeserve.co.uk>
References: <200207211153 DOT g6LBrVW07272 AT speedy DOT ludd DOT luth DOT se>
NNTP-Posting-Host: modem-148.sodium.dialup.pol.co.uk
Mime-Version: 1.0
X-Trace: newsg3.svr.pol.co.uk 1027258445 30659 62.136.10.148 (21 Jul 2002 13:34:05 GMT)
NNTP-Posting-Date: 21 Jul 2002 13:34:05 GMT
X-Complaints-To: abuse AT theplanet DOT net
X-Mailer: Mozilla 4.77 [en] (X11; U; Linux 2.2.19 i586)
X-Accept-Language: de,fr
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Hello.

Martin Str|mberg wrote:
> How do I examine "this" and "this->blarg" (in C++) while debugging
> with gdb. "p this" only says "No symbol "this" in current context."
> Doesn't every C++ function have a this variable. The source is using
> this "this" at least.

"p this" should work. I'm 100% sure that I've used that, when debugging C++
programs at work. Which version of gdb are you using? What debug flags did you
use, when compiling?

Try compiling with -gstabs+3 or -gdwarf-2. You'll probably need a recent gdb
(Andris's package of 5.2?) for DWARF-2 to work, but even then there may be
problems. I haven't been able to build libc.a with DWARF-2 debug info, for
instance.

Bye,

-- 
Richard Dawe [ http://www.phekda.freeserve.co.uk/richdawe/ ]

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019