Debugging – 6

Continuing from our previous post we move on to more details of gdb based debugging of applications. The first step is to build the code using -g symbol which means to built in the debug information. Only after building in the debug information can we run gdb on the...

Debugging – 4

In this post, we are going to learn how to debug code using a special tool called Debugger. A debugger is a tool for controlled execution of a program. IN GNU toolchain, the role is played by a specialised tool called as gdb.  With gdb we can view the state of...

Debugging -3

In today’s post we are going to discuss about Valgind. Valgrind is a tool that is capable of detecting many of the problems that we have discussed. In particular iit can detect array access errors and memory leaks. It can be downloaded from http://valgrind.org....

Debugging-5

In this post, we are going to learn how to debug code using a special library called electric fence.. The electric fence library attempts to use the virtual memory facilities of Linux to protect the memory used by malloc and free to halt the program at the point of...

Debugging -2

In this post, we are going to how to use assert macro. Below is a sample code file: – #include<stdio.h> #include<stdlib.h> #include<assert.h> #include<math.h> double my_sqrt(double x) { assert(x>=0.0); return sqrt(x); } int main() {...

Debugging -1

In this post, we are going to learn how to debug code when the code has errors. To write bug(or error) free code at the very beginning is a herculean(or Rajnikant type or Chuck Norris type)task. So learning to debug code is a very important aspect of software...