In linux we can compile a c/c++ pgm using cc / g++ command. But it will not execute sequentially (Unlike Turbo C ) so if we want to compile pgm sequentially what must be the solution
How to debug c/c++ pgm in linux? (step-by-step execution)?
You can use gdb (the GNU debugger) to step through programs on Linux.
First, be sure to compile with the -g flag to include debugging information.
Then, run gdb %26lt;program name%26gt; to start debugging.
A few of the commands available are:
%26gt; run
Starts the program
%26gt; break %26lt;line number%26gt;
Create a breakpoint at %26lt;line number%26gt;.
%26gt; step
Executes the current line of the program.
%26gt; print %26lt;variable%26gt;
Prints out the value of %26lt;variable%26gt;.
There are a lot more commands available, and can be found by using the help command in gdb. Additionally, there are a *ton* of gdb resources and guides available on the web.
Hope this helps!
cabbage
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment