fix: build firecracker-debug with the gdb feature actually enabled#27
Conversation
The debug variant was built with
tools/devtool build --release -- --bin firecracker --features gdb
but devtool's cmd_build discards everything after `--` (it does
`"--") shift; break` then runs a fixed `release.sh --libc --profile`),
and release.sh runs `cargo build --workspace --bins` with no --features.
So --features gdb never reached cargo: the published firecracker-debug had
no gdb stub, was byte-for-byte a plain build, and Firecracker never bound
the gdb socket on resume (resume-build -gdb could not attach).
Enable the feature in a way the plain build honors: temporarily add gdb to
the firecracker crate's default features, build, then restore the manifest.
Add a sanity check that the produced binary actually contains the gdb
feature (the FIRECRACKER_GDB_SOCKET literal), so a non-gdb build fails the
release instead of shipping silently.
Signed-off-by: Nikita Kalyazin <nikita.kalyazin@e2b.dev>
PR SummaryLow Risk Overview Adds a build-time guard that fails if Reviewed by Cursor Bugbot for commit 10e28a4. Bugbot is set up for automated code reviews on this repo. Configure here. |
Problem
The published
firecracker-debug(added in #26) is not actually gdb-enabled. It was built with:but firecracker's
tools/devtoolcmd_builddiscards everything after--(it does"--") shift; breakthen runs a fixedtools/release.sh --libc --profile), andrelease.shrunscargo build --workspace --binswith no--features. So--features gdbsilently never reaches cargo — the "debug" binary has no gdb stub and is byte-for-byte a plain build.Consequence: Firecracker never binds the gdb socket on resume, so
resume-build -gdbcannot attach.Evidence (same source, three builds)
FIRECRACKER_GDB_SOCKETliteralcargo build --features gdb(direct)devtool build -- --features gdb(= old build.sh)firecracker-debugThe published binary is byte-size identical to a plain (non-gdb) build.
Fix
Enable the feature in a way the unmodified firecracker tooling honors: add
gdbto the firecracker crate's default features before the build (devtool/release.sh/cmd_shellall build default features and can't take--features). One line, editing only the throwaway clone — no backup/restore needed since the prod binary is already built and copied above.Also adds a build-time sanity check that the produced
firecracker-debugactually contains the gdb feature (theFIRECRACKER_GDB_SOCKETliteral), so a featureless build fails the release loudly instead of shipping silently — the guard that would have caught the original bug.Verification (no real release)
End-to-end
build.shrun forv1.14.1_084e75f/ amd64:firecracker(prod)firecracker-debugfirecracker-debug.debugThe resulting
firecracker-debugwas then used to driveresume-build -gdbagainst a real snapshot on a dev node: Firecracker bound the gdb socket, gdb attached, and DWARF source-level symbols resolved.Follow-up
The currently published
firecracker-debugartifacts are still the broken non-gdb binaries — a re-release is needed after this merges. The underlying footgun (devtool/release.sh dropping--features) lives in the firecracker repo and could be fixed there separately.🤖 Generated with Claude Code