/// Finds the CUs for the function address given.
///
/// There might be multiple CUs whose range contains this address.
/// Weak symbols have shown up in the wild which cause this to happen
/// but otherwise this can happen if the CU has non-contiguous functions
/// but only reports a single range.
///
/// Consequently we return an iterator for all CUs which may contain the
/// address, and the caller must check if there is actually a function or
/// location in the CU for that address.
Finds the CUs for the function address given.
There might be multiple CUs whose range contains this address.
Weak symbols have shown up in the wild which cause this to happen
but otherwise this can happen if the CU has non-contiguous functions
but only reports a single range.

Consequently we return an iterator for all CUs which may contain the
address, and the caller must check if there is actually a function or
location in the CU for that address.
Finds the CUs for the function address given . There might be multiple CUs whose range contains this address . Weak symbols have shown up in the wild which cause this to happen but otherwise this can happen if the CU has non - contiguous functions but only reports a single range . Consequently we return an iterator for all CUs which may contain the address and the caller must check if there is actually a function or location in the CU for that address .
fn find_units(&self, probe: u64) -> impl Iterator<Item = &ResUnit<R>> {
        // First up find the position in the array which could have our function
        // address.
        let pos = match self
            .unit_ranges
            .binary_search_by_key(&probe, |i| i.range.begin)
        {
            // Although unlikely, we could find an exact match.
            Ok(i) => i + 1,
            // No exact match was found, but this probe would fit at slot `i`.
            // This means that slot `i` is bigger than `probe`, along with all
            // indices greater than `i`, so we need to search all previous
            // entries.
            Err(i) => i,
        };
        // Once we have our index we iterate backwards from that position
        // looking for a matching CU.
        self.unit_ranges[..pos]
            .iter()
            .rev()
            .take_while(move |i| {
                // We know that this CU's start is beneath the probe already because
                // of our sorted array.
                debug_assert!(i.range.begin <= probe);
                // Each entry keeps track of the maximum end address seen so far,
                // starting from the beginning of the array of unit ranges. We're
                // iterating in reverse so if our probe is beyond the maximum range
                // of this entry, then it's guaranteed to not fit in any prior
                // entries, so we break out.
                probe <= i.max_end
            })
            .filter_map(move |i| {
                // If this CU doesn't actually contain this address, move to the
                // next CU.
                if probe > i.range.end {
                    return None;
                }
                Some(&self.units[i.unit_id])
            })
    }
fn find_units ( & self , probe : u64 ) -> impl Iterator < Item = & ResUnit < R > > { // First up find the position in the array which could have our function // address. let pos = match self . unit_ranges . binary_search_by_key ( & probe , | i | i . range . begin ) { // Although unlikely, we could find an exact match. Ok ( i ) => i + 1 , // No exact match was found, but this probe would fit at slot `i`. // This means that slot `i` is bigger than `probe`, along with all // indices greater than `i`, so we need to search all previous // entries. Err ( i ) => i , } ; // Once we have our index we iterate backwards from that position // looking for a matching CU. self . unit_ranges [ .. pos ] . iter ( ) . rev ( ) . take_while ( move | i | { // We know that this CU's start is beneath the probe already because // of our sorted array. debug_assert ! ( i range begin probe ) ; // Each entry keeps track of the maximum end address seen so far, // starting from the beginning of the array of unit ranges. We're // iterating in reverse so if our probe is beyond the maximum range // of this entry, then it's guaranteed to not fit in any prior // entries, so we break out. probe <= i . max_end } ) . filter_map ( move | i | { // If this CU doesn't actually contain this address, move to the // next CU. if probe > i . range . end { return None ; } Some ( & self . units [ i . unit_id ] ) } ) }
Finds the CUs for the function address given.
Finds the CUs for the function address given .
&self
probe
u64