fn try_parse_enum(
        &self,
        offset: gimli::DebugInfoOffset,
    ) -> Option<(Vec<&'i str>, Vec<gimli::DebugInfoOffset>)> {
        let (unit, u_offset) = self.di_to_unit(offset)?;
        let mut cursor = unit.entries_at_offset(u_offset).ok()?;
        let mut depth = 0;
        let mut variant_names = Vec::new();
        let mut variant_vals = Vec::new();
        // skip the first DIE, since that is the enum
        cursor.next_dfs().ok()??;
        // get the next element, which should be the variant description
        if let Some((_, entry)) = cursor.next_dfs().ok()? {
            // make sure we have an enum variant thingy
            if entry.tag() != constants::DW_TAG_variant_part {
                return None;
            }
            // now we can parse the entries
            while let Some((delta_depth, entry)) = cursor.next_dfs().ok()? {
                depth += delta_depth;
                if depth <= 0 {
                    break;
                }
                // if we are at a variant:
                if entry.tag() == constants::DW_TAG_variant {
                    // the child of this DIE describes the name and type of the variant
                    if let Some((delta_depth, entry)) = cursor.next_dfs().ok()? {
                        depth += delta_depth;
                        variant_names.push(
                            self.di_parser
                                .get_str_val(&entry, constants::DW_AT_name)
                                .ok()??,
                        );
                        variant_vals.push(get_type(unit, &entry).ok()?);
                    }
                }
            }
            Some((variant_names, variant_vals))
        } else {
            None
        }
    }
// returns None if parsing failed
// returns Some(_) if we found an enum
returns None if parsing failed
returns Some(_) if we found an enum
returns None if parsing failed returns Some ( _ ) if we found an enum
fn try_parse_enum(
        &self,
        offset: gimli::DebugInfoOffset,
    ) -> Option<(Vec<&'i str>, Vec<gimli::DebugInfoOffset>)> {
        let (unit, u_offset) = self.di_to_unit(offset)?;
        let mut cursor = unit.entries_at_offset(u_offset).ok()?;
        let mut depth = 0;
        let mut variant_names = Vec::new();
        let mut variant_vals = Vec::new();
        // skip the first DIE, since that is the enum
        cursor.next_dfs().ok()??;
        // get the next element, which should be the variant description
        if let Some((_, entry)) = cursor.next_dfs().ok()? {
            // make sure we have an enum variant thingy
            if entry.tag() != constants::DW_TAG_variant_part {
                return None;
            }
            // now we can parse the entries
            while let Some((delta_depth, entry)) = cursor.next_dfs().ok()? {
                depth += delta_depth;
                if depth <= 0 {
                    break;
                }
                // if we are at a variant:
                if entry.tag() == constants::DW_TAG_variant {
                    // the child of this DIE describes the name and type of the variant
                    if let Some((delta_depth, entry)) = cursor.next_dfs().ok()? {
                        depth += delta_depth;
                        variant_names.push(
                            self.di_parser
                                .get_str_val(&entry, constants::DW_AT_name)
                                .ok()??,
                        );
                        variant_vals.push(get_type(unit, &entry).ok()?);
                    }
                }
            }
            Some((variant_names, variant_vals))
        } else {
            None
        }
    }
fn try_parse_enum ( & self , offset : gimli :: DebugInfoOffset , ) -> Option < ( Vec < & ' i str > , Vec < gimli :: DebugInfoOffset > ) > { let ( unit , u_offset ) = self . di_to_unit ( offset ) ? ; let mut cursor = unit . entries_at_offset ( u_offset ) . ok ( ) ? ; let mut depth = 0 ; let mut variant_names = Vec :: new ( ) ; let mut variant_vals = Vec :: new ( ) ; // skip the first DIE, since that is the enum cursor . next_dfs ( ) . ok ( ) ? ? ; // get the next element, which should be the variant description if let Some ( ( _ , entry ) ) = cursor . next_dfs ( ) . ok ( ) ? { // make sure we have an enum variant thingy if entry . tag ( ) != constants :: DW_TAG_variant_part { return None ; } // now we can parse the entries while let Some ( ( delta_depth , entry ) ) = cursor . next_dfs ( ) . ok ( ) ? { depth += delta_depth ; if depth <= 0 { break ; } // if we are at a variant: if entry . tag ( ) == constants :: DW_TAG_variant { // the child of this DIE describes the name and type of the variant if let Some ( ( delta_depth , entry ) ) = cursor . next_dfs ( ) . ok ( ) ? { depth += delta_depth ; variant_names . push ( self . di_parser . get_str_val ( & entry , constants :: DW_AT_name ) . ok ( ) ? ? , ) ; variant_vals . push ( get_type ( unit , & entry ) . ok ( ) ? ) ; } } } Some ( ( variant_names , variant_vals ) ) } else { None } }
returns None if parsing failed
returns Some(_) if we found an enum
returns None if parsing failed returns Some ( _ ) if we found an enum
&self
offset
gimli::DebugInfoOffset
&self
offset
gimli::DebugInfoOffset