Skip to content

Commit d3254bd

Browse files
authored
Merge pull request #60 from SVF-tools/fix/dev-container-gdb
Fix dev container build and GDB setup
2 parents ca3332c + c0b5c2a commit d3254bd

4 files changed

Lines changed: 30 additions & 23 deletions

File tree

.github/workflows/svf-teaching.yml

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7,31 +7,22 @@ jobs:
77
build:
88
runs-on: ${{ matrix.os }}
99
strategy:
10+
fail-fast: false
1011
matrix:
11-
os: [ubuntu-latest, macos-latest]
12-
env:
13-
XCODE_VERSION: '16.0.0'
12+
os: [ubuntu-24.04, macos-15]
1413
steps:
1514
# checkout the repo
16-
- uses: actions/checkout@v2
17-
- uses: actions/setup-node@v3
15+
- uses: actions/checkout@v6
16+
- uses: actions/setup-node@v6
1817
with:
1918
node-version: 18
2019

21-
# setup the mac/ubuntu environment
22-
- name: mac-setup
23-
if: runner.os == 'macOS'
24-
uses: maxim-lobanov/setup-xcode@v1
25-
with:
26-
xcode-version: ${{ env.XCODE_VERSION }}
27-
- name: mac-setup-workaround
28-
if: runner.os == 'macOS'
29-
run: ln -sfn /Applications/Xcode_${{ env.XCODE_VERSION }}.app /Applications/Xcode.app
20+
# setup the Ubuntu environment; macOS uses the runner's default Xcode
3021
- name: ubuntu-setup
3122
if: runner.os == 'Linux'
3223
run: |
3324
sudo apt-get update
34-
sudo apt-get install cmake gcc g++ nodejs doxygen graphviz lcov libncurses5-dev libtinfo6 libzstd-dev
25+
sudo apt-get install -y cmake gcc g++ doxygen graphviz lcov libncurses5-dev libtinfo6 libzstd-dev
3526
3627
# install llvm and svf
3728
- name: env-setup

.vscode/launch.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@
1212
"preLaunchTask": "C/C++: cpp build active file",
1313
"MIMode": "gdb",
1414
"setupCommands": [
15+
{
16+
"description": "Disable debuginfod downloads for system libraries",
17+
"text": "-gdb-set debuginfod enabled off",
18+
"ignoreFailures": true
19+
},
1520
{
1621
"description": "Enable pretty-printing for gdb",
1722
"text": "-enable-pretty-printing",

.vscode/tasks.json

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,10 @@
33
{
44
"label": "C/C++: cpp build active file",
55
"type": "shell",
6-
// if you run SVF-Teaching not in docker container, you need to change the LLVM_DIR and SVF_DIR
7-
"command": "cmake -DCMAKE_BUILD_TYPE=Debug -DSVF_DIR=../SVF -DLLVM_DIR=../SVF/llvm-16.0.0.obj -DZ3_DIR=../SVF/z3.obj . && make",
6+
// This assumes SVF is cloned and built next to Software-Analysis-Studio.
7+
// SVF_DIR and LLVM_DIR point to the directories containing their
8+
// *Config.cmake files. Change these paths if your layout is different.
9+
"command": "cmake -DCMAKE_BUILD_TYPE=Debug -DSVF_DIR=../SVF/Debug-build/lib/cmake/SVF -DLLVM_DIR=../SVF/llvm-21.1.0.obj/lib/cmake/llvm -DZ3_DIR=../SVF/z3.obj . && make -j8",
810
"options": {
911
"cwd": "${workspaceFolder}"
1012
},
@@ -16,4 +18,4 @@
1618
}
1719
],
1820
"version": "2.0.0"
19-
}
21+
}

Dockerfile

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
FROM ubuntu:24.04
22

33
# Stop ubuntu-20 interactive options.
4-
ENV DEBIAN_FRONTEND noninteractive
4+
ENV DEBIAN_FRONTEND=noninteractive
55
ARG TARGETPLATFORM
66

77
# Stop script if any individual command fails.
@@ -19,7 +19,7 @@ ENV HOME=/home/SVF-tools
1919
# Launchpad PPA infrastructure has been intermittently unreachable
2020
# (HTTP 504 from add-apt-repository), and SVF itself does not pin a Python
2121
# version, so the base-image python is sufficient.
22-
ENV lib_deps="cmake g++ gcc git zlib1g-dev libncurses5-dev libtinfo6 build-essential libssl-dev libpcre2-dev zip libzstd-dev python3-dev"
22+
ENV lib_deps="cmake g++ gcc git zlib1g-dev libncurses5-dev libtinfo6 build-essential libssl-dev libpcre2-dev zip libzstd-dev python3-dev libc6-dbg"
2323
ENV build_deps="wget xz-utils git gdb tcl"
2424

2525
# Fetch dependencies.
@@ -35,7 +35,7 @@ RUN echo "Building SVF ..."
3535
RUN bash ./build.sh debug
3636

3737
# Export SVF, llvm, z3 paths
38-
ENV PATH=${HOME}/SVF/Release-build/bin:$PATH
38+
ENV PATH=${HOME}/SVF/Debug-build/bin:$PATH
3939
ENV PATH=${HOME}/SVF/llvm-$llvm_version.obj/bin:$PATH
4040
ENV SVF_DIR=${HOME}/SVF
4141
ENV LLVM_DIR=${HOME}/SVF/llvm-$llvm_version.obj
@@ -47,8 +47,17 @@ WORKDIR ${HOME}
4747
RUN git clone "https://github.com/SVF-tools/Software-Analysis-Studio.git"
4848
WORKDIR ${HOME}/Software-Analysis-Studio
4949
RUN echo "Building Software-Analysis-Studio ..."
50-
RUN sed -i 's/lldb/gdb/g' ${HOME}/Software-Analysis-Studio/.vscode/launch.json
51-
RUN cmake -DCMAKE_BUILD_TYPE=Debug .
50+
COPY .vscode/launch.json .vscode/launch.json
51+
COPY .vscode/tasks.json .vscode/tasks.json
52+
RUN cmake \
53+
-DCMAKE_BUILD_TYPE=Debug \
54+
-DSVF_DIR="${SVF_DIR}/Debug-build/lib/cmake/SVF" \
55+
-DLLVM_DIR="${LLVM_DIR}/lib/cmake/llvm" \
56+
-DZ3_DIR="${Z3_DIR}" \
57+
.
5258
RUN make -j8
5359

60+
# GDB inside a Dev Container requires ptrace permissions at container runtime.
61+
LABEL devcontainer.metadata='[{"capAdd":["SYS_PTRACE"],"securityOpt":["seccomp=unconfined"]}]'
62+
5463
CMD ["/bin/bash"]

0 commit comments

Comments
 (0)