Skip to content

Commit

Permalink
Add Icicle.architecture property
Browse files Browse the repository at this point in the history
  • Loading branch information
mrexodia committed Oct 13, 2024
1 parent 4083d9f commit a487432
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
3 changes: 3 additions & 0 deletions python/icicle/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,9 @@ def __init__(self, architecture: str, *,
tracing = False,
) -> None: ...

@property
def architecture(self) -> str: ...

@property
def exception_code(self) -> ExceptionCode: ...

Expand Down
9 changes: 8 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,7 @@ fn convert_protection(protection: MemoryProtection) -> u8 {

#[pyclass(unsendable, module = "icicle")]
struct Icicle {
architecture: String,
vm: icicle_vm::Vm,
regs: HashMap<String, NamedRegister>,
}
Expand Down Expand Up @@ -269,6 +270,11 @@ impl Icicle {
self.vm.cpu.exception.value
}

#[getter]
fn get_architecture(&self) -> String {
self.architecture.to_string()
}

#[new]
#[pyo3(signature = (
architecture,
Expand Down Expand Up @@ -341,6 +347,7 @@ impl Icicle {
}

Ok(Icicle {
architecture,
vm,
regs,
})
Expand All @@ -353,7 +360,7 @@ impl Icicle {
} else {
"little endian"
};
format!("Icicle VM for {0:?} ({endianness})", arch.triple.architecture)
format!("Icicle VM for {0:?} ({endianness})", self.architecture)
}

fn mem_map(&mut self, address: u64, size: u64, protection: MemoryProtection) -> PyResult<()> {
Expand Down

0 comments on commit a487432

Please sign in to comment.