Debugger
Debug (Alt+7) is an emulated debugger. It runs the program’s machine code one instruction at a time inside the analysis engine, using the analyzed program. Nothing runs natively on your computer, and the program file and the project are not changed.
- Pick a function, then open Debug.
- Optionally select a line in the listing to start there.
- Select Start debugging, or press F5. Debugging starts at the selected line, or at the current function.
The listing shows the function’s instructions. The current instruction is highlighted and scrolled into view.
Controls
Section titled “Controls”| Button | Key | What it does |
|---|---|---|
| Run | F5 | Run until a breakpoint, the function returns, or the run limit. |
| Step over | F10 | Run one instruction. A call runs to its return as one step. |
| Step into | F11 | Run one instruction, following calls into the called function. |
| Run to line | Run until the selected line is reached. | |
| Restart | Start again from the selected line or the current function. | |
| Stop | Shift+F5 | End the debugging session. |
Each Run executes at most 2,000,000 instructions. If it reaches that limit, the debugger pauses; select Run again to continue.
Breakpoints
Section titled “Breakpoints”After you start debugging, click the dot beside a line, or select the line and press F9, to set a breakpoint. Do the same again to remove it. Breakpoints in the side panel lists them; select one to select its line, or × to remove it.
Registers, stack and notes
Section titled “Registers, stack and notes”The side panel has four sections:
- Registers: the processor’s registers. Registers changed by the last step are highlighted. Double-click a value to change it, type a decimal number or
0xhex, and press Enter. Esc cancels. - Stack: 16 slots from the stack pointer, with their offsets.
- Breakpoints: every breakpoint in this session.
- Notes: what the emulator did on your behalf, such as calls it stepped over or operations it skipped.
The status line under the toolbar shows why the debugger stopped, and how many instructions have run:
| Status | Meaning |
|---|---|
| Ready. Step or run when you like. | Debugging has started. |
| Paused after a step. | A step finished. |
| Paused at a breakpoint. | Execution reached a breakpoint. |
| Paused at the chosen address. | Run to line reached its line. |
| The function returned. | The function being debugged returned. |
| The program exited. | The code called a function that ends the program. |
| Paused after the run limit. | Run executed 2,000,000 instructions. Run again to continue. |
| Stopped: the emulator could not go on. | Emulation failed, for example at an instruction it can’t execute. |
What the emulator does and doesn’t do
Section titled “What the emulator does and doesn’t do”The debugger emulates only the code inside the program. Keep these limits in mind when you read results:
- Imported functions are stepped over. A call to a DLL import is not executed. It returns 0, and a note names the function, for example Stepped over the call to CreateFileW (imported; returns 0 in the emulator).
- Imports that never return end the run. A call to a function such as
exit,ExitProcessorabortstops with The program exited. - Some processor operations are skipped. Operations the emulator doesn’t model, for example
cpuid,rdtscorLOCK, are skipped with a result of 0, and a note says so. - The starting state is empty. The stack starts empty and every register starts at 0, unless you set them. Change registers before you step, or pass starting values to
debug.startfrom the CLI or an agent. - Undefined memory reads as 0. Reading memory the program doesn’t define returns zeros.
Code that depends on the operating system, other processes, files or the network will behave differently from a real run. Treat what you see as a model of the code, and confirm important conclusions another way.
Processors
Section titled “Processors”The debugger works with any processor the analysis engine can emulate. The register list is tailored for x86-64, x86, AArch64 and ARM. Other processors show the program counter, the stack pointer and up to 24 general registers.
Sessions are shared
Section titled “Sessions are shared”Each program has one debugging session, held by the engine. The desktop app, the CLI and connected agents all see and control the same session. An agent can start debugging, set breakpoints and step, and you see the result in Debug. See the CLI reference for the 11 debug.* operations.
The debugger only reads the program. Its operations are all class read, so they are allowed under every approval policy.