summaryrefslogtreecommitdiff
path: root/rust/examples
diff options
context:
space:
mode:
authorMason Reed <mason@vector35.com>2024-12-03 11:05:06 -0500
committerMason Reed <mason@vector35.com>2024-12-03 11:08:39 -0500
commit9b22a138793d31972cf2c8b3350eb2025505befe (patch)
treee132d96bebd89a08f5f401e994f77a6fe5859851 /rust/examples
parentd14513b4abcd436082a768b73de9932fe67646e6 (diff)
IDB Import: Bump idb-rs dependency
Fixes many of the known parsing failures
Diffstat (limited to 'rust/examples')
-rw-r--r--rust/examples/idb_import/Cargo.toml2
-rw-r--r--rust/examples/idb_import/src/lib.rs10
-rw-r--r--rust/examples/idb_import/src/types.rs12
3 files changed, 11 insertions, 13 deletions
diff --git a/rust/examples/idb_import/Cargo.toml b/rust/examples/idb_import/Cargo.toml
index dd1e6c69..4e6acbad 100644
--- a/rust/examples/idb_import/Cargo.toml
+++ b/rust/examples/idb_import/Cargo.toml
@@ -10,5 +10,5 @@ crate-type = ["cdylib"]
[dependencies]
anyhow = { version = "1.0.86", features = ["backtrace"] }
binaryninja = { path = "../../" }
-idb-rs = { git = "https://github.com/Vector35/idb-rs", version = "0.1.4" }
+idb-rs = { git = "https://github.com/Vector35/idb-rs", version = "0.1.5" }
log = "0.4.20"
diff --git a/rust/examples/idb_import/src/lib.rs b/rust/examples/idb_import/src/lib.rs
index 3308f905..4adf04ca 100644
--- a/rust/examples/idb_import/src/lib.rs
+++ b/rust/examples/idb_import/src/lib.rs
@@ -23,8 +23,7 @@ impl CustomDebugInfoParser for IDBDebugInfoParser {
if let Some(project_file) = view.file().get_project_file() {
project_file.name().as_str().ends_with(".i64")
|| project_file.name().as_str().ends_with(".idb")
- }
- else {
+ } else {
view.file().filename().as_str().ends_with(".i64")
|| view.file().filename().as_str().ends_with(".idb")
}
@@ -52,8 +51,7 @@ impl CustomDebugInfoParser for TILDebugInfoParser {
fn is_valid(&self, view: &BinaryView) -> bool {
if let Some(project_file) = view.file().get_project_file() {
project_file.name().as_str().ends_with(".til")
- }
- else {
+ } else {
view.file().filename().as_str().ends_with(".til")
}
}
@@ -337,7 +335,9 @@ fn parse_id0_section_info(
#[allow(non_snake_case)]
#[no_mangle]
pub extern "C" fn CorePluginInit() -> bool {
- Logger::new("IDB Import").with_level(LevelFilter::Error).init();
+ Logger::new("IDB Import")
+ .with_level(LevelFilter::Error)
+ .init();
DebugInfoParser::register("IDB Parser", IDBDebugInfoParser);
DebugInfoParser::register("TIL Parser", TILDebugInfoParser);
true
diff --git a/rust/examples/idb_import/src/types.rs b/rust/examples/idb_import/src/types.rs
index 360aa119..01cc5ff3 100644
--- a/rust/examples/idb_import/src/types.rs
+++ b/rust/examples/idb_import/src/types.rs
@@ -137,11 +137,7 @@ impl<F: Fn(usize, usize) -> Result<(), ()>> TranslateIDBTypes<'_, F> {
b"Unkown" | b"uint8_t" => Some(TranslateTypeResult::Translated(Type::int(1, false))),
b"IUnkown" | b"int8_t" => Some(TranslateTypeResult::Translated(Type::int(1, true))),
b"SHORT" | b"USHORT" => Some(TranslateTypeResult::Translated(Type::int(
- self.til
- .sizes
- .map(|x| x.size_short.get())
- .unwrap_or(2)
- .into(),
+ self.til.size_short.get() as usize,
name == b"SHORT",
))),
b"int16_t" => Some(TranslateTypeResult::Translated(Type::int(2, true))),
@@ -558,11 +554,13 @@ pub fn translate_ephemeral_type(debug_file: &BinaryView, ty: &TILType) -> Transl
cm: 0,
def_align: 1,
symbols: vec![],
- type_ordinal_numbers: None,
+ type_ordinal_alias: None,
types: vec![],
size_i: 4.try_into().unwrap(),
size_b: 1.try_into().unwrap(),
- sizes: None,
+ size_short: 2.try_into().unwrap(),
+ size_long: 4.try_into().unwrap(),
+ size_long_long: 8.try_into().unwrap(),
size_long_double: None,
macros: None,
is_universal: false,