PRPL debugger: Trace you code step-by-step and see changes on stack & variables

Started by kajacx, September 21, 2017, 01:25:17 PM

Previous topic - Next topic

kajacx

Do you have a problem in your PRPL code and don't know where? Are you tired of putting "Trace" everywhere? Then hesitate no more and download the PRPL Debugger!

Preview
[close]

How it works: You can execute your code one command at a time (or one line at a time), as well as see the stack, variables, and lists.

How to install: (requires Java 8, and mono if you are on Linux or Mac)

  • Download the .zip file and extract it anywhere, and open the jarfile.
  • Click "Add file" and select the prpl script you want to debug
  • Check "Compile every second" - This will check for updates to the file and automaticly recompile if needed. (You still need to hit "Compile" in PF after changing a file, of course)
  • In your map, set the Custom0pp image to a 64x64 white square (one is avaliable in img/other/square-full-64.png in the zip)
  • Hit "Compile" and you should see a new script with "_debug" at the end, add that script to some core.
  • You are good to go

Controls:

  • Step over: Execute the current command, and move to the next one (steps over function calls)
  • Step line: Execute all commands on the current line
  • Step into: Execute the current command, and move to the next one (steps into a function)
  • Step out: Steps out of a function: execute all commands until the script leaves the current funtion
  • Continue: Continue code execution until a breakpoint is reached (use "--debuggerInspect" to create a breakpoint)
  • Break: Stop an ongoing code execution

If you have never used a debugger before, just try it out, it is pretty intuitive. Just a few of the things to watch out for: If you have Delay in your code, the entire script will still freeze for the duration of the delay. If the image slot "Custom0pp" is occupied by something else, upload the image to another slot, and change the script argument at CsBin/editor/DebuggerTemplate.prpl at line 10.

I hope this will help you find a problem in your code when you have one.
Why do work yourself, when you can write a program that will do the work for you.