This chapter contains the following topics:
Rules and Limits
Your Oracle account must have
EXECUTE privileges on the package and
CREATE LIBRARY privileges.
To install the package, run the script
Install/load this package in the Oracle USER where you want to debug the 'extproc' process.
Ensure that you have execute privileges on package
SELECT SUBSTR(OBJECT_NAME, 1, 20) FROM USER_OBJECTS WHERE OBJECT_NAME = 'DEBUG_EXTPROC';
You can install this package as any other user, as long as you have
EXECUTE privileges on the package.
Note:These notes assumes that you built your shared library with debug symbols to aid in the debugging process. Please check the C compiler manual pages for the appropriate C compiler switches to build the shared library with debug symbols.
Having installed the package, proceed accordingly:
Start a new Oracle session through SQL*Plus or OCI program by connecting to
STARTUP_EXTPROC_AGENT to startup the extproc agent in this session; for example, execute
STARTUP_EXTPROC_AGENT; Do not exit this session, because that terminates the extproc agent.
Determine the PID of the extproc agent that was started up for this session.
Using a debugger (for example, gdb, dbx, or the native system debugger), load the extproc executable and attach to the running process.
Set a breakpoint on function 'pextproc' and let the debugger continue with its execution.
Now execute your external procedure in the same session where you first executed
Your debugger should now break in function 'pextproc'. At this point in time, the shared library referenced by your PL/SQL external function would have been loaded and the function resolved. Now set a breakpoint in your C function and let the debugger continue its execution.
Because PL/SQL loads the shared library at runtime, the debugger you use may or may not automatically be able to track the new symbols from the shared library. You may have to issue some debugger command to load the symbols (for example, 'share' in gdb)
The debugger should now break in your C function. Its assumed that you had built the shared library with debugging symbols.
Now proceed with your debugging.
DEBUG_EXTPROCworks only on platforms with debuggers that can attach to a running process.
Starts up the extproc agent process in the session
This procedure starts up the extproc agent process in the session.This enables you to get the PID of the executing process. This PID is needed to be able to attach to the running process using a debugger.