📄 tcl-debug.ps
字号:
1 10 Q(6) 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 T0 14 Q(The \322s\323 command \320 \322Step\323) 54 728.67 T1 12 Q0.7 (The n command executes a procedure atomical-) 54 709 P-0.16 (ly) 54 695 P-0.16 (. It is possible to step into a procedure with the) 62.55 695 P2 F(s) 54 681 T1 F( command.) 58.67 681 T1.97 (W) 54 662 P1.97 (e\325ll rewind this scenario to just before p4 is) 64.36 662 P(about to be executed.) 54 648 T1 10 Q(1) 155.92 652.8 T3 11 Q(4: p4 $b) 72 629.67 T(expect5.5> s) 72 618.67 T(7: expr 1+$x) 72 607.67 T(expect8.6>) 72 596.67 T1 12 Q0.17 (\322expr 1+$x\323 is the \336rst command to be executed) 54 582 P0.48 (inside of p4. It is nested inside of two brackets,) 54 568 P-0.22 (plus the procedure call of p4, so the stack level is) 54 554 P(increased by three.) 54 540 T0.5 (After the s command, the debugger stops before) 54 521 P0.1 (the \336rst command in the procedure and waits for) 54 507 P(more interactive commands.) 54 493 T1.46 (If the command that is about to be executed is) 54 474 P(not a procedure, then s and n behave identically) 54 460 T(.) 282.04 460 T1.78 (Both s and n take an optional ar) 54 441 P1.78 (gument in the) 218.48 441 P2.26 (form of a number describing how many com-) 54 427 P(mands to execute.) 54 413 T(For example:) 54 394 T3 11 Q(s 2) 72 375.67 T(s 100) 72 364.67 T(s $b) 72 353.67 T(s [expr 2+[p4 $b]]) 72 342.67 T1 12 Q2.62 (The ar) 54 328 P2.62 (guments are evaluated according to the) 87.37 328 P1.71 (usual T) 54 314 P1.71 (cl rules because s and n are commands) 90.51 314 P(known to T) 54 300 T(cl.) 108.46 300 T1.92 (The debugger will not interrupt procedures in-) 54 281 P1.35 (voked from the command-line. This is usually) 54 267 P1.99 (the desired behavior) 54 253 P1.99 (, although it is possible to) 154.76 253 P(change this.) 54 239 T0 14 Q(The \322w\323 Command \320 \322Wher) 54 213.67 T(e\323) 226.32 213.67 T1 12 Q0.9 (In the current scenario, we are about to execute) 54 194 P1.97 (\322expr 1+$x\323 in the procedure p4. W) 54 180 P1.97 (e can re-) 242.78 180 P0.18 (mind ourselves of this by displaying the stack of) 54 166 P(procedure scopes using the) 54 152 T2 F(w) 186.56 152 T1 F( command.) 194.56 152 T3 11 Q(7: expr 1+$x) 72 133.67 T(expect8.6> w) 72 122.67 T( 0: expect -D 1 debug-test.exp) 72 111.67 T(*1: p4 1) 72 100.67 T54 78 288 93 C63 91 207 91 2 L0.5 H2 Z0 X0 KN0 0 612 792 C1 10 Q0 X0 K0.29 (1. There is no actual command to \322rewind\323 com-) 72 71.33 P(mands, alas.) 72 59.33 T3 11 Q( 7: expr 1+1) 324 730.67 T1 12 Q0.45 (The \336rst line describes scope 0. This is the top-) 306 716 P1.64 (level scope of the \336le itself, and the command) 306 702 P0.83 (used to invoke the program is shown. The sec-) 306 688 P6.73 (ond line describes scope 1 which is the) 306 674 P-0.15 (invocation of procedure p4. The last line is not a) 306 660 P0.93 (scope but just repeats the evaluation stack level) 306 646 P(and the command about to be executed.) 306 632 T1.55 (Notice that when w prints commands, they are) 306 613 P0.26 (displayed using the literal values of each param-) 306 599 P9.91 (eter) 306 585 P9.91 (. In contrast, when the debugger) 323.32 585 P0.26 (automatically prints out the next command to be) 306 571 P-0.19 (executed, the command is printed as it was origi-) 306 557 P2.77 (nally entered in the script. For example, the) 306 543 P4.36 (debugger initially stopped and printed \322expr) 306 529 P0.68 (1+$w\323, but the same instruction shows as \322expr) 306 515 P(1+1\323 in the output from the w command.) 306 501 T0 14 Q(The Curr) 306 475.67 T(ent Scope) 362.88 475.67 T1 12 Q1.4 (Executing fourteen steps \050via \322s 14\323\051 brings us) 306 456 P(to the \336rst command in procedure p3.) 306 442 T3 11 Q(expect8.8> s 14) 324 423.67 T(4: set m 0) 324 412.67 T(expect5.9> w) 324 401.67 T( 0: expect -D 1 debug-test.exp) 324 390.67 T( 1: p1) 324 379.67 T( 2: p2) 324 368.67 T(*3: p3) 324 357.67 T( 4: set m 0) 324 346.67 T1 12 Q0.03 (The asterisk denotes that p3 is the) 306 332 P2 F0.03 (curr) 471.8 332 P0.03 (ent scope) 492 332 P1 F0.03 (.) 537 332 P0.78 (W) 306 318 P0.78 (e can now execute T) 316.36 318 P0.78 (cl commands appropriate) 417.2 318 P2.56 (to the scope of p3. This includes commands) 306 304 P(such as global, uplevel, and upvar) 306 290 T(.) 468.22 290 T3 11 Q(expect5.10> uplevel {set c}) 324 271.67 T(4) 324 260.67 T0 14 Q3.37 (The \322u\323 and \322d\323 commands \320 \322Up\323) 306 237.67 P(and \322Down\323) 306 221.67 T1 12 Q0.02 (The current scope can be changed by the u and d) 306 202 P0.02 (commands.) 306 188 P2 F0.02 (u) 367 188 P1 F0.02 ( moves the current scope up, while) 373 188 P2 F1.26 (d) 306 174 P1 F1.26 ( moves it down. Interactive variable accesses) 312 174 P(always refer to the current scope.) 306 160 T3 11 Q(expect5.11> u) 324 141.67 T(expect5.12> w) 324 130.67 T( 0: expect -D 1 debug-test.exp) 324 119.67 T( 1: p1) 324 108.67 T(*2: p2) 324 97.67 T( 3: p3) 324 86.67 T( 4: set m 0) 324 75.67 T(expect5.13> set c) 324 64.67 TFMENDPAGE%%EndPage: "6" 5%%Page: "7" 5612 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(7) 553 27 T3 11 Q(4) 90 730.67 T1 12 Q2.01 (Both u and d accept an ar) 72 716 P2.01 (gument representing) 205.73 716 P-0.15 (the number of scopes by which to move. For ex-) 72 702 P(ample, \322u 2\323 moves from scope 2 to scope 0.) 72 688 T3 11 Q(expect5.14> u 2) 90 669.67 T(expect5.15> w) 90 658.67 T(*0: expect -D 1 debug-test.exp) 90 647.67 T( 1: p1) 90 636.67 T( 2: p2) 90 625.67 T( 3: p3) 90 614.67 T( 4: set m 0) 90 603.67 T1 12 Q-0.17 (An absolute scope is also accepted in the form of) 72 589 P(\322#\323 followed by a scope number) 72 575 T(, such as \322#3\323.) 227.06 575 T3 11 Q(expect5.16> u #3) 90 556.67 T(expect5.17> w) 90 545.67 T( 0: expect -D 1 debug-test.exp) 90 534.67 T( 1: p1) 90 523.67 T( 2: p2) 90 512.67 T(*3: p3) 90 501.67 T( 4: set m 0) 90 490.67 T1 12 Q0.83 (When an absolute scope is named, either u or d) 72 476 P0.5 (may be used, irrespective of which direction the) 72 462 P(new scope lies.) 72 448 T0.96 (Moving the scope does not af) 72 429 P0.96 (fect the command) 218.15 429 P0.25 (that is about to be executed. If a command such) 72 415 P0.58 (as s or n is given, the current scope is automati-) 72 401 P5.7 (cally reset to whereever is appropriate for) 72 387 P(execution of the new command.) 72 373 T0 14 Q(The \322r\323 Command \320 \322Return\323) 72 347.67 T1 12 Q0.45 (The) 72 328 P2 F0.45 (r) 94.1 328 P1 F0.45 ( command completes execution of the cur-) 98.77 328 P0.28 (rent procedure. In other words, it stops after the) 72 314 P(current procedure returns.) 72 300 T3 11 Q(expect5.18> r) 90 281.67 T(3: set d 5) 90 270.67 T(expect4.19> w) 90 259.67 T( 0: expect -D 1 debug-test.exp) 90 248.67 T( 1: p1) 90 237.67 T(*2: p2) 90 226.67 T( 3: set d 5) 90 215.67 T(expect4.20> r) 90 204.67 T(2: set a 3) 90 193.67 T(expect3.21> w) 90 182.67 T( 0: expect -D 1 debug-test.exp) 90 171.67 T(*1: p1) 90 160.67 T( 2: set a 3) 90 149.67 T(expect3.22> r) 90 138.67 T(1: set k 7) 90 127.67 T(expect2.23> w) 90 116.67 T(*0: expect -D 1 debug-test.exp) 90 105.67 T( 1: set k 7) 90 94.67 T(expect2.24> r) 90 83.67 T(nowhere to return to) 90 72.67 T0 14 Q(The \322c\323 Command \320 \322Continue\323) 324 728.67 T1 12 Q3.25 (The) 324 709 P2 F3.25 (c) 348.9 709 P1 F3.25 ( command lets execution of commands) 354.22 709 P1.92 (continue without having to single-step. In the) 324 695 P0.43 (scenario so far) 324 681 P0.43 (, given a command anywhere, the) 394.31 681 P-0.22 (program would continue until the script ends and) 324 667 P(the shell prompt appears.) 324 653 T3 11 Q(expect2.25> c) 342 634.67 T(%) 342 623.67 T1 12 Q-0.22 (The c command is also useful in other ways. Af-) 324 609 P4.86 (ter setting breakpoints, the program can be) 324 595 P-0.27 (continued until it hits a breakpoint. The program) 324 581 P0.4 (can also be continued until a signal occurs, such) 324 567 P(as by the user pressing ^C.) 324 553 T0 14 Q(The \322b\323 Command \320 \322Br) 324 527.67 T(eakpoint\323) 475.34 527.67 T1 12 Q1.6 (Prior commands have shown how to execute a) 324 508 P1.75 (\336xed number of commands or procedure calls.) 324 494 P2.12 (In contrast, breakpoints provide a way to stop) 324 480 P0.97 (execution upon a condition. The conditions in-) 324 466 P(clude:) 324 452 T(\245) 341.5 433 T(line number and \336lename matching) 358.49 433 T(\245) 341.5 417 T(expression testing) 358.49 417 T(\245) 341.5 401 T(command and ar) 358.49 401 T(gument name matching) 438.21 401 T0 F(Br) 324 379 T(eakpoint by Line Number and Filename) 337.11 379 T0 10 Q(1) 542.02 383.8 T1 12 Q1.31 (Line numbers and \336lenames are the most com-) 324 360 P1.05 (mon way to specify a breakpoint. This form is) 324 346 P-0.14 (correspondingly the most compact. For example) 324 332 P4.63 (the following command causes execution to) 324 318 P(break before executing line 7.) 324 304 T3 11 Q(expect2.26> b 7) 342 285.67 T(0) 342 274.67 T1 12 Q0.5 (After creation of a breakpoint, an integer identi-) 324 260 P1.23 (fying the breakpoint is printed. The reason for) 324 246 P(this will be described later) 324 232 T(.) 449.92 232 T0.76 (By default, the line number refers to the \336le as-) 324 213 P-0.02 (sociated with the current scope. A \336lename may) 324 199 P1.67 (be used to refer to a dif) 324 185 P1.67 (ferent \336le. A colon is) 445.05 185 P(used to separate the \336lename and line number) 324 171 T(.) 542.84 171 T3 11 Q(expect2.27> b foo.exp:7) 342 152.67 T324 102 558 117 C333 115 477 115 2 L0.5 H2 Z0 X0 KN0 0 612 792 C1 10 Q0 X0 K1.16 (1. Breakpoints by line number and \336lename are) 342 95.33 P0.21 (not currently supported. See \322Line Numbers\323 on) 342 83.33 P3.62 (page) 342 71.33 P3.62 (13 and \322Current Limitations and Future) 363.37 71.33 P(W) 342 59.33 T(ork\323 on page) 350.64 59.33 T(15.) 404.76 59.33 TFMENDPAGE%%EndPage: "7" 6%%Page: "8" 6612 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(8) 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 T(Br) 54 730 T(eakpoint by Expr) 67.11 730 T(ession) 156.2 730 T1 F0.41 (It is possible to break at a line only when an ex-) 54 711 P3.11 (pression is true. For example, the following) 54 697 P2.74 (command causes execution to break at line 7) 54 683 P(only when foo is greater than three.) 54 669 T3 11 Q(expect2.28> b 7 if {$foo>3}) 72 650.67 T1 12 Q0.21 (Expressions are the usual T) 54 636 P0.21 (cl syntax and may be) 185.9 636 P(arbitrarily complex.) 54 622 T0.03 (No breakpointing occurs inside of the evaluation) 54 603 P0.24 (of breakpoint expressions \050unless another break-) 54 589 P(point dictates this\051.) 54 575 T0 F(Br) 54 553 T(eakpoint by Pattern Match) 67.11 553 T1 F1.35 (It is also possible to de\336ne breakpoints by pat-) 54 534 P2.67 (tern matching on the command or ar) 54 520 P2.67 (guments.) 244.36 520 P-0.12 (Regular expressions are introduced by the \337ag \322-) 54 506 P3.04 (regexp\323 \050commonly abbreviated \322-re\323\051) 54 492 P1 10 Q2.53 (1) 249.28 496.8 P1 12 Q3.04 (. The) 254.28 492 P2.54 (following command stops if the string p4 ap-) 54 478 P(pears within the command:) 54 464 T3 11 Q(expect2.29> b -re "p4") 72 445.67 T(0) 72 434.67 T1 12 Q1.48 (W) 54 420 P1.48 (ith our sample \336le, we can see the results of) 64.84 420 P(this:) 54 406 T3 11 Q(% expect -D 1 debug-test.exp) 72 387.67 T(1: set b 1) 72 376.67 T(expect2.1> b -re "p4") 72 365.67 T(0) 72 354.67 T(expect2.2> c) 72 343.67 T(breakpoint 0: -re "p4") 72 332.67 T(1: proc p4 {x} {) 72 321.67 T( return [) 72 310.67 T(expr 5+[expr 1+$x]]) 144 299.67 T(}) 72 288.67 T(expect2.3> c) 72 277.67 T(breakpoint 0: -re "p4") 72 266.67 T(4: p4 $b) 72 255.67 T(expect5.4> c) 72 244.67 T(breakpoint 0: -re "p4") 72 233.67 T(3: expr 2+[p4 $b]) 72 222.67 T(expect4.5> c) 72 211.67 T(breakpoint 0: -re "p4") 72 200.67 T(2: expr 1+[expr 2+[p4 $b]]) 72 189.67 T1 12 Q0.14 (The \336rst breakpoint occurred upon the de\336nition) 54 175 P-0.01 (of p4. The second occurred when p4 was called.) 54 161 P54 126 288 141 C63 139 207 139 2 L0.5 H2 Z0 X0 KN0 0 612 792 C1 10 Q0 X0 K1.05 (1. The debugger permits all \337ags to be abbrevi-) 72 119.33 P0.67 (ated to the smallest unique pre\336x. For example,) 72 107.33 P0.85 (\322-regexp\323 can actually be abbreviated \322-r\323. The) 72 95.33 P-0.1 (usual quoting conventions around patterns should) 72 83.33 P0.6 (be observed. In this example, the quotes around) 72 71.33 P(p4 can be omitted.) 72 59.33 T1 12 Q0.17 (T) 306 730 P0.17 (wo more breakpoints occurred only because p4) 312.49 730 P(was mentioned in the command.) 306 716 T0.05 (W) 306 697 P0.05 (ith appropriate regular expressions, any one of) 316.84 697 P0.8 (these can be selected by itself. For example, to) 306 683 P(stop only on de\336nitions:) 306 669 T3 11 Q(expect2.1> b -re "proc p4 ") 324 650.67 T1 12 Q(T) 306 636 T(o stop only on a call to p4 itself:) 312.49 636 T3 11 Q(expect2.2> b -re "^p4 ") 324 617.67 T1 12 Q(T) 306 603 T(o stop only on commands which call p4:) 312.49 603 T3 11 Q(expect2.3> b -re "\134\134\134[p4 ") 324 584.67 T1 12 Q0.64 (The complexity of this last example is, perhaps,) 306 570 P1.13 (somewhat ameliorated by the unlikelihood of it) 306 556 P1.87 (ever being used. It is more shown simply for) 306 542 P0.52 (completeness. The point is, the ability to match) 306 528 P(on regular expressions is extremely powerful.) 306 514 T0.64 (Multi-line patterns may be matched in the usual) 306 495 P(way \320 using characters such as \134n and \134r) 306 481 T(.) 495.86 481 T1 10 Q(2) 498.85 485.8 T1 12 Q2.8 (Glob-style matching is available by using the) 306 462 P-0.13 (\337ag -glob instead of -regexp. It works exactly as) 306 448 P1 (in T) 306 434 P1 (cl\325) 325.82 434 P1 (s case command. Since glob matches an) 337.81 434 P2.4 (entire string by default, the equivalents to the) 306 420 P
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -