diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 3a2c25992..6e860eebc 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -56,7 +56,6 @@ jobs: extension-file-name: "not-yet-supported" target: x86_64-unknown-linux-gnu use-cross: false - strip-cmd: strip profile: release features: "" # - artifact: linux-aarch64 @@ -66,7 +65,6 @@ jobs: # extension-file-name: "" # target: aarch64-unknown-linux-gnu # use-cross: true - # strip-cmd: aarch64-linux-gnu-strip # profile: release # features: "" # - artifact: linux-armv7 @@ -76,7 +74,6 @@ jobs: # extension-file-name: "" # target: armv7-unknown-linux-gnueabihf # use-cross: true - # strip-cmd: arm-linux-gnueabihf-strip # profile: release # features: "" env: @@ -138,17 +135,6 @@ jobs: command: build args: --features "${{ matrix.features }}" --profile ${{ matrix.profile }} --target ${{ matrix.target }} use-cross: ${{ matrix.use-cross }} - # Strip debug symbols (Linux and macOS) - # TODO-medium We could replace this with Cargo's recent built-in strip function - - name: Strip debug symbols from Linux binary - if: startsWith(matrix.os, 'ubuntu-') - run: | - cp target/${{ matrix.target }}/${{ matrix.profile }}/${{ matrix.lib-file-name }} target/${{ matrix.target }}/${{ matrix.profile }}/libhelgobox-debug.so - ${{ matrix.strip-cmd }} target/${{ matrix.target }}/${{ matrix.profile }}/${{ matrix.lib-file-name }} - - name: Strip debug symbols from macOS binary - if: matrix.os == 'macos-latest' - run: | - strip -u -r target/${{ matrix.target }}/${{ matrix.profile }}/${{ matrix.lib-file-name }} # Upload - name: Upload plug-in and extension to artifact uses: actions/upload-artifact@v4 diff --git a/CONTRIBUTING.adoc b/CONTRIBUTING.adoc index 854706e22..55e8e21cd 100644 --- a/CONTRIBUTING.adoc +++ b/CONTRIBUTING.adoc @@ -365,6 +365,115 @@ To be used like this: . Copy the error report to the clipboard. . Execute the action. +=== Differences between debug levels + +==== macOS + +Insights: + +* The size difference between `debug = 1` and `debug = 2` is almost nothing (both 58 MB), and there's nothing to gain from `debug = 2` in terms of stack traces. +* The size difference between `debug = 0` and `debug = 1` is around 5 MB (53 MB vs. 58 MB), and `debug = 1` only makes a difference if the source files exist (showing line numbers), and only for panics. +* Hard crash stack traces are completely independent of the `debug` value. +They are always helpful except when stripping the symbols. +* `strip = symbols` leads to the smallest binaries (38 MB) but also to completely useless stack traces, both in soft and hard crashes. +However, `split-debuginfo = "packed" seems to fix this at least for hard crashes, at a similar-sized binary (not for panics though) ... even if the DSYM directories are not on disk. What also fixes this for hard crashes is stripping via `strip -u -r`. +We shouldn't do that anymore! +* `strip = debuginfo` leads to an okay size reduction (53 MB) but removes line numbers even if source files exist. +However, `split-debuginfo = "packed"` solves this by creating dSYM directories, as long as they are there. + +Takeaway: + +* We should build with `debug = 2` +** While `debug = 1` is actually enough for most purposes, it can't hurt building with `debug = 2` since we strip debuginfo anyway. +So there's no size difference for the final binary. +That way we have more debuginfo on the server whenever we need it. +* `strip = debuginfo` is the max we can strip away if we want panics to contain something useful +* `strip = symbols` is only okay if we are fine with bogus stack traces in panics. +In that case, we must use `split-debuginfo = "packed"` to get at least detailed stack traces in case of hard crashes. +* We should use `split-debuginfo = "packed"` in all cases. +* Would be good to find a way to leverage symbols for panic stack traces, but I think there is none. + +===== "debug = 0" + +.Panic (sources don't matter) +---- +7: 0x120531450 - helgobox::infrastructure::plugin::sandbox::execute::h9608b1370cb08106 +---- + +.Hard crash (sources don't matter) +---- +4 helgobox-arm64.vst.dylib 0x120527df4 _$LT$helgobox..domain..targets..track_volume_target..TrackVolumeTarget$u20$as$u20$helgoboss_learn..mode..target..Target$GT$::current_value::hff7df2fe68cec5d5 + 20 +---- + +===== "debug = 1" + +.Panic if sources exist +---- +7: 0x13071ffdc - helgobox::infrastructure::plugin::sandbox::execute::hb564445c2d9211ee + at /Users/helgoboss/Documents/projects/dev/realearn/main/src/infrastructure/plugin/sandbox.rs:3:5 +---- + +.Panic if sources are gone +---- +7: 0x140f1ffdc - helgobox::infrastructure::plugin::sandbox::execute::hb564445c2d9211ee +---- + +.Hard crash (sources don't matter) +---- +6 helgobox-arm64.vst.dylib 0x1302d4a64 _$LT$helgobox..domain..mapping..CompoundMappingTarget$u20$as$u20$helgoboss_learn..mode..target..Target$GT$::current_value::hadfcb1be993900b3 + 20 (mapping.rs:2498) [inlined] +---- + +===== "debug = 2" + +.Panic if sources exist +---- +7: 0x12160dafc - helgobox::infrastructure::plugin::sandbox::execute::h18fb689d4112e2d3 + at /Users/helgoboss/Documents/projects/dev/realearn/main/src/infrastructure/plugin/sandbox.rs:3:5 +---- + +.Panic if sources are gone +---- +7: 0x153f81afc - helgobox::infrastructure::plugin::sandbox::execute::h18fb689d4112e2d3 +---- + +.Hard crash (sources don't matter) +---- +6 helgobox-arm64.vst.dylib 0x1212d8148 _$LT$helgobox..domain..mapping..CompoundMappingTarget$u20$as$u20$helgoboss_learn..mode..target..Target$GT$::current_value::h15041e3226fa455d + 20 (mapping.rs:2498) [inlined] +---- + +===== "debug = 2; strip = debuginfo" + +.Panic (sources don't matter) +---- +7: 0x138616570 - helgobox::infrastructure::plugin::sandbox::execute::hd0d406afe4d62df9 +---- + +.Hard crash (sources don't matter) +---- +4 helgobox-arm64.vst.dylib 0x13885aab4 _$LT$helgobox..domain..targets..track_volume_target..TrackVolumeTarget$u20$as$u20$helgoboss_learn..mode..target..Target$GT$::current_value::h35c07d80eb0a312b + 20 +---- + +===== "debug = 2; strip = symbols" + +.Soft crash (sources don't matter) +---- +0: 0x14bdef0ec - _NSEEL_HOSTSTUB_EnterMutex +1: 0x14bd56f08 - _NSEEL_HOSTSTUB_EnterMutex +2: 0x14bfbe4e4 - _cpp_to_rust_ProjectStateContext_SetTempFlag +3: 0x14bfbddcc - _cpp_to_rust_ProjectStateContext_SetTempFlag +4: 0x14bfbca08 - _cpp_to_rust_ProjectStateContext_SetTempFlag +5: 0x14bfbdabc - _cpp_to_rust_ProjectStateContext_SetTempFlag +6: 0x14c075710 - _cpp_to_rust_ProjectStateContext_SetTempFlag +7: 0x14af50aa0 - _ReaperPluginEntry +8: 0x14bd58fcc - _NSEEL_HOSTSTUB_EnterMutex +9: 0x14bd82844 - _NSEEL_HOSTSTUB_EnterMutex +---- + +.Hard crash (sources don't matter) +---- +7 helgobox-arm64.vst.dylib 0x14b34b5e0 0x14a65c000 + 13563360 +---- + == Documentation All documentation is written in AsciiDoc. diff --git a/Cargo.lock b/Cargo.lock index 9a774d3b3..cfb9aed32 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -20,9 +20,9 @@ checksum = "330223a1aecc308757b9926e9391c9b47f8ef2dbd8aea9df88312aea18c5e8d6" [[package]] name = "addr2line" -version = "0.21.0" +version = "0.24.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a30b2e23b9e17a9f90641c7ab1549cd9b44f296d3ccbf309d2863cfe398a0cb" +checksum = "dfbe277e56a376000877090da837660b4427aad530e3028d44e0bffe4f89a1c1" dependencies = [ "gimli", ] @@ -33,6 +33,12 @@ version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" +[[package]] +name = "adler2" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "512761e0bb2578dd7380c6baaa0f4ce03e84f95e960231d1dec8bf4d7d6e2627" + [[package]] name = "aead" version = "0.5.2" @@ -630,17 +636,17 @@ dependencies = [ [[package]] name = "backtrace" -version = "0.3.69" +version = "0.3.74" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2089b7e3f35b9dd2d0ed921ead4f6d318c27680d4a5bd167b3ee120edb105837" +checksum = "8d82cb332cdfaed17ae235a638438ac4d4839913cc2af585c3c6746e8f8bee1a" dependencies = [ "addr2line", - "cc 1.0.83", "cfg-if", "libc", - "miniz_oxide", + "miniz_oxide 0.8.0", "object", "rustc-demangle", + "windows-targets 0.52.6", ] [[package]] @@ -2316,7 +2322,7 @@ dependencies = [ "flume", "half", "lebe", - "miniz_oxide", + "miniz_oxide 0.7.1", "rayon-core", "smallvec", "zune-inflate", @@ -2395,7 +2401,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "46303f565772937ffe1d394a4fac6f411c6013172fadde9dcdb1e147a086940e" dependencies = [ "crc32fast", - "miniz_oxide", + "miniz_oxide 0.7.1", ] [[package]] @@ -2762,9 +2768,9 @@ dependencies = [ [[package]] name = "gimli" -version = "0.28.1" +version = "0.31.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253" +checksum = "07e28edb80900c19c28f1072f2e8aeca7fa06b23cd4169cefe1af5aa3260783f" [[package]] name = "gio-sys" @@ -3826,9 +3832,9 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.153" +version = "0.2.161" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd" +checksum = "8e9489c2807c139ffd9c1794f4af0ebe86a828db53ecdc7fea2111d0fed085d1" [[package]] name = "libdbus-sys" @@ -4238,6 +4244,15 @@ dependencies = [ "simd-adler32", ] +[[package]] +name = "miniz_oxide" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2d80299ef12ff69b16a84bb182e3b9df68b5a91574d3d4fa6e41b65deec4df1" +dependencies = [ + "adler2", +] + [[package]] name = "mio" version = "0.8.10" @@ -4701,9 +4716,9 @@ dependencies = [ [[package]] name = "object" -version = "0.32.2" +version = "0.36.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a6a622008b6e321afc04970976f62ee297fdbaa6f95318ca343e3eebb9648441" +checksum = "aedf0a2d09c573ed1d8d85b30c119153926a2b36dce0ab28322c09a117a4683e" dependencies = [ "memchr", ] @@ -5096,7 +5111,7 @@ dependencies = [ "crc32fast", "fdeflate", "flate2", - "miniz_oxide", + "miniz_oxide 0.7.1", ] [[package]] @@ -6000,9 +6015,9 @@ checksum = "cb626abdbed5e93f031baae60d72032f56bc964e11ac2ff65f2ba3ed98d6d3e1" [[package]] name = "rustc-demangle" -version = "0.1.21" +version = "0.1.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ef03e0a2b150c7a90d01faf6254c9c48a41e95fb2a8c2ac1c6f0d2b9aefc342" +checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f" [[package]] name = "rustc-hash" diff --git a/Cargo.toml b/Cargo.toml index 2e0eba946..37bf50c89 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -126,8 +126,11 @@ cached = "0.53.1" imageproc = "0.25.0" [profile.release] -# This is important for having line numbers in bug reports. +# There's a long reasoning about those values in CONTRIBUTING.adoc debug = 2 +# Switching to "symbols" will reduce size even more but leads to useless stack traces when panicking +strip = "debuginfo" +split-debuginfo = "packed" [profile.dev-llvm-out-of-memory-fix] inherits = "dev" diff --git a/main/Cargo.toml b/main/Cargo.toml index 94dc6a88e..2cd98459c 100644 --- a/main/Cargo.toml +++ b/main/Cargo.toml @@ -75,7 +75,7 @@ once_cell.workspace = true derivative.workspace = true chrono.workspace = true smallvec = "1.7.0" -backtrace = "0.3" +backtrace = "0.3.74" regex.workspace = true enum-map.workspace = true # For generating controller file names from controller names diff --git a/main/src/infrastructure/plugin/actions.rs b/main/src/infrastructure/plugin/actions.rs index 1e24cbc56..583fe890f 100644 --- a/main/src/infrastructure/plugin/actions.rs +++ b/main/src/infrastructure/plugin/actions.rs @@ -118,13 +118,12 @@ pub const ACTION_DEFS: &[ActionDef] = &[ requires_instance: true, ..DEFAULT_DEF }, - #[cfg(debug_assertions)] ActionDef { section: ActionSection::General, - command_name: "HB_SANDBOX", - action_name: "Execute sandbox", + command_name: "HB_PANIC", + action_name: "Simulate error", developer: true, - op: crate::infrastructure::plugin::sandbox::execute, + op: crate::infrastructure::plugin::sandbox::simulate_error, ..DEFAULT_DEF }, ]; diff --git a/main/src/infrastructure/plugin/mod.rs b/main/src/infrastructure/plugin/mod.rs index b1bcfcf75..0573e23f6 100644 --- a/main/src/infrastructure/plugin/mod.rs +++ b/main/src/infrastructure/plugin/mod.rs @@ -18,7 +18,6 @@ pub use actions::*; mod dynamic_toolbar; mod hidden_helper_panel; pub mod persistent_toolbar; -#[cfg(debug_assertions)] mod sandbox; mod unit_shell; pub use unit_shell::*; diff --git a/main/src/infrastructure/plugin/sandbox.rs b/main/src/infrastructure/plugin/sandbox.rs index e836be692..e1e4426e6 100644 --- a/main/src/infrastructure/plugin/sandbox.rs +++ b/main/src/infrastructure/plugin/sandbox.rs @@ -1,4 +1,4 @@ //! Some experimental code for trying things out. -pub fn execute() { - panic!("Panic test"); +pub fn simulate_error() { + panic!("Simulated error"); }