Skip to content

Commit 9d23add

Browse files
committed
update idb_import to 0.1.8
1 parent d059f99 commit 9d23add

File tree

2 files changed

+193
-151
lines changed

2 files changed

+193
-151
lines changed

plugins/idb_import/src/lib.rs

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use binaryninja::debuginfo::{
1010

1111
use idb_rs::id0::{ID0Section, IDBParam1, IDBParam2};
1212
use idb_rs::til::section::TILSection;
13-
use idb_rs::til::Type as TILType;
13+
use idb_rs::til::TypeVariant as TILTypeVariant;
1414

1515
use log::{error, trace, warn, LevelFilter};
1616

@@ -148,9 +148,9 @@ fn parse_til_info(
148148
bv: debug_file,
149149
offset: 0,
150150
};
151-
let file = std::io::BufReader::new(file);
151+
let mut file = std::io::BufReader::new(file);
152152
trace!("Parsing the TIL section");
153-
let til = TILSection::parse(file)?;
153+
let til = TILSection::read(&mut file, idb_rs::IDBSectionCompression::None)?;
154154
import_til_section(debug_info, debug_file, &til, progress)
155155
}
156156

@@ -168,26 +168,26 @@ pub fn import_til_section(
168168
TranslateTypeResult::NotYet => {
169169
panic!(
170170
"type could not be processed `{}`: {:#?}",
171-
&String::from_utf8_lossy(&ty.name),
171+
ty.name.as_utf8_lossy(),
172172
&ty.og_ty
173173
);
174174
}
175175
TranslateTypeResult::Error(error) => {
176176
error!(
177177
"Unable to parse type `{}`: {error}",
178-
&String::from_utf8_lossy(&ty.name)
178+
ty.name.as_utf8_lossy(),
179179
);
180180
}
181181
TranslateTypeResult::PartiallyTranslated(_, error) => {
182182
if let Some(error) = error {
183183
error!(
184184
"Unable to parse type `{}` correctly: {error}",
185-
&String::from_utf8_lossy(&ty.name)
185+
ty.name.as_utf8_lossy(),
186186
);
187187
} else {
188188
warn!(
189189
"Type `{}` maybe not be fully translated",
190-
&String::from_utf8_lossy(&ty.name)
190+
ty.name.as_utf8_lossy(),
191191
);
192192
}
193193
}
@@ -200,11 +200,8 @@ pub fn import_til_section(
200200
if let TranslateTypeResult::Translated(bn_ty)
201201
| TranslateTypeResult::PartiallyTranslated(bn_ty, _) = &ty.ty
202202
{
203-
if !debug_info.add_type(String::from_utf8_lossy(&ty.name), bn_ty, &[/* TODO */]) {
204-
error!(
205-
"Unable to add type `{}`",
206-
&String::from_utf8_lossy(&ty.name)
207-
)
203+
if !debug_info.add_type(ty.name.as_utf8_lossy(), bn_ty, &[/* TODO */]) {
204+
error!("Unable to add type `{}`", ty.name.as_utf8_lossy())
208205
}
209206
}
210207
}
@@ -214,11 +211,8 @@ pub fn import_til_section(
214211
if let TranslateTypeResult::Translated(bn_ty)
215212
| TranslateTypeResult::PartiallyTranslated(bn_ty, _) = &ty.ty
216213
{
217-
if !debug_info.add_type(String::from_utf8_lossy(&ty.name), bn_ty, &[/* TODO */]) {
218-
error!(
219-
"Unable to fix type `{}`",
220-
&String::from_utf8_lossy(&ty.name)
221-
)
214+
if !debug_info.add_type(ty.name.as_utf8_lossy(), bn_ty, &[/* TODO */]) {
215+
error!("Unable to fix type `{}`", ty.name.as_utf8_lossy())
222216
}
223217
}
224218
}
@@ -273,7 +267,7 @@ fn parse_id0_section_info(
273267
});
274268

275269
match (label, &ty, bnty) {
276-
(_, Some(TILType::Function(_)), bnty) => {
270+
(_, Some(ty), bnty) if matches!(&ty.type_variant, TILTypeVariant::Function(_)) => {
277271
if bnty.is_none() {
278272
error!("Unable to convert the function type at {addr:#x}",)
279273
}

0 commit comments

Comments
 (0)