Reputation: 1
Is there a way to get the value of all variables in c during each execution step of a program.
Some other method except GDB.
Thanks in advance -Sahil
Upvotes: 0
Views: 72
Reputation: 76
The debug statements you are talking about are the printf
s marcadian pointed out, which you will have to do manually, I don't know any other way in which you can tell the compiler to build the executable such that it will automatically print the variables except from GDB. All you have to do is compile the file like this : gcc -g file.c -o output.o
. The -g
flag constructs the table for gdb, have a look at some tutorials online http://www.cprogramming.com/gdbtutorial.html on how to use it afterwards.
Edit: info locals
will be quite useful to print all the local ones
Upvotes: 1