Split-debuginfo = "packed" produce much bigger binary than expected

⚓ rust    📅 2025-07-06    👤 surdeus    👁️ 2      

surdeus

I'm trying to create a release binary (as small as possible, but with backtrace info) + a separate .dwp debug info artifact.
Below are my config files.
.cargo/config.toml

[unstable]
build-std = ["core", "alloc", "std"]

Cargo.toml

[profile.release]
debug = "full"
split-debuginfo = "packed"

The size is much much bigger than with strip = "debuginfo" enabled, but with strip = "debuginfo", the size is reasonable, but lldb and gdb can't find the debug symbols with dwp, even when you mannually add-symbol-file xxx.dwp for it.

Full debug info is good, to profile you program, analyze a core dump and replay a rr trace, even for release build, so here is split dwarf for linux platform, which also significantly speed compiling.

Let's admit one thing: Windows *.pdb does do thing right, split debug info should be default, and debug info is alse needed for release build. What a mess for linux world, objcopy --strip-all --add-gnu-debuglink=<DBG_FILE> <BASE_FILE> is a lie, cheating us for so many years, wasting so much time and electric power.

So my wish is

  1. keep all debug info in dwp file, not the binary file.
  2. keep stack trace info in binary file by default, but provide options to not keep it or leave it in dwp file.
  3. generate debug info and keep it by default for release build.

At least, we should provide options for it, developer experience matters, especially for rust programmers.

1 post - 1 participant

Read full topic

🏷️ rust_feed