How do you debug code using the gdb debugger?
GDB debugger helps us to run a program upto a certain point and we can pause the program there and print the values of the variables which we want to examine. We can make the values printed after every line too.
It doesnt work if the program has errors but it tells us about
the memory leaks too.
Use the following command to install gdb:
$ sudo apt-get install libc6-dbg gdb valgrind
It maintains a symbol table which contains all the variables and their values are updated after every step.
Get Answers For Free
Most questions answered within 1 hours.