Debugging a custom server

If your custom server does not operate as expected, you can use the debug facility to identify the point of error. Using the AIX dbx debugger, you can step through each statement and observe the results of the execution of that line of code.

You can also use custom server trace for debugging custom servers; this may be more suitable for debugging custom servers that are in production. See Tracing custom servers.

To use the dbx debugger, you must specify -g as a compile (C flags) option when you define the main() function properties, as described in Defining properties.

If you want to use another debugging tool, instead of dbx, edit the custom server debug script, CA_DEBUG which is located in $VAETOOLS. Change the line that initiates dbx to initiate your debugging tool.

The printf C-library function can be useful for debugging. To avoid a delay caused by buffering, follow each printf with an fflush function. The output of the printf function is sent to the DTstatus.out file. However, the results of the printf function can become merged with other data sent to DTstatus.out; to prevent this happening, use the setlinebuf function before your printf function to ensure that your data always starts printing on a new line.

Note: You cannot run more than one custom server of the same name at a time. Therefore, if you have an earlier version of this custom server running in production status, you must stop it before you can debug your new version. Refer to the Blueworx Voice Response for AIX: Configuring the System information for information about stopping the execution of a custom server.

Use the following procedure to initiate the debug facility:

  1. From the Welcome window, select Applications —> Custom Servers
  2. Open the custom server: Open the custom server that you want to debug. The system displays the Custom Server window.
  3. Start debugging: To start the debug facility click Utilities —> Debug. The system displays the Custom Server Debug window, running dbx.
    Figure 1. Custom Server Debug window
    This is an example Custom Server Debug window
  4. Step through your program: Step through each statement in the program, or run the program. You can do this by typing standard dbx commands (for example: stop in main, run, next) in the Custom Server Debug window (refer to the Commands Reference for information about dbx). The program executes and displays the activities and results as programmed.
  5. Note any errors or unexpected results so that you can make required modifications.
  6. When you have finished debugging the custom server, type quit at the (dbx) prompt.