⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 tcldbg.man

📁 Linux下的tcl语言调试器
💻 MAN
📖 第 1 页 / 共 2 页
字号:
.TH TCLDBG N "5 November 1996" Tcldbg "Tcl Interactive Debugger".IX "Expect" "Debugger" "TCL" "TK" "exp_debug" "debug".SH NAMEtcl debugger \- interactive debugger for Tcl and Expect.SH INTRODUCTIONThe Tcl debugger allows debugging of Tcl scripts in a manner very similarto classical debuggers such as dbx and gdb.  The Tcl debugger can be usedwith Tcl extensions such as Expect and Tk.  The debugger can:.TP 5oPerform a step-by-step execution of a script and its procedures..TPoCreate user-defined breakpoints. Any number of breakpoints can be set,and they can be triggered by the value of a variable, by the value ofan expression, or by pattern matching on a command or its arguments..BEYou can customize the action taken when a breakpoint is triggered. Thedefault action is to stop the script's execution, but any block of TCL statements can be specified..TPoExamine the current values of variables and expressions. You can alsostep up or down through nested procedures to examine the values of variablesas known by those procedures..TPoDisplay the current state of the program stack..PPThis man page describes a large percentage of the debugger but doesnot describe all of it.  See the Expect book for further discussion ofthe debugger including a tutorial..SH USAGE.PPThe debugger may be invoked in two ways: from the UNIX command line orby a Tcl command.  Not all extensions support both of these.  Sincethe Expect extensions supports both, this man page demonstrates thedebugger using Expect.  For example, to start the debugger from thecommand line, enter:      % \fBexpect \-D 1 \-i \fR[ \fIcmdfile\fR ] [ \fIargs\fR ]where.I cmdfileis an optional script file and.I args are optional arguments for the script.To turn on the debugging flag when you are already in .B Tcl'sinteractive mode, enter the following command at the.B Expectprompt:      expect1.1> \fBexp_debug 1\fRThis command can also be given as \fBdebug\fR.Once the debugger flag has been turned on, the debugger is activatedat the next error or signal, or at the next \fBexp_debug\fR (or \fBdebug\fR)command. To turn on the debugger flag and enter the debugger immediately,enter the following command:      \fBexp_debug \-now 1\fRWhen you are in the \fBTcl\fRdebugger, the prompt changes to \fBdbg\fI#.#\fB\>\fR, where the firstnumber is the number of pending calls to Tcl_Eval and the second isthe history number (this is the same format as the default \fBExpect\fRprompt). If you give an incomplete command, the prompt changes to \fBdbg+>\fR to indicate additional input is needed.To leave the debugger and return to the normal \fBTcl\fRprompt, give the \fBreturn\fR command. .TP 6\fBNOTE:\fRUnlike \fBExpect's\fR prompts, the debugger prompts cannotbe redefined from within \fBExpect\fR. To change them, you must edit the\fBDbg.c\fR source file and recompile..SH COMMANDS.PPWhen the interactive debugger is running, you can give any TCL orextension commands. In addition, the following debugger commands areavailable:.TP 6\fBb\fRSets, clears, or shows \fBb\fRreakpoints. See \fBBREAKPOINTS\fR below..TP\fBc\fR\fBC\fRontinue program execution until the end of the script, until the script hits a signal, or until a breakpoint is triggered, whichevercomes first..TP\fBd\fRMove the scope of the debugger \fBd\fRown one or more levels so as to view the state of variables at that level. Use \fBd\fR \fIn\fR tomove \fIn\fR levels down. Use \fBd #\fIn\fR to move to absolute scopenumber \fIn\fR.Changing the scope only changes the view you have of the variables thatare defined at that point. If you continue program execution, the scopeis automatically reset to whatever is appropriate for the next command..TP\fBh\fRDisplay a \fBh\fRelp screen listing the debugger commands..TP\fBn\fRExecute the \fBn\fRext pending command and display the next command to beexecuted. If the next command is a complex expression, such as:      \fBset a [expr 1+[expr 2+[expr 3+$b]]\fR\fBn\fR evaluates each sub-expression at a time; \fBn\fR worksoutward, using \fBTCL's\fR usual rules of precedence and evaluation.To step through more than one command, follow \fBn\fR with the number ofexpressions to evaluate, such as \fBn 3\fR..TP\fBN\fRExecute the \fBN\fRext pending command, and if it is a complex expression,evaluate all parts. Thus, if the next command is:     \fBset a [expr 1+[expr 2+[expr 3+$b]]\fR\fBN\fR evaluates all parts and assigns the proper value to \fB$a\fR.To step through more than one command, follow \fBN\fR with the number ofexpressions to evaluate, such as \fBN 3\fR..TP\fBr\fRComplete execution of the current procedure and \fBr\fReturn to the debugger. If no procedure has been called, \fBTcl\fR displays \fBnowhere to return to\fR and redisplays the debugger prompt..TP\fBs\fRIf the next pending command is a procedure, \fBs\fRtep into the next procedureand stop before executing the procedure's first command. If the nextcommand is not a procedure, \fBs\fR is identical to the \fBn\fR command.To step through more than one command, follow \fBs\fR with the number ofexpressions to evaluate, such as \fBs 3\fR..TP\fBu\fRMove the scope of the debugger \fBu\fRp one or more levels so asto view the state of variables at that level. Use \fBu\fR \fIn\fR tomove \fIn\fR levels up. Use \fBu #\fIn\fR to move to absolute scopenumber \fIn\fR.Changing the scope only changes the view you have of the variables thatare defined at that point. If you continue program execution, the scopeis automatically reset to whatever is appropriate for the next command..TP\fBw\fRShow \fBw\fRhere the current scope of the program is. 0 is the top-levelscope and always shows the command used to invoke the current program.The last line of the display shows the current value of the Tcl_Eval stackand the next command to be executed, with all parameters replaced withtheir current literal values.The \fBw\fR command also controls the \fBw\fRindow display. The      \fBw \-w\fI n\fR command sets the width of the display to \fIn\fRcharacters. If a line is longer than this width, the debugger shows an ellipses (...) to represent the additional characters. The default width is 75. Use      \fBw \-w\fR to display the current width. The \fBw \-c\fR command sets the compression mode, which displaysall control characters using their escape sequences (such as "\\n").This is particularly useful when procedures and blocks of statementsare spread over several lines and you would prefer to see the entiredefinition on one line.To turn off the compression mode (the default), use      \fBw \-c 0\fRTo turn on the compression mode, use      \fBw \-c 1\fRTo display the current setting, use      \fBw \-c\fR.PP To repeat the last debugger command given, enter a blank line..SS BREAKPOINTS.PPThe \fBb\fR command can be used to set, clear, and display breakpointsthat are used when executing a script (breakpoints are not available forcommands entered at the debugger prompt).Breakpoints can be triggered either when a given expression becomes truewhen evaluated, or when a specified pattern is found in the next commandto be executed. An action can be defined along with a breakpoint, so that when the breakpoint is triggered, the associated action is performed before the debugger prompt reappears. An action can be any set of TCL or extensioncommands. Debugger commands can also be included but commandsthat that control the flow of program execution (\fBc\fR, \fBn\fR,\fBN\fR, \fBr\fR, \fBs\fR) are queued until the breakpoint action is completed.If no action was specified when the breakpoint was set, the debugger prints the number and definition of the breakpoint that wastriggered before redisplaying the the debugger prompt.Multiple breakpoints can be triggered at once. If so, all of the actions associated with those breakpoints are done.The following breakpoint commands exist:.TP 10\fBb\fRDisplay all currently defined breakpoints..TP\fBb if {\fIexpr\fB} then {\fIcommands\fB}Set a breakpoint based on the value of the given \fIexpr\fR. If \fIexpr\fR is true, the \fIcommands\fR are executed and the debugger

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -