Thread overview
GDB behaves strange with DMD
Jul 04, 2017
Gorthad
Jul 07, 2017
Martin Krejcirik
Sep 11, 2017
Gorthad
July 04, 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.
July 07, 2017
Dne 4. 7. 2017 v 13:46 Gorthad napsal(a):
> As you see, GDB seems to have wrong info about line numbers.

This is acually a regression since 2.072. I'll file a bug report.

-- 
mk
September 11, 2017
On Friday, 7 July 2017 at 17:10:23 UTC, Martin Krejcirik wrote:
> Dne 4. 7. 2017 v 13:46 Gorthad napsal(a):
>> As you see, GDB seems to have wrong info about line numbers.
>
> This is acually a regression since 2.072. I'll file a bug report.

Could you please send a link to the bug tracker issue and/or provide some info about its current status?
Thank you!