fn parse_object_location(
    unit: &Unit<EndianSlice<RunTimeEndian>>,
    entry: &DebuggingInformationEntry<EndianSlice<RunTimeEndian>>,
    dwarf: &Dwarf<EndianSlice<RunTimeEndian>>,
    header: &UnitHeader<EndianSlice<RunTimeEndian>>,
) -> Result<Option<ObjectLocation>> {
    let mut attrs = entry.attrs();
    let mut name: String = String::new();
    let mut location: Option<u64> = None;
    'outer: while let Some(attr) = attrs.next()? {
        if attr.name() == gimli::constants::DW_AT_name {
            match attr.value() {
                AttributeValue::DebugStrRef(offset) => {
                    name = dwarf
                        .string(offset)
                        .unwrap()
                        .to_string()
                        .unwrap()
                        .to_string();
                }
                _ => (),
            }
        } else if attr.name() == gimli::constants::DW_AT_location {
            match attr.value() {
                AttributeValue::Exprloc(e) => {
                    if let Some(loc) = location_from_expr(header, e)? {
                        location = Some(loc);
                    }
                }
                AttributeValue::LocationListsRef(offset) => {
                    let mut locations = dwarf.locations(unit, offset)?;
                    while let Some(loc) = locations.next()? {
                        if let Some(loc) = location_from_expr(header, loc.data)? {
                            location = Some(loc);
                            break 'outer;
                        }
                    }
                }
                _ => (),
            }
        // Ignore external objects
        } else if attr.name() == gimli::constants::DW_AT_external {
            break;
        }
    }

    if location.is_some() {
        let replay = ObjectLocation {
            name,
            address: location,
        };
        return Ok(Some(replay));
    }
    Ok(None)
}
/// Tries to find the variable information (location and name) for the
/// current entry if it is a variable.
Tries to find the variable information (location and name) for the
current entry if it is a variable.
Tries to find the variable information ( location and name ) for the current entry if it is a variable .
fn parse_object_location(
    unit: &Unit<EndianSlice<RunTimeEndian>>,
    entry: &DebuggingInformationEntry<EndianSlice<RunTimeEndian>>,
    dwarf: &Dwarf<EndianSlice<RunTimeEndian>>,
    header: &UnitHeader<EndianSlice<RunTimeEndian>>,
) -> Result<Option<ObjectLocation>> {
    let mut attrs = entry.attrs();
    let mut name: String = String::new();
    let mut location: Option<u64> = None;
    'outer: while let Some(attr) = attrs.next()? {
        if attr.name() == gimli::constants::DW_AT_name {
            match attr.value() {
                AttributeValue::DebugStrRef(offset) => {
                    name = dwarf
                        .string(offset)
                        .unwrap()
                        .to_string()
                        .unwrap()
                        .to_string();
                }
                _ => (),
            }
        } else if attr.name() == gimli::constants::DW_AT_location {
            match attr.value() {
                AttributeValue::Exprloc(e) => {
                    if let Some(loc) = location_from_expr(header, e)? {
                        location = Some(loc);
                    }
                }
                AttributeValue::LocationListsRef(offset) => {
                    let mut locations = dwarf.locations(unit, offset)?;
                    while let Some(loc) = locations.next()? {
                        if let Some(loc) = location_from_expr(header, loc.data)? {
                            location = Some(loc);
                            break 'outer;
                        }
                    }
                }
                _ => (),
            }
        // Ignore external objects
        } else if attr.name() == gimli::constants::DW_AT_external {
            break;
        }
    }
    if location.is_some() {
        let replay = ObjectLocation {
            name,
            address: location,
        };
        return Ok(Some(replay));
    }
    Ok(None)
}
fn parse_object_location ( unit : & Unit < EndianSlice < RunTimeEndian > > , entry : & DebuggingInformationEntry < EndianSlice < RunTimeEndian > > , dwarf : & Dwarf < EndianSlice < RunTimeEndian > > , header : & UnitHeader < EndianSlice < RunTimeEndian > > , ) -> Result < Option < ObjectLocation > > { let mut attrs = entry . attrs ( ) ; let mut name : String = String :: new ( ) ; let mut location : Option < u64 > = None ; ' outer : while let Some ( attr ) = attrs . next ( ) ? { if attr . name ( ) == gimli :: constants :: DW_AT_name { match attr . value ( ) { AttributeValue :: DebugStrRef ( offset ) => { name = dwarf . string ( offset ) . unwrap ( ) . to_string ( ) . unwrap ( ) . to_string ( ) ; } _ => ( ) , } } else if attr . name ( ) == gimli :: constants :: DW_AT_location { match attr . value ( ) { AttributeValue :: Exprloc ( e ) => { if let Some ( loc ) = location_from_expr ( header , e ) ? { location = Some ( loc ) ; } } AttributeValue :: LocationListsRef ( offset ) => { let mut locations = dwarf . locations ( unit , offset ) ? ; while let Some ( loc ) = locations . next ( ) ? { if let Some ( loc ) = location_from_expr ( header , loc . data ) ? { location = Some ( loc ) ; break ' outer ; } } } _ => ( ) , } // Ignore external objects } else if attr . name ( ) == gimli :: constants :: DW_AT_external { break ; } } if location . is_some ( ) { let replay = ObjectLocation { name , address : location , } ; return Ok ( Some ( replay ) ) ; } Ok ( None ) }
Tries to find the variable information (location and name) for the
current entry if it is a variable.
Tries to find the variable information ( location and name ) for the current entry if it is a variable .
unit
&Unit<EndianSlice<RunTimeEndian>>
entry
&DebuggingInformationEntry<EndianSlice<RunTimeEndian>>
dwarf
&Dwarf<EndianSlice<RunTimeEndian>>
header
&UnitHeader<EndianSlice<RunTimeEndian>>
unit
&Unit<EndianSlice<RunTimeEndian>>
entry
&DebuggingInformationEntry<EndianSlice<RunTimeEndian>>
dwarf
&Dwarf<EndianSlice<RunTimeEndian>>
header
&UnitHeader<EndianSlice<RunTimeEndian>>