- Use remotedebug branch which adds GDB/QMP server support - Build with --enable-remotedebug configure flag - Add proper GDB handshake (qSupported) to gdb_client.py - Support no-ack mode for faster communication - Expose QMP port 4444 in addition to GDB port 1234 The GDB server is configured via [dosbox] section: gdbserver = true gdbserver port = 1234 qmpserver = true qmpserver port = 4444 Tested features: register read, memory read, breakpoints
129 lines
3.2 KiB
Docker
129 lines
3.2 KiB
Docker
# DOSBox-X with GDB stub support
|
|
# Multi-stage build for minimal final image
|
|
|
|
# =============================================================================
|
|
# Stage 1: Build DOSBox-X with GDB support
|
|
# =============================================================================
|
|
FROM debian:bookworm-slim AS builder
|
|
|
|
# Install build dependencies
|
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
git \
|
|
build-essential \
|
|
automake \
|
|
autoconf \
|
|
libtool \
|
|
pkg-config \
|
|
libsdl2-dev \
|
|
libsdl2-net-dev \
|
|
libsdl2-image-dev \
|
|
libpng-dev \
|
|
libpcap-dev \
|
|
libslirp-dev \
|
|
libfluidsynth-dev \
|
|
libavcodec-dev \
|
|
libavformat-dev \
|
|
libavutil-dev \
|
|
libswscale-dev \
|
|
nasm \
|
|
ca-certificates \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
# Clone DOSBox-X with remote debugging support (GDB server + QMP)
|
|
# This fork adds --enable-remotedebug which compiles in gdbserver.cpp and qmp.cpp
|
|
# See: https://github.com/joncampbell123/dosbox-x/issues/752
|
|
WORKDIR /build
|
|
RUN git clone --branch remotedebug --depth 1 https://github.com/lokkju/dosbox-x-remotedebug.git dosbox-x
|
|
|
|
WORKDIR /build/dosbox-x
|
|
|
|
# Configure and build with GDB server support
|
|
# --enable-remotedebug: Enables C_REMOTEDEBUG flag for GDB/QMP servers
|
|
# --enable-debug: Enables internal debugger (Alt+Pause)
|
|
RUN ./autogen.sh && \
|
|
./configure \
|
|
--prefix=/opt/dosbox-x \
|
|
--enable-remotedebug \
|
|
--enable-debug \
|
|
--enable-sdl2 \
|
|
--disable-printer \
|
|
&& make -j$(nproc) \
|
|
&& make install
|
|
|
|
# =============================================================================
|
|
# Stage 2: Runtime image
|
|
# =============================================================================
|
|
FROM debian:bookworm-slim
|
|
|
|
# Install runtime dependencies only
|
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
libsdl2-2.0-0 \
|
|
libsdl2-net-2.0-0 \
|
|
libsdl2-image-2.0-0 \
|
|
libpng16-16 \
|
|
libpcap0.8 \
|
|
libslirp0 \
|
|
libfluidsynth3 \
|
|
libavcodec59 \
|
|
libavformat59 \
|
|
libavutil57 \
|
|
libswscale6 \
|
|
libgl1 \
|
|
libx11-6 \
|
|
libncurses6 \
|
|
libxkbcommon0 \
|
|
libxrandr2 \
|
|
libxi6 \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
# Copy DOSBox-X from builder
|
|
COPY --from=builder /opt/dosbox-x /opt/dosbox-x
|
|
|
|
# Create symlink in PATH
|
|
RUN ln -s /opt/dosbox-x/bin/dosbox-x /usr/local/bin/dosbox-x
|
|
|
|
# Create directories for config and DOS files
|
|
RUN mkdir -p /config /dos
|
|
|
|
# Default configuration for DOSBox-X
|
|
# GDB server is enabled via --enable-remotedebug at compile time
|
|
RUN cat > /config/dosbox.conf << 'EOF'
|
|
[sdl]
|
|
fullscreen=false
|
|
windowresolution=800x600
|
|
output=opengl
|
|
|
|
[cpu]
|
|
core=auto
|
|
cputype=auto
|
|
cycles=auto
|
|
|
|
[dosbox]
|
|
memsize=16
|
|
|
|
[serial]
|
|
serial1=disabled
|
|
serial2=disabled
|
|
|
|
[autoexec]
|
|
# Mount /dos as C:
|
|
MOUNT C /dos
|
|
C:
|
|
EOF
|
|
|
|
# Expose ports:
|
|
# - 1234: GDB server (standard GDB remote protocol)
|
|
# - 4444: QMP server (QEMU Machine Protocol for control)
|
|
EXPOSE 1234 4444
|
|
|
|
# Set working directory
|
|
WORKDIR /dos
|
|
|
|
# Environment for X11 forwarding
|
|
ENV DISPLAY=:0
|
|
|
|
# Entry point
|
|
# Note: GDB/QMP servers are enabled via config file [dosbox] section
|
|
ENTRYPOINT ["dosbox-x", "-conf", "/config/dosbox.conf"]
|
|
CMD []
|