Setting breakpoints in C++ using AT ENTRY/EXIT
AT ENTRY/EXIT
sets a breakpoint in the specified
block. You can set a breakpoint on methods, methods within nested
classes, templates, and overloaded operators. An example is given
for each below.
A block identifier can be quite long, especially with templates,
nested classes, or class with many levels of inheritance. In fact,
it might not even be obvious at first as to the block name for a particular
function. To set a breakpoint for these nontrivial blocks can be quite
cumbersome. Therefore, it is recommended that you make use of DESCRIBE
CU
and retrieve the block identifier from the session log.
DESCRIBE CU
, the methods are always
shown qualified by their class. If a method is unique, you can set
a breakpoint by using just the method name. Otherwise, you must qualify
the method with its class name. The following two examples are equivalent:
AT ENTRY method()
AT ENTRY classname::method()
The following examples are valid:
Example | Description |
---|---|
AT ENTRY square(int,int) |
'simple' method square |
AT ENTRY shapes::square(int) |
Method square qualified by its class shapes. |
AT EXIT outer::inner::func() |
Nested classes. Outer and inner are
classes. func() is within class inner. |
AT EXIT Stack<int,5>::Stack() |
Templates. |
AT ENTRY Plus::operator++(int) |
Overloaded operator. |
AT ENTRY ::fail() |
Functions defined at file scope must be referenced by the global scope operator :: |
The following examples are invalid:
Example | Description |
---|---|
AT ENTRY shapes |
Where shapes is a class. Cannot set breakpoint on a class. (There is no block identifier for a class.) |
AT ENTRY shapes::square |
Invalid since method square must be followed by its parameter list. |
AT ENTRY shapes:>square(int) |
Invalid since shapes is a class name, not a block name. |