[go: up one dir, main page]

Struct gimli::EntriesCursor [] [src]

pub struct EntriesCursor<'input, 'abbrev, 'unit, Endian> where 'input: 'unit, Endian: Endianity + 'unit {
    // some fields omitted
}

A cursor into the Debugging Information Entries tree for a compilation unit.

The EntriesCursor can traverse the DIE tree in either DFS order, or skip to the next sibling of the entry the cursor is currently pointing to.

Methods

impl<'input, 'abbrev, 'unit, Endian> EntriesCursor<'input, 'abbrev, 'unit, Endian> where Endian: Endianity
[src]

fn current<'me>(&'me mut self) -> Option<ParseResult<DebuggingInformationEntry<'input, 'abbrev, 'unit, Endian>>>

Get the entry that the cursor is currently pointing to.

fn next_dfs(&mut self) -> Result<isize()>

Move the cursor to the next DIE in the tree in DFS order.

Upon success, return the delta traversal depth:

  • If we moved down into the previous current entry's children, we get Ok(1).

  • If we moved to the previous current entry's sibling, we get Ok(0).

  • If the previous entry does not have any siblings and we move up to its parent's next sibling, then we get Ok(-1). Note that if the parent doesn't have a next sibling, then it could go up to the parent's parent's next sibling and return Ok(-2), etc.

Here is an example that finds the first entry in a compilation unit that does not have any children.


let unit = get_some_compilation_unit();
let abbrevs = get_abbrevs_for_compilation_unit(&unit);

let mut first_entry_with_no_children = None;
let mut cursor = unit.entries(&abbrevs);

// Keep looping while the cursor is moving deeper into the DIE tree.
while let Ok(delta_depth) = cursor.next_dfs() {
    // 0 means we moved to a sibling, a negative number means we went back
    // up to a parent's sibling. In either case, bail out of the loop because
    //  we aren't going deeper into the tree anymore.
    if delta_depth <= 0 {
        break;
    }

    let current = cursor.current()
        .expect("Should be at an entry")
        .expect("And we should parse the entry ok");
    first_entry_with_no_children = Some(current);
}

println!("The first entry with no children is {:?}",
         first_entry_with_no_children.unwrap());

fn next_sibling(&mut self) -> Result<()()>

Move the cursor to the next sibling DIE of the current one.

Trait Implementations

impl<'input, 'abbrev, 'unit, Endian: Debug> Debug for EntriesCursor<'input, 'abbrev, 'unit, Endian> where 'input: 'unit, Endian: Endianity + 'unit
[src]

fn fmt(&self, __arg_0: &mut Formatter) -> Result

Formats the value using the given formatter.

impl<'input, 'abbrev, 'unit, Endian: Clone> Clone for EntriesCursor<'input, 'abbrev, 'unit, Endian> where 'input: 'unit, Endian: Endianity + 'unit
[src]

fn clone(&self) -> EntriesCursor<'input, 'abbrev, 'unit, Endian>

Returns a copy of the value. Read more

fn clone_from(&mut self, source: &Self)
1.0.0

Performs copy-assignment from source. Read more