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

📄 tcl-debug.ps

📁 Linux下的tcl语言调试器
💻 PS
📖 第 1 页 / 共 5 页
字号:
1.56 (previous example look slightly dif) 306 406 P1.56 (ferent.  Note) 476.6 406 P(the asterisks.) 306 392 T(T) 306 373 T(o stop only on de\336nitions:) 312.49 373 T3 11 Q(expect2.4> b -glob "proc p4 *") 324 354.67 T1 12 Q(On calls to p4:) 306 340 T3 11 Q(expect2.5> b -glob "p4") 324 321.67 T1 12 Q(On commands which call p4:) 306 307 T3 11 Q(expect2.6> b -glob "*\134\134\134[p4 *") 324 288.67 T1 12 Q1.02 (Expressions can be combined with patterns just) 306 274 P0.2 (as if they were with line numbers.  For example,) 306 260 P0.41 (to break on a call to p4 only when foo is greater) 306 246 P(than three:) 306 232 T3 11 Q-0.31 (expect2.7> b -glob p4 if {$foo>3}) 324 213.67 P1 12 Q4.76 (Regular expression patterns save the strings) 306 199 P2.6 (which matched any patterns in the array) 306 185 P2 F2.6 (dbg) 519.01 185 P1 F2.6 (.) 537 185 P0.77 (The part of the command matched by the entire) 306 171 P1.42 (pattern is saved in $dbg\0500\051.  Up to 9 parenthe-) 306 157 P1.81 (sized subpattern matches are stored in $dbg\0501\051) 306 143 P(through $dbg\0509\051.) 306 129 T306 102 540 117 C315 115 459 115 2 L0.5 H2 Z0 X0 KN0 0 612 792 C1 10 Q0 X0 K0.53 (2. Using braces instead of double quotes permits) 324 95.33 P1.31 (the previous pattern to be simpli\336ed to {\134[p4 }.) 324 83.33 P2.39 (However) 324 71.33 P2.39 (, the braces prevent the possibility of) 360.23 71.33 P-0.17 (explicitly matching escaped characters such as \134n.) 324 59.33 PFMENDPAGE%%EndPage: "8" 7%%Page: "9" 7612 792 0 FMBEGINPAGE0 12 Q0 X0 K(Don Libes) 72 758.33 T(A Debugger for T) 391.87 758.33 T(cl Applications) 481.7 758.33 T(T) 72 27 T(cl/Tk W) 78.9 27 T(orkshop - June 10-1) 119.89 27 T(1, 1993 - Berkeley) 220.85 27 T(, CA) 311.46 27 T1 10 Q(9) 553 27 T1 12 Q1.9 (For example, the name of a variable being set) 72 730 P1.69 (can be accessed as $dbg\0501\051 after the following) 72 716 P(breakpoint:) 72 702 T3 11 Q(expect2.8> b -re {^set \050[^ ]\051+ }) 90 683.67 T1 12 Q0.17 (This can be used to construct more sophisticated) 72 669 P0.81 (breakpoints.  For example, the following break-) 72 655 P2.36 (point occurs only when the variable being set) 72 641 P(was already set.) 72 627 T3 11 Q-0.22 (expect2.9> b -re {^set \050[^ ]\051+ }) 90 608.67 P(if {info exists $dbg\0501\051}) 90 597.67 T0 12 Q(Br) 72 578 T(eakpoint Actions) 85.11 578 T1 F-0.17 (Breakpoints may trigger actions.  The default ac-) 72 559 P0.46 (tion prints the breakpoint id and de\336nition.  It is) 72 545 P0.04 (possible to replace this action with any T) 72 531 P0.04 (cl state-) 268.32 531 P1.31 (ment.  As an example, the following command) 72 517 P1.8 (de\336nes a breakpoint which prints a descriptive) 72 503 P2.45 (message whenever the variable a is being de-) 72 489 P(\336ned:) 72 475 T3 11 Q-0.22 (expect2.1> b -re "^set a " then {) 90 456.67 P(+>) 90 445.67 T(puts "a is being set") 126 445.67 T3 9 Q(1) 264.43 450.07 T3 11 Q(+>) 90 434.67 T(puts "old value of a = $a") 126 434.67 T(+> }) 90 423.67 T1 12 Q(When run, it looks like this:) 72 409 T3 11 Q(expect2.2> c) 90 390.67 T(a is being set) 90 379.67 T(2: set a 2) 90 368.67 T(expect3.3> c) 90 357.67 T(a is being set) 90 346.67 T(old value of a = 2) 90 335.67 T(2: set a 3) 90 324.67 T(expect3.4> c) 90 313.67 T(a is being set) 90 302.67 T(old value of a = 3) 90 291.67 T(2: set a 5) 90 280.67 T1 12 Q2.88 (Each time the breakpoint occurs, the old and) 72 266 P1.95 (new value of a are displayed.  Notice that the) 72 252 P0.56 (\336rst time the breakpoint occurred, a was not de-) 72 238 P0.87 (\336ned.  In this case, $a was meaningless and the) 72 224 P1.73 (puts command was not executed.  If there had) 72 210 P1.86 (been further statements in the breakpoint, they) 72 196 P2.4 (would also have been skipped.  Implicit error) 72 182 P(messages generated by actions are discarded.) 72 168 T1.17 (Error messages generated in breakpoint expres-) 72 149 P0.31 (sions are also discarded.  It is assumed that such) 72 135 P-0.26 (errors are just variables temporarily out of scope.) 72 121 P72 78 306 93 C81 91 225 91 2 L0.5 H2 Z0 X0 KN0 0 612 792 C1 10 Q0 X0 K-0.13 (1. Expect prompts with \322+>\323 when an incomplete) 90 71.33 P(command has been entered.) 90 59.33 T1 12 Q3.08 (By default, breakpoints stop execution of the) 324 730 P-0.29 (program.  It is possible to tell the debugger not to) 324 716 P1.71 (stop by using the commands c, s, n, or r from) 324 702 P(within an action.) 324 688 T0.26 (This can be used to trace variables.  T) 324 669 P0.26 (o illustrate) 506.77 669 P-0.06 (a dif) 324 655 P-0.06 (ferent ef) 345.37 655 P-0.06 (fect, the following breakpoint prints) 385.37 655 P0.15 (out the name of each procedure as it is being de-) 324 641 P(\336ned.) 324 627 T3 11 Q-1.35 (expect2.1> b -re \322proc \050p.\051\323 then) 342 608.67 P({) 342 597.67 T(+>) 342 586.67 T(puts \322proc $dbg\0501\051 defined\323) 378 586.67 T(+>) 342 575.67 T(c) 378 575.67 T(+> }) 342 564.67 T(0) 342 553.67 T1 12 Q-0.1 (The c command in the last line, allows execution) 324 539 P(to continue after each breakpoint.) 324 525 T3 11 Q(expect2.2> c) 342 506.67 T(proc p4 defined) 342 495.67 T(proc p3 defined) 342 484.67 T(proc p2 defined) 342 473.67 T(proc p1 defined) 342 462.67 T1 12 Q-0.08 (The following breakpoint causes the debugger to) 324 448 P1.11 (break after the return of any procedure that has) 324 434 P(called p4.) 324 420 T3 11 Q(expect2.1> b -glob "p4" then "r") 342 401.67 T1 12 Q3.13 (The following command prints out the string) 324 387 P2.12 (\322entering p4\323 when p4 is invoked.  Execution) 324 373 P(continues for four more steps after that.) 324 359 T3 11 Q(expect2.2> b -re "^p4 " then {) 342 340.67 T(+>) 342 329.67 T(puts "entering p4") 378 329.67 T(+>) 342 318.67 T(s 4) 378 318.67 T(+> }) 342 307.67 T1 12 Q0.02 (Multiple breakpoints can occur on the same line.) 324 293 P-0.07 (All corresponding actions are executed.  At most) 324 279 P1.09 (one debugger command will be executed, how-) 324 265 P6.25 (ever) 324 251 P6.25 (.  For example, if breakpoints trigger) 343.98 251 P0.23 (commands containing both \322s 1\323 and \322s 2\323, only) 324 237 P0.87 (the second \050or last in general\051 will have any ef-) 324 223 P(fect.) 324 209 T0 F-0.14 (Limitations in Br) 324 187 P-0.14 (eakpoints Actions and Inter-) 412.14 187 P(active Commands) 324 173 T1 F2.23 (Debugger commands speci\336ed in a breakpoint) 324 154 P1.22 (action occur only after all the breakpoints have) 324 140 P1.8 (completed.  For example, the following break-) 324 126 P0.05 (point appears to print out the old and new values) 324 112 P(of every variable about to be set.) 324 98 T3 11 Q-0.22 (expect2.1> b -re {^set \050[^ ]+\051 }) 342 79.67 P(then {) 342 68.67 T(+>) 342 57.67 T(puts \322old $dbg\0501\051 = [set) 378 57.67 TFMENDPAGE%%EndPage: "9" 8%%Page: "10" 8612 792 0 FMBEGINPAGE0 12 Q0 X0 K(A Debugger for T) 54 758.33 T(cl Applications) 143.83 758.33 T(Don Libes) 487.68 758.33 T1 10 Q(10) 54 27 T0 12 Q(T) 277.22 27 T(cl/Tk W) 284.12 27 T(orkshop - June 10-1) 325.11 27 T(1, 1993 - Berkeley) 426.08 27 T(, CA) 516.68 27 T3 11 Q($dbg\0501\051]\323) 72 730.67 T(+>) 72 719.67 T(n) 108 719.67 T(+>) 72 708.67 T(puts \322new $dbg\0501\051 = [set) 108 708.67 T($dbg\0501\051]\323) 72 697.67 T(+> }) 72 686.67 T1 12 Q1.28 (However) 54 672 P1.28 (, the debugger does not actual execute) 97.48 672 P1.02 (the next procedure call in the program until the) 54 658 P2.83 (breakpoint action completes.  This breakpoint) 54 644 P1.42 (therefore prints the old value twice, incorrectly) 54 630 P(claiming that the latter is the new value.) 54 616 T3 11 Q(expect4.7> c) 72 597.67 T(old a = 2) 72 586.67 T(new a = 2) 72 575.67 T1 12 Q-0.05 (In this case, it is possible to get the new value by) 54 561 P1.97 (just omitting the last puts.  The debugger will) 54 547 P0.27 (then automatically print the new value as part of) 54 533 P(echoing the next command to be executed.) 54 519 T3 11 Q(expect4.7>) 72 500.67 T(old a = 2) 72 489.67 T(2: set a 3) 72 478.67 T1 12 Q1.78 (This example illustrates a limitation of the de-) 54 464 P1.65 (bugger) 54 450 P1.65 (.  The debugger does not use a separate) 86.65 450 P1.64 (thread of control, and therefore does not allow) 54 436 P0.59 (arbitrary automation of its own commands.  For) 54 422 P1.8 (more discussion on these limitations see \322Cur-) 54 408 P(rent Limitations and Future W) 54 394 T(ork\323 on page) 198.95 394 T(15.) 263.9 394 T0 F(General Form of Br) 54 372 T(eakpoints) 156.04 372 T1 F0.02 (Expressions and actions may be combined.  This) 54 353 P1.95 (follows the syntax of T) 54 339 P1.95 (cl\325) 172.23 339 P1.95 (s if-then \050no \322else\323\051.) 184.23 339 P0.86 (For example, the following command prints the) 54 325 P(value of $foo whenever it is non-zero.) 54 311 T3 11 Q(expect2.1> b if {$foo} then {) 72 292.67 T(puts "foo = $foo") 108 281.67 T(}) 72 270.67 T1 12 Q2.58 (The general form of the breakpoint command) 54 256 P0.69 (permits up to one location \050speci\336ed by pattern,) 54 242 P2.36 (or line number and \336lename\051, one expression,) 54 228 P0.63 (and one action.  They must appear in this order) 54 214 P0.63 (,) 285 214 P(but are all optional.) 54 200 T3.31 (If a location is provided or the if-expression) 54 181 P0.53 (doesn\325) 54 167 P0.53 (t look like a line number and/or \336lename,) 85.76 167 P1.13 (the \322if\323 token may be omitted.  If an if-expres-) 54 153 P2.12 (sion has already appeared, the \322then\323 token is) 54 139 P0.74 (also optional.  For example, the following com-) 54 125 P(mands have the same ef) 54 111 T(fect:) 168.36 111 T3 11 Q(expect2.1> b if {$foo} then {) 72 92.67 T(+>) 72 81.67 T(puts "foo = $foo") 108 81.67 T(+>}) 72 70.67 T(0) 72 59.67 T(expect2.2> b {$foo} {) 324 730.67 T(+>) 324 719.67 T(puts "foo = $foo") 360 719.67 T(+>}) 324 708.67 T(1) 324 697.67 T1 12 Q1.91 (When the \336rst ar) 306 683 P1.91 (gument resembles both a line) 391.79 683 P-0.13 (number and expression, it is assumed to be a line) 306 669 P0.02 (number) 306 655 P0.02 (.  The following command breaks on line) 341.98 655 P(17:) 306 641 T3 11 Q(expect2.3> b 17) 324 622.67 T(2) 324 611.67 T0 12 Q(Listing Br) 306 592 T(eakpoints) 358.1 592 T1 F2.43 (If no ar) 306 573 P2.43 (guments are supplied, the b command) 345.95 573 P0.4 (lists all breakpoints.  The following example as-) 306 559 P0.81 (sumes the previous three breakpoints have been) 306 545 P2.48 (set and creates two more.  Notice that break-) 306 531 P(points zero and one are identical.) 306 517 T3 11 Q(expect2.4> b -re "^p4") 324 498.67 T(3) 324 487.67 T(expect2.5> b zz.exp:17 if {$foo}) 324 476.67 T(4) 324 465.67 T(expect2.6> b) 324 454.67 T-0.38 (breakpoint 4: zz.exp:23 if {$foo}) 324 443.67 P(breakpoint 3: -re "^p4" if {^p4}) 324 432.67 T(breakpoint 2: b 17) 324 421.67 T(breakpoint 1: if {$foo} then {) 324 410.67 T(puts "foo = $foo") 360 399.67 T(}) 324 388.67 T(breakpoint 0: if {$foo} then {) 324 377.67 T(puts "foo = $foo") 360 366.67 T(}) 324 355.67 T1 12 Q0.73 (Each breakpoint is identi\336ed by an integer) 306 341 P0.73 (.  For) 512.89 341 P1.55 (example, breakpoint four occurs if $foo is true) 306 327 P(just before line 23 is executed in \336le zz.exp.) 306 313 T2.25 (When multiple breakpoints occur on the same) 306 294 P1.98 (line, the actions are executed in the order that) 306 280 P(they are listed by the b command.) 306 266 T0 F(Deleting Br) 306 244 T(eakpoints) 364.74 244 T1 F1.02 (A breakpoint can be deleted with the command) 306 225 P1.5 (\322b -#\323 where # is the breakpoint number) 306 211 P1.5 (.  The) 509.36 211 P(following command deletes breakpoint 4.) 306 197 T3 11 Q(expect2.7> b -4) 324 178.67 T1 12 Q1.12 (All breakpoints may be deleted by omitting the) 306 164 P(number) 306 150 T(.  For example:) 341.98 150 T3 11 Q(expect2.8> b -) 324 131.67 T0 14 Q(The \322h\323 command \320 \322Help\323) 306 108.67 T1 12 Q1.02 (The) 306 89 P2 F1.02 (h) 328.67 89 P1 F1.02 ( command prints a short listing of debug-) 334.66 89 P4.61 (ger commands, ar) 306 75 P4.61 (guments and other helpful) 400.6 75 P(information.) 306 61 TFMENDPAGE%%EndPage: "10" 9%%Page: "11" 9612 792 0 FMBEGINPAGE0 12 Q0 X0 K(Don Libes) 72 758.33 T(A Debugger for T) 391.87 758.33 T(cl Applications) 481.7 758.33 T(T) 72 27 T(cl/Tk W) 78.9 27 T(orkshop - June 10-1) 119.89 27 T(1, 1993 - Berkeley) 220.85 27 T(, CA) 311.46 27 T1 10 Q(11) 548.01 27 T0 14 Q(Changing Pr) 72 728.67 T(ogram Behavior) 148.33 728.67 T1 12 Q0.4 (When the debugger is active, the variable dbg is) 72 709 P0.31 (de\336ned in the global scope.  When the debugger) 72 695 P0.16 (is not active, dbg is not de\336ned.  This allows T) 72 681 P0.16 (cl) 297.34 681 P1.4 (applications to behave dif) 72 667 P1.4 (ferently when the de-) 199.56 667 P(bugger is running.) 72 653 T0 14 Q(Changing Debugger Behavior) 72 627.67 T1 12 Q0.21 (By default, long commands are truncated so that) 72 608 P0.32 (the debugger can \336t them on a line.  This occurs) 72 594 P1.1 (when the debugger prints out a command to be) 72 580 P0.28 (executed and also in the listing from the w com-) 72 566 P(mand.) 72 552 T2.35 (The w command has a -width \337ag which can) 72 533 P-0.13 (change the current printing width.  It takes a new) 72 519 P1.5 (width as an ar) 72 505 P1.5 (gument.  For example to display) 143.24 505 P(long commands \050such as procedure de\336nitions\051:) 72 491 T3 11 Q(expect2.2> w -w 300) 90 472.67 T1 12 Q2.75 (Because of the parameter substitutions, the w) 72 458 P3.58 (command may try to display extremely long) 72 444 P(lines.  Imagine the following script:) 72 430 T3 11 Q(puts [exec cat /etc/passwd]) 90 411.67 T1 12 Q1.64 (When the debugger is run, w command output) 72 397 P2.92 (will be truncated unless the printing width is) 72 383 P(quite lar) 72 369 T(ge.) 111.42 369 T3 11 Q(2: exec cat /etc/passwd) 90 350.67 T(expect3.1> s) 90 339.67 T(1: puts [exec cat /etc/passwd]) 90 328.67 T(expect2.2> w) 90 317.67 T(*0: expect -D 1 debug-test3.exp) 90 306.67 T-0.51 ( 1: puts {root:Xu.VjBHD/xM7E:0:1:) 90 295.67 P(Operator:/:/bin/csh) 90 284.67 T(nobody:*:65534:65534::/...) 90 273.67 T(expect2.3> w -w 200) 90 262.67 T(expect2.4> w) 90 251.67 T(*0: expect -D 1 debug-test3.exp) 90 240.67 T-0.51 ( 1: puts {root:Xu.VjBHD/xM7E:0:1:) 90 229.67 P(Operator:/:/bin/csh) 90 218.67 T(nobody:*:65534:65534::/:) 90 207.67 T(daemon:*:1:1::/:) 90 196.67 T(sys:*:2:2::/:/bin/csh) 90 185.67 T(bin:*:3:3::/bin:) 90 174.67 T(uucp:*:4:8::/var/spool/uucppubli) 90 163.67 T(c:) 90 152.67 T(news:*:6:6::/var/spool/news:/) 90 141.67 T(bin...) 90 130.67 T(expect2.5>) 90 119.67 T1 12 Q-0.17 (When output is truncated, an ellipsis is appended) 72 105 P-0.02 (to the end.  The default width is 75 which allows) 72 91 P1.39 (some space at the beginning of the line for the) 72 77 P(procedure call depth information.) 72 63 T2.5 (By default, no other output formatting is per-) 324 730 P2.5 (formed.  But even short statements can cause) 324 716 P1.74 (lots of scrolling.  The following declaration of) 324 702 P0.06 (p4 is less then 75 characters but still takes sever-) 324 688 P(al lines.) 324 674 T3 11 Q(% expect -D 1 debug-test.exp)

⌨️ 快捷键说明

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