Skip to content

Commit 621572f

Browse files
committed
Support Ghidra processor modules in the icicle python module directory
1 parent 050670e commit 621572f

File tree

3 files changed

+15
-3
lines changed

3 files changed

+15
-3
lines changed

Cargo.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,4 @@ tracing = "*"
2121
tracing-subscriber = "0.3.17"
2222

2323
[build-dependencies]
24-
pyo3-build-config = "0.18.3"
24+
pyo3-build-config = "0.18.3"

src/lib.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -515,6 +515,18 @@ class MemoryError(Exception):
515515
self.code = code
516516
def __str__(self):
517517
return f"{super().__str__()}: {self.code}"
518+
519+
def __ghidra_init():
520+
import os
521+
for path in __path__ + [os.getenv("GHIDRA_SRC")]:
522+
processors_dir = os.path.join(path, "Ghidra/Processors")
523+
if os.path.isdir(processors_dir):
524+
os.putenv("GHIDRA_SRC", path)
525+
os.environ["GHIDRA_SRC"] = path
526+
return
527+
raise FileNotFoundError("Ghidra processors not found")
528+
529+
__ghidra_init()
518530
"#, "icicle_exceptions.py", "icicle")?;
519531
Ok(())
520532
}

0 commit comments

Comments
 (0)