JavaScript is required to for searching.
跳过导航链接
退出打印视图
Oracle Solaris Studio 12.3:使用 dbx 调试程序     Oracle Solaris Studio 12.3 Information Library (简体中文)
search filter icon
search icon

文档信息

前言

1.  dbx 入门

2.  启动 dbx

3.  定制 dbx

4.  查看和导航到代码

导航到代码

导航到文件

导航到函数

从 C++ 二义函数名称列表中选择

在多个具体值中进行选择

打印源码列表

在调用堆栈中移动以导航到代码

程序位置的类型

程序作用域

反映当前作用域的变量

访问作用域

访问作用域的组件

更改访问作用域

使用作用域转换操作符限定符号

反引号操作符

C++ 双冒号作用域转换操作符

块局部操作符

链接程序名

查找符号

打印符号具体值列表

确定 dbx 使用哪个符号

作用域转换搜索路径

放宽作用域查找规则

查看变量、成员、类型和类

查找变量、成员和函数的定义

查找类型和类的定义

目标文件和可执行文件中的调试信息

目标文件装入

列出模块的调试信息

列出模块

查找源文件和目标文件

5.  控制程序执行

6.  设置断点和跟踪

7.  使用调用堆栈

8.  求值和显示数据

9.  使用运行时检查

10.  修复并继续

11.  调试多线程应用程序

12.  调试子进程

13.  调试 OpenMP 程序

14.  处理信号

15.  使用 dbx 调试 C++

16.  使用 dbx 调试 Fortran

17.  使用 dbx 调试 Java 应用程序

18.  在机器指令级调试

19.  将 dbx 与 Korn Shell 配合使用

20.  调试共享库

A.  修改程序状态

B.  事件管理

C.  宏

D.  命令参考

索引

查看变量、成员、类型和类

whatis 命令可输出标识符、结构、类型和 C++ 类的声明或定义,或者表达式类型。您可以查找的标识符包括变量、函数、字段、数组和枚举常量。

有关更多信息,请参见whatis 命令

查找变量、成员和函数的定义

要打印输出标识符的声明,请键入:

(dbx) whatis identifier

根据需要使用文件和函数信息来限定标识符名。

对于 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;

查找类型和类的定义

whatis 命令的 -t 选项可显示类型的定义。对于 C++,whatis -t 显示的列表包括模板定义和类模板实例化。

打印类型或 C++ 类的声明,请键入:

(dbx) whatis -t type_or_class_name

要查看继承成员,可以在 whatis 命令中使用 -r 选项(表示“递归”),该选项显示指定类的声明以及它从基类继承的成员。

(dbx) whatis -t -r  class_name

whatis -r 查询的输出可能会很长,具体取决于类分层结构以及类的大小。输出以从最原始的类继承的成员列表开头。插入的注释行将成员列表分到其各自的父类中。

以下是两个示例,它们使用了类 table,它是父类 load_bearing_block 的子类,而该父类又是 block 的子类。

如果不使用 -rwhatis 会报告在类 table 中声明的成员:

(dbx) whatis -t class table
class table : public load_bearing_block {
public:
    table::table(char *name, int w, int h, const class point &pos);
    virtual char *table::type();
    virtual void table::draw(unsigned long pw);
};

以下是对子类使用 whatis -r 以查看它继承的成员时的结果:

(dbx) whatis -t -r class table
class table : public load_bearing_block {
public:
  /* from base class table::load_bearing_block::block */
  block::block();
  block::block(char *name, int w, int h, const class point &pos, class load_bearing_block *blk);
    virtual char *block::type();
    char *block::name();
    int block::is_movable();
//  deleted several members from example protected:
    char *nm;
    int movable;
    int width;
    int height;
    class point  position;
    class load_bearing_block *supported_by;
    Panel_item panel_item;
    /* from base class table::load_bearing_block */
public:
    load_bearing_block::load_bearing_block();
    load_bearing_block::load_bearing_block(char *name, int w, int h,
        const class point &pos, class load_bearing_block *blk);
    virtual int load_bearing_block::is_load_bearing();
    virtual class list *load_bearing_block::supported_blocks();
    void load_bearing_block::add_supported_block(class block &b);
    void load_bearing_block::remove_supported_block(class block &b);
    virtual void load_bearing_block::print_supported_blocks();
    virtual void load_bearing_block::clear_top();
    virtual void load_bearing_block::put_on(class block &object);
    class point load_bearing_block::get_space(class block &object);
    class point load_bearing_block::find_space(class block &object);
    class point load_bearing_block::make_space(class block &object);
protected:
    class list *support_for;
    /* from class table */
public:
    table::table(char *name, int w, int h, const class point &pos);
    virtual char *table::type();
    virtual void table::draw(unsigned long pw);
};