Debug your assembly code remotely and graphically on CSIF with VS Code graphic debug interface on your local machine!
- NO local Linux environment (such as WSL or VM) or PuTTY is needed!
- NO makefile is needed for building executables any more!
- NO need to use command-line
gdbany more!
- VS Code
- VS Code Extension Remote - SSH
-
Open VS Code
-
Click the little green button in the bottom-left corner of the window to open Remote - SSH extension
-
Click Remote-SSH: Connect to Host...
-
Select csif if you configured Passwordless Login to CSIF
- If not, in the textbox prompted, enter
username@pcXX.cs.ucdavis.edu(you need to replaceusernameandXX), press enter, and then enter your password for CSIF
- If not, in the textbox prompted, enter
-
Wait for VS Code to install VS Code Server on CSIF automatically
- VS Code Server will be installed in
/home/username/.vscode-serverso other users don't have access to it - Retry if you get any error
- VS Code Server will be installed in
-
Install VS Code Extension C/C++ by Microsoft
- This will install the extension on VS Code Server on CSIF instead of your local machine
- There is no assembly debugger available, but the config of the C/C++ extension will be modified to make it work with assembly
-
Open an integrated terminal inside VS Code (Terminal Menu -> New Terminal)
- You should notice that this terminal is already connected to the CSIF
-
Run the following command inside the integrated terminal
git clone --depth=1 --branch=master https://github.com/HazyFish/ucdavis-csif-vscode-asm-dbg.git assembly- This command transfers the folder with configiration files and a sample assembly code file (written by me) to CSIF
-
Run command
rm -rf ./assembly/.gitto remove unnecessary files generated bygit -
Run command
code ./assemblyto open the folder in VS Code -
You are all almost there! Let's try it out!
-
Click
hello.son the left to open the sample assembly code file -
Go to Terminal Menu -> Run Build Task... to build the executable from the currently opened file
- You should be able to see the output of assembler and linker in the integrated terminal
- The executable
hello.outis built
-
Go to Run Menu -> Start Debugging to start debugging the file you opened
- You will see a
segmentation faultbecause you haven't set a breakpoint yet - You can add breakpoints in the Breakpoints panel on the left of the window, such as
_startanddone - You can add expressions in the Watch panel on the left of the window to watch the values, such as
$eaxand(int)a
- You will see a
-
Go to Terminal Menu -> Run Task... -> clean all to remove all the object files and executables inside the folder
-
You are all set! You can put any assembly code files in this folder (or subfolder) to debug in this way!
- Make sure to open the assembly file you want to build/debug before running the tasks or debugging!
-
To disconnect VS Code from CSIF, click the little green button on the bottom left and select Close Remote Connection
- Give a star to this if you enjoy it!
- Open up an issue or pull request to report typos, problems, or anything that can help make this better
- Follow me on GitHub!