Debugging D code with GDB

Iain Buclaw ibuclaw at
Tue Nov 30 09:01:38 UTC 2021

On Monday, 29 November 2021 at 14:48:21 UTC, Luís Ferreira wrote:
> On Sun, 2021-11-28 at 21:59 +0000, Iain Buclaw via 
> Digitalmars-d-learn wrote:
>> DMD doesn't emit this information. GDB can't work miracles 
>> when the compiler isn't pulling its own weight.
> I confirm this is an issue with DMD. I filed a bug in the issue 
> tracker, in case you want to follow: 
> Anyway, DMD exports the symbol, it should work if you do 
> something like `myPrint(&s)`, but I think there is another 
> problem on calling it, due to defective calling convention on 
> both DMD and LDC implementations.
> LDC exports the symbol correctly, although.

Indeed, gdb assumes calling convention is same as default for 
target (actually its been years since I last looked, but are 
calling conventions tags in dwarf? Does gdb know about functions 
with thiscall or regparm attributes?)

Another thing on the gdb side, it is currently missing D language 
support for overloads, so that the correct function would be 
picked when you call e.g std.math.sin(1f).

More information about the Digitalmars-d-learn mailing list