When debugging where you have a crash dump, vtable pointers are good indicators of an object in memory.
What I would like to do in gdb is be able to query for the vtable by doing something like
info address 'vtable for Bar'
However, the only way to do this (without requiring a valid instance of the object) I have found is to use the mangled name for the vtable.
Example:
info address _ZTV3Bar
It isn't the end of the world to try and figure out the vtable mangled name, but it is an annoyance (i.e. using objdump -t myexecutable).
Does anyone know of a way where I can find the vtable address of a type in a less painful way (without requiring a valid instance of the type)?
- Rules: can't require a valid instance of the object in question and find the vtable pointer in the object.
Use info variable instead:
info variable vtable for Bar
Displays information about a virtual method table (vtable) of an object
Syntax
info vtbl [Expression]
Parameters
Expression Specifies an expression that will be evaluted to get the pointer to the object which virtual method table should be displayed.
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