www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.debugger - GDB behaves strange with DMD

reply Gorthad <clavichord yandex.ru> writes:
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.
Jul 04 2017
parent reply Martin Krejcirik <mk-junk i-line.cz> writes:
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
Jul 07 2017
parent Gorthad <clavichord yandex.ru> writes:
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!
Sep 11 2017