Oracle® Solaris Studio 12.4: Debugging a Program With dbx

Exit Print View

Updated: January 2015
 
 

Looking Up Definitions of Variables, Members, and Functions

Use the whatis command to print out the declaration of an identifier:

(dbx) whatis identifier

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

For C++ programs, whatis lists function template instantiations. Template definitions are displayed with whatis -t 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, you would type the following commands:

(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

(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
     "block_draw.cc"
(dbx) whatis this
class brick *this;