@@ -10,7 +10,7 @@ use binaryninja::debuginfo::{
1010
1111use idb_rs:: id0:: { ID0Section , IDBParam1 , IDBParam2 } ;
1212use idb_rs:: til:: section:: TILSection ;
13- use idb_rs:: til:: Type as TILType ;
13+ use idb_rs:: til:: TypeVariant as TILTypeVariant ;
1414
1515use log:: { error, trace, warn, LevelFilter } ;
1616
@@ -92,9 +92,7 @@ impl std::io::Seek for BinaryViewReader<'_> {
9292 fn seek ( & mut self , pos : std:: io:: SeekFrom ) -> std:: io:: Result < u64 > {
9393 let new_offset = match pos {
9494 std:: io:: SeekFrom :: Start ( offset) => Some ( offset) ,
95- std:: io:: SeekFrom :: End ( end) => u64:: try_from ( self . bv . len ( ) )
96- . unwrap ( )
97- . checked_add_signed ( end) ,
95+ std:: io:: SeekFrom :: End ( end) => self . bv . len ( ) . checked_add_signed ( end) ,
9896 std:: io:: SeekFrom :: Current ( next) => self . offset . checked_add_signed ( next) ,
9997 } ;
10098 let new_offset =
@@ -148,9 +146,9 @@ fn parse_til_info(
148146 bv : debug_file,
149147 offset : 0 ,
150148 } ;
151- let file = std:: io:: BufReader :: new ( file) ;
149+ let mut file = std:: io:: BufReader :: new ( file) ;
152150 trace ! ( "Parsing the TIL section" ) ;
153- let til = TILSection :: parse ( file) ?;
151+ let til = TILSection :: read ( & mut file, idb_rs :: IDBSectionCompression :: None ) ?;
154152 import_til_section ( debug_info, debug_file, & til, progress)
155153}
156154
@@ -168,26 +166,26 @@ pub fn import_til_section(
168166 TranslateTypeResult :: NotYet => {
169167 panic ! (
170168 "type could not be processed `{}`: {:#?}" ,
171- & String :: from_utf8_lossy ( & ty. name) ,
169+ ty. name. as_utf8_lossy ( ) ,
172170 & ty. og_ty
173171 ) ;
174172 }
175173 TranslateTypeResult :: Error ( error) => {
176174 error ! (
177175 "Unable to parse type `{}`: {error}" ,
178- & String :: from_utf8_lossy ( & ty. name)
176+ ty. name. as_utf8_lossy ( ) ,
179177 ) ;
180178 }
181179 TranslateTypeResult :: PartiallyTranslated ( _, error) => {
182180 if let Some ( error) = error {
183181 error ! (
184182 "Unable to parse type `{}` correctly: {error}" ,
185- & String :: from_utf8_lossy ( & ty. name)
183+ ty. name. as_utf8_lossy ( ) ,
186184 ) ;
187185 } else {
188186 warn ! (
189187 "Type `{}` maybe not be fully translated" ,
190- & String :: from_utf8_lossy ( & ty. name)
188+ ty. name. as_utf8_lossy ( ) ,
191189 ) ;
192190 }
193191 }
@@ -200,11 +198,8 @@ pub fn import_til_section(
200198 if let TranslateTypeResult :: Translated ( bn_ty)
201199 | TranslateTypeResult :: PartiallyTranslated ( bn_ty, _) = & ty. ty
202200 {
203- if !debug_info. add_type ( String :: from_utf8_lossy ( & ty. name ) , bn_ty, & [ /* TODO */ ] ) {
204- error ! (
205- "Unable to add type `{}`" ,
206- & String :: from_utf8_lossy( & ty. name)
207- )
201+ if !debug_info. add_type ( ty. name . as_utf8_lossy ( ) , bn_ty, & [ /* TODO */ ] ) {
202+ error ! ( "Unable to add type `{}`" , ty. name. as_utf8_lossy( ) )
208203 }
209204 }
210205 }
@@ -214,11 +209,8 @@ pub fn import_til_section(
214209 if let TranslateTypeResult :: Translated ( bn_ty)
215210 | TranslateTypeResult :: PartiallyTranslated ( bn_ty, _) = & ty. ty
216211 {
217- if !debug_info. add_type ( String :: from_utf8_lossy ( & ty. name ) , bn_ty, & [ /* TODO */ ] ) {
218- error ! (
219- "Unable to fix type `{}`" ,
220- & String :: from_utf8_lossy( & ty. name)
221- )
212+ if !debug_info. add_type ( ty. name . as_utf8_lossy ( ) , bn_ty, & [ /* TODO */ ] ) {
213+ error ! ( "Unable to fix type `{}`" , ty. name. as_utf8_lossy( ) )
222214 }
223215 }
224216 }
@@ -273,7 +265,7 @@ fn parse_id0_section_info(
273265 } ) ;
274266
275267 match ( label, & ty, bnty) {
276- ( _, Some ( TILType :: Function ( _) ) , bnty ) => {
268+ ( _, Some ( ty ) , bnty ) if matches ! ( & ty . type_variant , TILTypeVariant :: Function ( _) ) => {
277269 if bnty. is_none ( ) {
278270 error ! ( "Unable to convert the function type at {addr:#x}" , )
279271 }
0 commit comments