From Bugzilla Helper: User-Agent: Mozilla/5.0 (X11; U; Linux i586; en-US; rv:0.9.2) Gecko/20010809 Description of problem: gdb reports that there is no line number information for a program being debugged when it was compiled with -ggdb Version-Release number of selected component (if applicable): How reproducible: Always Steps to Reproduce: 1.create program.c source code 2.run gdb ./program 3.add breakpoint for main 4.run program within gdb 5.type "next" Actual Results: (gdb) next Single stepping until exit from function main, which has no line number information. Expected Results: (gdb) next printf("Hello world\n"); Additional info:
Works just fine here... [teg@halden teg]$ rpm -q gdb gcc gdb-5.0rh-15 gcc-2.96-97 [teg@halden teg]$ [teg@halden teg]$ cat hello.c #include <stdio.h> int main(int argc,char **argv){ printf("hello, world!\n"); return 0; } [teg@halden teg]$ gcc hello.c -o hello -g [teg@halden teg]$ gdb hello GNU gdb Red Hat Linux 7.x (5.0rh-15) (MI_OUT) Copyright 2001 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Type "show copying" to see the conditions. There is absolutely no warranty for GDB. Type "show warranty" for details. This GDB was configured as "i386-redhat-linux"... (gdb) l 1 #include <stdio.h> 2 3 int main(int argc,char **argv){ 4 printf("hello, world!\n"); 5 return 0; 6 } (gdb) [teg@halden teg]$ gcc hello.c -o hello -ggdb [teg@halden teg]$ gdb hello GNU gdb Red Hat Linux 7.x (5.0rh-15) (MI_OUT) Copyright 2001 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Type "show copying" to see the conditions. There is absolutely no warranty for GDB. Type "show warranty" for details. This GDB was configured as "i386-redhat-linux"... (gdb) l 1 #include <stdio.h> 2 3 int main(int argc,char **argv){ 4 printf("hello, world!\n"); 5 return 0; 6 } (gdb)
whether or not the list command works is irrelevant. this command requires the source code to be available. the problem is line number information in the binary and not file name information. it did work with -g but -ggdb does not work. this may be a bug in gcc or gdb.
addtitionally gcc-2.96-97 is not even on the rawhide site!
It is, and you should use "-g", not "-gdb". The compiler was available shortly after from Rawhide, but didn't have anything to do with the report.