SBThread

Struct SBThread 

Source
pub struct SBThread {
    pub raw: SBThreadRef,
}
Expand description

A thread of execution.

SBThreads can be referred to by their ID, which maps to the system specific thread identifier, or by IndexID. The ID may or may not be unique depending on whether the system reuses its thread identifiers. The IndexID is a monotonically increasing identifier that will always uniquely reference a particular thread, and when that thread goes away it will not be reused.

§Thread State

§Execution Control

§Frames

The thread contains stack frames. These can be iterated over with SBThread::frames():

// Iterate over the frames...
for frame in thread.frames() {
    println!("Hello {:?}!", frame);
}
// Or collect them into a vector!
let frames = thread.frames().collect::<Vec<SBFrame>>();

Some functions operate on the ‘currently selected frame’. This can retrieved via SBThread::selected_frame() and set via SBThread::set_selected_frame().

§Events

Fields§

§raw: SBThreadRef

The underlying raw SBThreadRef.

Implementations§

Source§

impl SBThread

Source

pub fn is_valid(&self) -> bool

Check whether or not this is a valid SBThread value.

Source

pub fn broadcaster_class_name() -> &'static str

Source

pub fn stop_reason(&self) -> StopReason

Get the stop reason for this thread.

Source

pub fn stop_return_value(&self) -> Option<SBValue>

The return value from the last stop if we just stopped due to stepping out of a function

Source

pub fn thread_id(&self) -> lldb_tid_t

Returns a unique thread identifier for the current SBThread that will remain constant throughout the thread’s lifetime in this process and will not be reused by another thread during this process lifetime. On macOS systems, this is a system-wide unique thread identifier; this identifier is also used by other tools like sample which helps to associate data from those tools with lldb. See related SBThread::index_id.

Source

pub fn index_id(&self) -> u32

Return the index number for this SBThread. The index number is the same thing that a user gives as an argument to thread select in the command line lldb.

These numbers start at 1 (for the first thread lldb sees in a debug session) and increments up throughout the process lifetime. An index number will not be reused for a different thread later in a process - thread 1 will always be associated with the same thread. See related SBThread::thread_id.

Source

pub fn name(&self) -> Option<&str>

The name associated with the thread, if any.

Source

pub fn queue(&self) -> Option<SBQueue>

Return the queue associated with this thread, if any.

If this SBThread is actually a history thread, then there may be a queue ID and name available, but not a full SBQueue as the individual attributes may have been saved, but without enough information to reconstitute the entire SBQueue at that time.

Source

pub fn queue_name(&self) -> Option<&str>

Return the queue name associated with this thread, if any.

For example, this would report a libdispatch (Grand Central Dispatch) queue name.

Source

pub fn queue_id(&self) -> u64

Return the dispatch_queue_id for this thread, if any.

For example, this would report a libdispatch (Grand Central Dispatch) queue ID.

Source

pub fn suspend(&self) -> Result<(), SBError>

Set the user resume state for this thread to suspend.

LLDB currently supports process centric debugging which means when any thread in a process stops, all other threads are stopped. The suspend call here tells our process to suspend a thread and not let it run when the other threads in a process are allowed to run. So when SBProcess::continue_execution() is called, any threads that aren’t suspended will be allowed to run. If any of the SBThread functions for stepping are called (step_over, step_into, step_out, step_instruction, run_to_address), the thread will not be allowed to run and these functions will simply return.

Source

pub fn resume(&self) -> Result<(), SBError>

Set the user resume state for this to allow it to run again.

See the discussion on SBThread::suspend() for further details.

Source

pub fn is_suspended(&self) -> bool

Is this thread set to the suspended user resume state?

See the discussion on SBThread::suspend() for further details.

Source

pub fn is_stopped(&self) -> bool

Is this thread stopped?

Source

pub fn frames(&self) -> SBThreadFrameIter<'_>

Get an iterator over the frames known to this thread instance.

Source

pub fn selected_frame(&self) -> SBFrame

Get the currently selected frame for this thread.

Source

pub fn set_selected_frame(&self, frame_index: u32) -> Option<SBFrame>

Set the currently selected frame for this thread. This takes a frame index.

Source

pub fn process(&self) -> SBProcess

Get the process in which this thread is running.

Source

pub fn step_over(&self, stop_other_threads: RunMode) -> Result<(), SBError>

Source

pub fn step_into(&self, stop_other_threads: RunMode)

Source

pub fn step_into_until( &self, target_name: Option<&str>, end_line: u32, stop_other_threads: RunMode, ) -> Result<(), SBError>

Source

pub fn step_out(&self) -> Result<(), SBError>

Source

pub fn step_out_of_frame(&self, frame: &SBFrame) -> Result<(), SBError>

Step out of the specified frame.

Source

pub fn step_instruction(&self, step_over: bool) -> Result<(), SBError>

Source

pub fn step_over_until( &self, frame: &SBFrame, file_spec: &SBFileSpec, line: u32, ) -> Result<(), SBError>

Source

pub fn event_as_thread_event(event: &SBEvent) -> Option<SBThreadEvent<'_>>

If the given event is a thread event, return it as an SBThreadEvent. Otherwise, return None.

Trait Implementations§

Source§

impl Clone for SBThread

Source§

fn clone(&self) -> SBThread

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for SBThread

Source§

fn fmt(&self, fmt: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Drop for SBThread

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl Send for SBThread

Source§

impl Sync for SBThread

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.