GNU Debugger (GDB)
GDB allows you to see what is going on ‘inside’ another program while it executes.
Useful for debugging in C and C++.
Make sure to compile with -g flag.
How to Use
At least at Blackberry QNX, I’ve used it to debug Open Source Projects.
You download from the software centre. Thentodo
Commands
next: runs one line of the programnprint variable: allows you to see value of that variable at that timepdisplay var: prints the value of var after each next/stepcontinue: runs the program until the next breakpointcrefresh: fix the layout src displaybreakpoints
More Commands
watch var: breaks the program whenever var is changedstep: runs one instruction of the programlist: show surrounding lines of the programbacktrace: lists the sequence of function calls that got you to your current locationup/down: change the function in the call stack we are observing so as to inspect other variablesset var: allows us to set a variable at runtimeundipslay 1: stops displaying first var set with displaydelete breakpoint number: rename break point from use (watch and break)