Halting when certain functions are called in C++

This topic describes how to halt just before or just after a routine is called by using the AT CALL or AT ENTRY commands. The Example: sample C++ program for debugging is used to describe these commands. Before you use either of these commands, you must do the following tasks:

  • To use the AT ENTRY command, you must compile the called program with the TEST compiler option.
  • To use the AT CALL command, you must compile the calling program with the TEST compiler option.

When you use either of these commands, include the C++ signature along with the function name.

To facilitate entering the breakpoint, you can display PUSHPOP.CPP in the Source window by typing over the name of the file on the top line of the Source window. This makes PUSHPOP.CPP your currently qualified program. You can then enter the following command:

LIST NAMES

z/OS® Debugger displays the names of all the blocks and variables for the currently qualified program. z/OS Debugger displays information similar to the following example in the Log window:

There are no session names.
The following names are known in block CALC ::> "USERID.MFISTART.CPP(PUSHPOP)"
IntStack::~IntStack()
IntStack::IntStack()
IntLink::get_i()
IntLink::get_next()
IntLink::~IntLink()
IntLink::set_i(int)
IntLink::set_next(IntLink*)
IntLink::IntLink()

Now you can save some keystrokes by inserting the command next to the block name.

To halt just before IntStack::push(int) is called, insert AT CALL next to the function signature and, by pressing Enter, the entire command is placed on the command line. Now, with AT CALL IntStack::push(int) on the command line, you can enter the following command:
AT CALL IntStack::push(int)

To halt just after IntStack::push(int) is called, enter the following command, which is the same way as the AT CALL command:

AT ENTRY IntStack::push(int) ;

To halt just after IntStack::push(int) is called and only when num equals 16, enter the following command:

AT ENTRY IntStack::push(int) WHEN num=16;