Tracing and debugging a C++ client and C++ business object on AIX

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

npoolt2a.gif (3218 bytes)

Description
In this exercise, you will complete these steps:

  1. Set up .profile file.
  2. Start Object Level Trace.
  3. Run the client application and create a trace.
  4. Set a breakpoint on the trace.
  5. Prepare for tracing and debugging.
  6. Rerun the application and step into server code.
  7. Step from server to client code.
  8. Step into server code again at the next breakpoint.
  9. Run the application to completion.

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

  1. Ensure the /usr/idebug/bin/OLT.profile file has been executed from within the .profile file.
  2. Start Object Level Trace.
    1. From a korn shell on the AIX system, enter olt to start OLT.
    2. 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.
  3. Run the client application and create a trace.
    1. 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:

      npnoltgn.gif (18721 bytes)

  4. Set a breakpoint in the trace.
    1. 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.
    2. Select the event, right-click, and select Add to Method Breakpoint List.

      npgetpr.gif (15554 bytes)

  5. Prepare for tracing and debugging.
    1. From the OLT Viewer's Options menu, deselect Step-by-step Debugging Mode.
    2. In the OLT Viewer's Client Controller page, select Trace and debug for Execution mode for Default settings and click Apply.
  6. 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.)

    npnoai2a.gif (3400 bytes)

  7. Step from server to client code.
    1. 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:

      npnoai3a.gif (3531 bytes)

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

      npnoai4a.gif (3252 bytes)

      The debugger is now in the client application.

  8. Step into server code again at the next breakpoint.
    Click Run. The debugger stops at the next breakpoint in the server business object:

    npnoai5a.gif (3688 bytes)

  9. 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:

    npoolt7a.gif (2368 bytes)

    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.

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