Debugging Techniques

   

 

Friday 25 February

 
15:05 - 16:20 Maintenance Block

Lecture 5

Debugging Techniques

Paolo Adragna
The lecture addresses the problem of eliminate bugs from software. It is targeted on programmers who develop software on Unix-like platform using C/C++ language, but a large part of the content is general purpose and can be exploited also in a different context (platform or language).
Introduction and general comments about debugging
 
In the introduction the general background required by debugging is reviewed
 
1) Noting and localizing a bug
2) Classifying a bug
3) Understanding a bug
4) Repairing a bug

 
Part one - General debugging
 
The first part of the lecture presents advices for general purpose debugging
 
1) Exploiting compiler feature: static analysis, warning option, optimization flag
2) Reading the right documentation
3) The abused cout debugging technique: general description, disadvantages.
4) Defensive programming and the assert macro (as a solution of cout technique)
5) The debugger. The example of gdb/ddd.
6) ANWB debugging technique: not really a technique actually, rather a method to flush out bugs
7) Code walkthrough: really an advice (possibly a citation of Gerhard's lecture)

 
Part two - C/C++-generated problems and tools to solve them
 
The second part addresses problems usually generated by C/C++ programming
 
1) Preprocessor: problems with versions, headers
2) System dependency
3) System call examination and interaction with the system: the example of strace
5) Dynamic storage allocation: general description of the problem.

 -

Exploitable tools: libraries (to be linked) or external programs

 -

Libraries: MEMWATCH, Electric Fence (with examples)

 -

Executables: YAMD, Valgrind (with examples)

 -

Comparison
6) Incremental building: description of the problem and citation of make