Komodo Debugger FunctionsThe Komodo debugger is a powerful tool for developing high-quality software programs. The Komodo debugger provides the ability to analyze programs on a line by line basis, monitor and alter variable and watch output as it is generated.
Komodo's Debugger also supports remote debugging, which is used to open a file on a remote machine and debug the file on your local machine using Komodo. This is useful for debugging CGI programs in a live Web server setting, and for systems built using client/server architecture. This section of the user guide contains general information about the debugger that is applicable to each language. Komodo provides debugging support for Perl, Python, PHP and XSLT. For information about configuring languages and language-specific debugger functions, select a link below: Notes
Starting the DebuggerTo start the debugger:
If multiple files are open in the editor pane, the program that is currently displayed will be debugged. If no breakpoints have been set, the debugger will run to the end without stopping. If the Output pane is currently hidden, Komodo will expand it. You will be prompted to specify Debugging Options. To suppress display of the Debugging Options dialog, hold down the Ctrl key while clicking the desired debugging button on the Debugging Toolbar or using the desired Keyboard Shortcut key combination. ![]() Debugging OptionsWhen you invoke the debugger, the Debugging Options dialog is displayed. The Debugging Options dialog is used to configure the system environment, command line arguments, CGI environment, and other options for debugging. (To suppress display of the Debugging Options dialog, hold down the Ctrl key while clicking the desired debugging button on the Debugging Toolbar or clicking the desired Keyboard Shortcut key.) Debugging options for each language "persist" from one debugging session to another. For example, if you configure command-line options and environment variables when debugging a Perl script, the next time you debug a Perl script those same options and variables will be displayed in the Debugging Options dialog. Options will persist across programs and Komodo sessions; every time you change debugging options for a language, those options will remain until they are changed again. Not all of the debugging options described below apply to all languages. For example, if you are debugging an XSLT program, there are only three options displayed on the "General" tab. The available tabs and fields depend on the value in the Debug this program using drop down list. This value defaults according to the File Associations configured for the file that is currently active in the editor. General Tab
Environment TabThe Environment tab displays all variables that are configured on your system. You can add new variables, or change the values of existing variables by adding a new variable with the same name but with a different value. (During Komodo debugging sessions, variables configured in this dialog override variables configured on your system.) Variable changes have no effect outside of the Komodo debugger, and are stored for each language from one Komodo session to the next. The Default Environment Variables pane displays all environment variables that have been declared on your system.
The CGI Environment tab is only displayed if the Simulate CGI Environment box is checked on the General tab. The CGI Environment tab displays CGI Environment Variables that would commonly be configured on a web server. You can alter existing variables and add new variables. Variable changes have no effect outside of the Komodo debugger, and are stored for each language from one Komodo session to the next.
The CGI Input tab is only displayed if the Simulate CGI Environment box is checked on the General tab. It is used to configure CGI form type and variables for the purpose of simulating CGI input. Note that Komodo's CGI emulation does not generate HTTP Request Headers; rather, it executes the CGI directly by emulating a web server environment.
Use the Request Variable section of the dialog to create variables that will be processed by your CGI program. These variables will be displayed in the Browser Arguments section of the dialog.
To alter variables: click on the desired variable in the Browser Arguments section of the dialog, make changes in the Type, Name and Value fields, then click Update. To delete variables: click on the desired variable in the Browser Arguments section of the dialog, and click Delete. ![]() Setting and Clearing BreakpointsBreakpoints are lines in the program where you want program execution to stop. Breakpoints appear as round green symbols in the left margin of the Editor pane. Breakpoints turn red only during debugging. In some files there are two left margins in the Editor pane.
In other files, there is only one left margin in the Editor pane. This margin is for breakpoints only. To set or insert breakpoints:
To clear or remove breakpoints:
You can also toggle breakpoints using the Editor pane's Context Menu. ![]() Sending Input to the ProgramWhen your program prompts for input, the method of entering the input depends on whether you are debugging in a console window or in Komodo's Output tab. See Debugging Options for instructions on selecting the console or the Output tab. Input via the Console If you are debugging in a console window, the program will pause at the point where it requires input. Enter the desired input in the console window, and press Enter to continue. Input via the Output tab If you are debugging in the Output tab, the program execution will pause at the point where it requires input. Enter the desired input in the Output tab, and press Enter to continue. ![]() Using Debugger CommandsDebugger Command DescriptionThis table lists common tasks and their Komodo commands.
![]() Debugger Stepping BehaviorWhen the debugger steps over a statement, it executes that statement and stops at the next statement. If the statement being stepped over calls one or more subroutines, Step Over executes the entire statement without stopping inside any of those subroutines. Note that the Perl operators "sort", "map", and "grep" behave like other looping constructs with respect to stepping behavior in the debugger. When Komodo has stopped at one of these operators, Step Over will stop at the first statement or expression used within the first argument of these operators. For example, if you Step Over a statement containing a "foreach", "while", "map", "grep", or "sort" looping construct that evaluates its body five times, you stay inside that loop for five iterations. When you Step Over on the sixth iteration, you exit the loop and stop at the next statement. To skip execution of such looping constructs, you can set a breakpoint on the statement following the construct, and Continue until Komodo hits that breakpoint. ![]() Using the Variables TabYou can view the call stack, see the program variables, and watch variables change while you debug your programs using the Variables tab in the Output pane. Viewing the Call StackA call stack is a data area or buffer used for storing requests that need to be handled by the program. Komodo's stack stores temporary data such as variables and parameters and operates as a push-down list. This means that each new data moves to the top of the stack and pushes the older data down in a "last-in, first-out" arrangement. There is one line in this pane per stack frame at any point in the execution of a program. The calling frame contains the information about a function call, including the filename, the line number, and any parameters or local variables. To view the call stack:
![]() Viewing VariablesThe Variables section of the Variables tab is divided into two tabs that vary according to the language of the program that is currently being debugged. (Language variations are described below.) Variables with multiple values (such as arrays) are indicated by plus and minus symbols to the left of the variable name. To Expand or Collapse Variables plus symbols indicate variables with multiple values that can be expanded; minus symbols indicate variables that can be collapsed. Click on the plus or minus symbol to expand or collapse the variable list. To Change Variable Values double click in the variable's Value field and enter the desired value. (You cannot change the value of nodes in XML documents.)
![]() Watching VariablesThe right-most window on the Variables tab is the Watched Variables pane. You can watch variables, or expressions based on variables. You can type expressions in by hand, you can drag and drop expressions from an editor, or you can drag variables from one of the variable panes immediately to the left. You can change the value of a variable in the Watched Variables pane, and you can remove a variable from the Watched Variables pane. Watched variables can be added, manipulated and removed regardless of whether or not the debugger is currently running. To watch the evolution of one or more variables as the program iterates, do one of the following:
To enter arbitrary expressions in the Watched Variables pane:
For Perl, you can type any scalar expression in the Variable Name field of the Watched Variables pane, and watch its value change. To change the values of variables:
To remove a variable from the Watched Variables pane, click on the variable and click the Delete button above the Watched Variables pane. ![]() Using the Output TabThe Output tab is located on the left of the Output pane, which is below the Editor pane and separated by a splitter bar. The Output tab is used to view program output, to send input to the program being debugged, and to preview HTML output. When your program produces HTML output, click the icon on the right side of the Output tab for an HTML preview. Click the button a second time to display the original HTML code. You can resize or hide the Output pane. ![]() Watching FilesWhen you're debugging a program that writes output to another file, or when you want to watch programs execute, you can watch the output or the log file using Komodo's File Watcher. This window shows a file as the file is being updated on disk. It has no relationship with variable viewing, except that while debugging it is often useful to watch variables change state and files change content. To use the File Watcher:
![]() Stopping the DebuggerTo stop the Komodo debugger, do one of the following:
The Debug toolbar collapses and the Output pane remains open to display the results of the execution. ![]()
|