[an error occurred while processing this directive] Node:Static vars, Next:, Previous:Included source, Up:Debugging

12.7 GDB cannot display or set static uninitialized variables

Q: Why can't I set or display the values of some static variables in my program?

A: This seems to be a limitation of the COFF debugging information emitted by GCC by default: the debuggers cannot display or set the value of an uninitialized static variables (those who are in the .bss section of the program). A work-around is to initialize these variables, which causes the linker to put them into the .data section. Another solution is to use the stabs debugging support; latest versions of GCC include this support, so upgrade and use -gstabs+ instead of -g.


[an error occurred while processing this directive]