summaryrefslogtreecommitdiff
path: root/plugins/idb_import/src/addr_info.rs
diff options
context:
space:
mode:
authorrbran <git@rubens.io>2025-05-22 21:12:43 +0000
committerMason Reed <35282038+emesare@users.noreply.github.com>2025-05-27 09:44:36 -0400
commit8820fd7a7a553d8bceea870997cce3c12eeb9427 (patch)
treecf7e53ba62f215d5652198a0ae7ca0d52b0af8c5 /plugins/idb_import/src/addr_info.rs
parentff04e7fbbbd6ccbdd6ed35a4e243699eca99935a (diff)
update idb_import idb-rs to 0.1.10
Diffstat (limited to 'plugins/idb_import/src/addr_info.rs')
-rw-r--r--plugins/idb_import/src/addr_info.rs25
1 files changed, 14 insertions, 11 deletions
diff --git a/plugins/idb_import/src/addr_info.rs b/plugins/idb_import/src/addr_info.rs
index 8d1b1c1b..cb977496 100644
--- a/plugins/idb_import/src/addr_info.rs
+++ b/plugins/idb_import/src/addr_info.rs
@@ -1,30 +1,32 @@
+use std::borrow::Cow;
use std::collections::HashMap;
use anyhow::Result;
use idb_rs::id0::ID0Section;
-use idb_rs::til;
+use idb_rs::{til, IDAKind};
#[derive(Default)]
pub struct AddrInfo<'a> {
// TODO does binja diferenciate comments types on the API?
pub comments: Vec<&'a [u8]>,
- pub label: Option<&'a str>,
+ pub label: Option<Cow<'a, str>>,
// TODO make this a ref
pub ty: Option<til::Type>,
}
-pub fn get_info(id0: &ID0Section, version: u16) -> Result<HashMap<u64, AddrInfo<'_>>> {
- let mut addr_info: HashMap<u64, AddrInfo> = HashMap::new();
+pub fn get_info<K: IDAKind>(
+ id0: &ID0Section<K>,
+ version: u16,
+) -> Result<HashMap<K::Usize, AddrInfo<'_>>> {
+ use idb_rs::id0::FunctionsAndComments::*;
+ let mut addr_info: HashMap<K::Usize, AddrInfo> = HashMap::new();
// the old style comments, most likely empty on new versions
- let old_comments = id0.functions_and_comments()?.filter_map(|fc| {
- use idb_rs::id0::FunctionsAndComments::*;
- match fc {
- Err(e) => Some(Err(e)),
- Ok(Comment { address, comment }) => Some(Ok((address, comment))),
- Ok(Name | Function(_) | Unknown { .. }) => None,
- }
+ let old_comments = id0.functions_and_comments()?.filter_map(|fc| match fc {
+ Err(e) => Some(Err(e)),
+ Ok(Comment { address, comment }) => Some(Ok((address, comment))),
+ Ok(Name | Function(_) | Unknown { .. }) => None,
});
for old_comment in old_comments {
let (addr, comment) = old_comment?;
@@ -50,6 +52,7 @@ pub fn get_info(id0: &ID0Section, version: u16) -> Result<HashMap<u64, AddrInfo<
}
}
Other { .. } => {}
+ DefinedStruct(_) => {}
}
}