summaryrefslogtreecommitdiff
path: root/rust/src/relocation.rs
diff options
context:
space:
mode:
authorRusty Wagner <rusty.wagner@gmail.com>2024-01-03 15:56:01 -0700
committerRusty Wagner <rusty.wagner@gmail.com>2024-01-04 12:42:14 -0700
commit7e8de24c479672261b8a5c9911cac8800bad180b (patch)
tree6992a8a6f59a46c4be93f7a4693b52fc871fbfce /rust/src/relocation.rs
parenta9cfac7ff14d93ff22092366f99eb2dd3213ea7e (diff)
Add GetRelocationsAt API
Diffstat (limited to 'rust/src/relocation.rs')
-rw-r--r--rust/src/relocation.rs20
1 files changed, 19 insertions, 1 deletions
diff --git a/rust/src/relocation.rs b/rust/src/relocation.rs
index cb7e4e3d..7be7861d 100644
--- a/rust/src/relocation.rs
+++ b/rust/src/relocation.rs
@@ -3,7 +3,7 @@ use crate::{
architecture::{Architecture, CoreArchitecture},
binaryview::BinaryView,
llil,
- rc::{Ref, RefCountable},
+ rc::{CoreArrayProvider, CoreArrayWrapper, CoreOwnedArrayProvider, Ref, RefCountable},
symbol::Symbol,
};
use binaryninjacore_sys::*;
@@ -210,6 +210,24 @@ impl Relocation {
}
}
+impl CoreArrayProvider for Relocation {
+ type Raw = *mut BNRelocation;
+ type Context = ();
+}
+
+unsafe impl CoreOwnedArrayProvider for Relocation {
+ unsafe fn free(raw: *mut Self::Raw, count: usize, _context: &Self::Context) {
+ BNFreeRelocationList(raw, count);
+ }
+}
+
+unsafe impl<'a> CoreArrayWrapper<'a> for Relocation {
+ type Wrapped = Relocation;
+ unsafe fn wrap_raw(raw: &'a Self::Raw, _context: &'a Self::Context) -> Self::Wrapped {
+ Relocation(*raw)
+ }
+}
+
pub trait RelocationHandler: 'static + Sized + AsRef<CoreRelocationHandler> {
type Handle: Borrow<Self>;