GDB expression handling can interpret most C++ expressions.
Warning: GDB can only debug C++ code if you use the proper compiler. Typically, C++ debugging depends on the use of additional debugging information in the symbol table, and thus requires special support. In particular, if your compiler generates a.out, MIPS ecoff, RS/6000 xcoff, or elf with stabs extensions to the symbol table, these facilities are all available. (With gnu CC, you can use the -gstabs option to request stabs debugging extensions explicitly.) Where the object code format is standard coff or dwarf in elf, on the other hand, most of the C++ support in GDB does not work.
count = aml->GetOriginal(x, y)
this
following the same rules as C++.
It does perform integral conversions and promotions, floating-point promotions, arithmetic conversions, pointer conversions, conversions of 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.
Overload resolution is always performed, unless you have specified
set overload-resolution off
. See GDB features for C++.
You must specify set overload-resolution off
in order to use an
explicit function signature to call an overloaded function, as in
p 'foo(char,int)'('x', 13)
The GDB command-completion facility can simplify this; see Command completion.
In the parameter list shown when GDB displays a frame, the values of reference variables are not displayed (unlike other variables); this avoids clutter, since references are often used for large structures. The address of a reference variable is always shown, unless you have specified set print address off.
::
—your
expressions can use it just as expressions in your program do. Since
one scope may be defined in another, you can use ::
repeatedly if
necessary, for example in an expression like
scope1::scope2::name. GDB also allows
resolving name scope by reference to source files, in both C and C++
debugging (see Program variables).
In addition, when used with HP's C++ compiler, GDB supports calling virtual functions correctly, printing out virtual bases of objects, calling functions in a base subobject, casting objects, and invoking user-defined operators.