Installation of Docker, VSCode and its extensions - SVF-tools/Software-Security-Analysis GitHub Wiki

If you encounter some problem, please check this document Trouble-Shooting-for-IDE.

0. Prerequisite:

1. Working with VSCode in Docker containers

1.1 Install extensions in VSCode

*To install the extension, open the Extensions view (MAC: โ‡งโŒ˜X, Windows: Ctrl+Shift+X, Linux: Ctrl+Shift+X)
  • Extension(1): Docker extension
    • Search for docker to filter results and select Docker extension authored by Microsoft.

width=400px

  • Extension(2): Remote Containers extension
    • Search for dev container to filter results and select extension authored by Microsoft.

width=400px


1.2 Pull and load the pre-built image from Docker hub (or build from scratch)

Step1: Enter the command in cmd or terminal (shortcut to open a terminal: Ctrl+`):

  • Mac X86_64, Windows X86_64, Ubuntu Linux x86_64: docker pull svftools/software-security-analysis:latest

  • Mac ARM (M1-M3 chips): docker pull svftools/software-security-analysis:latest-aarch64

Step2: Create and run a container of the image:

  • Mac X86_64, Windows X86_64, Ubuntu Linux x86_64: docker run -itd svftools/software-security-analysis:latest /bin/bash

  • Mac ARM (M1-M3 chips): docker run -itd svftools/software-security-analysis:latest-aarch64 /bin/bash

width=400px

Step3: Load Docker container in VSCode

Right click the container item and select 'Attach Visual Studio Code'

width=400px

If you can't see the working directory, please select file -> open (folder)... then enter the /home/SVF-tools/Software-Security-Analysis

width=400px


1.4 Install/Enable C/C++ extension in container

- To install the extension, open the Extensions view (MAC: โ‡งโŒ˜X, Windows: Ctrl+Shift+X, Linux: Ctrl+Shift+X)

- Search for C/C++ and select Docker extension authored by Microsoft.

width=400px

width=400px


2. Run and debug your program

  • VSCode's built-in debugger helps your editing, compilation and debugging.
  • Software-Security-Analysis has prepared configurations in launch.json in .vscode folder to debug hello.cpp in HelloWorld folder.
  • More information VSCode-debugging
  • If you just want to compile without using the VSCode tools you can run this command in the terminal which will compile everything and put the executables inside the bin folder
cmake -DCMAKE_BUILD_TYPE=Debug . && make

width=400px

width=400px

2.1 Switching programs

When working on different labs/assignments, change the "program" and "args" fields in launch.json

Lab/Assignment "program" "args"
Lab-Exercise-1 "${workspaceFolder}/bin/lab1" "test1"
Lab-Exercise-2 "${workspaceFolder}/bin/lab2" "test1"
Lab-Exercise-3 "${workspaceFolder}/bin/lab3" "test1"
Assignment-1 "${workspaceFolder}/bin/ass1" "-icfg", "${workspaceFolder}/Assignment-1/Tests/testcases/icfg/test1.ll" "-pta", "${workspaceFolder}/Assignment-1/Tests/testcases/pta/test1.ll" "-taint", "${workspaceFolder}/Assignment-1/Tests/testcases/taint/test1.ll"
Assignment-2 "${workspaceFolder}/bin/ass2" "${workspaceFolder}/Assignment-2/Tests/testcases/sse/test1.ll"
Assignment-3 "${workspaceFolder}/bin/ass3" "${workspaceFolder}/Assignment-3/Tests/testcases/ae/test1.ll"