LLDB mainline
lldb::SBThread Class Reference

#include <SBThread.h>

Public Types

enum  {
  eBroadcastBitStackChanged = (1 << 0) , eBroadcastBitThreadSuspended = (1 << 1) , eBroadcastBitThreadResumed = (1 << 2) , eBroadcastBitSelectedFrameChanged = (1 << 3) ,
  eBroadcastBitThreadSelected = (1 << 4)
}

Public Member Functions

 SBThread ()
 SBThread (const lldb::SBThread &thread)
 ~SBThread ()
lldb::SBQueue GetQueue () const
 operator bool () const
bool IsValid () const
void Clear ()
lldb::StopReason GetStopReason ()
size_t GetStopReasonDataCount ()
 Get the number of words associated with the stop reason.
uint64_t GetStopReasonDataAtIndex (uint32_t idx)
 Get information associated with a stop reason.
bool GetStopReasonExtendedInfoAsJSON (lldb::SBStream &stream)
SBThreadCollection GetStopReasonExtendedBacktraces (InstrumentationRuntimeType type)
size_t GetStopDescription (char *dst_or_null, size_t dst_len)
SBValue GetStopReturnValue ()
lldb::tid_t GetThreadID () const
uint32_t GetIndexID () const
const char * GetName () const
const char * GetQueueName () const
lldb::queue_id_t GetQueueID () const
bool GetInfoItemByPathAsString (const char *path, SBStream &strm)
void StepOver (lldb::RunMode stop_other_threads=lldb::eOnlyDuringStepping)
void StepOver (lldb::RunMode stop_other_threads, SBError &error)
void StepInto (lldb::RunMode stop_other_threads=lldb::eOnlyDuringStepping)
void StepInto (const char *target_name, lldb::RunMode stop_other_threads=lldb::eOnlyDuringStepping)
void StepInto (const char *target_name, uint32_t end_line, SBError &error, lldb::RunMode stop_other_threads=lldb::eOnlyDuringStepping)
void StepOut ()
void StepOut (SBError &error)
void StepOutOfFrame (SBFrame &frame)
void StepOutOfFrame (SBFrame &frame, SBError &error)
void StepInstruction (bool step_over)
void StepInstruction (bool step_over, SBError &error)
SBError StepOverUntil (lldb::SBFrame &frame, lldb::SBFileSpec &file_spec, uint32_t line)
SBError StepUsingScriptedThreadPlan (const char *script_class_name)
SBError StepUsingScriptedThreadPlan (const char *script_class_name, bool resume_immediately)
SBError StepUsingScriptedThreadPlan (const char *script_class_name, lldb::SBStructuredData &args_data, bool resume_immediately)
SBError JumpToLine (lldb::SBFileSpec &file_spec, uint32_t line)
void RunToAddress (lldb::addr_t addr)
void RunToAddress (lldb::addr_t addr, SBError &error)
SBError ReturnFromFrame (SBFrame &frame, SBValue &return_value)
SBError UnwindInnermostExpression ()
bool Suspend ()
 LLDB currently supports process centric debugging which means when any thread in a process stops, all other threads are stopped.
bool Suspend (SBError &error)
bool Resume ()
bool Resume (SBError &error)
bool IsSuspended ()
bool IsStopped ()
uint32_t GetNumFrames ()
lldb::SBFrame GetFrameAtIndex (uint32_t idx)
lldb::SBFrame GetSelectedFrame ()
lldb::SBFrame SetSelectedFrame (uint32_t frame_idx)
lldb::SBProcess GetProcess ()
const lldb::SBThreadoperator= (const lldb::SBThread &rhs)
bool operator== (const lldb::SBThread &rhs) const
bool operator!= (const lldb::SBThread &rhs) const
bool GetDescription (lldb::SBStream &description) const
bool GetDescription (lldb::SBStream &description, bool stop_format) const
SBError GetDescriptionWithFormat (const SBFormat &format, SBStream &output)
 Similar to GetDescription() but the format of the description can be configured via the format parameter.
bool GetStatus (lldb::SBStream &status) const
SBThread GetExtendedBacktraceThread (const char *type)
uint32_t GetExtendedBacktraceOriginatingIndexID ()
SBValue GetCurrentException ()
SBThread GetCurrentExceptionBacktrace ()
bool SafeToCallFunctions ()
SBValue GetSiginfo ()

Static Public Member Functions

static const char * GetBroadcasterClassName ()
static bool EventIsThreadEvent (const SBEvent &event)
static SBFrame GetStackFrameFromEvent (const SBEvent &event)
static SBThread GetThreadFromEvent (const SBEvent &event)

Private Member Functions

 SBThread (const lldb::ThreadSP &lldb_object_sp)
void SetThread (const lldb::ThreadSP &lldb_object_sp)
lldb::ThreadSP GetSP () const
lldb_private::Threadoperator-> ()
lldb_private::Threadget ()

Private Attributes

lldb::ExecutionContextRefSP m_opaque_sp

Friends

class SBBreakpoint
class SBBreakpointLocation
class SBBreakpointCallbackBaton
class SBSaveCoreOptions
class SBExecutionContext
class SBFrame
class SBProcess
class SBDebugger
class SBValue
class lldb_private::QueueImpl
class SBQueueItem
class SBThreadCollection
class SBThreadPlan
class SBTrace
class lldb_private::python::SWIGBridge

Detailed Description

Definition at line 26 of file SBThread.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
eBroadcastBitStackChanged 
eBroadcastBitThreadSuspended 
eBroadcastBitThreadResumed 
eBroadcastBitSelectedFrameChanged 
eBroadcastBitThreadSelected 

Definition at line 28 of file SBThread.h.

Constructor & Destructor Documentation

◆ SBThread() [1/3]

◆ SBThread() [2/3]

SBThread::SBThread ( const lldb::SBThread & thread)

Definition at line 69 of file SBThread.cpp.

References lldb_private::clone(), LLDB_INSTRUMENT_VA, m_opaque_sp, and SBThread().

◆ ~SBThread()

◆ SBThread() [3/3]

SBThread::SBThread ( const lldb::ThreadSP & lldb_object_sp)
private

Definition at line 64 of file SBThread.cpp.

References LLDB_INSTRUMENT_VA, and m_opaque_sp.

Member Function Documentation

◆ Clear()

void SBThread::Clear ( )

Definition at line 129 of file SBThread.cpp.

References LLDB_INSTRUMENT_VA, and m_opaque_sp.

Referenced by ~SBThread().

◆ EventIsThreadEvent()

bool SBThread::EventIsThreadEvent ( const SBEvent & event)
static

◆ get()

lldb_private::Thread * SBThread::get ( )
private

◆ GetBroadcasterClassName()

const char * SBThread::GetBroadcasterClassName ( )
static

◆ GetCurrentException()

SBValue SBThread::GetCurrentException ( )

Definition at line 1280 of file SBThread.cpp.

References LLDB_INSTRUMENT_VA, m_opaque_sp, and SBValue.

Referenced by ~SBThread().

◆ GetCurrentExceptionBacktrace()

SBThread SBThread::GetCurrentExceptionBacktrace ( )

Definition at line 1290 of file SBThread.cpp.

References LLDB_INSTRUMENT_VA, m_opaque_sp, and SBThread().

Referenced by ~SBThread().

◆ GetDescription() [1/2]

bool SBThread::GetDescription ( lldb::SBStream & description) const

Definition at line 1179 of file SBThread.cpp.

References GetDescription(), and LLDB_INSTRUMENT_VA.

Referenced by GetDescription(), and ~SBThread().

◆ GetDescription() [2/2]

◆ GetDescriptionWithFormat()

SBError SBThread::GetDescriptionWithFormat ( const SBFormat & format,
SBStream & output )

Similar to GetDescription() but the format of the description can be configured via the format parameter.

See https://lldb.llvm.org/use/formatting.html for more information on format strings.

Parameters
[in]formatThe format to use for generating the description.
[out]outputThe stream where the description will be written to.
Returns
An error object with an error message in case of failures.

Definition at line 1206 of file SBThread.cpp.

References lldb_private::API, error(), lldb_private::Status::FromErrorString(), lldb_private::Status::FromErrorStringWithFormat(), lldb::SBFormat::GetFormatEntrySP(), lldb_private::GetLog(), lldb_private::GetStoppedExecutionContext(), LLDB_INVALID_THREAD_ID, LLDB_LOG_ERROR, m_opaque_sp, and lldb::SBStream::ref().

Referenced by ~SBThread().

◆ GetExtendedBacktraceOriginatingIndexID()

uint32_t SBThread::GetExtendedBacktraceOriginatingIndexID ( )

Definition at line 1271 of file SBThread.cpp.

References LLDB_INSTRUMENT_VA, LLDB_INVALID_INDEX32, and m_opaque_sp.

Referenced by ~SBThread().

◆ GetExtendedBacktraceThread()

◆ GetFrameAtIndex()

◆ GetIndexID()

uint32_t SBThread::GetIndexID ( ) const

Definition at line 304 of file SBThread.cpp.

References LLDB_INSTRUMENT_VA, LLDB_INVALID_INDEX32, and m_opaque_sp.

Referenced by ~SBThread().

◆ GetInfoItemByPathAsString()

◆ GetName()

◆ GetNumFrames()

uint32_t SBThread::GetNumFrames ( )

◆ GetProcess()

◆ GetQueue()

◆ GetQueueID()

◆ GetQueueName()

◆ GetSelectedFrame()

◆ GetSiginfo()

SBValue SBThread::GetSiginfo ( )

Definition at line 1319 of file SBThread.cpp.

References LLDB_INSTRUMENT_VA, m_opaque_sp, and SBValue.

Referenced by ~SBThread().

◆ GetSP()

lldb::ThreadSP SBThread::GetSP ( ) const
private

Definition at line 1309 of file SBThread.cpp.

References m_opaque_sp.

Referenced by lldb_private::python::SWIGBridge.

◆ GetStackFrameFromEvent()

SBFrame SBThread::GetStackFrameFromEvent ( const SBEvent & event)
static

◆ GetStatus()

◆ GetStopDescription()

size_t SBThread::GetStopDescription ( char * dst_or_null,
size_t dst_len )

◆ GetStopReason()

◆ GetStopReasonDataAtIndex()

uint64_t SBThread::GetStopReasonDataAtIndex ( uint32_t idx)

Get information associated with a stop reason.

Breakpoint stop reasons will have data that consists of pairs of breakpoint IDs followed by the breakpoint location IDs (they always come in pairs).

Stop Reason Count Data Type ======================== ===== ========================================= eStopReasonNone 0 eStopReasonTrace 0 eStopReasonBreakpoint N duple: {breakpoint id, location id} eStopReasonWatchpoint 1 watchpoint id eStopReasonSignal 1 unix signal number eStopReasonException N exception data eStopReasonExec 0 eStopReasonFork 1 pid of the child process eStopReasonVFork 1 pid of the child process eStopReasonVForkDone 0 eStopReasonPlanComplete 0

Definition at line 170 of file SBThread.cpp.

References lldb_private::API, lldb_private::GetLog(), lldb_private::GetStoppedExecutionContext(), LLDB_INSTRUMENT_VA, LLDB_LOG_ERROR, and m_opaque_sp.

Referenced by ~SBThread().

◆ GetStopReasonDataCount()

size_t SBThread::GetStopReasonDataCount ( )

Get the number of words associated with the stop reason.

See also GetStopReasonDataAtIndex().

Definition at line 152 of file SBThread.cpp.

References lldb_private::API, lldb_private::GetLog(), lldb_private::GetStoppedExecutionContext(), LLDB_INSTRUMENT_VA, LLDB_LOG_ERROR, and m_opaque_sp.

Referenced by ~SBThread().

◆ GetStopReasonExtendedBacktraces()

◆ GetStopReasonExtendedInfoAsJSON()

bool SBThread::GetStopReasonExtendedInfoAsJSON ( lldb::SBStream & stream)

◆ GetStopReturnValue()

◆ GetThreadFromEvent()

SBThread SBThread::GetThreadFromEvent ( const SBEvent & event)
static

◆ GetThreadID()

lldb::tid_t SBThread::GetThreadID ( ) const

Definition at line 295 of file SBThread.cpp.

References LLDB_INSTRUMENT_VA, LLDB_INVALID_THREAD_ID, and m_opaque_sp.

Referenced by StepOutOfFrame(), and ~SBThread().

◆ IsStopped()

◆ IsSuspended()

◆ IsValid()

bool SBThread::IsValid ( ) const

Definition at line 110 of file SBThread.cpp.

References LLDB_INSTRUMENT_VA.

Referenced by ~SBThread().

◆ JumpToLine()

◆ operator bool()

SBThread::operator bool ( ) const
explicit

◆ operator!=()

bool SBThread::operator!= ( const lldb::SBThread & rhs) const

Definition at line 1151 of file SBThread.cpp.

References LLDB_INSTRUMENT_VA, m_opaque_sp, and SBThread().

Referenced by ~SBThread().

◆ operator->()

lldb_private::Thread * SBThread::operator-> ( )
private

Definition at line 1311 of file SBThread.cpp.

References get().

◆ operator=()

const lldb::SBThread & SBThread::operator= ( const lldb::SBThread & rhs)

Definition at line 77 of file SBThread.cpp.

References lldb_private::clone(), LLDB_INSTRUMENT_VA, m_opaque_sp, and SBThread().

Referenced by ~SBThread().

◆ operator==()

bool SBThread::operator== ( const lldb::SBThread & rhs) const

Definition at line 1144 of file SBThread.cpp.

References LLDB_INSTRUMENT_VA, m_opaque_sp, and SBThread().

Referenced by ~SBThread().

◆ Resume() [1/2]

bool SBThread::Resume ( )

Definition at line 969 of file SBThread.cpp.

References error(), LLDB_INSTRUMENT_VA, and Resume().

Referenced by Resume(), and ~SBThread().

◆ Resume() [2/2]

◆ ReturnFromFrame()

◆ RunToAddress() [1/2]

void SBThread::RunToAddress ( lldb::addr_t addr)

Definition at line 667 of file SBThread.cpp.

References error(), LLDB_INSTRUMENT_VA, and RunToAddress().

Referenced by RunToAddress(), and ~SBThread().

◆ RunToAddress() [2/2]

◆ SafeToCallFunctions()

bool SBThread::SafeToCallFunctions ( )

Definition at line 1300 of file SBThread.cpp.

References LLDB_INSTRUMENT_VA, and m_opaque_sp.

Referenced by ~SBThread().

◆ SetSelectedFrame()

◆ SetThread()

◆ StepInstruction() [1/2]

void SBThread::StepInstruction ( bool step_over)

Definition at line 634 of file SBThread.cpp.

References error(), LLDB_INSTRUMENT_VA, and StepInstruction().

Referenced by StepInstruction(), and ~SBThread().

◆ StepInstruction() [2/2]

◆ StepInto() [1/3]

void SBThread::StepInto ( const char * target_name,
lldb::RunMode stop_other_threads = lldb::eOnlyDuringStepping )

Definition at line 484 of file SBThread.cpp.

References error(), LLDB_INSTRUMENT_VA, LLDB_INVALID_LINE_NUMBER, and StepInto().

◆ StepInto() [2/3]

◆ StepInto() [3/3]

void SBThread::StepInto ( lldb::RunMode stop_other_threads = lldb::eOnlyDuringStepping)

Definition at line 478 of file SBThread.cpp.

References LLDB_INSTRUMENT_VA, and StepInto().

Referenced by StepInto(), StepInto(), and ~SBThread().

◆ StepOut() [1/2]

void SBThread::StepOut ( )

Definition at line 547 of file SBThread.cpp.

References error(), LLDB_INSTRUMENT_VA, and StepOut().

Referenced by StepOut(), and ~SBThread().

◆ StepOut() [2/2]

◆ StepOutOfFrame() [1/2]

void SBThread::StepOutOfFrame ( SBFrame & frame)

Definition at line 586 of file SBThread.cpp.

References error(), LLDB_INSTRUMENT_VA, SBFrame, and StepOutOfFrame().

Referenced by StepOutOfFrame(), and ~SBThread().

◆ StepOutOfFrame() [2/2]

◆ StepOver() [1/2]

◆ StepOver() [2/2]

void SBThread::StepOver ( lldb::RunMode stop_other_threads = lldb::eOnlyDuringStepping)

Definition at line 435 of file SBThread.cpp.

References error(), LLDB_INSTRUMENT_VA, and StepOver().

Referenced by StepOver(), and ~SBThread().

◆ StepOverUntil()

◆ StepUsingScriptedThreadPlan() [1/3]

SBError SBThread::StepUsingScriptedThreadPlan ( const char * script_class_name)

◆ StepUsingScriptedThreadPlan() [2/3]

SBError SBThread::StepUsingScriptedThreadPlan ( const char * script_class_name,
bool resume_immediately )

Definition at line 833 of file SBThread.cpp.

References LLDB_INSTRUMENT_VA, and StepUsingScriptedThreadPlan().

◆ StepUsingScriptedThreadPlan() [3/3]

◆ Suspend() [1/2]

bool SBThread::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() is called, any threads that aren't suspended will be allowed to run. If any of the SBThread functions for stepping are called (StepOver, StepInto, StepOut, StepInstruction, RunToAddress), the thread will not be allowed to run and these functions will simply return.

Eventually we plan to add support for thread centric debugging where each thread is controlled individually and each thread would broadcast its state, but we haven't implemented this yet.

Likewise the SBThread::Resume() call will again allow the thread to run when the process is continued.

Suspend() and Resume() functions are not currently reference counted, if anyone has the need for them to be reference counted, please let us know.

Definition at line 943 of file SBThread.cpp.

References error(), LLDB_INSTRUMENT_VA, and Suspend().

Referenced by Suspend(), and ~SBThread().

◆ Suspend() [2/2]

◆ UnwindInnermostExpression()

◆ lldb_private::python::SWIGBridge

friend class lldb_private::python::SWIGBridge
friend

Definition at line 248 of file SBThread.h.

References GetSP(), SBThread(), and SetThread().

◆ lldb_private::QueueImpl

friend class lldb_private::QueueImpl
friend

Definition at line 242 of file SBThread.h.

◆ SBBreakpoint

friend class SBBreakpoint
friend

Definition at line 233 of file SBThread.h.

References SBBreakpoint.

Referenced by SBBreakpoint.

◆ SBBreakpointCallbackBaton

friend class SBBreakpointCallbackBaton
friend

Definition at line 235 of file SBThread.h.

References SBBreakpointCallbackBaton.

Referenced by SBBreakpointCallbackBaton.

◆ SBBreakpointLocation

friend class SBBreakpointLocation
friend

Definition at line 234 of file SBThread.h.

References SBBreakpointLocation.

Referenced by SBBreakpointLocation.

◆ SBDebugger

friend class SBDebugger
friend

Definition at line 240 of file SBThread.h.

References SBDebugger.

Referenced by SBDebugger.

◆ SBExecutionContext

friend class SBExecutionContext
friend

Definition at line 237 of file SBThread.h.

References SBExecutionContext.

Referenced by SBExecutionContext.

◆ SBFrame

◆ SBProcess

friend class SBProcess
friend

Definition at line 239 of file SBThread.h.

References SBProcess.

Referenced by GetProcess(), and SBProcess.

◆ SBQueueItem

friend class SBQueueItem
friend

Definition at line 243 of file SBThread.h.

References SBQueueItem.

Referenced by SBQueueItem.

◆ SBSaveCoreOptions

friend class SBSaveCoreOptions
friend

Definition at line 236 of file SBThread.h.

References SBSaveCoreOptions.

Referenced by SBSaveCoreOptions.

◆ SBThreadCollection

friend class SBThreadCollection
friend

Definition at line 244 of file SBThread.h.

References SBThreadCollection.

Referenced by GetStopReasonExtendedBacktraces(), SBThreadCollection, and ~SBThread().

◆ SBThreadPlan

friend class SBThreadPlan
friend

Definition at line 245 of file SBThread.h.

References SBThreadPlan.

Referenced by SBThreadPlan.

◆ SBTrace

friend class SBTrace
friend

Definition at line 246 of file SBThread.h.

References SBTrace.

Referenced by SBTrace.

◆ SBValue

friend class SBValue
friend

Definition at line 241 of file SBThread.h.

References SBValue.

Referenced by GetCurrentException(), GetSiginfo(), GetStopReturnValue(), ReturnFromFrame(), SBValue, and ~SBThread().

Member Data Documentation

◆ m_opaque_sp


The documentation for this class was generated from the following files: