summaryrefslogtreecommitdiff
path: root/rust/examples
diff options
context:
space:
mode:
authorJosh Ferrell <josh@vector35.com>2024-10-14 15:59:56 -0400
committerJosh Ferrell <josh@vector35.com>2024-10-14 16:03:03 -0400
commita9d3753b9e6dcdb463a85a9d613ae37b00e94157 (patch)
tree96d9bfa4e971fb92140029f07c91832e6211d4cc /rust/examples
parentf95056eacd7d6432805779773dc122ea7684df11 (diff)
Support loading IDBs from projects in idb_import
Diffstat (limited to 'rust/examples')
-rw-r--r--rust/examples/idb_import/src/lib.rs17
1 files changed, 14 insertions, 3 deletions
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(