diff --git a/frida-gum/Cargo.toml b/frida-gum/Cargo.toml index e539708..60e8b14 100644 --- a/frida-gum/Cargo.toml +++ b/frida-gum/Cargo.toml @@ -9,13 +9,14 @@ description.workspace = true [features] auto-download = ["frida-gum-sys/auto-download"] -backtrace = ["libc"] +backtrace = ["libc", "std"] event-sink = ["frida-gum-sys/event-sink"] invocation-listener = ["frida-gum-sys/invocation-listener"] -memory-access-monitor = [] -module-names = [] +memory-access-monitor = ["std"] +module-names = ["std"] stalker-observer = ["frida-gum-sys/stalker-observer"] stalker-params = ["frida-gum-sys/stalker-params"] +std = [] [dependencies] cstr_core = { version = "0.2.6", default-features = false, features = [ @@ -40,4 +41,5 @@ features = [ "invocation-listener", "stalker-observer", "stalker-params", + "std" ] diff --git a/frida-gum/src/lib.rs b/frida-gum/src/lib.rs index 091ac5c..a1c9d97 100644 --- a/frida-gum/src/lib.rs +++ b/frida-gum/src/lib.rs @@ -45,23 +45,12 @@ //! } //! ``` -#![cfg_attr( - not(any( - feature = "module-names", - feature = "backtrace", - feature = "memory-access-monitor" - )), - no_std -)] +#![cfg_attr(not(feature = "std"), no_std)] #![deny(warnings)] #![allow(clippy::needless_doctest_main)] #![allow(clippy::missing_safety_doc)] -#[cfg(not(any( - feature = "module-names", - feature = "backtrace", - feature = "memory-access-monitor" -)))] +#[cfg(not(feature = "std"))] extern crate alloc; extern crate num; @@ -74,11 +63,7 @@ use core::{ fmt::{Debug, Display, Formatter, LowerHex, UpperHex}, }; -#[cfg(not(any( - feature = "module-names", - feature = "backtrace", - feature = "memory-access-monitor" -)))] +#[cfg(not(feature = "std"))] use alloc::string::String; pub mod stalker; diff --git a/frida-gum/src/memory_range.rs b/frida-gum/src/memory_range.rs index b92eea8..fa25f06 100644 --- a/frida-gum/src/memory_range.rs +++ b/frida-gum/src/memory_range.rs @@ -11,11 +11,7 @@ use core::{ ops::Range, }; -#[cfg(not(any( - feature = "module-names", - feature = "backtrace", - feature = "memory-access-monitor" -)))] +#[cfg(not(feature = "std"))] use alloc::vec::Vec; pub struct MatchPattern { diff --git a/frida-gum/src/module.rs b/frida-gum/src/module.rs index 956f6d1..b5dfd97 100644 --- a/frida-gum/src/module.rs +++ b/frida-gum/src/module.rs @@ -21,11 +21,7 @@ use { frida_gum_sys::{gboolean, gpointer, GumExportDetails, GumModuleDetails, GumSymbolDetails}, }; -#[cfg(not(any( - feature = "module-names", - feature = "backtrace", - feature = "memory-access-monitor" -)))] +#[cfg(not(feature = "std"))] use alloc::{boxed::Box, string::String, vec, vec::Vec}; extern "C" fn enumerate_ranges_callout( diff --git a/frida-gum/src/module_map.rs b/frida-gum/src/module_map.rs index 61e249d..a661fe2 100644 --- a/frida-gum/src/module_map.rs +++ b/frida-gum/src/module_map.rs @@ -19,11 +19,7 @@ use { frida_gum_sys as gum_sys, }; -#[cfg(not(any( - feature = "module-names", - feature = "backtrace", - feature = "memory-access-monitor" -)))] +#[cfg(not(feature = "std"))] use alloc::{ boxed::Box, string::{String, ToString}, diff --git a/frida-gum/src/range_details.rs b/frida-gum/src/range_details.rs index f39c531..d8a3277 100644 --- a/frida-gum/src/range_details.rs +++ b/frida-gum/src/range_details.rs @@ -20,11 +20,7 @@ use { frida_gum_sys as gum_sys, }; -#[cfg(not(any( - feature = "module-names", - feature = "backtrace", - feature = "memory-access-monitor" -)))] +#[cfg(not(feature = "std"))] use alloc::{boxed::Box, string::String}; /// The memory protection of an unassociated page. diff --git a/frida-gum/src/stalker/transformer.rs b/frida-gum/src/stalker/transformer.rs index b9ed242..48a29d6 100644 --- a/frida-gum/src/stalker/transformer.rs +++ b/frida-gum/src/stalker/transformer.rs @@ -10,11 +10,7 @@ use { core::{ffi::c_void, marker::PhantomData}, }; -#[cfg(not(any( - feature = "module-names", - feature = "backtrace", - feature = "memory-access-monitor" -)))] +#[cfg(not(feature = "std"))] use alloc::boxed::Box; pub struct StalkerIterator<'a> {