From a9d3753b9e6dcdb463a85a9d613ae37b00e94157 Mon Sep 17 00:00:00 2001 From: Josh Ferrell Date: Mon, 14 Oct 2024 15:59:56 -0400 Subject: Support loading IDBs from projects in idb_import --- rust/examples/idb_import/src/lib.rs | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'rust/examples') diff --git a/rust/examples/idb_import/src/lib.rs b/rust/examples/idb_import/src/lib.rs index d611d1d7..4bd75c79 100644 --- a/rust/examples/idb_import/src/lib.rs +++ b/rust/examples/idb_import/src/lib.rs @@ -20,8 +20,14 @@ use anyhow::Result; struct IDBDebugInfoParser; impl CustomDebugInfoParser for IDBDebugInfoParser { fn is_valid(&self, view: &BinaryView) -> bool { - view.file().filename().as_str().ends_with(".i64") - || view.file().filename().as_str().ends_with(".idb") + 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 { + view.file().filename().as_str().ends_with(".i64") + || view.file().filename().as_str().ends_with(".idb") + } } fn parse_info( @@ -44,7 +50,12 @@ impl CustomDebugInfoParser for IDBDebugInfoParser { struct TILDebugInfoParser; impl CustomDebugInfoParser for TILDebugInfoParser { fn is_valid(&self, view: &BinaryView) -> bool { - view.file().filename().as_str().ends_with(".til") + if let Some(project_file) = view.file().get_project_file() { + project_file.name().as_str().ends_with(".til") + } + else { + view.file().filename().as_str().ends_with(".til") + } } fn parse_info( -- cgit v1.3.1