Tracing and debugging a C++ client and
C++ business object on AIX
Objective
The
objective of this sample is to trace and debug a distributed application in which both
server and client code are written in C++ and installed on AIX.
Before you begin
You must complete the steps to compile and install the C++ Policy Sample for AIX (as
explained in the Preparing for the OLT tutorials).
For this exercise, a single AIX machine is running OLT, the debugger, and your client
and server applications, as follows:

Description
In this exercise, you will complete these steps:
- Set up .profile file.
- Start Object Level Trace.
- Run the client application and create a trace.
- Set a breakpoint on the trace.
- Prepare for tracing and debugging.
- Rerun the application and step into server code.
- Step from server to client code.
- Step into server code again at the next breakpoint.
- Run the application to completion.
Sample instructions
Follow these steps to perform the tracing and debugging for this scenario:
- Ensure the /usr/idebug/bin/OLT.profile file has been executed from within the .profile
file.
- Start Object Level Trace.
- From a korn shell on the AIX system, enter olt to start OLT.
- Make sure that Trace only is selected for Execution mode
for Default settings in the OLT Viewer window. If you have to change the
setting, click Apply.
- Run the client application and create a trace.
- From a korn shell, go to the location of the client application and type PolicyApp,
as follows:
cd /home/cbuser/samples/InstallVerification
cd ProgrammingModel/Applications/C++/Policy
PolicyApp
Once PolicyApp has run to completion, the OLT Viewer should contain a trace, similar to
the following:

- Set a breakpoint in the trace.
- In the trace, select the server event that represents the getpremium method. To find the
event, pass the mouse over the events in the OLT viewer and look in the Current
line at the bottom of the window for the getpremium method call.
- Select the event, right-click, and select Add to Method Breakpoint List.

- Prepare for tracing and debugging.
- From the OLT Viewer's Options menu, deselect Step-by-step
Debugging Mode.
- In the OLT Viewer's Client Controller page, select Trace and debug for Execution
mode for Default settings and click Apply.
- Rerun the application and step into server code.
From a korn shell, go to the location of the client application and type PolicyApp
to rerun the application, as described in step 3.The program halts at your specified
breakpoint, and the debugger opens and highlights the getpremium method. (You may be
prompted for the location of the source code.)

- Step from server to client code.
- Click Step return. A new debugger page is opened for the client
application. Notice that you stop immediately after the _req.invoke() call that invoked
the method on the server:

- Click Step return twice to return immediately past the getpremium
method called by the client:

The debugger is now in the client application.
- Step into server code again at the next breakpoint.
Click Run. The debugger stops at the next breakpoint in the server business object:
- Run the application to completion.
Click Run until the application runs to completion. When the client
application completes, a dialog box is displayed. The following image is an example of
such a dialog box:
Click OK. The debugger process for the client application ends. The
debugger for the Policy business object stays active until you stop the application server
using System Manager.
Important note: While running your application, do not close the
debugger window that you are using to debug server code. When you finish debugging, stop
your application server using System Manager, then close the OLT window.

Component Broker Object Level Trace examples
OLT Overview