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

[2] fun<<int,int,int> >(int,<int,int,int>...) at my_variadic.cc:2
[3] fun<<int> >(int,<int>...) at my_variadic.cc:2
> 2
1 template<class ...T> void fun(int x, T ...args)
2 {
3 int a[] = {0, args..., 5};
4 int y;
5 y = x;
6 }
7
8 int main(int argc, char** argv)
9 {
10 fun(1, 2, 3, 4);
(gdb) q
HP WDB commands or variables used in C++ application debugging
Table 4 shows the summary of HP WDB commands to debug C++ applications.
NOTE: The show command is used to display the current status or setting of a particular or all
WDB variables.
Table 2 Summary of GDB Commands to Debug C++ Applications
PurposeGDB Command
Sets breakpoints using regular expressions. It is helpful for setting
breakpoints on overloaded functions that are not members of any special
classes.
rbreak regex
Debugs C++ exception handling.catch throw <exception>
catch catch <exception>
Print inheritance relationships as well as other information for type
typename.
ptype <typename>
Displays the C++ symbols in mangled or demangled form.set print demangle [on | off]
The default value is on. C++ symbols will be displayed as demangled.
show print demangle
Displays the C++ symbols in mangled or demangled form in disassembly
output.
set print asm-demangle [on |
off]
The default value is on.
show print asm-demangle
Chooses whether to print derived (actual) or declared types of objects.set print object [on |off]
show print object
This command displays run time type information for C++ polymorphic
object. The input to this command is the address of the C++ polymorphic
object. GDB displays the demangled type name as output.
info rtti <address>
NOTE: This command is supported only on HP Integrity systems.
Controls the format for printing virtual function tables.set print vtbl [on | off]
NOTE: The vtbl commands are currently not available.
show print vtbl
Enables overload resolution for C++ expression evaluation. The default is
on. For overloaded functions, GDB evaluates the arguments and searches
set overload-resolution on
for a function whose signature matches the argument types, using the
standard C++ conversion rules. If it cannot find a match, it emits a
message.
Disable overload resolution for C++ expression evaluation. For overloaded
functions that are not class member functions, GDB chooses the first function
set overload-resolution off
of the specified name that it finds in the symbol table, whether or not its
arguments are of the correct type. For overloaded functions that are class
member functions, GDB searches for a function whose signature exactly
matches the argument types.
40