Skip to content

linux: ship DWARF5 symbols as a separate -debug artifact#65

Open
benhillis wants to merge 2 commits into
microsoft:mainfrom
benhillis:linux-debug-symbols
Open

linux: ship DWARF5 symbols as a separate -debug artifact#65
benhillis wants to merge 2 commits into
microsoft:mainfrom
benhillis:linux-debug-symbols

Conversation

@benhillis

Copy link
Copy Markdown
Member

The 6.1 and 6.18 test kernels currently ship without DWARF debug info, which makes crash dumps hard to debug (only kallsyms symbol names are available — no source-level info for gdb/crash/drgn).

This PR enables CONFIG_DEBUG_INFO_DWARF5 (with zlib-compressed debug sections) for both kernels on both architectures, and splits the debug info into its own release artifact so consumers only download symbols when they actually need them.

Layout change

pkg/linux/build.sh now uses objcopy --only-keep-debug / --strip-debug / --add-gnu-debuglink to produce:

  • vmlinux — stripped of .debug_* sections, but retains .symtab/kallsyms; ships in the existing openvmm-test-linux-<ver>.<arch>.<ver>.tar.gz tarball.
  • vmlinux.debug — the DWARF5 symbol file (zlib-compressed); ships in a new openvmm-test-linux-<ver>-debug.<arch>.<ver>.tar.gz artifact.

gdb, crash, drgn, etc. auto-load vmlinux.debug via the .gnu_debuglink recorded inside vmlinux when both files are extracted into the same directory. The bootable image (bzImage/Image) is unaffected.

Artifact size impact (final .tar.gz)

Artifact x86_64 aarch64
openvmm-test-linux-6.1 24 MB 17 MB
openvmm-test-linux-6.1-debug 176 MB 112 MB
openvmm-test-linux-6.18 24 MB 19 MB
openvmm-test-linux-6.18-debug 146 MB 142 MB

So the boot-only kernel artifact actually got smaller than before (was ~125-200 MB with embedded debug info; previously had no debug at all before this stack of work), and people who don't debug never download the symbol file.

Verification

Built all four (arch × version) pairs locally via the pkg/linux/README.md bootstrap procedure and confirmed for each:

  • BuildID matches between vmlinux and vmlinux.debug (e.g. 6.1 x86_64: both report c6e4ac6f...).
  • readelf -p .gnu_debuglink vmlinuxvmlinux.debug.
  • file vmlinux.debugwith debug_info, not stripped.
  • file vmlinuxnot stripped (kallsyms preserved; only .debug_* removed).

The four kernel configs were regenerated from in-build olddefconfig output per the README, so the committed diffs are minimal and toolchain-correct.

Notes

  • Compression is zlib (not zstd) because the bundled cross toolchain (binutils 2.33.1 / GCC 11.5.0) predates zstd debug-section support; CONFIG_DEBUG_INFO_COMPRESSED_ZSTD would be silently dropped by olddefconfig. Documented in pkg/linux/README.md.
  • The "Adding a new kernel version" recipe in pkg/linux/README.md is updated to include the new result-linux-<ver>-debug Dockerfile stage.

Copilot AI review requested due to automatic review settings May 27, 2026 16:22

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the Linux test-kernel build/publish pipeline to ship DWARF5 debug symbols (compressed) as a separate -debug release artifact, keeping the default boot kernel artifact small while enabling source-level debugging for crash dump analysis.

Changes:

  • Enable DWARF5 debug info (compressed) in 6.1 and 6.18 kernel configs for both x86_64 and aarch64.
  • Split vmlinux into vmlinux (stripped of .debug_*) and vmlinux.debug (symbols) via objcopy, and publish the symbols as a new openvmm-test-linux-<ver>-debug... artifact.
  • Extend Docker build stages and the GitHub Actions release packaging to produce and upload the new -debug tarballs; update documentation to reflect the new layout.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
README.md Documents the new output directory layout and new -debug release artifacts.
pkg/linux/README.md Explains symbol splitting, .gnu_debuglink behavior, and compression/toolchain constraints; updates “add kernel version” instructions.
pkg/linux/build.sh Implements vmlinux/vmlinux.debug splitting and outputs boot vs debug payloads into separate sysroot directories.
pkg/linux/6.18/x86_64.config Enables CONFIG_DEBUG_INFO_DWARF5 and zlib-compressed debug sections for 6.18 x86_64.
pkg/linux/6.18/aarch64.config Enables CONFIG_DEBUG_INFO_DWARF5 and zlib-compressed debug sections for 6.18 aarch64.
pkg/linux/6.1/x86_64.config Enables CONFIG_DEBUG_INFO_DWARF5 and compressed debug info for 6.1 x86_64.
pkg/linux/6.1/aarch64.config Enables CONFIG_DEBUG_INFO_DWARF5 and compressed debug info for 6.1 aarch64.
Dockerfile Adds result-linux-<ver>-debug stages and exports linux-<ver>-debug/ outputs alongside existing kernel outputs.
.github/workflows/build.yml Packages and publishes new openvmm-test-linux-<ver>-debug... tarballs in the release job.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread pkg/linux/README.md
Consumers that don't need symbols don't have to download them. Tools
like `gdb`, `crash`, and `drgn` will automatically pick up
`vmlinux.debug` when both files are extracted into the same directory
(the link is recorded via `objcopy --add-gnu-debuglink` in `build.sh`).

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, thanks. Added a paragraph right after this one in eb68f63 documenting the sibling-directory gotcha for the local docker build --output layout and suggesting both cp/ln and set debug-file-directory as workarounds.

Copilot AI added 2 commits June 12, 2026 15:31
Enable CONFIG_DEBUG_INFO_DWARF5 (with zlib-compressed debug sections)
for both the 6.1 and 6.18 test kernels on x86_64 and aarch64, so crash
dumps can be analysed with gdb/crash/drgn against the matching release.

To keep the existing kernel tarball small, the build now splits vmlinux
into a stripped image and a separate vmlinux.debug symbol file via
objcopy --only-keep-debug / --strip-debug / --add-gnu-debuglink. The
stripped vmlinux ships in the existing openvmm-test-linux-<ver> tarball
(now ~20 MB); the symbol file ships in a new
openvmm-test-linux-<ver>-debug.<arch>.<ver>.tar.gz artifact so consumers
only download symbols when they need them.

Tools that follow .gnu_debuglink (gdb, crash, drgn, ...) auto-load
vmlinux.debug when both files are extracted into the same directory;
the bzImage/Image bootable images are unaffected.

Verified end-to-end by building all four (arch x version) pairs locally
and confirming BuildID match between each vmlinux and vmlinux.debug,
that .gnu_debuglink points at vmlinux.debug, and that the stripped
vmlinux retains kallsyms (only .debug_* sections were removed).

Note: the bundled cross toolchain (binutils 2.33.1 / GCC 11.5.0) does
not support zstd debug-section compression, so we use zlib;
documented in pkg/linux/README.md.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Address PR feedback: `docker build --output` lands vmlinux and
vmlinux.debug in sibling directories, so .gnu_debuglink auto-load
doesn't fire out of the box. Document the workaround (copy/symlink
or set debug-file-directory).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings June 12, 2026 15:32
@benhillis benhillis force-pushed the linux-debug-symbols branch from eb68f63 to 006cbd3 Compare June 12, 2026 15:32

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.

Comment thread pkg/linux/README.md
Comment on lines +32 to +33
directory explicitly (for `gdb`: `set debug-file-directory
out/linux-<ver>-debug`). The release tarballs are designed to be
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants