From 6264254065bbae9d89f51cf3330379b7ace09592 Mon Sep 17 00:00:00 2001 From: Mason Reed Date: Sat, 3 May 2025 23:15:17 -0400 Subject: [Rust] Return `String` instead of `BnString` for cases where lossy conversion can be tolerated Still need to go and audit all usage, but realistically the most important places to give the user control are with symbols, where the data can come from non utf8 sources This is still incomplete, I just looked for usage of -> BnString so any other variant was omitted. --- plugins/dwarf/dwarf_export/src/lib.rs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'plugins/dwarf/dwarf_export/src') diff --git a/plugins/dwarf/dwarf_export/src/lib.rs b/plugins/dwarf/dwarf_export/src/lib.rs index bc159825..d1754d29 100644 --- a/plugins/dwarf/dwarf_export/src/lib.rs +++ b/plugins/dwarf/dwarf_export/src/lib.rs @@ -18,7 +18,6 @@ use binaryninja::{ interaction, interaction::{FormResponses, FormResponses::Index}, rc::Ref, - string::BnString, symbol::SymbolType, types::{MemberAccess, StructureType, Type, TypeClass}, }; @@ -422,7 +421,7 @@ fn export_functions( // Set subprogram DIE attributes dwarf.unit.get_mut(function_die_uid).set( gimli::DW_AT_name, - AttributeValue::String(function.symbol().short_name().as_bytes().to_vec()), + AttributeValue::String(function.symbol().short_name().to_bytes().to_vec()), ); // TODO : (DW_AT_main_subprogram VS DW_TAG_entry_point) @@ -557,7 +556,7 @@ fn export_data_vars( if let Some(symbol) = data_var_sym { dwarf.unit.get_mut(var_die_uid).set( gimli::DW_AT_name, - AttributeValue::String(symbol.full_name().as_bytes().to_vec()), + AttributeValue::String(symbol.full_name().to_bytes().to_vec()), ); if symbol.external() { @@ -756,7 +755,7 @@ fn export_dwarf(bv: &BinaryView) { let arch_name = if let Some(arch) = bv.default_arch() { arch.name() } else { - BnString::new("Unknown") + String::from("Unknown") }; let responses = present_form(arch_name.as_str()); -- cgit v1.3.1