- Open VS Marketplace
- Search Solana step debugger or click this link
- Install
- Restart VS Code if necessary
-
Launch the Debugger:
- Press
Cmd + Shift + P
(on Mac) orCtrl + Shift + P
(on Windows). - Select
Run Solana LLDB
from the command palette. - This will launch the debugger and run the file that is currently open in the VSCode window.
- Press
-
Add Breakpoints:
- After the file has run, you can add breakpoints.
- To add a breakpoint, you can click on a row in the breakpoint area or press
F9
. - You can add and remove breakpoints, and commands will automatically be executed in the Solana LLDB terminal to reflect these changes.
- Note: If the debugger is stopped, you will need to add all of the breakpoints again.
-
Re-run the Debugger:
- Press
Cmd + Shift + P
(on Mac) orCtrl + Shift + P
(on Windows) again. - Select
Re-run process launch
to run the debugger with the breakpoints.
- Press
-
Hit Breakpoints:
- When a breakpoint is hit, you will see the memory address location, frame, file, and row of the breakpoint in the terminal.
- To continue execution, type
continue
in the terminal. - The program execution will continue to the next breakpoint or until it finishes.
To run the example project, follow these steps:
- Open a terminal in the
example-project/solana_test_extension
folder. - Open the
lib.rs
file located in thesrc
directory. - Press
Cmd + Shift + P
(on Mac) orCtrl + Shift + P
(on Windows) to open the Command Palette. - Select
Run Solana LLDB
from the Command Palette. - A popup will appear in the right corner with the message "Target folder not found. Cargo is installing necessary tools." Wait while Cargo installs the necessary tools.
- Once the installation is complete, the debugger will automatically start and execute the program.
- After the program finishes executing, you can set breakpoints and run it again using the Command Pallette and selecting
Re-run process launch
Refer to this site LLDB Commands