pub struct VariableCache { /* private fields */ }
Expand description

VariableCache stores available Variables, and provides methods to create and navigate the parent-child relationships of the Variables.

Implementations§

Creates a new VariableCache.

Performs an add or update of a probe_rs::debug::Variable to the cache, consuming the input and returning a Clone.

  • Add operation: If the Variable::variable_key is 0, then assign a key and store it in the cache.
    • Return an updated Clone of the stored variable
  • Update operation: If the Variable::variable_key is > 0
    • If the key value exists in the cache, update it, Return an updated Clone of the variable.
    • If the key value doesn’t exist in the cache, Return an error.
  • For all operations, update the parent_key. A value of None means there are no parents for this variable.
    • Validate that the supplied Variable::parent_key is a valid entry in the cache.
  • If appropriate, the Variable::value is updated from the core memory, and can be used by the calling function.

Retrieve a clone of a specific Variable, using the variable_key.

Retrieve a clone of a specific Variable, using the name and parent_key. If there is more than one, it will be logged (tracing::error!), and only the last will be returned.

Retrieve a clone of a specific Variable, using the name. If there is more than one, it will be logged (tracing::warn!), and only the first will be returned. It is possible for a hierarchy of variables in a cache to have duplicate names under different parents.

Retrieve cloned version of all the children of a Variable. If parent_key == None, it will return all the top level variables (no parents) in this cache.

Check if a Variable has any children. This also validates that the parent exists in the cache, before attempting to check for children.

Sometimes DWARF uses intermediate nodes that are not part of the coded variable structure. When we encounter them, the children of such intermediate nodes are assigned to the parent of the intermediate node, and we discard the intermediate nodes from the DebugInfo::VariableCache

Similarly, while resolving VariableNodeType::is_deferred(), i.e. ‘lazy load’ of variables, we need to create intermediate variables that are eliminated here.

NOTE: For all other situations, this function will silently do nothing.

source

pub fn remove_cache_entry_children(
    &mut self,
    parent_variable_key: i64
) -> Result<(), Error>

Removing an entry’s children from the VariableCache will recursively remove all their children

source

pub fn remove_cache_entry(&mut self, variable_key: i64) -> Result<(), Error>

Removing an entry from the VariableCache will recursively remove all its children

Trait Implementations§

Formats the value using the given formatter. Read more
Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more
Converts self into T using Into<T>. Read more
Causes self to use its Binary implementation when Debug-formatted.
Causes self to use its Display implementation when Debug-formatted.
Causes self to use its LowerExp implementation when Debug-formatted.
Causes self to use its LowerHex implementation when Debug-formatted.
Causes self to use its Octal implementation when Debug-formatted.
Causes self to use its Pointer implementation when Debug-formatted.
Causes self to use its UpperExp implementation when Debug-formatted.
Causes self to use its UpperHex implementation when Debug-formatted.
Formats each item in a sequence. Read more

Returns the argument unchanged.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Pipes by value. This is generally the method you want to use. Read more
Borrows self and passes that borrow into the pipe function. Read more
Mutably borrows self and passes that borrow into the pipe function. Read more
Borrows self, then passes self.borrow() into the pipe function. Read more
Mutably borrows self, then passes self.borrow_mut() into the pipe function. Read more
Borrows self, then passes self.as_ref() into the pipe function.
Mutably borrows self, then passes self.as_mut() into the pipe function.
Borrows self, then passes self.deref() into the pipe function.
Mutably borrows self, then passes self.deref_mut() into the pipe function.
Immutable access to a value. Read more
Mutable access to a value. Read more
Immutable access to the Borrow<B> of a value. Read more
Mutable access to the BorrowMut<B> of a value. Read more
Immutable access to the AsRef<R> view of a value. Read more
Mutable access to the AsMut<R> view of a value. Read more
Immutable access to the Deref::Target of a value. Read more
Mutable access to the Deref::Target of a value. Read more
Calls .tap() only in debug builds, and is erased in release builds.
Calls .tap_mut() only in debug builds, and is erased in release builds.
Calls .tap_borrow() only in debug builds, and is erased in release builds.
Calls .tap_borrow_mut() only in debug builds, and is erased in release builds.
Calls .tap_ref() only in debug builds, and is erased in release builds.
Calls .tap_ref_mut() only in debug builds, and is erased in release builds.
Calls .tap_deref() only in debug builds, and is erased in release builds.
Calls .tap_deref_mut() only in debug builds, and is erased in release builds.
Attempts to convert self into T using TryInto<T>. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more