pub(crate) fn load_types(
    variables: &HashMap<String, VarInfo>,
    units: UnitList,
    dwarf: &gimli::Dwarf<EndianSlice<RunTimeEndian>>,
    verbose: bool
) -> HashMap<usize, TypeInfo> {
    let mut types = HashMap::<usize, TypeInfo>::new();
    // for each variable
    for (_name, VarInfo { typeref, ..}) in variables {
        // check if the type was already loaded
        if types.get(typeref).is_none() {
            if let Some(unit_idx) = units.get_unit(*typeref) {
                // create an entries_tree iterator that makes it possible to read the DIEs of this type
                let (unit, abbrev) = &units[unit_idx];
                let dbginfo_offset = gimli::DebugInfoOffset(*typeref);
                let unit_offset = dbginfo_offset.to_unit_offset(unit).unwrap();
                let mut entries_tree = unit.entries_tree(abbrev, Some(unit_offset)).unwrap();

                // load one type and add it to the collection (always succeeds for correctly structured DWARF debug info)
                match get_type(&units, unit_idx, entries_tree.root().unwrap(), None, dwarf) {
                    Ok(vartype) => {
                        types.insert(*typeref, vartype);
                    }
                    Err(errmsg) => {
                        if verbose {
                            println!("Error loading type info for variable {}: {}", _name, errmsg);
                        }
                    }
                }
            }
        }
    }

    types
}
// load all the types referenced by variables in given HashMap
load all the types referenced by variables in given HashMap
load all the types referenced by variables in given HashMap
pub(crate) fn load_types(
    variables: &HashMap<String, VarInfo>,
    units: UnitList,
    dwarf: &gimli::Dwarf<EndianSlice<RunTimeEndian>>,
    verbose: bool
) -> HashMap<usize, TypeInfo> {
    let mut types = HashMap::<usize, TypeInfo>::new();
    // for each variable
    for (_name, VarInfo { typeref, ..}) in variables {
        // check if the type was already loaded
        if types.get(typeref).is_none() {
            if let Some(unit_idx) = units.get_unit(*typeref) {
                // create an entries_tree iterator that makes it possible to read the DIEs of this type
                let (unit, abbrev) = &units[unit_idx];
                let dbginfo_offset = gimli::DebugInfoOffset(*typeref);
                let unit_offset = dbginfo_offset.to_unit_offset(unit).unwrap();
                let mut entries_tree = unit.entries_tree(abbrev, Some(unit_offset)).unwrap();
                // load one type and add it to the collection (always succeeds for correctly structured DWARF debug info)
                match get_type(&units, unit_idx, entries_tree.root().unwrap(), None, dwarf) {
                    Ok(vartype) => {
                        types.insert(*typeref, vartype);
                    }
                    Err(errmsg) => {
                        if verbose {
                            println!("Error loading type info for variable {}: {}", _name, errmsg);
                        }
                    }
                }
            }
        }
    }
    types
}
pub ( crate ) fn load_types ( variables : & HashMap < String , VarInfo > , units : UnitList , dwarf : & gimli :: Dwarf < EndianSlice < RunTimeEndian > > , verbose : bool ) -> HashMap < usize , TypeInfo > { let mut types = HashMap :: < usize , TypeInfo > :: new ( ) ; // for each variable for ( _name , VarInfo { typeref , .. } ) in variables { // check if the type was already loaded if types . get ( typeref ) . is_none ( ) { if let Some ( unit_idx ) = units . get_unit ( * typeref ) { // create an entries_tree iterator that makes it possible to read the DIEs of this type let ( unit , abbrev ) = & units [ unit_idx ] ; let dbginfo_offset = gimli :: DebugInfoOffset ( * typeref ) ; let unit_offset = dbginfo_offset . to_unit_offset ( unit ) . unwrap ( ) ; let mut entries_tree = unit . entries_tree ( abbrev , Some ( unit_offset ) ) . unwrap ( ) ; // load one type and add it to the collection (always succeeds for correctly structured DWARF debug info) match get_type ( & units , unit_idx , entries_tree . root ( ) . unwrap ( ) , None , dwarf ) { Ok ( vartype ) => { types . insert ( * typeref , vartype ) ; } Err ( errmsg ) => { if verbose { println ! ( " " _name errmsg ) ; } } } } } } types }
load all the types referenced by variables in given HashMap
load all the types referenced by variables in given HashMap
variables
&HashMap<String, VarInfo>
units
UnitList
dwarf
&gimli::Dwarf<EndianSlice<RunTimeEndian>>
verbose
bool