Tracing and debugging a C++ client and
C++ business object on Solaris
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 Solaris.
Before you begin
You must complete the steps to compile and install the C++ Policy Sample for Solaris (as
explained in the Preparing for the OLT tutorials).
For this exercise, the OLT server, viewer, and System Manager user interface are
running on an Windows NT/2000 workstation. Your client and server applications are running on a
Solaris system, as follows:

The Solaris client and server applications can be generated on an AIX or Windows NT/2000
system. For this sample scenario, the applications are generated on the Windows NT/2000 system.
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 /opt/WebSphere/AppServer/bin/OLT.profile file has been sourced in the
.profile file on the Solaris system.
- Set the OLT server for the client in the System Manager user interface.
- Expand Host Images > Client Style Images and select the host name
that corresponds to the machine where your client application resides.
- From the client style image's pop-up menu, select Properties. A
notebook opens.
- On the Main tab, enter the fully qualified name or TCP/IP address of
the machine running your OLT server in the OLT hostname field. For the
Solaris sample, make sure that you have the Windows NT/2000 machine identified in this OLT
hostname entry.
- Enter the port where the OLT server listens for connecting OLT clients in the OLT
port field. Unless 2102 is being used, you can leave this setting as it is.
- Make sure that Enable debug checkbox is selected.
- Start Object Level Trace.
- From a command window on the Windows NT/2000 system, enter olt to start OLT.
- When the OLT Viewer window opens, make sure that the Execution mode is
set for Trace only for Default settings.
- Run the client application and create a trace.
- From a korn shell, go to the location of the client application and type:
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 4.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