I've got a simple .c file:
$ cat a.c
int i=0;
int j;
static int l=4;
void k(){}
void main(){
k();
}
I tried to compile it with "-Og" to enable debug information. GCC man says
-Og Optimize debugging experience.
-Og enables optimizations that do not interfere with debugging.
But when I use "gdb a.out" and try "list", it says:
(gdb) l
No symbol table read. Please use "file" command.
Well this is so weird as out of my expectation, If I use gcc a.c -g
, "list" is fine in gdb.
Why is that?