Menu

#321 Wrong string referens in errors when using O-sub

open
nobody
None
5
2013-07-09
2013-07-09
Nick
No

LinuxCNC raises an error which points to the string with O-call but not the string where error is met.

Example:

O100 SUB
    #1 = [1/0]
O100 ENDSUB
O100 CALL
M2

Will raise devision by 0 near the string 5
Instead of string 2.

It's easy to find the error if the program is as simple as in example, but if we have big program with nested subroutines it's hard to debug them when we get that error is somewhere in the first "root-sub" call.

PS this example shows the same behavior - the error is raised for the very first call.

O100 SUB
    #1 = [1/0]
O100 ENDSUB

O200 SUB
    O100 CALL
O200 ENDSUB

O200 CALL
M2

PSS it will be very very useful if there will be call-stack in the error, but just fixing line number will be enought :).
I'm not sure how this will behave with the subruotines calls from filename.

Discussion