为什么gdb casting不起作用? [英] Why gdb casting is not working?

查看:105
本文介绍了为什么gdb casting不起作用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用 print(CEthPacket *)0xeb609a0 来检查给定地址处的对象,并得到表达式中的语法错误,接近')0xeb609a0 '。



我做错了什么?

编辑:
CEthPacket是一个C ++类,我在gdb Fedora(6.8-37.el5)。

解决方案

从我的同事那里,我了解到您需要在单引号内提供类所属的名称空间,如下所示:



(gdb )p('MyScope :: MyClass'*)ptr;

I use print (CEthPacket*) 0xeb609a0 to examine an object at the given address and get A syntax error in expression, near ') 0xeb609a0'.

What am I doing wrong?

EDIT: CEthPacket is a C++ class and I'm on gdb Fedora (6.8-37.el5).

解决方案

I just ran in to similar issue, and, from a colleague of mine, I learnt that you need to provide the namespace that the class belongs to within a single quotes as following:

(gdb) p ('MyScope::MyClass'*) ptr;

这篇关于为什么gdb casting不起作用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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