[Issue 18846] New: VisualD - show vtable in debugger
    d-bugmail at puremagic.com 
    d-bugmail at puremagic.com
       
    Wed May  9 21:32:44 UTC 2018
    
    
  
https://issues.dlang.org/show_bug.cgi?id=18846
          Issue ID: 18846
           Summary: VisualD - show vtable in debugger
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: visuald
          Assignee: nobody at puremagic.com
          Reporter: turkeyman at gmail.com
Compile and debug this code (using Mago):
-----------------------------------
C++:
----
#include <stdio.h>
class Something
{
public:
    virtual void x();
    int data = 10;
};
void Something::x()
{
    printf("X");
}
void dfunc(Something*);
void main()
{
    Something s;
    dfunc(&s);
}
-----------------------------------
D:
--
extern(C++) class Something
{
    abstract void x();
    int data;
}
extern(C++) void dfunc(Something s)
{
    s.x();
}
-----------------------------------
Put a breakpoint in dfunc().
If you inspect 's' in C++, you will see "__vfptr ..." and "data = 10"
If you inspect 's' from D, you will only see "data = 10"
In C++, __vfptr is an array of "void*" that you can open and see a list of all
the virtual functions.
I really want to be able to see __vfptr from D's debuginfo too. At very least,
it will help to debug mis-alignments between C++ and extern(C++) vtables.
It's very easy to create a vtable mismatch from D.
If the debuginfo doesn't want to emit this member (it should), then I think it
might also be possible to fabricate its appearance with the natvis?
--
    
    
More information about the Digitalmars-d-bugs
mailing list