Ns adp debuginit

From AOLserver Wiki
Jump to navigation Jump to search

NAME

ns_adp_debuginit - Start TclPro debugging

SYNOPSIS

ns_adp_debuginit ?procsPattern? ?host? ?port?

DESCRIPTION

This command enables basic debugging when used with the TclPro debugger. It will connect to a remote debugger if not already connected. The procsPattern argument specifies a glob pattern to match Tcl procedures to be instrumented by the debugger and the host and port arguments are passed to the TclPro debugger_init procedure to connect to the remote debugger.

NOTES

This command is written in tcl and is in the debug.tcl file and is the default adp debuginit command that gets triggered when enabledebug adp config parameter is true and &debug=filePattern is present in the query string.
Despite its name, it's not really specific to adps. You can also execute this proc manually, then evaluate some code inside a debugger_eval {} as long as you make sure to call ns_markfordelete after calling this proc.
There are several issues with the current version of this command:
  1. If procsPattern is specified, it creates a temporary file with a dump of matching proc bodies, args, etc. For a wide pattern such as *, this can take quite some time. It would be best to cache it or for *, to obtain this from ns_ictl get.
  2. If there is an error in connecting to the debugger after creating such a temporary file, this file is not cleaned up.
  3. The whole enabledebug facility is a major security flaw and is unusable on any public-facing server. What's needed is some kind of a white list (i.e. private IP address ranges only) or perhaps nsperms authentication trigger when debugging is requested.

SEE ALSO

ns_adp_debug, ns_markfordelete

-