I need in a debug session, see and manipulate some global variables of a C program. I already tried some options of gcc, but no success until now to see (print) at least my global variables.
GDB always say: No symbol "???" in current context.
What flags shall I use in compilation with gcc to do that ?
MY SAMPLE:
#include <stdio.h>
/* Some vars to see in debug */
static long gvar = 0L;
int othervar=3;
char* onepointer=NULL;
int main() {
long lvar=gvar;
gvar = 1L;
lvar = gvar;
printf("gvar = %ld\n", gvar);
gvar = 5L;
lvar = gvar;
printf("gvar = %ld\n", gvar);
}
GDB TUI SESSION:
THE ENVIRONMENT:
- OS: AIX 7
- GCC: 4.8.3
- GDB: 7.8.1
TRIED GCC FLAGS (in some combinations):
-g, -g3, -ggdb, -ggdb3 -O0, and others