GDB behaves strange with DMD

Gorthad via Digitalmars-d-debugger digitalmars-d-debugger at puremagic.com
Tue Jul 4 04:46:10 PDT 2017


Hello everyone.

I'm trying to debug programs compiled with DMD using GDB.
My dmd version is 2.074.1, gdb version is 7.11.1, operating 
system is Ubuntu 16.04.

I have this little helloworld.d:

import std.stdio;

void main() {
     auto a = 5;

     writeln("Hello, world!");

     foreach (i; 0 .. 5)
         a = a + i;

     writeln("aaaaaaaa");
     writeln(a);


}


Then I compile it with tag -g and when I try to debug it with 
GDB, I get this: pastebin.com/GJD7q9XM

As you see, GDB seems to have wrong info about line numbers.

When I compile it with tag -gc, it's basically all the same 
except I need to write 'list _Dmain' in order to access the 
source code from gdb:
pastebin.com/5TkqxEvu

In bigger projects current line in GDB can jump all over the 
place without any obvious logic.

Do you have any ideas how to fix it?
Thank you.


More information about the Digitalmars-d-debugger mailing list