// helper debug functions to print info for a die
helper debug functions to print info for a die
helper debug functions to print info for a die
pub fn dump_die(
        &self,
        f: &mut dyn io::Write,
        depth: usize,
        entry: &gimli::DebuggingInformationEntry<Reader>,
    ) -> result::Result<(), gimli::Error> {
        let padding = "  ".repeat(2 * depth + 1);
        let tag_padding = "  ".repeat(2 * depth as usize);
        writeln!(
            f,
            "{}<{}>{}",
            tag_padding,
            depth,
            entry.tag().static_string().unwrap()
        )
        .ok();
        let mut attrs = entry.attrs();
        while let Some(attr) = attrs.next()? {
            write!(f, "{}", padding).ok();
            if let Some(n) = attr.name().static_string() {
                write!(f, "{}: ", n).ok();
            } else {
                write!(f, "{:27}: ", attr.name()).ok();
            }
            if let gimli::AttributeValue::DebugStrRef(offset) = attr.value() {
                let string = self.dwarf.debug_str.get_str(offset)?;
                let string = demangle(string.to_string()?).to_string();
                writeln!(f, "{}", string).ok();
            } else if let Some(num) = attr.udata_value() {
                writeln!(f, "{}", num).ok();
            } else if let gimli::AttributeValue::UnitRef(offset) = attr.value() {
                writeln!(f, "unit+{:#010x}", offset.0).ok();
            } else {
                writeln!(f, "??? {:#?}", attr.value()).ok();
            }
        }
        Ok(())
    }
pub fn dump_die ( & self , f : & mut dyn io :: Write , depth : usize , entry : & gimli :: DebuggingInformationEntry < Reader > , ) -> result :: Result < ( ) , gimli :: Error > { let padding = " " . repeat ( 2 * depth + 1 ) ; let tag_padding = " " . repeat ( 2 * depth as usize ) ; writeln ! ( f " " tag_padding depth entry tag ( ) static_string ( ) unwrap ( ) ) . ok ( ) ; let mut attrs = entry . attrs ( ) ; while let Some ( attr ) = attrs . next ( ) ? { write ! ( f " " padding ) . ok ( ) ; if let Some ( n ) = attr . name ( ) . static_string ( ) { write ! ( f " " n ) . ok ( ) ; } else { write ! ( f " " attr name ( ) ) . ok ( ) ; } if let gimli :: AttributeValue :: DebugStrRef ( offset ) = attr . value ( ) { let string = self . dwarf . debug_str . get_str ( offset ) ? ; let string = demangle ( string . to_string ( ) ? ) . to_string ( ) ; writeln ! ( f " " string ) . ok ( ) ; } else if let Some ( num ) = attr . udata_value ( ) { writeln ! ( f " " num ) . ok ( ) ; } else if let gimli :: AttributeValue :: UnitRef ( offset ) = attr . value ( ) { writeln ! ( f " " offset 0 ) . ok ( ) ; } else { writeln ! ( f " " attr value ( ) ) . ok ( ) ; } } Ok ( ( ) ) }
helper debug functions to print info for a die
helper debug functions to print info for a die
&self
f
&mut dyn io::Write
depth
usize
entry
&gimli::DebuggingInformationEntry<Reader>