summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorrbran <git@rubens.io>2025-01-28 13:54:11 -0300
committermason <35282038+emesare@users.noreply.github.com>2025-01-31 22:13:17 -0500
commit48cec427b50c42af803a25d4511c4d8d94b54e3e (patch)
tree16a96b7f2c62505cecef3478aee3581cd1c0c226 /plugins
parent286d265497a840f06e4ccb321c9bc81139d2e9a2 (diff)
Update IDB import to idb-rs 0.1.9
Diffstat (limited to 'plugins')
-rw-r--r--plugins/idb_import/Cargo.toml4
-rw-r--r--plugins/idb_import/src/types.rs23
2 files changed, 15 insertions, 12 deletions
diff --git a/plugins/idb_import/Cargo.toml b/plugins/idb_import/Cargo.toml
index 3b63027f..1871df6e 100644
--- a/plugins/idb_import/Cargo.toml
+++ b/plugins/idb_import/Cargo.toml
@@ -11,5 +11,5 @@ crate-type = ["cdylib"]
anyhow = { version = "1.0.86", features = ["backtrace"] }
binaryninja.workspace = true
binaryninjacore-sys.workspace = true
-idb-rs = { git = "https://github.com/Vector35/idb-rs", tag = "0.1.8" }
-log = "0.4" \ No newline at end of file
+idb-rs = { git = "https://github.com/Vector35/idb-rs", tag = "0.1.9" }
+log = "0.4"
diff --git a/plugins/idb_import/src/types.rs b/plugins/idb_import/src/types.rs
index 98706429..7b4ca675 100644
--- a/plugins/idb_import/src/types.rs
+++ b/plugins/idb_import/src/types.rs
@@ -219,8 +219,8 @@ impl<F: Fn(usize, usize) -> Result<(), ()>> TranslateIDBTypes<'_, F> {
};
let mut partial_error_args = vec![];
let mut bn_args = Vec::with_capacity(fun.args.len());
- for (i, (arg_name, arg_type, _arg_loc)) in fun.args.iter().enumerate() {
- let arg = match self.translate_type(arg_type) {
+ for (i, fun_arg) in fun.args.iter().enumerate() {
+ let arg = match self.translate_type(&fun_arg.ty) {
TranslateTypeResult::Translated(trans) => trans,
TranslateTypeResult::PartiallyTranslated(trans, error) => {
is_partial = true;
@@ -242,7 +242,8 @@ impl<F: Fn(usize, usize) -> Result<(), ()>> TranslateIDBTypes<'_, F> {
};
// TODO create location from `arg_loc`?
let loc = None;
- let name = arg_name
+ let name = fun_arg
+ .name
.as_ref()
.map(|name| name.as_utf8_lossy().to_string())
.unwrap_or_else(|| format!("arg_{i}"));
@@ -443,11 +444,11 @@ impl<F: Fn(usize, usize) -> Result<(), ()>> TranslateIDBTypes<'_, F> {
let mut structure = StructureBuilder::new();
structure.structure_type(StructureType::UnionStructureType);
let mut errors = vec![];
- for (i, (member_name, member_type)) in ty_union.members.iter().enumerate() {
+ for (i, member) in ty_union.members.iter().enumerate() {
// bitfields can be translated into complete fields
- let mem = match &member_type.type_variant {
+ let mem = match &member.ty.type_variant {
TILTypeVariant::Bitfield(field) => field_from_bytes(field.nbytes.get().into()),
- _ => match self.translate_type(member_type) {
+ _ => match self.translate_type(&member.ty) {
TranslateTypeResult::Translated(ty) => ty,
TranslateTypeResult::Error(error) => {
errors.push((i, error));
@@ -464,7 +465,8 @@ impl<F: Fn(usize, usize) -> Result<(), ()>> TranslateIDBTypes<'_, F> {
},
};
- let name = member_name
+ let name = member
+ .name
.as_ref()
.map(|name| name.as_utf8_lossy().to_string())
.unwrap_or_else(|| format!("member_{i}"));
@@ -484,12 +486,13 @@ impl<F: Fn(usize, usize) -> Result<(), ()>> TranslateIDBTypes<'_, F> {
fn translate_enum(&self, ty_enum: &TILEnum) -> Ref<Type> {
let mut eb = EnumerationBuilder::new();
- for (i, (name, member_value)) in ty_enum.members.iter().enumerate() {
- let name = name
+ for (i, member) in ty_enum.members.iter().enumerate() {
+ let name = member
+ .name
.as_ref()
.map(|name| name.as_utf8_lossy().to_string())
.unwrap_or_else(|| format!("member_{i}"));
- eb.insert(name, *member_value);
+ eb.insert(name, member.value);
}
Type::enumeration(
&eb.finalize(),