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

Description
In this exercise, you will complete these steps:
- Start Object Level Trace.
- Start the client application.
- Trace and debug the server code.
- Step into client code and debug it.
Sample instructions
Follow these steps to perform the tracing and debugging for this scenario:
- Start Object Level Trace.
- To start Object Level Trace on your Windows NT/2000 system, type olt in a
command window . OLT starts.
- When the OLT Viewer window opens, make sure that the Execution mode is
set for Trace and Debug for Default settings. Also, make
sure that the Debugger hostname and TCP/IP port settings
are correct. If you have to change the setting, click Apply.

- Start the client application.
- In a command window, go into the directory for PolicyApp.exe and run it, for example:
cd x:\CBroker\samples\InstallVerification\ProgrammingModel
cd BusinessObjects\Policy\Working\NT\TRACE_DEBUG\
PolicyApp.exe
The client application starts in a command shell. The OLT Viewer soon displays trace
lines and event symbols.
- Trace and debug the server code.
- The first debuggable event that OLT encounters is a call to the getPolicyNo method. At
this point, the application halts and a dialog box opens:

- Click OK.
- The debugger opens on the server code and a message appears because the source file
cannot be located. Specify the source file with the correct path and click OK.
- The debugger opens and steps into the getpolicyNo method.

- Step into client code and debug it.
- On the debugger toolbar, click Step Over. This starts a second pane
inside the debugger and displays the client application source code in the pane:

- On the debugger toolbar, click Run. The application runs until it
encounters the next debuggable server event, the setamount method.
- In the OLT Method Breakpoint dialog box, deselect the Step-by-step
debugging mode checkbox:

- Click OK. The application runs through to completion.
- When you see the following dialog box, click OK:

The OLT Viewer now contains a complete trace:

At this point, you can set breakpoints on any of the debuggable server events (shown as
filled circles on the Policy trace). If you rerun PolicyApp.exe, the debugger opens only
on your breakpoints.
Important Note: While running your application, do not close the
debugger window you are using to debug server code. Doing so shuts down the application
server (this is a Windows NT/2000 limitation). When you finish debugging, stop your application
server using System Manager, then close the OLT window.

Component Broker Object Level Trace examples
OLT Overview