c - GCC doesn't produce line number information even with -g option -


i have built , installed gcc 4.8.1 source:

$ gcc -v using built-in specs. collect_gcc=gcc collect_lto_wrapper=/usr/local/libexec/gcc/x86_64-unknown-linux-gnu/4.8.1/lto-wrapper target: x86_64-unknown-linux-gnu configured with: ./configure --disable-multilib thread model: posix gcc version 4.8.1 (gcc)  

and i've written simple useless program:

$ cat hw.c #include <stdio.h>  void foo() {     int a;     scanf("%d", &a); /* can press ctrl+c here. */     printf("hello world!\n"); }  int main() {     foo();    } 

now compile this:

$ gcc -g -o0 hw.c -o hw 

then started debugging gdb:

$ gdb hw gnu gdb (ubuntu/linaro 7.4-2012.04-0ubuntu2.1) 7.4-2012.04 copyright (c) 2012 free software foundation, inc. license gplv3+: gnu gpl version 3 or later <http://gnu.org/licenses/gpl.html> free software: free change , redistribute it. there no warranty, extent permitted law.  type "show copying" , "show warranty" details. gdb configured "x86_64-linux-gnu". bug reporting instructions, please see: <http://bugs.launchpad.net/gdb-linaro/>... reading symbols /home/calmarius/workdir/crucible/hw/hw...done. (gdb)  

run , ctrl+c immediately:

(gdb) run starting program: /home/dcsirmaz/workdir/crucible/hw/hw  ^c program received signal sigint, interrupt. 0x00007ffff7b018b0 in __read_nocancel () @ ../sysdeps/unix/syscall-template.s:82 82  ../sysdeps/unix/syscall-template.s: nincs ilyen fájl vagy könyvtár. 

i got function names in backtrace no line numbers in code:

(gdb) bt #0  0x00007ffff7b018b0 in __read_nocancel () @ ../sysdeps/unix/syscall-template.s:82 #1  0x00007ffff7a95ff8 in _io_new_file_underflow (fp=0x7ffff7dd4340) @ fileops.c:619 #2  0x00007ffff7a9703e in _io_default_uflow (fp=0x7ffff7dd4340) @ genops.c:440 #3  0x00007ffff7a74fb6 in _io_vfscanf_internal (s=<optimized out>, format=<optimized out>, argptr=0x7fffffffe018, errp=0x0) @ vfscanf.c:620 #4  0x00007ffff7a790bd in __isoc99_scanf (format=<optimized out>) @ isoc99_scanf.c:37 #5  0x000000000040054e in foo () #6  0x0000000000400568 in main () 

what's gone wrong? maybe configuration?

your gdb old -- need more recent gdb (i use 7.6) understand debugging info generated gcc 4.8.1


Comments

Popular posts from this blog

java - Run a .jar on Heroku -

java - Jtable duplicate Rows -

validation - How to pass paramaters like unix into windows batch file -