I'm writing a C++ project and building a DAG of various inheritance-related types. I've placed a breakpoint after construction and I'd like to view the DAG. The debugger however will only show the base class. It will name the most derived type next to the __vfptr
entry, but I can't actually view it's contents and verify that they are what I expect them to be. Is there any way to view the most derived type in the Locals window directly?
I am targetting x64, if that's relevant.
The only way that seem to work for me is to tell debugger to properly show objects with help of autoexp.dat. Not sure what's how well it will work in vs2010, I'm still using 2008. This method is very suitable for smart pointers. If you are trying to look inside raw pointers then, I guess, you need to manually cast pointer in the watch/quick watch window. If it's some sort of smartpointer or a class that store that raw base pointer then you can simply get it done with autoexp.dat this way (assuming that your base ptr is called m_ptr):
smart_ptr<*>{
preview
(
#if (($e.m_ptr)!=0)
(
#(
"smart_ptr ",
(*(($T1 *)$e.m_ptr))
)
)
#else
(
#("<Bad Ptr>")
)
)
children
(
#(
ptr: (*(($T1 *)$e.m_ptr))
)
)
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With