gcc -g -c ./src/hello.c -o ./obj/hello.o cd obj objdump -S hello.o No source debugging information can be seen in hello.o hello.o: file format elf32-i386
Disassembly of section .text: 00000000 <main>: 0: 55 push %ebp 1: 89 e5 mov %esp,%ebp 3: 83 ec 08 sub $0x8,%esp 6: 83 e4 f0 and $0xfffffff0,%esp 9: b8 00 00 00 00 mov $0x0,%eax e: 83 c0 0f add $0xf,%eax 11: 83 c0 0f add $0xf,%eax 14: c1 e8 04 shr $0x4,%eax 17: c1 e0 04 shl $0x4,%eax 1a: 29 c4 sub %eax,%esp 1c: 83 ec 0c sub $0xc,%esp 1f: 68 00 00 00 00 push $0x0 24: e8 fc ff ff ff call 25 <main+0x25> 29: 83 c4 10 add $0x10,%esp 2c: b8 00 00 00 00 mov $0x0,%eax 31: c9 leave 32: c3 ret gcc -g -c /home/yangzx/src/hello.c -o /home/yangzx/obj/hello.o Source debugging information can be seen in hello.o hello.o: file format elf32-i386 Disassembly of section .text: 00000000 <main>: #include <stdio.h> int main(void) { 0: 55 push %ebp 1: 89 e5 mov %esp,%ebp 3: 83 ec 08 sub $0x8,%esp 6: 83 e4 f0 and $0xfffffff0,%esp 9: b8 00 00 00 00 mov $0x0,%eax e: 83 c0 0f add $0xf,%eax 11: 83 c0 0f add $0xf,%eax 14: c1 e8 04 shr $0x4,%eax 17: c1 e0 04 shl $0x4,%eax 1a: 29 c4 sub %eax,%esp printf("hello world\n"); 1c: 83 ec 0c sub $0xc,%esp 1f: 68 00 00 00 00 push $0x0 24: e8 fc ff ff ff call 25 <main+0x25> 29: 83 c4 10 add $0x10,%esp return 0; 2c: b8 00 00 00 00 mov $0x0,%eax } 31: c9 leave 32: c3 ret Tried gcc 3.4.6 and gcc 4.1.1 on a Fedora 6 i386 box, gnuarm 4.1.1 on cygwin, all got the same result. -- Summary: No source debugging information with relative path Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: debug AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: yang dot zengxu at zte dot com dot cn http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34390