Sun Studio 12: Debugging a Program With dbx

Looking Up Definitions of Variables, Members, and Functions

To print out the declaration of an identifier, type:

(dbx) whatis identifier

Qualify the identifier name with file and function information as needed.

For C++ programs, whatis identifier lists function template instantiations. Template definitions are displayed with whatis -t identifier. See Looking Up Definitions of Types and Classes.

For Java programs, whatis identifier, lists the declaration of a class, a method in the current class, a local variable in the current frame, or a field in the current class.

To print out the member function, type

(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();

To print out the data member, type:

(dbx) whatis block::movable
int movable;

On a variable, the whatis command tells you the variable”s type

(dbx) whatis the_table
class table *the_table;

On a field, the whatis command gives the field”s type.

(dbx) whatis the_table->draw
void table::draw(unsigned long pw);

When you are stopped in a member function, you can look up the this pointer.

(dbx) stop in brick::draw
(dbx) cont
(dbx) where 1
brick::draw(this = 0x48870, pw = 374752), line 124 in
(dbx) whatis this
class brick *this;