• 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!

    function testDebugger() {debugger;}
    testDebugger(); //does nothing
  • 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() {
    intervalID = setInterval( function (){
      }, 1500);

    In my haste to reveal a working solution, I actually needed to test some more. The use of
    L5 timeoutID = setTimeout( function (){ as pointed out in post #3 is a better choice to make just one and only one call to invoke the debugger


  • 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.

  • Great, many thanks, it works! )

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview

'debugger' called from the right-hand side of IDE panel?

Posted by Avatar for AndreyVS @AndreyVS