You are reading a single comment by @Gordon and its replies. Click here to read the full conversation.
  • Ok, I've just come up with a branch for the debugger.

    There should be builds with it in here

    To use it, try uploading:

    function hang_me() {
      while (true) {
        digitalWrite(LED1,1);
        digitalWrite(LED1,0);
      }
    }
    
    function bob() {
      console.log(1);
      hang_me();
      console.log(2);
    }
    
    • Then type bob() on the left. It'll hang because of the while(true).
    • Press Ctrl-C - it'll show where you are in the code, with debug> prompt
    • Then you can type in commands to do stuff

      >bob()
      1
      while (true) {
                  ^
      debug>
      In debug mode: Expected a simple ID, type 'help' for more info.
      debug>help
      Commands:
      help / h           - this information
      quit / q / Ctrl-C  - Quit debug mode, break execution
      continue / c       - Continue execution
      next / n           - execute to next line
      step / s           - execute to next line, or step into function call
      print ... / p ...  - evaluate and print the next argument
      debug>n
      digitalWrite(LED1,1);
      ^
      debug>n
      digitalWrite(LED1,0);
      ^
      debug>n
      }
      ^
      debug>n
      }
      ^
      debug>n
      digitalWrite(LED1,1);
      ^
      debug>q
      Execution Interrupted
      at line 2 col 14
      while (true) {
               ^
      in function "hang_me" called from line 3 col 11
      hang_me();
            ^
      in function "bob" called from line 1 col 5
      bob()
      ^
      > 
      

    So overall, I think it's actually pretty useful as-is?

About

Avatar for Gordon @Gordon started