【问题标题】:Show real object hierarchy in gdb/Eclipse CDT debug watch by pointer通过指针在 gdb/Eclipse CDT 调试监视中显示真实对象层次结构
【发布时间】:2012-04-16 17:18:45
【问题描述】:

MSVS 有一个很好的特性,当观察一个指向接口的指针时,它会显示真实的对象。例如

struct IIntf1 {}
struct IIntf2 {}
class CIntf1: public IIntf1 {}
class CIntf2: public IIntf2, public CIntf1 {}
IIntf1 *p = new CIntf2();

MSVS 将显示 p 确实是 CIntf2,即 IIntf1 及其所有成员,它甚至会在那里显示多个嵌套类(即 p 是 C/IIntf1 等等)。

Linux 下的 gdb 和/或 Eclipse CDT 有类似的东西吗?

【问题讨论】:

    标签: c++ linux debugging gdb eclipse-cdt


    【解决方案1】:

    在 gdb 中尝试set print object on。 (如果您希望打印的对象具有更多结构,您也可以尝试set print pretty。)

    【讨论】:

      猜你喜欢
      • 2014-03-03
      • 2012-07-18
      • 2012-02-18
      • 2011-07-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-03-10
      • 2016-05-31
      相关资源
      最近更新 更多