Skip to content

Commit be8ec0d

Browse files
zhengyu123claude
andauthored
Add gdb to Docker test containers (#397)
- Install gdb in Alpine (musl) base image - Add --cap-add=SYS_PTRACE and --init/--ulimit flags to shell mode so gdb can ptrace processes inside the container Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 10b668f commit be8ec0d

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

utils/run-docker-tests.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
# --config=debug|release|asan|tsan (default: debug)
1414
# --tests="TestPattern" (optional, specific test to run)
1515
# --gtest (enable C++ gtests, disabled by default)
16-
# --shell (drop to shell instead of running tests)
16+
# --shell (drop to shell instead of running tests; enables SYS_PTRACE for gdb)
1717
# --mount (mount local repo instead of cloning - faster but may have stale artifacts)
1818
# --rebuild (force rebuild of Docker images)
1919
# --rebuild-base (force rebuild of base image only)
@@ -275,7 +275,7 @@ RUN apk update && \
275275
apk add --no-cache \
276276
curl wget bash make g++ clang git jq cmake coreutils \
277277
gtest-dev gmock tar binutils musl-dbg linux-headers \
278-
compiler-rt llvm openssh-client
278+
compiler-rt llvm openssh-client gdb
279279
280280
# Set up Gradle cache directory
281281
ENV GRADLE_USER_HOME=/gradle-cache
@@ -299,7 +299,7 @@ RUN apt-get update && \
299299
curl wget bash make g++ clang git jq cmake \
300300
libgtest-dev libgmock-dev tar binutils libc6-dbg \
301301
ca-certificates linux-libc-dev \
302-
libasan6 libtsan0 openssh-client && \
302+
libasan6 libtsan0 openssh-client build-essential gdb && \
303303
rm -rf /var/lib/apt/lists/*
304304
305305
# Set up Gradle cache directory
@@ -430,7 +430,7 @@ GRADLE_CMD="$GRADLE_CMD --no-daemon --parallel --build-cache --no-watch-fs"
430430
# Build Docker run command base
431431
DOCKER_CMD="docker run --rm"
432432
if $SHELL_MODE; then
433-
DOCKER_CMD="$DOCKER_CMD -it"
433+
DOCKER_CMD="$DOCKER_CMD -it --init --ulimit core=-1 --cap-add=SYS_PTRACE"
434434
fi
435435
DOCKER_CMD="$DOCKER_CMD $DOCKER_PLATFORM"
436436
DOCKER_CMD="$DOCKER_CMD -e LIBC=$LIBC"

0 commit comments

Comments
 (0)