By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,123 Members | 1,256 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,123 IT Pros & Developers. It's quick & easy.

a good way to debug g++ executable

P: n/a
How do I step debug a c++ program compiled with g++ or set a break
point? What is a good way to switch debug output e.g. a conditional
compilation or inline function?

Thanks,
Daniel

Jul 23 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
sa************@hotmail.com wrote:
How do I step debug a c++ program compiled with g++ or set a break
point? What is a good way to switch debug output e.g. a conditional
compilation or inline function?


Debugging is not defined by the language specification. Please ask
in a newsgroup that deals with your OS. They will be able to suggest
a tool (usually called a "debugger", not surprisingly) in which you
should be able to "step" through the program and "set a break point"
and other things.

V
Jul 23 '05 #2

P: n/a
A "debugger" , oh yes one of those, LOL. I am so used to using IDEs
that I have forgotten they can be seperate. I should have said "switch
log output," in my other question, I am refering to messages to be
printed out when a program is run. At the moment I am using something
like
#ifdef _DEBUG_INFO
std::cout << "blahblah" << std::endl;
#endif

which seems to too lengthy and only has two settings, on or off.

Jul 23 '05 #3

P: n/a
sa************@hotmail.com wrote:
A "debugger" , oh yes one of those, LOL. I am so used to using IDEs
that I have forgotten they can be seperate. I should have said "switch
log output," in my other question, I am refering to messages to be
printed out when a program is run. At the moment I am using something
like
#ifdef _DEBUG_INFO
std::cout << "blahblah" << std::endl;
#endif

which seems to too lengthy and only has two settings, on or off.


For logging you might want to check out 'log4cpp' project (IIRC it grows
from the Apache effort). It's not compiler-specific, it has plenty of
features and one of them that it can be turned on or off even in run-time.

V
Jul 23 '05 #4

P: n/a
I tried log4cpp, it did not work under my cygwin I got stuck on make
with error message
$ make
MAKE Version 5.2 Copyright (c) 1987, 2000 Borland
Error makefile 705: Use of : and :: dependents for target 'tags'
Error makefile 728: Colon expected
*** 2 errors during make ***

.... time for that linux box me thinks.

Victor Bazarov wrote:
sa************@hotmail.com wrote:
A "debugger" , oh yes one of those, LOL. I am so used to using IDEs
that I have forgotten they can be seperate. I should have said "switch
log output," in my other question, I am refering to messages to be
printed out when a program is run. At the moment I am using something
like
#ifdef _DEBUG_INFO
std::cout << "blahblah" << std::endl;
#endif

which seems to too lengthy and only has two settings, on or off.


For logging you might want to check out 'log4cpp' project (IIRC it grows
from the Apache effort). It's not compiler-specific, it has plenty of
features and one of them that it can be turned on or off even in run-time.

V


Jul 23 '05 #5

P: n/a
sa************@hotmail.com wrote:
How do I step debug a c++ program compiled with g++ or set a break
point? What is a good way to switch debug output e.g. a conditional
compilation or inline function?

Thanks,
Daniel


It's off-topic, but what's wrong with gdb? I've used it to debug C++
applications; on Cygwin no less.

Jul 23 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.