4. Viewing and Navigating To Code
Selecting From a List of C++ Ambiguous Function Names
Choosing Among Multiple Occurrences
Walking the Call Stack to Navigate To Code
Variables That Reflect the Current Scope
Components of the Visiting Scope
Qualifying Symbols With Scope Resolution Operators
C++ Double Colon Scope Resolution Operator
Printing a List of Occurrences of a Symbol
Determining Which Symbol dbx Uses
Relaxing the Scope Lookup Rules
Viewing Variables, Members, Types, and Classes
Debugging Information in Object Files and Executables
Listing Debugging Information for Modules
Finding Source and Object Files
5. Controlling Program Execution
6. Setting Breakpoints and Traces
8. Evaluating and Displaying Data
11. Debugging Multithreaded Applications
16. Debugging Fortran Using dbx
17. Debugging a Java Application With dbx
18. Debugging at the Machine-Instruction Level
19. Using dbx With the Korn Shell
The whatis command prints the declarations or definitions of identifiers, structs, types and C++ classes, or the type of an expression. The identifiers you can look up include variables, functions, fields, arrays, and enumeration constants.
For more information, see whatis Command.
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 "block_draw.cc" (dbx) whatis this class brick *this;
The -t option of the whatis command displays the definition of a type. For C++, the list displayed by whatis -t includes template definitions and class template instantiations.
To print the declaration of a type or C++ class, type:
(dbx) whatis -t type_or_class_name
To see inherited members, the whatis command takes an -r option (for recursive) that displays the declaration of a specified class together with the members it inherits from base classes.
(dbx) whatis -t -r class_name
The output from a whatis -r query may be long, depending on the class hierarchy and the size of the classes. The output begins with the list of members inherited from the most ancestral class. The inserted comment lines separate the list of members into their respective parent classes.
Here are two examples, using the class table, a child class of the parent class load_bearing_block, which is, in turn, a child class of block.
Without -r, whatis reports the members declared in class 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); };
Here are results when whatis -r is used on a child class to see members it inherits:
(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); };