diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 160af86b..c9a3e652 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -32,7 +32,7 @@ jobs: strategy: matrix: job: - - { os: ubuntu-22.04, target: x86_64-unknown-linux-gnu } + - { os: ubuntu-22.04, target: x86_64-unknown-linux-gnu, release: true } - { os: ubuntu-22.04, target: x86_64-unknown-linux-musl } - { os: windows-2022, target: x86_64-pc-windows-msvc } - { os: macos-13, target: x86_64-apple-darwin } @@ -49,6 +49,11 @@ jobs: run: cargo test --target ${{ matrix.job.target }} --no-run - name: Test run: cargo test --target ${{ matrix.job.target }} + - name: Release test + if: ${{ matrix.job.release }} + run: | + cargo test --target ${{ matrix.job.target }} --release --no-run + cargo test --target ${{ matrix.job.target }} --release install-cross: runs-on: ubuntu-latest diff --git a/src/linux/thread_info.rs b/src/linux/thread_info.rs index 5bb1f9e8..a3fbed95 100644 --- a/src/linux/thread_info.rs +++ b/src/linux/thread_info.rs @@ -37,20 +37,18 @@ enum NT_Elf { NT_ARM_VFP = 0x400, // ARM VFP/NEON registers } -#[inline] -pub fn to_u128(slice: &[u32]) -> &[u128] { - unsafe { std::slice::from_raw_parts(slice.as_ptr().cast(), slice.len().saturating_div(4)) } -} - -#[inline] -pub fn copy_registers(dst: &mut [u128], src: &[u128]) { - let to_copy = std::cmp::min(dst.len(), src.len()); - dst[..to_copy].copy_from_slice(&src[..to_copy]); -} - #[inline] pub fn copy_u32_registers(dst: &mut [u128], src: &[u32]) { - copy_registers(dst, to_u128(src)); + // SAFETY: We are copying a block of memory from ptrace as u32s to the u128 + // format of minidump-common + unsafe { + let dst: &mut [u8] = + std::slice::from_raw_parts_mut(dst.as_mut_ptr().cast(), dst.len() * 16); + let src: &[u8] = std::slice::from_raw_parts(src.as_ptr().cast(), src.len() * 4); + + let to_copy = std::cmp::min(dst.len(), src.len()); + dst[..to_copy].copy_from_slice(&src[..to_copy]); + } } trait CommonThreadInfo {