gcc does not generate debugger info when using -g, -ggdb, -g3, or -ggdb3

Posted by CJJ on Stack Overflow See other posts from Stack Overflow or by CJJ
Published on 2010-05-15T21:31:47Z Indexed on 2010/05/15 21:34 UTC
Read the original article Hit count: 400

Filed under:
|
|

I'm using GCC 4.4.1 and GDB 7.0-ubuntu on Ubuntu 9.10. However, GCC won't generate debugger info when using any of the following switches: -g, -g3, -ggdb, or -ggdb3. So when I run the program with GDB, its as if there was no debugger information generated. I have created very simple test source files in a new, empty folder.

Here is one example:

#include <stdlib.h>
#include <stdio.h>
int main (int argc, char **argv)
{
     char    msg[4];
     // allocate 4 bytes on the stack
     strcpy (msg, "hello world");
     // overflow 
     printf ("%s\n", msg);
     return 0;
}

© Stack Overflow or respective owner

Related posts about debugger

Related posts about c