DEBUG_EXTPROC package enables you to start up the extproc agent within a session. This utility package can help you debug external procedures.
This chapter contains the following topics:
211.1 DEBUG_EXTPROC Security Model
Your Oracle account must have
EXECUTE privileges on the package and
CREATE LIBRARY privileges.
211.2 DEBUG_EXTPROC Operational Notes
These operational notes apply to
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
EXECUTEprivileges on the package.
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_AGENTto 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.
211.3 Rules and Limits
DEBUG_EXTPROC works only on platforms with debuggers that can attach to a running process.
211.4 Summary of DEBUG_EXTPROC Subprograms
STARTUP_EXTPROC_AGENT procedure is the only
Table 211-1 DEBUG_EXTPROC Package Subprograms
Starts up the extproc agent process in the session