473,387 Members | 1,678 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Unix: advanced c++ debugging techniques

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."

Oct 30 '06 #1
6 4592
Maitre Bart wrote:
[..]
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
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
Oct 30 '06 #2
Maitre Bart wrote:
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
Oct 30 '06 #3
Adrian wrote:
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!

--
Phlip
http://www.greencheese.us/ZeekLand <-- NOT a blog!!!
Oct 30 '06 #4
Phlip wrote:
Adrian wrote:
>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!
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.

Oct 31 '06 #5

Gianni Mariani wrote:
Phlip wrote:
Adrian wrote:
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!

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.

Oct 31 '06 #6
Maitre Bart wrote:
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/s...sbn=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

Nov 1 '06 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Humpty Dumpty | last post by:
Hello, I've been using python for about 3 months now. Prior to that I did C++ for over 5 years. I'm wondering if my debugging techniques are too C++ oriented. E.g., it took me about 9 hrs of...
8
by: Millissa | last post by:
If someone can help me with examples of or info on how to create an advanced tables for the layout on my site, I would be very grateful! Thanks, M
5
by: Tom | last post by:
Hey, I'm quite new to C++ (or to programming as a whole, for that matter). My courses started in september; last thing we saw were functions and classes. I can't seem to get the assignment...
6
by: Matthew | last post by:
How would I go about creating a simple "hello world" program that will run in Unix. I am using MS Visual C++.
68
by: pemo | last post by:
What would expect to be covered? Say you'd already attended a course, that had covered stuff like structs, pointers, bitwise and logical operators, multi-demensional arrays , *but* hadn't covered...
5
by: rn5a | last post by:
Can someone please suggest me a text editor especially for DEBUGGING ASP scripts apart from Microsoft Visual Interdev? I tried using Visual Interdev & created a project but Interdev generates...
2
by: My Paradise | last post by:
Hello,I am doing MCA right now and I have Advanced Modelling Techniques as a subject now.Can you please tell me the proper websites where i can find information about this subject.I want websites...
1
by: Aljosa Mohorovic | last post by:
i've been using css over 3 years so i'm not looking for books with simple examples or theory but with in detail content. i've seen "advanced" books which are IMO to simple for somebody who is...
6
kenobewan
by: kenobewan | last post by:
Congratulations! You are one of the few who realise that over 80% of errors are simple and easy to fix. It is important to realise this as it can save a lot of time. Time that could be wasted making...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.