gdb-“尝试提取不是结构指针的值的组件”

时间:2018-10-30 21:16:17

标签: c++ gdb

我正在在Cortex-M4上使用Kinetis Design Studio调试C ++。

有一个标签Expressions,您可以在其中输入自定义表达式以查看变量的值。

在我的环境中,无论我重置,重新加载和运行多少次,分配对象在RAM中的位置都不会改变。

所以,我知道应该可以这样做:

((ClassA *) 0x12345678)->ClassA_member

但是由于某些原因它无法正常工作。

当我尝试输入此表达式时,gdb跟踪是:

513,896 244-stack-info-depth --thread 1 50
513,905 244^done,depth="11"
513,905 (gdb) 
513,905 245-var-create --thread 1 --frame 0 - * "((CXCPHostProtocolProperties * )0x1fffc2c4)->_MaxDT\
O"
513,907 246-data-evaluate-expression --thread 1 --frame 0 "&(((CXCPHostProtocolProperties * )0x1fffc\
2c4)->_MaxDTO)"
513,907 245^error,msg="Type CXCPHostProtocolProperties *(CXCPHostProtocolProperties * const) is not \
a structure or union type."
513,907 (gdb) 
513,908 247-data-evaluate-expression --thread 1 --frame 0 "((CXCPHostProtocolProperties * )0x1fffc2c\
4)->_MaxDTO"
513,908 246^error,msg="Attempt to extract a component of a value that is not a structure pointer."
513,908 (gdb) 
513,910 247^error,msg="Attempt to extract a component of a value that is not a structure pointer."
513,910 (gdb) 

我做错了什么?
ClassA_member公开 unsigned short

我还使用-Os优化大小(以防万一)。

0 个答案:

没有答案