Skip to content

Commit

Permalink
Support Ghidra processor modules in the icicle python module directory
Browse files Browse the repository at this point in the history
  • Loading branch information
mrexodia committed Aug 11, 2023
1 parent 050670e commit 621572f
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ tracing = "*"
tracing-subscriber = "0.3.17"

[build-dependencies]
pyo3-build-config = "0.18.3"
pyo3-build-config = "0.18.3"
12 changes: 12 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -515,6 +515,18 @@ class MemoryError(Exception):
self.code = code
def __str__(self):
return f"{super().__str__()}: {self.code}"
def __ghidra_init():
import os
for path in __path__ + [os.getenv("GHIDRA_SRC")]:
processors_dir = os.path.join(path, "Ghidra/Processors")
if os.path.isdir(processors_dir):
os.putenv("GHIDRA_SRC", path)
os.environ["GHIDRA_SRC"] = path
return
raise FileNotFoundError("Ghidra processors not found")
__ghidra_init()
"#, "icicle_exceptions.py", "icicle")?;
Ok(())
}

0 comments on commit 621572f

Please sign in to comment.