The Virtual Debugger - consider this your go-to tool when traditional debugging falls short. It's ideal for situations where you:
- Cannot run the code directly
- Can run the code, but struggle to reproduce the bug in a live debugger
- Can run the code, but you just want to think methodically about the decisions & changes you wish to make
Think of it as a debugger where you're in complete control. You make the decisions, and the Virtual Debugger diligently records your steps and choices. At the end, voila! - the bug is found, and now you can copy/paste the path for the lucky engineer who's going to fix it.
With the Virtual Debugger, you can:
- Analyze decision points: Step through if-else statements, switch statements, and other decision points to see which branches are taken and why.
- Identify issues with function calls: Examine input parameters, return values, and the behavior of called functions.
- Understand loop behavior: See how loops iterate, update variables, and evaluate conditions.
- Simplify complex code: Break down complex code into manageable pieces and understand the overall flow.
Accessing the Virtual Debugger
There are three options for accessing the Virtual Debugger:
- Right-click context menu: Right-click on a function entity and select "Virtual Debugger" from the context menu.
- Shortcut: Use the shortcut Ctrl + Shift + B with a function entity selected.
- Toolbar icon: Click on the new bug icon in the toolbar.
Navigating the Virtual Debugger
You can navigate the Virtual Debugger using your keyboard:
- Up Arrow: Previous statement
- Down Arrow: Next statement
- Right Arrow: Enter block
- Return/Enter: Enter selected function
- Esc: Exit current function
A green arrow indicator will show you what line you are on in the source code at any given point. If you are at a function call that can be entered, another small green indicator will appear underneath the accessible function.