INFORMIX
Extending INFORMIX-Universal Server: User-Defined Routines
Chapter 4: Debugging User-Defined Routines
Home Contents Index Master Index New Book

Debugging a DataBlade Module

To debug your DataBlade module, use a debugger that can attach to the active server process and access the symbol tables of dynamically loaded shared object files. On Solaris, the debugger utility meets these criteria.

To attach to the server process, do the following:

The following sections describe these steps.

Connecting to the Server from a Client

To connect to Universal Server, choose a client tool that allows you to submit ad hoc queries. On Windows NT, you can use INFORMIX-SQL Editor. On UNIX, you can use DB-Access.

For example, from UNIX, execute the following command, where database is a database in which you registered the DataBlade module that you want to debug:

Loading the DataBlade Module

Before you can attach to the server process with the debugger, you need to load the shared object file for your DataBlade modules into the server address space. With the shared object file loaded, you can set breakpoints on the entry points for the module and examine local storage provided by the module functions.

To load the DataBlade module into the server address space, execute one of its functions. One technique is to define a routine in the DataBlade module that you use to load the DataBlade module. The routine can be as simple as the following:

To prevent name conflicts, substitute the object prefix assigned to your DataBlade module in place of mod.

To load the DataBlade module shared object file, execute the following command in your client application:

Identifying the Server Process

To find the CPU or EXT virtual process in which your DataBlade module is loaded, execute the onstat command, as follows:

Figure 4-2 shows the last section of the output of this onstat command.

Figure 4-2
onstat -g glo Command Output

Find the CPU or EXT virtual processor that you want to debug and record its process ID for the next step.

Starting the Debugger

To start the debugger, enter the following command at the shell prompt, where process_id is the PID of the CPU or EXT virtual process:

This command starts the debugger on the server virtual-processor process without starting a new instance of the virtual processor.

You can set breakpoints, examine the stack, resume execution, or carry out any other normal debugger command. For more information about available debugger commands, see the debugger manual page.

Setting Breakpoints

You can set breakpoints in any function with an entry point known to debugger, which includes internal server functions and your DataBlade module functions. Universal Server is compiled with debugging support turned off, so local storage and line number information is not available for server routines. However, because you compiled the DataBlade module for debugging, you can see line number information and local storage for your functions.

The Universal Server routine that calls your DataBlade module functions is called udr_execute(). You can set a breakpoint in this routine as follows:

When you enter a command in the client that calls one of your DataBlade module functions, the debugger stops in the udr_execute() routine. Then you can step through your function. Because your DataBlade module is compiled with debugging support, you can view the local variables and stack for your functions.

Symbols in Shared Object Files

Undefined symbols in a shared object file are resolved with the main Universal Server module when the file is loaded. If a symbol is missing, the load fails on the first execution of the user-defined routine, and a message is written in the log file.

Symbols defined in two different shared object files are distinct entities and do not resolve against each other.

A symbol defined in a shared object file and the Universal Server main module behaves in one of two ways:




Extending INFORMIX-Universal Server: User-Defined Routines, version 9.1
Copyright © 1998, Informix Software, Inc. All rights reserved.