Skip to content

build(profile): keep line tables for the workspace and no debug info for dependencies - #77

Open
justin13888 wants to merge 1 commit into
masterfrom
chore/dev-profile-debuginfo
Open

justin13888 wants to merge 1 commit into
masterfrom
chore/dev-profile-debuginfo

Conversation

@justin13888

Copy link
Copy Markdown
Collaborator

Summary

  • Cargo.toml adds [profile.dev] debug = "line-tables-only" and [profile.dev.package."*"] debug = false, with a comment giving the reason and the override.
  • Cargo.toml [profile.test]: debug = 1 becomes "line-tables-only". opt-level = 3 and incremental = true are unchanged, because some suites are dominated by run time. A short comment records this. No [profile.test.package."*"] block is needed, because test inherits the dev "*" override (verified below).
  • Unchanged: release, fast-debug, bench.

Why: this keeps full debug info from piling up in target/ under fast iteration. Workspace backtraces keep file:line. Dependency frames keep their symbol names but lose file:line. To restore full debug info for one build: CARGO_PROFILE_DEV_DEBUG=2 / CARGO_PROFILE_TEST_DEBUG=2 (workspace) and cargo --config 'profile.dev.package."*".debug=2' ... (dependencies). No size measurements were taken.

Validation

  • cargo metadata --no-deps --format-version 1 — parses.
  • cargo fmt --all -- --check — pass.
  • cargo check --workspace — pass.
  • cargo build -v -p rawshift-core (dev). rawshift_core gets -C debuginfo=line-tables-only. Dependencies gamut_core, gamut_color, thiserror, syn and the rest get no -C debuginfo flag (= 0).
  • cargo test --no-run -v -p rawshift-core --lib (test). rawshift_core --test gets -C debuginfo=line-tables-only -C opt-level=3. gamut_core, gamut_color, serde_json, memchr, thiserror and the rest get -C opt-level=3 with no -C debuginfo. This confirms that test inherits dev.package."*".
  • Not run locally: just clippy, cargo test --workspace (the lefthook pre-commit/pre-push rows; lefthook is not installed in this checkout). Deferred to CI.

Risks and rollout

  • Dev/test-only build configuration. Release and bench artefacts are unaffected.
  • Step-debugging into a dependency, or getting file:line in its frames, now needs the override above. Generic dependency code instantiated in a workspace crate still carries that crate's line tables.
  • Native code: libjxl is built by jpegxl-src through cmake-rs (via gamut-jxl-sys), which picks its CMake build type from cargo's OPT_LEVEL/DEBUG. Under test (opt-level 3) it moves from RelWithDebInfo to Release, so the first cargo test after this rebuilds libjxl. Under dev (opt-level 0) it stays Debug, and so keeps its own -g. That build type was reasoned from cmake-rs's source, not observed in a build log here.

…for dependencies

A new `[profile.dev]` sets `debug = "line-tables-only"`, and
`[profile.dev.package."*"]` sets `debug = false`. `[profile.test]` drops
from `debug = 1` to `"line-tables-only"` and keeps `opt-level = 3` and
`incremental`. Its dependencies inherit the dev `"*"` override, which
`cargo test --no-run -v` confirms, so no test-specific package block is
needed.

Workspace backtraces keep file:line. Dependency frames keep their symbol
names but lose file:line. `CARGO_PROFILE_DEV_DEBUG=2` and
`--config 'profile.dev.package."*".debug=2'` restore full debug info for
one build.
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.

1 participant