Tracing and debugging a C++ client and C++ business object in step-by-step mode (Windows NT/2000)

Objective
The following information applies to Windows.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:

npoolt1c.gif (3022 bytes)

Description
In this exercise, you will complete these steps:

  1. Start Object Level Trace.
  2. Start the client application.
  3. Trace and debug the server code.
  4. Step into client code and debug it.

Sample instructions
Follow these steps to perform the tracing and debugging for this scenario:

  1. Start Object Level Trace.
    1. To start Object Level Trace on your Windows NT/2000 system, type olt in a command window . OLT starts.
    2. 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.

      npoolt73.gif (4908 bytes)

  2. Start the client application.
    1. 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.

  3. Trace and debug the server code.
    1. 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:

      npoolt75.gif (4209 bytes)

    2. Click OK.
    3. 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.
    4. The debugger opens and steps into the getpolicyNo method.

      npoolt76.gif (18752 bytes)

  4. Step into client code and debug it.
    1. 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:

      npoolt77.gif (16913 bytes)

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

      npoolt79.gif (3981 bytes)

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

      npoolt7a.gif (2368 bytes)

      The OLT Viewer now contains a complete trace:

      npoolt7b.gif (14554 bytes)

      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.

ngrelr.gif (548 bytes)
Component Broker Object Level Trace examples
OLT Overview