473,804 Members | 3,570 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 4614
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
1486
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 debugging to figure out that the second parameter to weakref.ref() was being passed as None. This is odd because the second parameter is optional, yet its default value is not documented, so I assumed that passing None would be fine, and then I...
8
2797
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
1481
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 for this week right. The second part of it prompts a user for the current date and his/her birthday; after that, the difference should be calculated as a number of days.
6
4134
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
2666
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 other stuff like recursion, unions, bit-fields . What topics would /should be covered on a course that takes students further?
5
2814
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 some error related to FrontPage extensions. I couldn't exactly understand the error. I tried to create the project in C: \Inetpub\wwwroot. If I just open a ASP file (by navigating to the File-->Open File... menu), then Interdev doesn't give the...
2
1604
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 that can help me to study for exams.Can you also tell me the best book for this subject. Thankyou.
1
1930
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 using css on daily basis so please recommend a book that promotes better use of css and advanced tips and techniques. Aljosa
6
28874
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 unnecessary changes, that in turn can cause further problems. Programming is a humbling experience. An experience that causes one to reflect on human error. One major cause of these errors is syntax, syntax, syntax. We tend not to notice when we...
0
9576
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10567
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10323
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10074
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9138
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7613
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6847
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5647
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2983
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.