()
| 45 | |
| 46 | #[test] |
| 47 | fn test_binary_saving_database() { |
| 48 | let _session = Session::new().expect("Failed to initialize session"); |
| 49 | let out_dir = env!("OUT_DIR").parse::<PathBuf>().unwrap(); |
| 50 | let view = binaryninja::load(out_dir.join("atox.obj")).expect("Failed to create view"); |
| 51 | // Update a symbol to verify modification |
| 52 | let entry_function = view |
| 53 | .entry_point_function() |
| 54 | .expect("Failed to get entry point function"); |
| 55 | let new_entry_func_symbol = |
| 56 | SymbolBuilder::new(SymbolType::Function, "test", entry_function.start()).create(); |
| 57 | view.define_user_symbol(&new_entry_func_symbol); |
| 58 | // Verify that we modified the binary |
| 59 | assert_eq!(entry_function.symbol().raw_name().as_str(), "test"); |
| 60 | // Save the modified database. |
| 61 | assert!(view.file().create_database(out_dir.join("atox.obj.bndb"))); |
| 62 | // Verify that the file exists and is modified. |
| 63 | let new_view = |
| 64 | binaryninja::load(out_dir.join("atox.obj.bndb")).expect("Failed to load new view"); |
| 65 | let new_entry_function = new_view |
| 66 | .entry_point_function() |
| 67 | .expect("Failed to get entry point function"); |
| 68 | assert_eq!(new_entry_function.symbol().raw_name().as_str(), "test"); |
| 69 | } |
nothing calls this directly
no test coverage detected