symbolic icon indicating copy to clipboard operation
symbolic copied to clipboard

symbolic_demangle DemangleOptions support only get parameters?

Open anranziruo opened this issue 3 years ago • 3 comments

anranziruo avatar Sep 01 '22 02:09 anranziruo

@getsentry/owners-native @zhangchao1 hey all, looks like the Issue could use some additional info.

souredoutlook avatar Sep 06 '22 19:09 souredoutlook

let view = ByteView::open("main.dSYM/Contents/Resources/DWARF/main")?;
let objects = Object::parse(&view)?;
 let session = objects.debug_session()?;
for fn_name in session.functions().into_iter(){
       println!("{:?}",fn_item);
}
pub struct Function<'data> {
    /// Relative instruction address of the start of the function.
    pub address: u64,
    /// Total code size covered by the function body, including inlined functions.
    pub size: u64,
    /// The name and language of the function symbol.
    pub name: Name<'data>,
    /// Path to the compilation directory. File paths are relative to this.
    pub compilation_dir: &'data [u8],
    /// Lines covered by this function, including inlined children.
    pub lines: Vec<LineInfo<'data>>,
    /// Functions that have been inlined into this function's body.
    pub inlinees: Vec<Function<'data>>,
    /// Specifies whether this function is inlined.
    pub inline: bool,
}

this inlinees infos name has matched the DW_AT_name of DW_TAG_subprogram? @souredoutlook

anranziruo avatar Sep 08 '22 02:09 anranziruo

I’m not sure what exactly you mean? We do prefer the symbol name from the symbol table for top-level functions. Otherwise we fall back to DW_AT_linkage_name and DW_AT_name, which we also use for inlined functions.

We also demangle symbols completely by default, with argument types and return types. The exception is the PDB type formatter which I think does not support return types for now.

Swatinem avatar Sep 12 '22 09:09 Swatinem

We do expose the raw mangled name as well, if there is more specific need for demangling, you can reach for the crates that do that directly.

Swatinem avatar Jan 25 '23 14:01 Swatinem