How to access target of std::tr1::shared_ptr in GDB

后端 未结 3 1321
执笔经年
执笔经年 2021-02-14 12:09

How can I access target of a std::tr1::shared_ptr in GDB. This doesn\'t work:

(gdb) p sharedPtr->variableOfTarget

If I try with the pointer

3条回答
  •  野趣味
    野趣味 (楼主)
    2021-02-14 12:30

    Try with

    (gdb) p (*sharedPtr.get())
    

    that function returns the a pointer to the object owned by the smart pointer.

提交回复
热议问题