How can I print all global variables/local variables? Is that possible in gdb?
In addition, since info locals does not display the arguments to the function you're in, use
(gdb) info args
For example:
int main(int argc, char *argv[]) {
argc = 6*7; //Break here.
return 0;
}
argc and argv won't be shown by info locals. The message will be "No locals."
Reference: info locals command.