Struct probe_rs::Session

source ·
pub struct Session { /* private fields */ }
Expand description

The Session struct represents an active debug session.

Creating a session

The session can be created by calling the Session::auto_attach() function, which tries to automatically select a probe, and then connect to the target.

For more control, the Probe::attach() and Probe::attach_under_reset() methods can be used to open a Session from a specific Probe.

Usage

The Session is the common handle that gives a user exclusive access to an active probe. You can create and share a session between threads to enable multiple stakeholders (e.g. GDB and RTT) to access the target taking turns, by using Arc<Mutex<Session>>.

If you do so, make sure that both threads sleep in between tasks such that other stakeholders may take their turn.

To get access to a single Core from the Session, the Session::core() method can be used. Please see the Session::core() method for more usage guidelines.

Implementations§

Automatically creates a session with the first connected probe found.

Lists the available cores with their number and their type.

Attaches to the core with the given number.

Usage

Everytime you want to perform an operation on the chip, you need to get the Core handle with the Session::core() method. This Core handle is merely a view into the core and provides a convenient API surface.

All the state is stored in the Session handle.

The first time you call Session::core() for a specific core, it will run the attach/init sequences and return a handle to the Core.

Every subsequent call is a no-op. It simply returns the handle for the user to use in further operations without calling any int sequences again.

It is strongly advised to never store the Core handle for any significant duration! Free it as fast as possible such that other stakeholders can have access to the Core too.

The idea behind this is: You need the smallest common denominator which you can share between threads. Since you sometimes need the Core, sometimes the Probe or sometimes the Target, the Session is the only common ground and the only handle you should actively store in your code.

Read available trace data from the specified data sink.

This method is only supported for ARM-based targets, and will return ArmError::ArchitectureRequired otherwise.

Returns an implementation of std::io::Read that wraps SwoAccess::read_swo.

The implementation buffers all available bytes from SwoAccess::read_swo on each std::io::Read::read, minimizing the chance of a target-side overflow event on which trace packets are lost.

Get the Arm probe interface.

Check if the connected device has a debug erase sequence defined

Erase all flash memory using the Device’s Debug Erase Sequence if any

Returns

Ok(()) if the device provides a custom erase sequence and it succeeded.

Errors

NotImplemented if no custom erase sequence exists Err(e) if the custom erase sequence failed

Reads all the available ARM CoresightComponents of the currently attached target.

This will recursively parse the Romtable of the attached target and create a list of all the contained components.

Get the target description of the connected target.

Configure the target and probe for serial wire view (SWV) tracing.

Configure the target to stop emitting SWV trace data.

Begin tracing a memory address over SWV.

Stop tracing from a given SWV unit

Return the Architecture of the currently connected chip.

Clears all hardware breakpoints on all cores

Trait Implementations§

Formats the value using the given formatter. Read more
Executes the destructor for this 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