gnudatalanguage / gdl

GDL - GNU Data Language
GNU General Public License v2.0
274 stars 61 forks source link

Addressing a variable that does not exist causes confusion during a debug session #1855

Open brandy125 opened 2 months ago

brandy125 commented 2 months ago

When addressing any not existing variable during debugging of a program causes confusion. The only way to continue is to create that variable with any contents. Any way to resolve this?

pro var
    stop
    print,'ok'
end
GDL> var
% Compiled module: VAR.
% Stop encountered: VAR                  3 var.pro
GDL> print,variablethatdoesnotexist
% PRINT: Variable is undefined: VARIABLETHATDOESNOTEXIST
% Execution halted at: VAR                  3 var.pro
%                      $MAIN$          
GDL> .c
% PRINT: Variable is undefined: VARIABLETHATDOESNOTEXIST
% Execution halted at: VAR                  3 var.pro
%                      $MAIN$          
GDL> 
ChunkyPanda03 commented 2 months ago

I just tested this on idl 6.3 and I can confirm that this is supposed to continue

IDL> var
% Stop encountered: VAR                 2  var.pro
IDL> print,variablethatdoesnotexist
% PRINT: Variable is undefined: VARIABLETHATDOESNOTEXIST.
% Execution halted at: VAR                 2  var.pro
%                      $MAIN$          
IDL> .c
ok

interesting idl states that it stopped on line 2 but GDL reports stopping on line 3 is this related? note .c = .continue I didn't know this before

GillesDuvert commented 2 months ago

Yes gdl is always "at the next line" . Dunno if this is unavoidable or if it could be patched. I think when trapped in an unvoluntary error loop as you report, one can do a stepover .so and then continue as usual.

GillesDuvert commented 2 months ago

Btw thanks for reporting, even if this issue will likely be not worked on soon.

brandy125 commented 1 month ago

Today I saw that there is another problem related to this when the procedure name was misspelled like "prin" instead of "print": Screenshot_2024-07-20 12 36 44_ugCoRs

This can be overcome by a ".skip" but it is boring. Imagine a long debug session where a "wrong" ".skip" could cause confusion in the debug session