List local and global variables
I have a general question here. I am trying to get the list of all global variables in a C code along with the local variables and their scope. I also need the memory address in which they are going to be saved. I already managed to write a script in GDB to run the code step by step and in each step writes the local variable list and their values in a file.
The thing I am going to need is kinda more comprehensive than that. Actually the only option that I see right now is to write a code to process the output file of the mentioned script and create another script to get the address of the variables. this is a hard job and I am wondering is there any way to get the variable names and addresses (automatically, by using gdb or any other tool). and also I couldn't find a way to get the list of global variables in gdb.