Debugging C++ pseudocomponents

Once loaded in your debugger, a C++ pseudocomponent can be debugged in the same manner as any other shared library or DLL. However, since the library is not loaded until a client program instantiates the pseudocomponent, setting breakpoints is tricky. The procedure below allows you to set breakpoints and step into your method code.

StepsDebugging a C++ pseudocomponent

  1. Verify that the process is using the debug versions of the EAServer libraries. For pseudocomponents executing in EAServer, start the debug version of the server executable. For standalone programs, verify that the debug DLLs or libraries are listed before the non-debug libraries in your system’s library search path. (On UNIX platforms, the debug libraries are in the lib/debug directory of your client installation. On Windows, they are in the dll\debug directory.)

  2. Attach the program that is instantiating the pseudocomponent with your debugger. This can be a standalone client executable, or EAServer process.

    Alternately, start the debugger to load the executable. For example, on UNIX, this command starts the dbx debugger and loads the debug server executable:

    dbx $JAGUAR/devbin/jagsrv ServerName
    

    As another example, on Windows, this command starts the Microsoft Visual C++ debugger and loads the debug server executable:

    msdev %JAGUAR%\devbin\jagsrv ServerName
    

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

  3. Set a breakpoint on the function jag_client_dbg_stop. This function executes every time the client runtime constructs a pseudocomponent instance. The jag_client_dbg_stop prototype is:

    void jag_client_dbg_stop(char *compName)
    

    The compName parameter specifies the name of the library or shared library that was just started. Several pseudocomponents may be loaded before yours. In the debugger, display the compName value when the jag_client_dbg_stop breakpoint is tripped, and monitor the value to determine when your component is loaded.

    NoteMake sure the jag_client_dbg_stop breakpoint is set before your client application instantiates any pseudocomponents.

  4. When your pseudocomponent’s DLL is loaded, you can specify the method names as breakpoints and step into the method’s code when it is invoked.

For more information about pseudocomponents, see Chapter 34, “Creating and Using EAServer Pseudocomponents,” in the EAServer Programmer’s Guide.