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

Overload resolution is always performed, unless you have turned off the option using set
overload-resolution off. When overload resolution is enabled, for overloaded functions,
the HP WDB evaluates the arguments and searches for a function whose signature matches the
argument types, using the standard C++ conversion rules. When overload resolution is disabled,
for overloaded functions that are not class member functions, the HP WDB chooses the first function
of the specified name that it finds in the symbol table irrespective of the arguments type. For
overloaded functions that are class member functions, the HP WDB searches for a function whose
signature exactly matches the argument types. For example consider the following log:
(gdb) show overload-resolution
Overload resolution in evaluating C++ functions is on.
(gdb) call func(10.12)
Here is float 10.12
(gdb) set overload-resolution off
(gdb) call func(10.12)
Here is int 10
In addition, you can also use the automatic command completion feature of WDB. This feature
enables you to choose from available alternatives for the given overloaded function.
When you want to set a breakpoint, you may want to distinguish whether you mean the version
of name that takes an int parameter, name(int), or the version that takes a float parameter,
name(float). To use the word-completion facilities in this situation, type a single quote (') at the
beginning of the function name. This alerts WDB that it needs to consider more information than
usual when you press TAB twice to request word completion as shown in the example below:
(gdb) b 'func( TAB TAB
func(char*) func(double) func(int)
NOTE: While setting a break-point using auto-completion (quote and TAB) the function with the
same signature in different files might be missed, so it is recommended to rely on the menu feature
which shows the file and line details also.
Other commands like ptype, list, call, and so on, which are passed with the function name
as an argument also displays a menu for overloaded functions.
Limitations of debugging overloaded functions
Following are the limitations of debugging overloaded functions:
HP WDB does not perform an overload resolution involving user-defined type conversions,
calls to constructors, or instantiations of templates that do not exist in the program.
HP WDB cannot handle ellipsis argument lists or default arguments.
HP WDB performs integral conversions and promotions, floating-point promotions, arithmetic
conversions, pointer conversions, converting class objects to base classes, and standard
conversions such as those of functions or arrays to pointers; it requires an exact match on the
number of function arguments.
Catching C++ exceptions
Exceptions in C++ provide a special way to react to exceptional circumstances, such as runtime
errors in a program by transferring control to special functions called handlers. HP WDB provides
26