Transiently replace the debug window with a printed debug message

First, turn on the debugger. Then run TestDebugToggler(). Even though FuncWithRTE() generates a run-time error, the debugger does not launch and a message is printed instead. Meanwhile, the functions continue executing. If you take out the call to UnDebug(), the debugger will catch the run-time error and pause execution.

function TestDebugToggler()
    UnDebug()
    FuncWithRTE()
    PrintDebug()
    ReDebug()
end

function FuncWithRTE()
    make /o/n=101 test
    fft test
end

function UnDebug()
    DebuggerOptions
    newdatafolder /o root:Packages
    newdatafolder /o root:Packages:DebugToggler
    variable /g root:Packages:DebugToggler:debugOn=v_enable
    DebuggerOptions enable=0
end

function PrintDebug()
    variable err=GetRTError(1)
    if(err)
        print GetErrMessage(err)
    endif
end

function ReDebug()
    nvar /z debugOn=root:Packages:DebugToggler:debugOn
    if(nvar_exists(debugOn))
        DebuggerOptions enable=debugOn
    endif
end

Forum

Support

Gallery

Igor Pro 8

Learn More

Igor XOP Toolkit

Learn More

Igor NIDAQ Tools MX

Learn More