查找变量、成员和函数的定义
要输出输出标识符的声明,请键入:
根据需要使用文件和函数信息来限定标识符名。
对于 C++ 程序,whatis identifier 会列出函数模板实例化。可使用 whatis -t identifier 显示模板定义。请参见查找类型和类的定义。
对于 Java 程序,whatis identifier 会列出类的声明、当前类中的方法、当前帧中的局部变量或当前类中的字段。
要输出成员函数,请键入:
(dbx) whatis block::draw
void block::draw(unsigned long pw);
(dbx) whatis table::draw
void table::draw(unsigned long pw);
(dbx) whatis block::pos
class point *block::pos();
(dbx) whatis table::pos
class point *block::pos();
:
|
要输出数据成员,请键入:
(dbx) whatis block::movable
int movable;
|
对于变量,whatis 命令将提供变量的类型。
(dbx) whatis the_table
class table *the_table;
.
|
对于字段,whatis 命令将提供字段的类型。
(dbx) whatis the_table->draw
void table::draw(unsigned long pw);
|
当程序在成员函数中停止时,可以查找 this 指针。
(dbx) stop in brick::draw
(dbx) cont
(dbx) where 1
brick::draw(this = 0x48870, pw = 374752), line 124 in
"block_draw.cc"
(dbx) whatis this
class brick *this;
|