Mail Archives: djgpp/1996/05/08/08:04:41
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 -