Unix: advanced c++ debugging techniques

M

Maitre Bart

One said: "The more time you'll spend on designing your app, the less
you'll spend time debugging it." I agree with that, but chances are,
you'll still need to debug it anyway! And the larger the app, the
higher the chances, yours or not.

There are many books that teach C++, but not so many that teach how to
debug C++ apps. Like there are some "must read" for the first category,
I imagine there likely to exist some "must read" too for the second.

So, here I am polling for those of you that have been impressed by
books, tools or libs on advanced c++ debugging techniques on Unix.
Those books that reveals "what, how and why using this tool/lib (open
source or commercial) when faced with this kind of problems". Or books
that teach "You did it wrong, man! Here is how to do this."
 
V

Victor Bazarov

Maitre said:
[..]
So, here I am polling for those of you that have been impressed by
books, tools or libs on advanced c++ debugging techniques on Unix.

With all due respect, why not ask in a Unix newsgroup? Tools, libs,
other things that make debugging easy are *very often* platform- and
os-specific, which makes them off-topic here. Please keep this in
mind.

V
 
A

Adrian

Maitre said:
One said: "The more time you'll spend on designing your app, the less
you'll spend time debugging it." I agree with that, but chances are,
you'll still need to debug it anyway! And the larger the app, the
higher the chances, yours or not.

There are many books that teach C++, but not so many that teach how to
debug C++ apps. Like there are some "must read" for the first category,
I imagine there likely to exist some "must read" too for the second.

So, here I am polling for those of you that have been impressed by
books, tools or libs on advanced c++ debugging techniques on Unix.
Those books that reveals "what, how and why using this tool/lib (open
source or commercial) when faced with this kind of problems". Or books
that teach "You did it wrong, man! Here is how to do this."
I have used a library called cppunit which is similar to Junit. This is so you
can design tests for each class. This can speed up things a lot if you run the
tests each time you make a change.

cppunit is available on sourceforge.net (http://sourceforge.net/projects/cppunit/)

It does seem that you spend more time writing tests then code - but as the
project gets bigger this is very helpful. It has saved me hours of debugging.
The whole idea is that you write the test for the class before the class. Then
code the class. This way when you modify the class later for some new purpose it
already checks that is works with all the old ways you are using it.

Other books that taught me and still are teaching me a lot are the Herb Sutter
books. They stopped me from doing a lot of bad things. The point out errors that
are very easy to make in c++ and cause problems as projects get more complex.

Adrian
 
P

Phlip

Adrian said:
cppunit is available on sourceforge.net
(http://sourceforge.net/projects/cppunit/)

It does seem that you spend more time writing tests then code - but as the
project gets bigger this is very helpful. It has saved me hours of
debugging.

Here's one of the best lite alternatives to CppUnit:

http://unittest-cpp.sourceforge.net/

It just popped a new version (uh, its 2nd tick), with documentation and a
couple user suggestions.

If you must debug, unit tests make an excellent support!
 
G

Gianni Mariani

Phlip said:
Here's one of the best lite alternatives to CppUnit:

http://unittest-cpp.sourceforge.net/

It just popped a new version (uh, its 2nd tick), with documentation and a
couple user suggestions.

If you must debug, unit tests make an excellent support!

I have to agree that unit testing is probably the most important thing
you can ever to. In fact, as a principle "Test Driven Design" is a
great way to reduce time debugging. The idea (as I see it) is that the
design starts with the unit test. Then you iteratively change the
interface and unit test so that it's an interface that does what you
want i.e. easy to use and is a robust interface (minimize chances that
someone does something wrong) and then write the code.

BTW, I have also created a unit test framework as part of the Austria
C++ library also available from sourceforge. I have some improvements
coming but it will be a couple of months before I can get that out.

Cheers.
 
M

Maitre Bart

Gianni said:
I have to agree that unit testing is probably the most important thing
you can ever to. In fact, as a principle "Test Driven Design" is a
great way to reduce time debugging. The idea (as I see it) is that the
design starts with the unit test. Then you iteratively change the
interface and unit test so that it's an interface that does what you
want i.e. easy to use and is a robust interface (minimize chances that
someone does something wrong) and then write the code.

BTW, I have also created a unit test framework as part of the Austria
C++ library also available from sourceforge. I have some improvements
coming but it will be a couple of months before I can get that out.

Cheers.

Thanks everyone. I'll take your suggestions into consideration.
 
S

Stephan Kuhagen

Maitre said:
So, here I am polling for those of you that have been impressed by
books, tools or libs on advanced c++ debugging techniques on Unix.
Those books that reveals "what, how and why using this tool/lib (open
source or commercial) when faced with this kind of problems". Or books
that teach "You did it wrong, man! Here is how to do this."

It seems to me, that this very readable and recommendable book is not very
popular yet (but it will be, I think):

"Why programs fail - A Guide to Systematic Debugging"

http://books.elsevier.com/uk/mk/uk/subindex.asp?isbn=1558608664

Test-driven design, unit-tests... everything good and recommended
techniques, but sometimes you have to debug. This book teaches how to find
failures, errors and how to reason about your observations in the behaviour
of a failing program and how to find the errors in it from that point on.

The author of the book is Andreas Zeller, who also wrote "ddd", the
debugger.

It's worth a look.

Regards
Stephan
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top