Using GDB to dump memory variables
I am new to GDB and I need to use it in my research. I have some questions:
1- I need to set the debugger to run instructions one by one and after each instruction, copy the value of all the variables in some file (I want to process this data in the future) and then do this again for the next instruction and so on... Does anyone know how can I do such thing (or something close to this, like dumping the memory used by my code in a file)?
2- how can I write a script to run some commands in gdb? because I want to do the thing I mentioned for every instruction, so it is really a pain in the a@@ if I have to do it manually.
Sorry if I seem so blunt, that's because I don't know much about gdb.