get_var_name

Function get_var_name 

Source
pub fn get_var_name<R: Reader<Offset = usize>>(
    dwarf: &Dwarf<R>,
    unit: &Unit<R>,
    die: &DebuggingInformationEntry<'_, '_, R>,
) -> Result<Option<String>>
Expand description

Will retrieve the name of a variable DIE.

Description:

  • dwarf - A reference to gimli-rs Dwarf struct.
  • unit - A reference to gimli-rs Unit struct, which the given DIE is located in.
  • die - A reference to DIE.

Will check if the given DIE represents a variable, if it does not it will return a error. After that it will try to evaluate the DW_AT_name attribute and return the result. But if it dose not have the name attribute it will try to get the name from the DIE in the DW_AT_abstract_origin attribute. If that attribute is missing it will return Ok(None), because the variable does not have a name.