Skip to content

Commit

Permalink
Merge branch 'master' into fix/demangle-fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Floris Bruynooghe committed Nov 18, 2021
2 parents 4dee01d + c30e34f commit 4a6507c
Show file tree
Hide file tree
Showing 32 changed files with 436 additions and 240 deletions.
2 changes: 2 additions & 0 deletions .craft.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ targets:
- name: github
requireNames:
- /^symbolic-.*-py2.py3-none-macosx_10_15_x86_64.whl$/
- /^symbolic-.*-py2.py3-none-macosx_11_0_arm64.whl$/
- /^symbolic-.*-py2\.py3-none-.*manylinux2010_i686.*\.whl$/
- /^symbolic-.*-py2\.py3-none-.*manylinux2010_x86_64\.whl$/
- /^symbolic-.*-py2\.py3-none-.*manylinux2014_aarch64\.whl$/
- /^symbolic-.*.zip$/
35 changes: 26 additions & 9 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,19 @@ on:

jobs:
python-wheel-mac:
name: Python macOS
runs-on: macos-10.15
strategy:
fail-fast: false
matrix:
include:
- macos-version: "10.15"
target: x86_64-apple-darwin
py-platform: macosx-10_15_x86_64
- macos-version: "11.0"
target: aarch64-apple-darwin
py-platform: macosx-11_0_arm64

name: Python macOS ${{ matrix.py-platform }}
runs-on: macos-${{ matrix.macos-version }}

steps:
- uses: actions/checkout@v2
Expand All @@ -18,14 +29,18 @@ jobs:
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: ${{ matrix.target }}
profile: minimal
override: true

- uses: actions/setup-python@v2
with:
python-version: 3.6

- run: make wheel
- run: make wheel PLATFORM=${{ matrix.py-platform }}
env:
# consumed by cargo and setup.py to obtain the target dir
CARGO_BUILD_TARGET: ${{ matrix.target }}

- uses: actions/upload-artifact@v2
with:
Expand All @@ -36,7 +51,10 @@ jobs:
strategy:
fail-fast: false
matrix:
build-arch: [i686, x86_64]
build-arch:
- manylinux2010_i686
- manylinux2010_x86_64
- manylinux2014_aarch64

name: Python Linux ${{ matrix.build-arch }}
runs-on: ubuntu-latest
Expand All @@ -46,14 +64,13 @@ jobs:
with:
submodules: recursive

- uses: actions-rs/toolchain@v1
- if: matrix.build-arch == 'manylinux2014_aarch64'
uses: docker/setup-qemu-action@v1
with:
toolchain: stable
profile: minimal
override: true
platforms: arm64

- name: Build in Docker
run: make wheel-manylinux IMAGE=quay.io/pypa/manylinux2010_${{ matrix.build-arch }}
run: make wheel-manylinux IMAGE=quay.io/pypa/${{ matrix.build-arch }}

- uses: actions/upload-artifact@v2
with:
Expand Down
38 changes: 37 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,42 @@
# Changelog

## Unreleased
## 8.5.0

**Features**:

- Add `ByteView::map_file_ref` constructor which does not consume the `File` passed to it. ([#448](https://github.com/getsentry/symbolic/pull/448))

**Fixes**:

- Support Unreal Engine 5 crash reporter. ([#449](https://github.com/getsentry/symbolic/pull/449))

## 8.4.0

**Features**:

- Add `Unreal4Crash::parse_with_limit` which allows specifying a maximum allocation size when extracting compressed UE4 crash archives. ([#447](https://github.com/getsentry/symbolic/pull/447))

**Fixes**:

- Apply speculative handling of stackless functions only on `amd64` when creating CFI caches. ([#445](https://github.com/getsentry/symbolic/pull/445))

## 8.3.2

**Features**:

- Build and publish binary wheels for `arm64` / `aarch64` on macOS and Linux. ([#442](https://github.com/getsentry/symbolic/pull/442))

**Fixes**:

- Don’t prefix ARM registers with `$` for CFI files. ([#443](https://github.com/getsentry/symbolic/pull/443))

**Thank you**:

Features, fixes and improvements in this release have been contributed by:

- [@Gankra](https://github.com/Gankra)

## 8.3.1

**Fixes**:

Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ sdist: .venv/bin/python
.PHONY: sdist

wheel: .venv/bin/python
cd py && ../.venv/bin/pip install -U wheel && ../.venv/bin/python setup.py bdist_wheel
cd py && ../.venv/bin/pip install -U wheel && ../.venv/bin/python setup.py bdist_wheel $(PLATFORM:%=-p %)
.PHONY: wheel

wheel-manylinux:
Expand Down
2 changes: 1 addition & 1 deletion examples/addr2line/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "addr2line"
version = "8.3.0"
version = "8.5.0"
authors = ["Jan Michael Auer <mail@jauer.org>"]
edition = "2018"
publish = false
Expand Down
2 changes: 1 addition & 1 deletion examples/dump_cfi/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "dump_cfi"
version = "8.3.0"
version = "8.5.0"
authors = ["Jan Michael Auer <mail@jauer.org>"]
edition = "2018"
publish = false
Expand Down
2 changes: 1 addition & 1 deletion examples/dump_sources/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "dump_sources"
version = "8.3.0"
version = "8.5.0"
authors = ["Jan Michael Auer <mail@jauer.org>"]
edition = "2018"
publish = false
Expand Down
2 changes: 1 addition & 1 deletion examples/minidump_stackwalk/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "minidump_stackwalk"
version = "8.3.0"
version = "8.5.0"
authors = ["Jan Michael Auer <mail@jauer.org>"]
edition = "2018"
publish = false
Expand Down
2 changes: 1 addition & 1 deletion examples/object_debug/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "object_debug"
version = "8.3.0"
version = "8.5.0"
authors = ["Jan Michael Auer <mail@jauer.org>"]
edition = "2018"
publish = false
Expand Down
2 changes: 1 addition & 1 deletion examples/symcache_debug/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "symcache_debug"
version = "8.3.0"
version = "8.5.0"
authors = ["Jan Michael Auer <mail@jauer.org>"]
edition = "2018"
publish = false
Expand Down
2 changes: 1 addition & 1 deletion examples/unreal_engine_crash/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "unreal_engine_crash"
version = "8.3.0"
version = "8.5.0"
authors = ["Jan Michael Auer <mail@jauer.org>"]
edition = "2018"
publish = false
Expand Down
10 changes: 9 additions & 1 deletion py/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,20 @@ def delete_scratchpad():
print("running `%s` (%s target)" % (" ".join(cmd), target))
build = spec.add_external_build(cmd=cmd, path=rust_path)

def find_dylib():
cargo_target = os.environ.get("CARGO_BUILD_TARGET")
if cargo_target:
in_path = "target/%s/%s" % (cargo_target, target)
else:
in_path = "target/%s" % target
return build.find_dylib("symbolic_cabi", in_path=in_path)

rtld_flags = ["NOW"]
if sys.platform == "darwin":
rtld_flags.append("NODELETE")
spec.add_cffi_module(
module_path="symbolic._lowlevel",
dylib=lambda: build.find_dylib("symbolic_cabi", in_path="target/%s" % target),
dylib=find_dylib,
header_filename=lambda: build.find_header(
"symbolic.h", in_path="symbolic-cabi/include"
),
Expand Down
4 changes: 2 additions & 2 deletions symbolic-cabi/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "symbolic-cabi"
version = "8.3.0"
version = "8.5.0"
license = "MIT"
authors = [
"Armin Ronacher <armin.ronacher@active-4.com>",
Expand All @@ -22,5 +22,5 @@ crate-type = ["cdylib"]
[dependencies]
serde_json = "1.0.40"
apple-crash-report-parser = { version = "0.4.0", features = ["with_serde"] }
symbolic = { version = "8.3.0", path = "../symbolic", features = ["debuginfo", "demangle", "minidump", "sourcemap", "symcache", "unreal-serde"] }
symbolic = { version = "8.5.0", path = "../symbolic", features = ["debuginfo", "demangle", "minidump", "sourcemap", "symcache", "unreal-serde"] }
proguard = { version = "4.0.1", features = ["uuid"] }
2 changes: 1 addition & 1 deletion symbolic-common/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "symbolic-common"
version = "8.3.0"
version = "8.5.0"
license = "MIT"
authors = [
"Armin Ronacher <armin.ronacher@active-4.com>",
Expand Down
52 changes: 50 additions & 2 deletions symbolic-common/src/byteview.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,8 @@ impl<'a> ByteView<'a> {

/// Constructs a `ByteView` from an open file handle by memory mapping the file.
///
/// See [`ByteView::map_file_ref`] for a non-consuming version of this constructor.
///
/// # Example
///
/// ```
Expand All @@ -131,7 +133,28 @@ impl<'a> ByteView<'a> {
/// }
/// ```
pub fn map_file(file: File) -> Result<Self, io::Error> {
let backing = match unsafe { Mmap::map(&file) } {
Self::map_file_ref(&file)
}

/// Constructs a `ByteView` from an open file handle by memory mapping the file.
///
/// The main difference with [`ByteView::map_file`] is that this takes the [`File`] by
/// reference rather than consuming it.
///
/// # Example
///
/// ```
/// use std::io::Write;
/// use symbolic_common::ByteView;
///
/// fn main() -> Result<(), std::io::Error> {
/// let mut file = tempfile::tempfile()?;
/// let view = ByteView::map_file_ref(&file)?;
/// Ok(())
/// }
/// ```
pub fn map_file_ref(file: &File) -> Result<Self, io::Error> {
let backing = match unsafe { Mmap::map(file) } {
Ok(mmap) => ByteViewBacking::Mmap(mmap),
Err(err) => {
// this is raised on empty mmaps which we want to ignore. The 1006 Windows error
Expand Down Expand Up @@ -234,7 +257,7 @@ unsafe impl StableDeref for ByteView<'_> {}
mod tests {
use super::*;

use std::io::Write;
use std::io::{Read, Seek, Write};

use similar_asserts::assert_eq;
use tempfile::NamedTempFile;
Expand All @@ -260,4 +283,29 @@ mod tests {

Ok(())
}

#[test]
fn test_mmap_fd_reuse() -> Result<(), std::io::Error> {
let mut tmp = NamedTempFile::new()?;
tmp.write_all(b"1234")?;

let view = ByteView::map_file_ref(tmp.as_file())?;

// This deletes the file on disk.
let path = tmp.path().to_path_buf();
let mut file = tmp.into_file();
assert!(!path.exists());

// Ensure we can still read from the the file after mmapping and deleting it on disk.
let mut buf = Vec::new();
file.rewind()?;
file.read_to_end(&mut buf)?;
assert_eq!(buf, b"1234");
drop(file);

// Ensure the byteview can still read the file as well.
assert_eq!(&*view, b"1234");

Ok(())
}
}
6 changes: 3 additions & 3 deletions symbolic-debuginfo/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "symbolic-debuginfo"
version = "8.3.0"
version = "8.5.0"
license = "MIT"
authors = [
"Armin Ronacher <armin.ronacher@active-4.com>",
Expand All @@ -27,7 +27,7 @@ dmsort = "1.0.1"
elementtree = "0.5.0"
fallible-iterator = "0.2.0"
flate2 = { version = "1.0.13", features = ["rust_backend"], default-features = false }
gimli = { version = "0.25.0", features = ["read", "std"], default-features = false }
gimli = { version = "0.26.1", features = ["read", "std"], default-features = false }
goblin = "0.4.2"
lazy_static = "1.4.0"
lazycell = "1.2.1"
Expand All @@ -40,7 +40,7 @@ scroll = "0.10"
serde = { version = "1.0.94", features = ["derive"] }
serde_json = "1.0.40"
smallvec = "1.2.0"
symbolic-common = { version = "8.3.0", path = "../symbolic-common" }
symbolic-common = { version = "8.5.0", path = "../symbolic-common" }
thiserror = "1.0.20"
walrus = "0.19.0"
wasmparser = "0.77.0" # must match spec in walrus
Expand Down
2 changes: 1 addition & 1 deletion symbolic-debuginfo/src/elf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ impl<'data> ElfObject<'data> {
pub fn code_id(&self) -> Option<CodeId> {
self.find_build_id()
.filter(|slice| !slice.is_empty())
.map(|slice| CodeId::from_binary(slice))
.map(CodeId::from_binary)
}

/// The binary's soname, if any.
Expand Down
Loading

0 comments on commit 4a6507c

Please sign in to comment.