home *** CD-ROM | disk | FTP | other *** search
-
- Starting with version 2, Oraperl incorporates Fred Fish' excellent
- debugging package, DBUG. The entire package (including documentation)
- is included in the dbug/ subdirectory, so you can install it separately
- to use with other programs. DBUG is in the public domain.
-
- Read dbug/dbug.p for full details on the package, but briefly you need
- to assign debugging control strings to $ora_debug to indicate the level
- of debugging required. A list of the debugging controls is on pages 18
- and 19 of the documentation. For example, if you want to trace allocation
- and freeing of memory in the functions ora_open and ora_close, writing
- the output to a file called trace, numbering the lines, you could say:
-
- $ora_debug = 'd,malloc,free:f,ora_open,ora_close:o,trace:N';
- ^ ^ ^ ^
- | | | |
- debugging keys ----+ | | |
- functions to be traced ----------+ | |
- where to write output --------------------------------+ |
- number output lines ------------------------------------------+
-
- The debugging keywords (for the 'd' parameter) used are the following:
-
- conv report string/double conversions (only for addresses)
- entry report function entry, with parameters
- exit report function exit, with return values
- free report memory freeing
- info report other information of interest
- malloc report memory allocation, success or failure
-
- Debugging is turned off by assigning an empty string to $ora_debug.
-
- It is still possible to assign a numeric value to $ora_debug, for
- compatibility with existing programs and to allow continued use of
- Perl's -D flag. Values are translated according to the following table:
-
- value keywords
- ----- --------
- 8 entry exit info
- 32 conv
- 128 malloc free
-
- These values may combined, so that $ora_debug = 168 turns on all debugging.
- If the resulting value contains no valid flags, debugging is turned off;
- thus "$ora_debug = 0" still works. When a numerical value is used, the
- controls ':t:N' are appended to show the function nesting and number the
- output lines.
-
- If your uperl.o was built with -DDEBUGGING, you can define PERL_DEBUGGING
- at compilation and the oraperl debugging will be initialiased from the -D
- flag. If not, you can still define DEBUGGING, but you will have to set
- ora_debug from within your program.
-
- One idea would be to include a flag in all your programs which would allow
- a debugging string to be entered on the command line. The author of the
- DBUG package recommends -# (and so the routines will remove a leading -#
- from the control string if there is one). For example, I use this line:
-
- $ora_debug = shift if $ARGV[0] =~ /-#/;
-
- If you want to trace something else, you can add your own DBUG_PRINT
- statements to the code wherever you want. I would recommend that you use
- a keyword that isn't specified here (possibly beginning with your initials)
- so that you can easily distinguish between my debugging and yours.
-