* You are viewing Posts Tagged ‘GDB’

Debugging in Linux with GDB

I came across this nice piece of tutorial regarding debugging with GDB. You can find the entire tutorial here.

To be able to debug a program, you need to compile it with debugging information enabled so that gdb can work with variables, their state and values, lines and functions. To do this, compile your program under gcc (or g++) with an extra ‘-g’ option:

example: gcc -g test.c -o test

Running gdb

Simply run gdb from the shell and pass the program name as parameter: gdb test

Once your program is loaded, … Continue Reading