fn deref_ptr(
        &self,
        offset: gimli::DebugInfoOffset,
    ) -> result::Result<gimli::DebugInfoOffset, gimli::Error> {
        if let Some((unit, offset)) = self.di_to_unit(offset) {
            let entry = unit.entry(offset)?;
            match entry.tag() {
                // it is another pointer, we need to dereference it
                constants::DW_TAG_pointer_type => {
                    let ptr = get_type(unit, &entry)?;
                    return self.deref_ptr(ptr);
                }
                // it is a concrete type, we need to return the offset of this type
                constants::DW_TAG_structure_type
                | constants::DW_TAG_base_type
                | constants::DW_TAG_array_type => {
                    if let Some(di) = unit_to_di(unit, entry.offset()) {
                        return Ok(di);
                    } else {
                        return Err(gimli::Error::InvalidLocationAddressRange);
                    }
                }
                _ => {}
            };
            Err(gimli::Error::UnsupportedAttributeForm)
        } else {
            // we could not determine the unit for this address
            Err(gimli::Error::InvalidLocationAddressRange)
        }
    }
//takes an offset to a pointer type, and returns the type that pointer points at
takes an offset to a pointer type, and returns the type that pointer points at
takes an offset to a pointer type and returns the type that pointer points at
fn deref_ptr(
        &self,
        offset: gimli::DebugInfoOffset,
    ) -> result::Result<gimli::DebugInfoOffset, gimli::Error> {
        if let Some((unit, offset)) = self.di_to_unit(offset) {
            let entry = unit.entry(offset)?;
            match entry.tag() {
                // it is another pointer, we need to dereference it
                constants::DW_TAG_pointer_type => {
                    let ptr = get_type(unit, &entry)?;
                    return self.deref_ptr(ptr);
                }
                // it is a concrete type, we need to return the offset of this type
                constants::DW_TAG_structure_type
                | constants::DW_TAG_base_type
                | constants::DW_TAG_array_type => {
                    if let Some(di) = unit_to_di(unit, entry.offset()) {
                        return Ok(di);
                    } else {
                        return Err(gimli::Error::InvalidLocationAddressRange);
                    }
                }
                _ => {}
            };
            Err(gimli::Error::UnsupportedAttributeForm)
        } else {
            // we could not determine the unit for this address
            Err(gimli::Error::InvalidLocationAddressRange)
        }
    }
fn deref_ptr ( & self , offset : gimli :: DebugInfoOffset , ) -> result :: Result < gimli :: DebugInfoOffset , gimli :: Error > { if let Some ( ( unit , offset ) ) = self . di_to_unit ( offset ) { let entry = unit . entry ( offset ) ? ; match entry . tag ( ) { // it is another pointer, we need to dereference it constants :: DW_TAG_pointer_type => { let ptr = get_type ( unit , & entry ) ? ; return self . deref_ptr ( ptr ) ; } // it is a concrete type, we need to return the offset of this type constants :: DW_TAG_structure_type | constants :: DW_TAG_base_type | constants :: DW_TAG_array_type => { if let Some ( di ) = unit_to_di ( unit , entry . offset ( ) ) { return Ok ( di ) ; } else { return Err ( gimli :: Error :: InvalidLocationAddressRange ) ; } } _ => { } } ; Err ( gimli :: Error :: UnsupportedAttributeForm ) } else { // we could not determine the unit for this address Err ( gimli :: Error :: InvalidLocationAddressRange ) } }
takes an offset to a pointer type, and returns the type that pointer points at
takes an offset to a pointer type and returns the type that pointer points at
&self
offset
gimli::DebugInfoOffset
&self
offset
gimli::DebugInfoOffset