next up previous
Next: Most commonly made Up: Introduction to debugging a Previous: Introduction to debugging a

Introduction

"Languages that prevent programming errors, a goal advanced by some inveterate language designers, are as feasible as knives that can cut meat but not hands. We need sharp tools to do good work."[1]

C and C++ are very sharp tools; when used correctly, they can be used to do good work. But as with all sharp tools, it's easy to cut yourself.

This document will describe how to debug an application written in C or C++. Most of this document is not C/C++ specific, so the techniques described can be used with other languages as well.

First, the most commonly made mistakes in programming in C and C++ will be mentioned, together with some simple solutions. Next, different methods of finding an error are discussed.

Since it's not feasible to describe every compiler and debugger available, some choice had to be made. Because the GNU versions of these tools are available on almost every platform, the gcc/g++ compiler and the GDB debugger will be used. However, differences with other Unix compiler and debuggers, eg. CC and dbx, are only minor.



SE Praktikum
Tue Aug 13 11:13:23 MET DST 1996