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

Fix DOCS_RS with javascipt and without auto-download; Update Frida to 16.5.6 #173

Merged
merged 4 commits into from
Oct 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
/target
Cargo.lock
.vscode
2 changes: 1 addition & 1 deletion FRIDA_VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
16.5.2
16.5.6
2 changes: 1 addition & 1 deletion examples/gum/linux_no_std/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ static ALLOC: Bump<[u8; HEAP_SIZE]> = Bump::uninit();
#[no_mangle]
extern "C" fn main() {
println!("NOSTD START");
let gum = unsafe { Gum::obtain() };
let gum = Gum::obtain();
println!("gum: {:p}", &gum);
println!("NOSTD DONE");
unsafe { _exit(0) };
Expand Down
2 changes: 1 addition & 1 deletion frida-gum-sys/FRIDA_VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
16.5.2
16.5.6
44 changes: 24 additions & 20 deletions frida-gum-sys/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,18 @@ fn main() {

let target_os = env::var("CARGO_CFG_TARGET_OS").unwrap();
let target_vendor = env::var("CARGO_CFG_TARGET_VENDOR").unwrap();

let docs = std::env::var("DOCS_RS").is_ok();
// We always use frida-gumjs.h for docs to not have to ship two big header files in this repo.
let use_gum_js = cfg!(feature = "js") || (!cfg!(feature = "auto-download") && docs);
#[cfg(any(
feature = "event-sink",
feature = "invocation-listener",
feature = "stalker-observer",
feature = "stalker-params"
))]
let use_gum_js_env = if use_gum_js { "1" } else { "0" };

#[cfg(feature = "event-sink")]
{
println!("cargo:rerun-if-changed=event_sink.c");
Expand Down Expand Up @@ -72,13 +84,13 @@ fn main() {
let bindings = bindings.clang_arg(format!("-I{include_dir}"));

#[cfg(not(feature = "auto-download"))]
let bindings = if std::env::var("DOCS_RS").is_ok() {
let bindings = if docs {
bindings.clang_arg("-Iinclude")
} else {
bindings
};

let bindings = if cfg!(feature = "js") {
let bindings = if use_gum_js {
bindings
.clang_arg("-DUSE_GUM_JS=1")
.header_contents("gum.h", "#include \"frida-gumjs.h\"")
Expand Down Expand Up @@ -109,14 +121,6 @@ fn main() {
.write_to_file(out_path.join("bindings.rs"))
.unwrap();

#[cfg(any(
feature = "event-sink",
feature = "invocation-listener",
feature = "stalker-observer",
feature = "stalker-params"
))]
let use_gum_js = if cfg!(feature = "js") { "1" } else { "0" };

#[cfg(feature = "event-sink")]
{
let mut builder = cc::Build::new();
Expand All @@ -126,7 +130,7 @@ fn main() {
let mut builder = builder.include(include_dir.clone());

#[cfg(not(feature = "auto-download"))]
let builder = if std::env::var("DOCS_RS").is_ok() {
let builder = if docs {
builder.include("include")
} else {
&mut builder
Expand All @@ -135,7 +139,7 @@ fn main() {
builder
.file("event_sink.c")
.opt_level(3)
.define("USE_GUM_JS", use_gum_js)
.define("USE_GUM_JS", use_gum_js_env)
.compile("event_sink");
}

Expand All @@ -148,7 +152,7 @@ fn main() {
let mut builder = builder.include(include_dir.clone());

#[cfg(not(feature = "auto-download"))]
let builder = if std::env::var("DOCS_RS").is_ok() {
let builder = if docs {
builder.include("include")
} else {
&mut builder
Expand All @@ -157,7 +161,7 @@ fn main() {
builder
.file("invocation_listener.c")
.opt_level(3)
.define("USE_GUM_JS", use_gum_js)
.define("USE_GUM_JS", use_gum_js_env)
.compile("invocation_listener");

let mut builder = cc::Build::new();
Expand All @@ -167,15 +171,15 @@ fn main() {
let mut builder = builder.include(include_dir.clone());

#[cfg(not(feature = "auto-download"))]
let builder = if std::env::var("DOCS_RS").is_ok() {
let builder = if docs {
builder.include("include")
} else {
&mut builder
};
builder
.file("probe_listener.c")
.opt_level(3)
.define("USE_GUM_JS", use_gum_js)
.define("USE_GUM_JS", use_gum_js_env)
.compile("probe_listener");
}

Expand All @@ -188,7 +192,7 @@ fn main() {
let mut builder = builder.include(include_dir.clone());

#[cfg(not(feature = "auto-download"))]
let builder = if std::env::var("DOCS_RS").is_ok() {
let builder = if docs {
builder.include("include")
} else {
&mut builder
Expand All @@ -197,7 +201,7 @@ fn main() {
builder
.file("stalker_observer.c")
.opt_level(3)
.define("USE_GUM_JS", use_gum_js)
.define("USE_GUM_JS", use_gum_js_env)
.compile("stalker_observer");
}

Expand All @@ -210,7 +214,7 @@ fn main() {
let mut builder = builder.include(include_dir);

#[cfg(not(feature = "auto-download"))]
let builder = if std::env::var("DOCS_RS").is_ok() {
let builder = if docs {
builder.include("include")
} else {
&mut builder
Expand All @@ -219,7 +223,7 @@ fn main() {
builder
.file("stalker_params.c")
.opt_level(3)
.define("USE_GUM_JS", use_gum_js)
.define("USE_GUM_JS", use_gum_js_env)
.compile("stalker_params");
}

Expand Down
Loading
Loading