You can now debug scripts using the Phantom Command Line Interpreter using the '-d' option with a script:
- Code: Select all
C:\Phantom>phantom.exe -?
Usage:
phantom.exe [script] [-l count] [-o file] [-d] [script_args]
[script] - The Phantom script to run [optional]
[-l count] - Run the script 'count' times [optional]
[-o file] - Capture all output to 'file' [optional]
[-d] - Enter debug mode (enter 'help' in debug mode
for commands). Requires [script]. [optional]
[-?] - Display this help message. [optional]
[script_args] - Additional arguments to pass to the script [optional]
Entering no arguments will start Phantom in console mode.
Type 'help' once in debug mode to get a list of debug commands:
- Code: Select all
C:\Phantom>phantom.exe -d .\scripts\test.psc
FileName is: .\scripts\test.psc
-----------------------------------------
| Phantom v2.1 |
| ****://****.phantomtest.com |
| This DOS version is freeware |
| Type 'stop' to quit. |
-----------------------------------------
DEBUG >>help
++++ Debug Commands ++++
<ENTER> - Steps one line
v {var} - Displays the value of variable {var}
g {#} - Steps {#} lines
t {#} - Runs to {#} line number
+b {#} {f} - Sets a breakpoint at line {#} in file {f}
-b {#} {f} - Removes a breakpoint at line {#} in file {f}
e {s} - Evaluates statement {s}
j - Jumps in to the current function
o - Jumps out of the current function
q or stop - Quits the script
verbose - Toggles the verbose mode on and off
? or help - Displays this help message
DEBUG >>g 1
DEBUG >>v i
10
DEBUG >>g 11
0
1
2
3
4
DEBUG >>v i
5
DEBUG >>e i = 10;
DEBUG >>v i
10
DEBUG >>g 10
10
Finished!
Below is an example of using the debugger on a simple script:
- Code: Select all
C:\Phantom>phantom.exe -d .\scripts\test.psc
FileName is: .\scripts\test.psc
-----------------------------------------
| Phantom v2.1 |
| ****://****.phantomtest.com |
| This DOS version is freeware |
| Type 'stop' to quit. |
-----------------------------------------
DEBUG >>g 1
DEBUG >>v i
10
DEBUG >>g 11
0
1
2
3
4
DEBUG >>v i
5
DEBUG >>e i = 10;
DEBUG >>v i
10
DEBUG >>g 10
10
Finished!
The test.psc script is:
- Code: Select all
int i = 10;
for(i = 0; i < 10; i++){
disp(i);
}
disp("Finished!");
Note that the PTD debugger can also still be used. This new feature is provided for script debugging when PTD is not installed or available.
We hope this helps! If you have any questions, please let me know.
-John