pausing_20under_20program_20control
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
pausing_20under_20program_20control [2018/03/31 13:19] – external edit 127.0.0.1 | pausing_20under_20program_20control [2024/01/05 00:22] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 2: | Line 2: | ||
//by Richard Russell, February 2007//\\ \\ When running a program from the Interactive Development Environment you can enter (or exit) **paused** mode using the menu selection **Run... Pause**, clicking the **Pause** button on the toolbar or pressing the **F8** key (if the IDE window has the input focus).\\ \\ It is also possible to enter and exit **paused** mode automatically using statements within your own BASIC program. To enter paused mode execute the following code:\\ \\ | //by Richard Russell, February 2007//\\ \\ When running a program from the Interactive Development Environment you can enter (or exit) **paused** mode using the menu selection **Run... Pause**, clicking the **Pause** button on the toolbar or pressing the **F8** key (if the IDE window has the input focus).\\ \\ It is also possible to enter and exit **paused** mode automatically using statements within your own BASIC program. To enter paused mode execute the following code:\\ \\ | ||
+ | <code bb4w> | ||
TRACE STEP ON | TRACE STEP ON | ||
+ | </ | ||
As soon as this statement is executed the program will pause and can be single-stepped in the usual way (via a menu selection, the Step button in the toolbar or pressing F7). You will normally want to select the **Trace** and/or **List Variables** utility to display useful information while stepping.\\ \\ To exit paused mode and resume normal execution use the following code:\\ \\ | As soon as this statement is executed the program will pause and can be single-stepped in the usual way (via a menu selection, the Step button in the toolbar or pressing F7). You will normally want to select the **Trace** and/or **List Variables** utility to display useful information while stepping.\\ \\ To exit paused mode and resume normal execution use the following code:\\ \\ | ||
+ | <code bb4w> | ||
TRACE STEP OFF | TRACE STEP OFF | ||
+ | </ | ||
You may wish to write your own **PROCpause** and **PROCunpause** procedures which execute these statements conditionally depending on some detected state. For example to pause only when the program is running under the IDE you can do:\\ \\ | You may wish to write your own **PROCpause** and **PROCunpause** procedures which execute these statements conditionally depending on some detected state. For example to pause only when the program is running under the IDE you can do:\\ \\ | ||
+ | <code bb4w> | ||
DEF PROCpause | DEF PROCpause | ||
LOCAL cmd% | LOCAL cmd% | ||
Line 11: | Line 16: | ||
IF INSTR($$cmd%, | IF INSTR($$cmd%, | ||
ENDPROC | ENDPROC | ||
+ | </ | ||
If you have a particularly difficult bug to trace you could arrange to pause your program only when a specific condition is met, such as a variable having a certain value or a particular key being pressed. | If you have a particularly difficult bug to trace you could arrange to pause your program only when a specific condition is met, such as a variable having a certain value or a particular key being pressed. |
pausing_20under_20program_20control.1522502373.txt.gz · Last modified: 2024/01/05 00:17 (external edit)