-
• #2
Sun 2021.03.14
It is likely that there is a small amount of delay during the upload that Espruino requires to unpack and manage memory, and the debugger becomes initialized after the testDebugger() function call.
By placing a small delay within your snippet, it is possible to launch immediately after the upload is complete.
function testDebugger() { debugger; } intervalID = setInterval( function (){ testDebugger(); }, 1500);
Edit:
In my haste to reveal a working solution, I actually needed to test some more. The use of
L5timeoutID = setTimeout( function (){
as pointed out in post #3 is a better choice to make just one and only one call to invoke the debuggerResult:
> debugger; ^ debug>
-
• #3
Hi! I think this might be because you're uploading to RAM: http://www.espruino.com/Saving
Basically, when you upload to RAM, code is executed as it is uploaded. If you have a
debugger
statement in your code then Espruino would break out into the debugger before all the code had finished uploading, so it gets ignored.As @Robin says, if you execute the code after a delay with something like
setTimeout(testDebugger,1000);
then it'll execute after the upload has finished and you should enter the debugger just fine. -
• #4
Great, many thanks, it works! )
Hi Everyone,
Trying to debug using debugger. But if I run the function from the right-hand IDE side, it does nothing. While if testDebugger() is called then from the left-hand IDE side, it works. Can I make it working in both cases? Thanks!