Debugging C++ Applications Using HP WDB (766162-001, March 2014)

(gdb) p m
$1 = {e = {employeeMember = 3}, static managerMember = 2}
(gdb) p m.e
$2 = {employeeMember = 3}
(gdb) p pm->managerMember
$3 = 2
You can use the ptype command as shown below:
(gdb) ptype Manager
type = class Manager {
public:
struct Manager::Employee e;
private:
static int managerMember;
public:
void print();
}
(gdb) ptype pm
type = class Manager {
public:
struct Manager::Employee e;
private:
static int managerMember;
public:
void print();
} *
You can use the whatis command as shown below:
(gdb) whatis m
type = class Manager
(gdb) whatis pm
type = pManager
Debugging member function
Member functions are operators and functions that are declared as members of a class. Member
functions in C++ are handled in the same way as the normal functions. It is possible to set a
breakpoint on the member function. You can perform the command line call with member
functions similar to the command line call of normal functions.
You can use the following commands to set a breakpoint on the member functions:
break <class_name>::<function_name> (for non-static member functions)
break <class_name>::<function_name> (for static member functions)
To call member function from command line:
call <object_name>.<function_name> (for non-static member functions)
call <class_name>::<function_name> (for static member functions)
Example 5 shows a sample program for debugging a member function.
12