www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 18846] New: VisualD - show vtable in debugger


          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 puremagic.com
          Reporter: turkeyman gmail.com

Compile and debug this code (using Mago):

#include <stdio.h>

class Something
    virtual void x();

    int data = 10;

void Something::x()

void dfunc(Something*);

void main()
    Something s;

extern(C++) class Something
    abstract void x();

    int data;

extern(C++) void dfunc(Something s)


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?

May 09 2018