Compiling source files  Running C++ components externally

Chapter 14: Creating CORBA C++ Components

Debugging C++ components

To debug a component you must run the debug version of the server, and use a debugger running on the same host as EAServer. Chapter 3, “Creating and Configuring Servers,” in the EAServer System Administration Guide describes how to start the debug server.

To debug a component from Microsoft Visual C++, you must set the component’s property under the Advanced tab to true.

Follow these steps to attach to the server and step into your component code:

  1. Change to the bin subdirectory in your EAServer installation, and start the debugger with the executable.

    On Solaris:

    1. Edit the file, and set the WORKSHOP_DIR environment variable to the location of the Workshop debugger; for example:

      export WORKSHOP_DIR
    2. On a command line, enter: -servername ServerName -workshop

    On Windows:

    1. Edit user_setenv.bat, and set the VC variable to the Visual C++ installation, where vcvars32.bat is located in vc_path\bin; for example:

      set vc=c:\vc_path
    2. On a command line, for Visual C++ version 5 or 6 compilers, enter:

      serverstart.bat -servername ServerName -msdev

      For Visual C++ version 7 compilers, enter:

      serverstart.bat -servername ServerName -devenv

    ServerName is the name of the server. If you are using the preconfigured server rather than one that you created yourself, use “Jaguar”.

  2. Set a breakpoint on the function jag_dbg_stop. This function executes every time the server loads a component DLL. The jag_dbg_stop prototype is:

    void jag_dbg_stop(char *compName)

    The compName parameter specifies the name of the library or shared library that was just started. Several components may be started before yours. In the debugger, display the compName value when the jag_dbg_stop breakpoint is tripped, and monitor the value to determine when your component is started. Breakpoints on jag_dbg_stop are triggered before the server calls the component’s create method.

    NoteMake sure the jag_dbg_stop breakpoint is set before running your client application.

  3. When your component’s DLL is started, you can specify the component’s C++ function names as breakpoints and step into the method’s code when it is invoked.

Copyright © 2005. Sybase Inc. All rights reserved. Running C++ components externally