|
Post by (X) on Mar 9, 2024 15:25:48 GMT 1
The TRON (TRace-ON) statement is arguably the most important tool in a coder's resources. If you run this program, you'll get a trace printout in the Debug window of every line number and code statement after the "TRON db" statement until an error is encountered, then, the Try..Catch..EndCatch code structure produces the error description. Try Tron db Print "Hello World!"; 1 / 0 Catch Troff Debug "Err:"; Err$ EndCatch
Proc db Debug TraceLnr, Trace$ EndProc Debug Window...
|
|
|
Post by (X) on Mar 9, 2024 17:42:30 GMT 1
This does an even better job of only reporting a trace if there is an error.
Try Tron db Print "Hello World!" Print "Hello World!"; 1 / 1 Print "Hello World!" Print "Hello World!" Print "Hello World!"; 1 / 0 Catch Troff EndCatch
Proc db Global tr$ If Err Debug "Trace: "; tr$ Debug "Error: "; Err$ Else tr$ = "Line#:" & TraceLnr & #9 & Trace$ EndIf EndProc
|
|
|
Post by (X) on Mar 9, 2024 21:03:36 GMT 1
I think TRON is only "ALIVE" if run from the IDE and not from a compiled version of the code. Aaaand... You can set TRON ON|OFF with $STEPOFF command, then on again with $STEPON
Aaaand... You can select if either { Exe, GLL, LG32, IDE } will respond to Assert & Trace in the IDE->Extra->Properties->Compiler popup menu.
As you can see there are a few configuration possiblilities and tailoring the exact behaviour you want could be a bit tricky. If you do manage to get these settings to work for you, it doesn't take Einstein to realize how much time can be saved, by letting the IDE do all the heavy lifting.
Not required:
|
|