Repository navigation
Debugging Firebot
Firebot is built with Electron which runs two separate node processes. The first is the "Main process", which is where the app is started and ran from. The second is the "Renderer process" which is what hosts the Chromium instance that displays the web views. From a web dev point of view, we treat the main process as the "back end" and the renderer process as the "front end". Debugging is handled differently for both process, this article details how.
Main process code is largely located in the /lib directory.
To debug the main process, simply go to the Debug tab:
Next, click the green play button to launch the debug session:
Firebot should launch and debug controls will become available in the top middle of VS Code.
And that's it! Now you can set breakpoints, inspect variables, and step through code.
- A breakpoint (Pauses code execution)
- Inspecting a variable at run time
- Debug toolbar with buttons for things like stepping through code line by line.
Learn more about what you can do with VS Code debugging here: https://code.visualstudio.com/docs/editor/debugging
Renderer process code is located in the /gui directory.
Since the front end is largely encompassed in an AngularJS app, the easiest way to debug the renderer process at this time is to use traditional Chrome debugging.
To do this, simply add debugger; anywhere you'd like code execution to stop. Then simply start the app (either normally or via the debug tab), then open the Dev Tools console and navigate or run through the workflow of whatever you are testing. When the code hits the debugger; line, execution will automatically pause and you can use the dev tools to inspect variables or step through code.
Still need help? Come chat with us in the #help channel of our Discord server.