使用 GDB 打印 C++ vtables [英] Print C++ vtables using GDB

查看:23
本文介绍了使用 GDB 打印 C++ vtables的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用 gdb 打印对象的 vtable;我找到了

I'm trying to print an object's vtable using gdb; I found the

show print vt bl on

设置,但我仍然不知道如何打印 vtable - p *object 仍然不打印出来.

setting, but I still don't actually know how to print the vtable - p *object still doesn't print it out.

如何打印 vtable?

How do I print the vtable?

推荐答案


  (gdb) set $i = 0
  (gdb) while $i < 10
     >print $i
     >p /a (*(void ***)obj)[$i]
     >set $i = $i + 1
     >end

其中obj"是您要打印其 vtable 的对象,10 是方法数.

Where "obj" is the object whose vtable you'd like to print, and 10 is the number of methods.

这篇关于使用 GDB 打印 C++ vtables的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆