pub struct Variable {
Show 14 fields pub variable_key: i64, pub parent_key: Option<i64>, pub name: VariableName, pub source_location: Option<SourceLocation>, pub type_name: VariableType, pub unit_header_offset: Option<DebugInfoOffset>, pub variable_unit_offset: Option<UnitOffset>, pub variable_node_type: VariableNodeType, pub memory_location: VariableLocation, pub byte_size: u64, pub member_index: Option<i64>, pub range_lower_bound: i64, pub range_upper_bound: i64, pub role: VariantRole, /* private fields */
}
Expand description

The Variable struct is used in conjunction with VariableCache to cache data about variables.

Any modifications to the Variable value will be transient (lost when it goes out of scope), unless it is updated through one of the available methods on VariableCache.

Fields§

§variable_key: i64

Every variable must have a unique key value assigned to it. The value will be zero until it is stored in VariableCache, at which time its value will be set to the same as the VariableCache::variable_cache_key

§parent_key: Option<i64>

Every variable must have a unique parent assigned to it when stored in the VariableCache. A parent_key of None in the cache simply implies that this variable doesn’t have a parent, i.e. it is the root of a tree.

§name: VariableName

The variable name refers to the name of any of the types of values described in the VariableCache

§source_location: Option<SourceLocation>

The source location of the declaration of this variable, if available.

§type_name: VariableType

The name of the type of this variable.

§unit_header_offset: Option<DebugInfoOffset>

The unit_header_offset and variable_unit_offset are cached to allow on-demand access to the variable’s gimli::Unit, through functions like: gimli::Read::DebugInfo.header_from_offset(), and
gimli::Read::UnitHeader.entries_tree()

§variable_unit_offset: Option<UnitOffset>

The offset of this variable into the compilation unit debug information.

§variable_node_type: VariableNodeType

For ‘lazy loading’ of certain variable types we have to determine if the variable recursion should be deferred, and if so, how to resolve it when the request for further recursion happens. See VariableNodeType for more information.

§memory_location: VariableLocation

The starting location/address in memory where this Variable’s value is stored.

§byte_size: u64

The size of this variable in bytes.

§member_index: Option<i64>

If this is a subrange (array, vector, etc.), is the ordinal position of this variable in that range

§range_lower_bound: i64

If this is a subrange (array, vector, etc.), we need to temporarily store the lower bound.

§range_upper_bound: i64

If this is a subrange (array, vector, etc.), we need to temporarily store the the upper bound of the range.

§role: VariantRole

The role of this variable.

Implementations§

In most cases, Variables will be initialized with their ELF references so that we resolve their data types and values on demand.

Implementing set_value(), because the library passes errors into the value of the variable. This ensures debug front ends can see the errors, but doesn’t fail because of a single variable not being able to decode correctly.

Convert the String value into the appropriate memory format and update the target memory with the new value. Currently this only works for base data types. There is no provision in the MS DAP API to catch this client side, so we can only respond with a ‘gentle’ error message if the user attemtps unsupported data types.

Implementing get_value(), because Variable.value has to be private (a requirement of updating the value without overriding earlier values … see set_value()).

Evaluate the variable’s result if possible and set self.value, or else set self.value as the error String.

The variable is considered to be an ‘indexed’ variable if the name starts with two underscores followed by a number. e.g. “__1”. TODO: Consider replacing this logic with std::str::pattern::Pattern when that API stabilizes

true if the Variable has a valid value, or an empty value. false if the Variable has a VariableValue::Error(_)value

Trait Implementations§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Returns the “default value” for a type. Read more
This method tests for self and other values to be equal, and is used by ==.
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.

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
Compare self to key and return true if they are equal.
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.
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
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