无法访问 STL C++ GDB 的容器值
我正在调试 C++ 代码,并且在尝试访问 std::list 时遇到问题。 问题是我无法获取与头节点关联的地址($3 指的是列表):
p $3._M_impl._M_node
$21 = {
_M_next = 0x240ee70,
_M_prev = 0x240ee70
}
当我尝试获取头节点地址时收到以下错误消息:
(gdb) p &($3._M_impl._M_node )
尝试获取不在内存中的值的地址。
我也尝试过从互联网上获得的 STL 扩展,但同样失败了。
set $head = &$arg0._M_impl._M_node
我查看了谷歌,这是我能找到的有关该问题的全部信息:
http:// /permalink.gmane.org/gmane.comp.gdb.devel/9496
但这并不能解决我的问题。任何建议都非常受欢迎。
提前致谢
I am debugging C++ code and I have problems when trying to access to an std::list.
The problem is that I cannot get the address associated to the head node ($3 refers to the list):
p $3._M_impl._M_node
$21 = {
_M_next = 0x240ee70,
_M_prev = 0x240ee70
}
I get the following error message when I try to get the head node address:
(gdb) p &($3._M_impl._M_node)
Attempt to take address of value not located in memory.
I also have tried with the STL extension available from the Internet and it also fails at the same point.
set $head = &$arg0._M_impl._M_node
I have looked at Google an this is all I can find about the problem:
http://permalink.gmane.org/gmane.comp.gdb.devel/9496
But it doesn't solve my problem. Any suggestions are more than welcomed.
Thanks in advance
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论