https://issues.dlang.org/show_bug.cgi?id=16067
Issue ID: 16067 Summary: Invalid source lines shown with disassembly with gdb and objdump Product: D Version: D2 Hardware: x86_64 OS: Linux Status: NEW Severity: minor Priority: P1 Component: dmd Assignee: nob...@puremagic.com Reporter: christo...@meessen.net Looking at disassembly with interleaved source code I detected a mismatch. Trying with the following simple program app.d 1 import std.stdio; 2 3 void main() 4 { 5 int a = 10; 6 7 a += 3; 8 9 ++a; 10 11 writefln("Value: %d", a); 12 13 writeln("Helloworld!"); 14 15 } I get this output with '$ objdump -d -S app' for the function _Dmain 000000000043aae8 <_Dmain>: import std.stdio; void main() 43aae8: 55 push %rbp 43aae9: 48 8b ec mov %rsp,%rbp 43aaec: 48 83 ec 10 sub $0x10,%rsp { int a = 10; 43aaf0: c7 45 f8 0a 00 00 00 movl $0xa,-0x8(%rbp) a += 3; 43aaf7: 83 45 f8 03 addl $0x3,-0x8(%rbp) ++a; 43aafb: ff 45 f8 incl -0x8(%rbp) writefln("Value: %d", a); 43aafe: ba 60 e5 46 00 mov $0x46e560,%edx 43ab03: be 09 00 00 00 mov $0x9,%esi { int a = 10; a += 3; ++a; 43ab08: 8b 7d f8 mov -0x8(%rbp),%edi 43ab0b: e8 18 00 00 00 callq 43ab28 <_D3std5stdio19__T8writeflnTAyaTiZ8writeflnFNfAyaiZv> writefln("Value: %d", a); writeln("Helloworld!"); 43ab10: ba 6a e5 46 00 mov $0x46e56a,%edx 43ab15: bf 0b 00 00 00 mov $0xb,%edi 43ab1a: 48 89 d6 mov %rdx,%rsi 43ab1d: e8 e6 9b 00 00 callq 444708 <_D3std5stdio16__T7writelnTAyaZ7writelnFNfAyaZv> 43ab22: 31 c0 xor %eax,%eax } 43ab24: c9 leaveq 43ab25: c3 retq 43ab26: 66 90 xchg %ax,%ax 000000000043ab28 <_D3std5stdio19__T8writeflnTAyaTiZ8writeflnFNfAyaiZv>: } Looking at the debug line table for the main function with the command '$ objdump --dwarf=decodedline app | less' I get this ./app.d:[++] app.d 3 0x43aae8 app.d 5 0x43aaf0 app.d 7 0x43aaf7 app.d 9 0x43aafb app.d 11 0x43aafe app.d 9 0x43ab08 app.d 13 0x43ab10 app.d 15 0x43ab24 After closer inspection of the disassembly code it appears that the second line with 9 should not be present. Removing it should provide a correct debug table. I didn't check the possible frequency of occurrence in a more complex program. --