Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

frida: clarify runtime lifetimes #160

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft

Conversation

ajwerner
Copy link
Contributor

Also introduces an abstraction around GObject to try to more appropriately capture the situation.

Also introduces an abstraction around GObject to try to more
appropriately capture the situation.
}

/// Returns the device's name.
pub fn get_name(&self) -> &str {
let name =
unsafe { CStr::from_ptr(frida_sys::frida_device_get_name(self.device_ptr) as _) };
let name = unsafe { CStr::from_ptr(frida_sys::frida_device_get_name(self.0.ptr()) as _) };
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this not call the ptr() function above?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same for the rest of the self.0.ptr() calls...

pub struct DeviceManager<'a> {
#[derive(Clone)]
pub struct DeviceManager {
frida: Frida,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we call this frida here, but runtime() above... Let's choose one and stick with it.

}
}

static THE_ONE_TRUE_FRIDA: Mutex<Option<Arc<FridaSingleton>>> = Mutex::new(None);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While this name is cute and pithy, would be better to call it FRIDA_SINGLETON, I think.

ptr
}

pub(crate) fn new(ptr: *mut T, runtime: RT) -> Self {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

perhaps this should be called from_raw?

@@ -85,7 +72,7 @@ impl<'a> SpawnOptions<'a> {
let mut arg_ptrs: Vec<*mut _> = args.iter().map(|s| s.as_ptr() as *mut _).collect();
unsafe {
frida_sys::frida_spawn_options_set_argv(
self.options_ptr,
self.0.ptr(),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

self.ptr(), no?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants