From a0141c6c8c17d34f43355688b38271108d93d676 Mon Sep 17 00:00:00 2001 From: Amaan Qureshi Date: Mon, 15 Apr 2024 08:23:37 -0400 Subject: [PATCH] fix: compilation on nightly (#130) --- frida-gum/src/instruction_writer/aarch64/writer.rs | 6 +++++- frida-gum/src/instruction_writer/x86_64/writer.rs | 6 +++++- frida-gum/src/lib.rs | 12 ++++++++++-- frida-gum/src/memory_range.rs | 6 +++++- frida-gum/src/module.rs | 6 +++++- frida-gum/src/module_map.rs | 6 +++++- frida-gum/src/range_details.rs | 9 ++++++--- frida-gum/src/stalker/transformer.rs | 6 +++++- frida/src/process.rs | 1 - 9 files changed, 46 insertions(+), 12 deletions(-) diff --git a/frida-gum/src/instruction_writer/aarch64/writer.rs b/frida-gum/src/instruction_writer/aarch64/writer.rs index 6f218bc..4bd1e86 100644 --- a/frida-gum/src/instruction_writer/aarch64/writer.rs +++ b/frida-gum/src/instruction_writer/aarch64/writer.rs @@ -7,7 +7,11 @@ use { gum_sys::GumArgument, }; -#[cfg(not(feature = "module-names"))] +#[cfg(not(any( + feature = "module-names", + feature = "backtrace", + feature = "memory-access-monitor" +)))] use alloc::vec::Vec; /// The Aarch64 instruction writer. diff --git a/frida-gum/src/instruction_writer/x86_64/writer.rs b/frida-gum/src/instruction_writer/x86_64/writer.rs index 6e330d9..335e0ff 100644 --- a/frida-gum/src/instruction_writer/x86_64/writer.rs +++ b/frida-gum/src/instruction_writer/x86_64/writer.rs @@ -5,7 +5,11 @@ use { gum_sys::{gssize, GumArgument, GumBranchHint}, }; -#[cfg(not(feature = "module-names"))] +#[cfg(not(any( + feature = "module-names", + feature = "backtrace", + feature = "memory-access-monitor" +)))] use alloc::vec::Vec; /// The x86/x86_64 instruction writer. diff --git a/frida-gum/src/lib.rs b/frida-gum/src/lib.rs index f25d6e6..bc07f61 100644 --- a/frida-gum/src/lib.rs +++ b/frida-gum/src/lib.rs @@ -58,7 +58,11 @@ #![allow(clippy::needless_doctest_main)] #![allow(clippy::missing_safety_doc)] -#[cfg(not(feature = "module-names"))] +#[cfg(not(any( + feature = "module-names", + feature = "backtrace", + feature = "memory-access-monitor" +)))] extern crate alloc; extern crate num; @@ -71,7 +75,11 @@ use core::{ fmt::{Debug, Display, Formatter, LowerHex, UpperHex}, }; -#[cfg(not(feature = "module-names"))] +#[cfg(not(any( + feature = "module-names", + feature = "backtrace", + feature = "memory-access-monitor" +)))] use alloc::string::String; pub mod stalker; diff --git a/frida-gum/src/memory_range.rs b/frida-gum/src/memory_range.rs index e9e1dc8..b92eea8 100644 --- a/frida-gum/src/memory_range.rs +++ b/frida-gum/src/memory_range.rs @@ -11,7 +11,11 @@ use core::{ ops::Range, }; -#[cfg(not(feature = "module-names"))] +#[cfg(not(any( + feature = "module-names", + feature = "backtrace", + feature = "memory-access-monitor" +)))] use alloc::vec::Vec; pub struct MatchPattern { diff --git a/frida-gum/src/module.rs b/frida-gum/src/module.rs index beb5779..956f6d1 100644 --- a/frida-gum/src/module.rs +++ b/frida-gum/src/module.rs @@ -21,7 +21,11 @@ use { frida_gum_sys::{gboolean, gpointer, GumExportDetails, GumModuleDetails, GumSymbolDetails}, }; -#[cfg(not(feature = "module-names"))] +#[cfg(not(any( + feature = "module-names", + feature = "backtrace", + feature = "memory-access-monitor" +)))] 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 a1f5ffc..61e249d 100644 --- a/frida-gum/src/module_map.rs +++ b/frida-gum/src/module_map.rs @@ -19,7 +19,11 @@ use { frida_gum_sys as gum_sys, }; -#[cfg(not(feature = "module-names"))] +#[cfg(not(any( + feature = "module-names", + feature = "backtrace", + feature = "memory-access-monitor" +)))] use alloc::{ boxed::Box, string::{String, ToString}, diff --git a/frida-gum/src/range_details.rs b/frida-gum/src/range_details.rs index 6f3c5b2..5c39825 100644 --- a/frida-gum/src/range_details.rs +++ b/frida-gum/src/range_details.rs @@ -13,7 +13,6 @@ extern crate alloc; use { crate::MemoryRange, - alloc::string::String, core::{ ffi::{c_void, CStr}, marker::PhantomData, @@ -21,8 +20,12 @@ use { frida_gum_sys as gum_sys, }; -#[cfg(not(feature = "module-names"))] -use alloc::boxed::Box; +#[cfg(not(any( + feature = "module-names", + feature = "backtrace", + feature = "memory-access-monitor" +)))] +use alloc::{boxed::Box, string::String}; /// The memory protection of an unassociated page. #[derive(Clone, FromPrimitive)] diff --git a/frida-gum/src/stalker/transformer.rs b/frida-gum/src/stalker/transformer.rs index 5faa02c..f124593 100644 --- a/frida-gum/src/stalker/transformer.rs +++ b/frida-gum/src/stalker/transformer.rs @@ -10,7 +10,11 @@ use { core::{ffi::c_void, marker::PhantomData}, }; -#[cfg(not(feature = "module-names"))] +#[cfg(not(any( + feature = "module-names", + feature = "backtrace", + feature = "memory-access-monitor" +)))] use alloc::boxed::Box; pub struct StalkerIterator<'a> { diff --git a/frida/src/process.rs b/frida/src/process.rs index 4741c64..2b126ce 100644 --- a/frida/src/process.rs +++ b/frida/src/process.rs @@ -5,7 +5,6 @@ */ use frida_sys::{FridaSpawnOptions, _FridaProcess}; -use std::convert::TryInto; use std::ffi::{CStr, CString}; use std::marker::PhantomData;