Bug 18881 – extern(C++) classes don't work properly in debuginfo

Status
RESOLVED
Resolution
FIXED
Severity
enhancement
Priority
P1
Component
visuald
Product
D
Version
D2
Platform
x86
OS
Windows
Creation time
2018-05-20T01:11:45Z
Last change time
2019-05-31T16:47:00Z
Assigned to
Rainer Schuetze
Creator
Manu

Comments

Comment #0 by turkeyman — 2018-05-20T01:11:45Z
Here's a test class: -------------------------------------------- extern(C++) class BaseCPP { ~this() {} void poo() {} int x = 10; int y = 20; } extern(C++) class DerivedCPP : BaseCPP { int z; } void main() { DerivedCPP d = new DerivedCPP; BaseCPP b = d; int x = 10; // PLACE BREAKPOINT HERE } -------------------------------------------- At the breakpoint, inspect the value of 'b'. You should expect to see: - b 0x0073fb2c {z=0} BaseCPP* {DerivedCPP} + [DerivedCPP] {z=0} DerivedCPP + __vfptr 0x00394c50 {DerivedCPP.__vftable} void** x 10 int y 20 int But instead, there is only the 2 members of BaseCPP: `x` and `y`. extern(C++) classes are missing their type, entry to get from base-class pointer to the most-derived type, and the vtable. C++ populates the class with all this information, so extern(C++) classes should be able to show the exact same set of members as when debugging in C++?
Comment #1 by turkeyman — 2018-05-20T01:15:59Z
Sadly, more of my D code is extern(C++) than not >_<
Comment #2 by r.sagitario — 2018-05-21T08:00:55Z
The __vfptr is now shown, but the derived class is not available because there is no RTTI for extern(C++) classes.
Comment #3 by turkeyman — 2018-05-21T08:43:39Z
We don't generate the typeinfo? Hmm... we probably need to be able to do that at some stage. Do you know if we reserve the vtable slot for it?
Comment #4 by r.sagitario — 2018-05-21T09:16:01Z
AFAICT the vtable slot is at __vfptr[-1], but that's not reserved => crash when trying "typeid(*baseCPPptr)".
Comment #5 by r.sagitario — 2019-05-31T16:47:00Z
dynamic type information is now extracted from the symbol name of the vtbl. See https://github.com/dlang/visuald/releases/tag/v0.50.0-beta1