2

how to perform step by step execution in Linux,i want to see the content of the used variables the address and the value that the pointers are holding

Manu
  • 5,534
  • 6
  • 32
  • 42

1 Answers1

2

Compile your program by giving -g flag. This will create the debugging information (symbols) for your program.

gcc -g -o foo foo.c

Then run the program with a debugger of your choice. Here is an example using gdb

# gdb foo
# b main  --> this will set the break point at main function.
# r       --> start running your program. If you want to pass some argument, use: r <args>
# n       --> to goto next line of execution
# print <var> --> to print variable value
# help  --> for list of supported commands. 
Vikram.exe
  • 4,565
  • 3
  • 29
  • 40