Debugging D code with GDB

Luís Ferreira contact at lsferreira.net
Wed Jan 5 04:24:39 UTC 2022


On Tue, 2021-11-30 at 09:01 +0000, Iain Buclaw via Digitalmars-d-learn
wrote:
> 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: 
> > https://issues.dlang.org/show_bug.cgi?id=22551
> > 
> > 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?)
> 

Yes, it is specified in 7.15. Calling Convention Encodings in DWARF
standard. You can use DW_AT_calling_convention attribute to specify a
certain calling convention, being DW_CC_normal the default value. But
you have very limited number of calling conventions available, being
the rest considered vendor-specific. You might want
DW_CC_BORLAND_thiscall ?

-- 
Sincerely,
Luís Ferreira @ lsferreira.net

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part
URL: <http://lists.puremagic.com/pipermail/digitalmars-d-learn/attachments/20220105/c903e242/attachment.sig>


More information about the Digitalmars-d-learn mailing list