diff --git a/CHANGELOG.md b/CHANGELOG.md index 929a83be..d8017756 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,21 +6,16 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -## [Unreleased] - -### Added +## [0.3.1] - 2021-04-23 ### Changed -### Deprecated - -### Removed +- Updated `sentry-native` to 0.4.9. ### Fixed - Improved README. - -### Security +- Fixed cross-compilation from x86_64-apple-darwin to aarch64-apple-darwin ## [0.3.0] - 2021-02-08 @@ -157,8 +152,7 @@ and this project adheres to - Initial release. -[unreleased]: - https://github.com/daxpedda/sentry-contrib-native/compare/0.3.0...HEAD +[0.3.1]: https://github.com/daxpedda/sentry-contrib-native/releases/tag/0.3.1 [0.3.0]: https://github.com/daxpedda/sentry-contrib-native/releases/tag/0.3.0 [0.2.1]: https://github.com/daxpedda/sentry-contrib-native/releases/tag/0.2.1 [0.2.0]: https://github.com/daxpedda/sentry-contrib-native/releases/tag/0.2.0 diff --git a/Cargo.toml b/Cargo.toml index 6020094e..f6de2caf 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sentry-contrib-native" -version = "0.3.0" +version = "0.3.1" authors = ["daxpedda "] edition = "2018" description = "Unofficial bindings to the Sentry Native SDK for Rust." @@ -18,7 +18,7 @@ members = ["sentry-contrib-native-sys", "tests/res/dylib"] http = { version = "0.2", optional = true } once_cell = "1" rmpv = "0.4" -sys = { package = "sentry-contrib-native-sys", version = "0.3.0", path = "sentry-contrib-native-sys", default-features = false } +sys = { package = "sentry-contrib-native-sys", version = "0.3.1", path = "sentry-contrib-native-sys", default-features = false } thiserror = "1" url = { version = "2", optional = true } vsprintf = "2" diff --git a/sentry-contrib-native-sys/Cargo.toml b/sentry-contrib-native-sys/Cargo.toml index adfad5c8..6e2a0644 100644 --- a/sentry-contrib-native-sys/Cargo.toml +++ b/sentry-contrib-native-sys/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sentry-contrib-native-sys" -version = "0.3.0" +version = "0.3.1" authors = ["daxpedda "] edition = "2018" links = "sentry-native" diff --git a/sentry-contrib-native-sys/sentry-native b/sentry-contrib-native-sys/sentry-native index 5fcb1dc4..06d43609 160000 --- a/sentry-contrib-native-sys/sentry-native +++ b/sentry-contrib-native-sys/sentry-native @@ -1 +1 @@ -Subproject commit 5fcb1dc4d1c8b85fc5ab225d29c7394b375fd1e9 +Subproject commit 06d436096653925e5d7a493e413c9981ce7c5f1c diff --git a/sentry-contrib-native-sys/src/lib.rs b/sentry-contrib-native-sys/src/lib.rs index 5cd71531..2e8d56c4 100644 --- a/sentry-contrib-native-sys/src/lib.rs +++ b/sentry-contrib-native-sys/src/lib.rs @@ -22,7 +22,7 @@ use std::{ pub type c_wchar = u16; /// SDK Version -pub const SDK_USER_AGENT: &str = "sentry.native/0.4.7"; +pub const SDK_USER_AGENT: &str = "sentry.native/0.4.9"; /// The Sentry Client Options. /// @@ -134,7 +134,7 @@ pub enum UserConsent { /// In case of `false`, sentry will log an error, but continue with freeing /// the transport. /// * `free_func`: Frees the transports `state`. This hook might be called even -/// though `shudown_func` returned `false` previously. +/// though `shutdown_func` returned `false` previously. /// /// The transport interface might be extended in the future with hooks to flush /// its internal queue without shutting down, and to dump its internal queue to @@ -158,8 +158,12 @@ pub struct Envelope([u8; 0]); /// same event. In case the event should be discarded, the callback needs to /// call `sentry_value_decref` on the provided event, and return a /// `sentry_value_new_null()` instead. +/// /// This function may be invoked inside of a signal handler and must be safe for /// that purpose, see . +/// On Windows, it may be called from inside of a `UnhandledExceptionFilter`, +/// see the documentation on SEH (structured exception handling) for more +/// information pub type EventFunction = extern "C" fn(event: Value, hint: *mut c_void, closure: *mut c_void) -> Value; @@ -300,24 +304,80 @@ extern "C" { #[link_name = "sentry_value_is_true"] pub fn value_is_true(value: Value) -> c_int; - /// Creates a new empty event value. + /// Creates a new empty Event value. + /// + /// See for how to + /// further work with events, and + /// for a detailed overview of the possible properties of an Event. #[link_name = "sentry_value_new_event"] pub fn value_new_event() -> Value; - /// Creates a new message event value. + /// Creates a new Message Event value. + /// + /// See /// /// `logger` can be NULL to omit the logger value. #[link_name = "sentry_value_new_message_event"] pub fn value_new_message_event(level: i32, logger: *const c_char, text: *const c_char) -> Value; - /// Creates a new breadcrumb with a specific type and message. + /// Creates a new Breadcrumb with a specific type and message. + /// + /// See /// /// Either parameter can be NULL in which case no such attributes is /// created. #[link_name = "sentry_value_new_breadcrumb"] pub fn value_new_breadcrumb(type_: *const c_char, message: *const c_char) -> Value; + /// Creates a new Exception value. + /// + /// This is intended for capturing language-level exception, such as from a + /// try-catch block. `type` and `value` here refer to the exception class + /// and a possible description. + /// + /// See + /// + /// The returned value needs to be attached to an event via + /// `sentry_event_add_exception`. + #[link_name = "sentry_value_new_exception"] + pub fn value_new_exception(type_: *const c_char, value: *const c_char) -> Value; + + /// Creates a new Thread value. + /// + /// See + /// + /// The returned value needs to be attached to an event via + /// `sentry_event_add_thread`. + /// + /// `name` can be NULL. + #[link_name = "sentry_value_new_thread"] + pub fn value_new_thread(id: u64, value: *const c_char) -> Value; + + /// Creates a new Stack Trace conforming to the Stack Trace Interface. + /// + /// See + /// + /// The returned object needs to be attached to either an exception + /// event, or a thread object. + /// + /// If `ips` is NULL the current stack trace is captured, otherwise `len` + /// stack trace instruction pointers are attached to the event. + #[link_name = "sentry_value_new_stacktrace"] + pub fn value_new_stacktrace(ips: *mut *mut c_void, len: usize) -> Value; + + /// Adds an Exception to an Event value. + /// + /// This takes ownership of the `exception`. + #[link_name = "sentry_event_add_exception"] + pub fn event_add_exception(event: Value, exception: Value); + + /// Adds a Thread to an Event value. + /// + /// This takes ownership of the `thread`. + #[link_name = "sentry_event_add_thread"] + pub fn event_add_thread(event: Value, thread: Value); + /// Serialize a Sentry value to msgpack. /// /// The string is freshly allocated and must be freed with @@ -326,10 +386,15 @@ extern "C" { #[link_name = "sentry_value_to_msgpack"] pub fn value_to_msgpack(value: Value, size_out: *mut usize) -> *mut c_char; - /// Adds a stacktrace to an event. + /// Adds a stack trace to an event. + /// + /// The stack trace is added as part of a new thread object. + /// This function is **deprecated** in favor of using + /// `sentry_value_new_stacktrace` in combination with + /// `sentry_value_new_thread` and `sentry_event_add_thread`. /// - /// If `ips` is NULL the current stacktrace is captured, otherwise `len` - /// stacktrace instruction pointers are attached to the event. + /// If `ips` is NULL the current stack trace is captured, otherwise `len` + /// stack trace instruction pointers are attached to the event. #[link_name = "sentry_event_value_add_stacktrace"] pub fn event_value_add_stacktrace(event: Value, ips: *mut *mut c_void, len: usize); @@ -527,7 +592,7 @@ extern "C" { /// Automatic session tracking is enabled by default and is equivalent to /// calling `sentry_start_session` after startup. /// There can only be one running session, and the current session will - /// always be closed implicitly by `sentry_shutdown`, when starting a + /// always be closed implicitly by `sentry_close`, when starting a /// new session with `sentry_start_session`, or manually by calling /// `sentry_end_session`. #[link_name = "sentry_options_set_auto_session_tracking"] @@ -651,8 +716,8 @@ extern "C" { /// Shuts down the Sentry client and forces transports to flush out. /// /// Returns 0 on success. - #[link_name = "sentry_shutdown"] - pub fn shutdown() -> c_int; + #[link_name = "sentry_close"] + pub fn close() -> c_int; /// This will lazily load and cache a list of all the loaded libraries. /// diff --git a/src/lib.rs b/src/lib.rs index 678a7d60..2e1be255 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -196,7 +196,7 @@ impl Consent { /// } /// ``` pub fn shutdown() { - unsafe { sys::shutdown() }; + unsafe { sys::close() }; // de-allocate `BEFORE_SEND` BEFORE_SEND