I have been tasked with writing a program that will retrieve global variable information from a combination of c and c++ programs (compiled w/gcc).
I need to be able to get the variable names, types, and addresses for all defined global variables.
The only way I see that this can be done is to compile with debug info (gcc -g) and then to use a debugger such as gdb or dbx in batch mode to retrieve the information.
Is there a way to list all of the global variables by name in gdb or dbx?
Also, if someone has another approach, suggestions are welcome...
The program needs to work in both cygwin and IRIX (both have gcc, gdb, and dbx available).