LLDB mainline
Public Types | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
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)
 
SBError ResumeNewPlan (lldb_private::ExecutionContext &exe_ctx, lldb_private::ThreadPlan *new_plan)
 
lldb_private::Threadoperator-> ()
 
lldb_private::Threadget ()
 

Private Attributes

lldb::ExecutionContextRefSP m_opaque_sp
 

Friends

class SBBreakpoint
 
class SBBreakpointLocation
 
class SBBreakpointCallbackBaton
 
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::SBThread ( )

Definition at line 60 of file SBThread.cpp.

References LLDB_INSTRUMENT_VA.

Referenced by GetCurrentExceptionBacktrace().

◆ SBThread() [2/3]

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

Definition at line 69 of file SBThread.cpp.

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

◆ ~SBThread()

SBThread::~SBThread ( )
default

References lldb::operator==().

◆ SBThread() [3/3]

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

Definition at line 64 of file SBThread.cpp.

References LLDB_INSTRUMENT_VA.

Member Function Documentation

◆ Clear()

void SBThread::Clear ( )

Definition at line 130 of file SBThread.cpp.

References LLDB_INSTRUMENT_VA, and m_opaque_sp.

◆ 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 1311 of file SBThread.cpp.

References LLDB_INSTRUMENT_VA, m_opaque_sp, and SBValue.

◆ GetCurrentExceptionBacktrace()

SBThread SBThread::GetCurrentExceptionBacktrace ( )

Definition at line 1321 of file SBThread.cpp.

References LLDB_INSTRUMENT_VA, m_opaque_sp, and SBThread().

◆ GetDescription() [1/2]

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

Definition at line 1218 of file SBThread.cpp.

References GetDescription(), and LLDB_INSTRUMENT_VA.

Referenced by GetDescription().

◆ GetDescription() [2/2]

bool SBThread::GetDescription ( lldb::SBStream description,
bool  stop_format 
) const

◆ 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 1241 of file SBThread.cpp.

References lldb_private::Thread::DumpUsingFormat(), error(), lldb::SBFormat::GetFormatEntrySP(), lldb_private::ExecutionContext::GetThreadPtr(), lldb_private::ExecutionContext::HasThreadScope(), LLDB_INVALID_THREAD_ID, m_opaque_sp, and lldb::SBStream::ref().

◆ GetExtendedBacktraceOriginatingIndexID()

uint32_t SBThread::GetExtendedBacktraceOriginatingIndexID ( )

Definition at line 1302 of file SBThread.cpp.

References LLDB_INSTRUMENT_VA, LLDB_INVALID_INDEX32, and m_opaque_sp.

◆ GetExtendedBacktraceThread()

SBThread SBThread::GetExtendedBacktraceThread ( const char *  type)

◆ GetFrameAtIndex()

SBFrame SBThread::GetFrameAtIndex ( uint32_t  idx)

◆ GetIndexID()

uint32_t SBThread::GetIndexID ( ) const

Definition at line 391 of file SBThread.cpp.

References LLDB_INSTRUMENT_VA, LLDB_INVALID_INDEX32, and m_opaque_sp.

◆ GetInfoItemByPathAsString()

bool SBThread::GetInfoItemByPathAsString ( const char *  path,
SBStream strm 
)

◆ GetName()

const char * SBThread::GetName ( ) const

◆ GetNumFrames()

uint32_t SBThread::GetNumFrames ( )

◆ GetProcess()

SBProcess SBThread::GetProcess ( )

◆ GetQueue()

lldb::SBQueue SBThread::GetQueue ( ) const

◆ GetQueueID()

lldb::queue_id_t SBThread::GetQueueID ( ) const

◆ GetQueueName()

const char * SBThread::GetQueueName ( ) const

◆ GetSelectedFrame()

lldb::SBFrame SBThread::GetSelectedFrame ( )

◆ GetSiginfo()

SBValue SBThread::GetSiginfo ( )

Definition at line 1348 of file SBThread.cpp.

References LLDB_INSTRUMENT_VA, m_opaque_sp, and SBValue.

◆ GetStackFrameFromEvent()

SBFrame SBThread::GetStackFrameFromEvent ( const SBEvent event)
static

◆ GetStatus()

bool SBThread::GetStatus ( lldb::SBStream status) const

◆ GetStopDescription()

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

◆ GetStopReason()

StopReason SBThread::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 213 of file SBThread.cpp.

References lldb::eStopReasonBreakpoint, lldb::eStopReasonException, lldb::eStopReasonExec, lldb::eStopReasonFork, lldb::eStopReasonInstrumentation, lldb::eStopReasonInterrupt, lldb::eStopReasonInvalid, lldb::eStopReasonNone, lldb::eStopReasonPlanComplete, lldb::eStopReasonProcessorTrace, lldb::eStopReasonSignal, lldb::eStopReasonThreadExiting, lldb::eStopReasonTrace, lldb::eStopReasonVFork, lldb::eStopReasonVForkDone, lldb::eStopReasonWatchpoint, lldb_private::StopPointSiteList< StopPointSite >::FindByID(), lldb_private::Process::GetBreakpointSiteList(), lldb_private::ExecutionContext::GetProcessPtr(), lldb_private::Process::GetRunLock(), lldb_private::Thread::GetStopInfo(), lldb_private::ExecutionContext::GetThreadPtr(), lldb_private::ExecutionContext::HasThreadScope(), LLDB_INSTRUMENT_VA, LLDB_INVALID_BREAK_ID, m_opaque_sp, and lldb_private::ProcessRunLock::ProcessRunLocker::TryLock().

◆ GetStopReasonDataCount()

size_t SBThread::GetStopReasonDataCount ( )

◆ GetStopReasonExtendedBacktraces()

SBThreadCollection SBThread::GetStopReasonExtendedBacktraces ( InstrumentationRuntimeType  type)

◆ GetStopReasonExtendedInfoAsJSON()

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

◆ GetStopReturnValue()

SBValue SBThread::GetStopReturnValue ( )

◆ GetThreadFromEvent()

SBThread SBThread::GetThreadFromEvent ( const SBEvent event)
static

◆ GetThreadID()

lldb::tid_t SBThread::GetThreadID ( ) const

◆ IsStopped()

bool SBThread::IsStopped ( )

◆ IsSuspended()

bool SBThread::IsSuspended ( )

◆ IsValid()

bool SBThread::IsValid ( ) const

Definition at line 109 of file SBThread.cpp.

References LLDB_INSTRUMENT_VA.

◆ JumpToLine()

SBError SBThread::JumpToLine ( lldb::SBFileSpec file_spec,
uint32_t  line 
)

◆ operator bool()

SBThread::operator bool ( ) const
explicit

◆ operator!=()

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

Definition at line 1195 of file SBThread.cpp.

References LLDB_INSTRUMENT_VA, and m_opaque_sp.

◆ operator->()

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

Definition at line 1340 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, and m_opaque_sp.

◆ operator==()

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

Definition at line 1188 of file SBThread.cpp.

References LLDB_INSTRUMENT_VA, and m_opaque_sp.

◆ Resume() [1/2]

bool SBThread::Resume ( )

Definition at line 1025 of file SBThread.cpp.

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

Referenced by Resume().

◆ Resume() [2/2]

bool SBThread::Resume ( SBError error)

◆ ResumeNewPlan()

SBError SBThread::ResumeNewPlan ( lldb_private::ExecutionContext exe_ctx,
lldb_private::ThreadPlan new_plan 
)
private

◆ ReturnFromFrame()

SBError SBThread::ReturnFromFrame ( SBFrame frame,
SBValue return_value 
)

◆ RunToAddress() [1/2]

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

Definition at line 739 of file SBThread.cpp.

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

Referenced by RunToAddress().

◆ RunToAddress() [2/2]

void SBThread::RunToAddress ( lldb::addr_t  addr,
SBError error 
)

◆ SafeToCallFunctions()

bool SBThread::SafeToCallFunctions ( )

Definition at line 1331 of file SBThread.cpp.

References LLDB_INSTRUMENT_VA, and m_opaque_sp.

◆ SetSelectedFrame()

lldb::SBFrame SBThread::SetSelectedFrame ( uint32_t  frame_idx)

◆ SetThread()

void SBThread::SetThread ( const lldb::ThreadSP lldb_object_sp)
private

◆ StepInstruction() [1/2]

void SBThread::StepInstruction ( bool  step_over)

Definition at line 710 of file SBThread.cpp.

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

Referenced by StepInstruction().

◆ StepInstruction() [2/2]

void SBThread::StepInstruction ( bool  step_over,
SBError error 
)

◆ StepInto() [1/3]

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

Definition at line 575 of file SBThread.cpp.

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

◆ StepInto() [2/3]

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

◆ StepInto() [3/3]

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

Definition at line 569 of file SBThread.cpp.

References LLDB_INSTRUMENT_VA, and StepInto().

Referenced by StepInto().

◆ StepOut() [1/2]

void SBThread::StepOut ( )

Definition at line 631 of file SBThread.cpp.

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

Referenced by StepOut().

◆ StepOut() [2/2]

void SBThread::StepOut ( SBError error)

◆ StepOutOfFrame() [1/2]

void SBThread::StepOutOfFrame ( SBFrame frame)

Definition at line 666 of file SBThread.cpp.

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

Referenced by StepOutOfFrame().

◆ StepOutOfFrame() [2/2]

void SBThread::StepOutOfFrame ( SBFrame frame,
SBError error 
)

◆ StepOver() [1/2]

void SBThread::StepOver ( lldb::RunMode  stop_other_threads,
SBError error 
)

◆ StepOver() [2/2]

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

Definition at line 530 of file SBThread.cpp.

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

Referenced by StepOver().

◆ StepOverUntil()

SBError SBThread::StepOverUntil ( lldb::SBFrame frame,
lldb::SBFileSpec file_spec,
uint32_t  line 
)

◆ StepUsingScriptedThreadPlan() [1/3]

SBError SBThread::StepUsingScriptedThreadPlan ( const char *  script_class_name)

Definition at line 890 of file SBThread.cpp.

References LLDB_INSTRUMENT_VA, and StepUsingScriptedThreadPlan().

Referenced by StepUsingScriptedThreadPlan().

◆ StepUsingScriptedThreadPlan() [2/3]

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

Definition at line 896 of file SBThread.cpp.

References LLDB_INSTRUMENT_VA, and StepUsingScriptedThreadPlan().

◆ StepUsingScriptedThreadPlan() [3/3]

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

◆ 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 998 of file SBThread.cpp.

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

Referenced by Suspend().

◆ Suspend() [2/2]

bool SBThread::Suspend ( SBError error)

◆ UnwindInnermostExpression()

SBError SBThread::UnwindInnermostExpression ( )

Friends And Related Function Documentation

◆ lldb_private::python::SWIGBridge

friend class lldb_private::python::SWIGBridge
friend

Definition at line 247 of file SBThread.h.

◆ lldb_private::QueueImpl

friend class lldb_private::QueueImpl
friend

Definition at line 241 of file SBThread.h.

◆ SBBreakpoint

friend class SBBreakpoint
friend

Definition at line 233 of file SBThread.h.

◆ SBBreakpointCallbackBaton

friend class SBBreakpointCallbackBaton
friend

Definition at line 235 of file SBThread.h.

◆ SBBreakpointLocation

friend class SBBreakpointLocation
friend

Definition at line 234 of file SBThread.h.

◆ SBDebugger

friend class SBDebugger
friend

Definition at line 239 of file SBThread.h.

◆ SBExecutionContext

friend class SBExecutionContext
friend

Definition at line 236 of file SBThread.h.

◆ SBFrame

friend class SBFrame
friend

Definition at line 237 of file SBThread.h.

◆ SBProcess

friend class SBProcess
friend

Definition at line 238 of file SBThread.h.

◆ SBQueueItem

friend class SBQueueItem
friend

Definition at line 242 of file SBThread.h.

◆ SBThreadCollection

friend class SBThreadCollection
friend

Definition at line 243 of file SBThread.h.

Referenced by GetStopReasonExtendedBacktraces().

◆ SBThreadPlan

friend class SBThreadPlan
friend

Definition at line 244 of file SBThread.h.

◆ SBTrace

friend class SBTrace
friend

Definition at line 245 of file SBThread.h.

◆ SBValue

friend class SBValue
friend

Definition at line 240 of file SBThread.h.

Referenced by GetCurrentException(), GetSiginfo(), and GetStopReturnValue().

Member Data Documentation

◆ m_opaque_sp

lldb::ExecutionContextRefSP lldb::SBThread::m_opaque_sp
private

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