www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/05/08/08:04:41

Xref: news2.mv.net comp.os.msdos.djgpp:3558
From: elric AT wheel DOT ucdavis DOT edu (Jeffrey Taylor)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Lots of Q's
Date: 8 May 1996 01:04:14 GMT
Organization: Davis Community Network - Davis, California, USA
Lines: 36
Message-ID: <4morue$5ai@mark.ucdavis.edu>
References: <199605061003 DOT GAA04578 AT delorie DOT com>
NNTP-Posting-Host: wheel.dcn.davis.ca.us
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Martynas Kunigelis (martynas DOT kunigelis AT VM DOT KTU DOT LT) wrote:
:  I've so many DJGPP and non-DJGPP related questions spinning in my head,
: that I'm even afraid to forget some of them...

<snip>

: *5* How do I debug C++ progs with GDB??? This one bothers me the most. The docs
:     say debugging C++ requires additional debug info, not supported by COFF.
:     They suggest -gstabs, though. However, it doesn't help. I try to say:
:     `break Class::Method', but GDB says `class Class not found'. Is it true,
:     that you can't debug C++ programs with COFF? I mean that's a major loss.
:     If so, moving to ELF is really necessary IMHO, because NT compatibility
:     is not worth losing C++ debugging ability. Please advise if I'm wrong.
:     I really need to debug C++.

I use -g3 to compile C++ code for GDB.  It is workable.  GDB does not 
seem to know about C++ name mangling.  I use file names and line numbers 
for setting break points.  To print a class variable requires "this->" 
in front.  For example:

p this->m_variable

This doesn't always work, sometimes GDB says the member donesn't exist so 
I use:

p *this

and wade thru all the members.  Printing class static variables requires 
figuring out the mangled name.  Not graceful or seamless, but useable.  I 
have debugged 10s of thousands of lines this way.

--
============================================
Without my guitar, I am a poet without arms.
                        - Michael Bloomfield
============================================

- Raw text -


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