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>

Collaboration diagram for lldb::SBThread:
Collaboration graph
[legend]

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 (const lldb::ThreadSP &lldb_object_sp)
 
 ~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. More...
 
uint64_t GetStopReasonDataAtIndex (uint32_t idx)
 Get information associated with a stop reason. More...
 
bool GetStopReasonExtendedInfoAsJSON (lldb::SBStream &stream)
 
SBThreadCollection GetStopReasonExtendedBacktraces (InstrumentationRuntimeType type)
 
size_t GetStopDescription (char *dst, 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. More...
 
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
 
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

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 SBThreadPlan
 
class SBTrace
 

Detailed Description

Definition at line 20 of file SBThread.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
eBroadcastBitStackChanged 
eBroadcastBitThreadSuspended 
eBroadcastBitThreadResumed 
eBroadcastBitSelectedFrameChanged 
eBroadcastBitThreadSelected 

Definition at line 22 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() [3/3]

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

◆ ~SBThread()

SBThread::~SBThread ( )
default

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

Definition at line 1167 of file SBThread.cpp.

References lldb::SBEvent::get(), and LLDB_INSTRUMENT_VA.

◆ get()

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

◆ GetBroadcasterClassName()

const char * SBThread::GetBroadcasterClassName ( )
static

Definition at line 53 of file SBThread.cpp.

References LLDB_INSTRUMENT.

◆ GetCurrentException()

SBValue SBThread::GetCurrentException ( )

Definition at line 1284 of file SBThread.cpp.

References LLDB_INSTRUMENT_VA, m_opaque_sp, and SBValue.

◆ GetCurrentExceptionBacktrace()

SBThread SBThread::GetCurrentExceptionBacktrace ( )

Definition at line 1294 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 1215 of file SBThread.cpp.

References LLDB_INSTRUMENT_VA.

◆ GetDescription() [2/2]

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

◆ GetExtendedBacktraceOriginatingIndexID()

uint32_t SBThread::GetExtendedBacktraceOriginatingIndexID ( )

Definition at line 1275 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 385 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 1321 of file SBThread.cpp.

References LLDB_INSTRUMENT_VA, m_opaque_sp, and SBValue.

◆ GetStackFrameFromEvent()

SBFrame SBThread::GetStackFrameFromEvent ( const SBEvent event)
static

Definition at line 1173 of file SBThread.cpp.

References lldb::SBEvent::get(), and LLDB_INSTRUMENT_VA.

◆ GetStatus()

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

◆ GetStopDescription()

size_t SBThread::GetStopDescription ( char *  dst,
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 210 of file SBThread.cpp.

References lldb::eStopReasonBreakpoint, lldb::eStopReasonException, lldb::eStopReasonExec, lldb::eStopReasonFork, lldb::eStopReasonInstrumentation, lldb::eStopReasonInvalid, lldb::eStopReasonNone, lldb::eStopReasonPlanComplete, lldb::eStopReasonProcessorTrace, lldb::eStopReasonSignal, lldb::eStopReasonThreadExiting, lldb::eStopReasonTrace, lldb::eStopReasonVFork, lldb::eStopReasonVForkDone, lldb::eStopReasonWatchpoint, lldb_private::BreakpointSiteList::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

Definition at line 1179 of file SBThread.cpp.

References lldb::SBEvent::get(), and LLDB_INSTRUMENT_VA.

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

References LLDB_INSTRUMENT_VA, and m_opaque_sp.

◆ operator->()

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

Definition at line 1313 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 1185 of file SBThread.cpp.

References LLDB_INSTRUMENT_VA, and m_opaque_sp.

◆ Resume() [1/2]

bool SBThread::Resume ( )

Definition at line 1023 of file SBThread.cpp.

References error(), and LLDB_INSTRUMENT_VA.

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

References error(), and LLDB_INSTRUMENT_VA.

◆ RunToAddress() [2/2]

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

◆ SafeToCallFunctions()

bool SBThread::SafeToCallFunctions ( )

Definition at line 1304 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 706 of file SBThread.cpp.

References error(), and LLDB_INSTRUMENT_VA.

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

References LLDB_INSTRUMENT_VA.

Referenced by StepInto().

◆ StepOut() [1/2]

void SBThread::StepOut ( )

Definition at line 627 of file SBThread.cpp.

References error(), and LLDB_INSTRUMENT_VA.

◆ StepOut() [2/2]

void SBThread::StepOut ( SBError error)

◆ StepOutOfFrame() [1/2]

void SBThread::StepOutOfFrame ( SBFrame frame)

Definition at line 662 of file SBThread.cpp.

References error(), and LLDB_INSTRUMENT_VA.

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

References error(), and LLDB_INSTRUMENT_VA.

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

References LLDB_INSTRUMENT_VA.

Referenced by StepUsingScriptedThreadPlan().

◆ StepUsingScriptedThreadPlan() [2/3]

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

Definition at line 894 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 996 of file SBThread.cpp.

References error(), and LLDB_INSTRUMENT_VA.

◆ Suspend() [2/2]

bool SBThread::Suspend ( SBError error)

◆ UnwindInnermostExpression()

SBError SBThread::UnwindInnermostExpression ( )

Friends And Related Function Documentation

◆ lldb_private::QueueImpl

friend class lldb_private::QueueImpl
friend

Definition at line 222 of file SBThread.h.

◆ SBBreakpoint

friend class SBBreakpoint
friend

Definition at line 214 of file SBThread.h.

◆ SBBreakpointCallbackBaton

friend class SBBreakpointCallbackBaton
friend

Definition at line 216 of file SBThread.h.

◆ SBBreakpointLocation

friend class SBBreakpointLocation
friend

Definition at line 215 of file SBThread.h.

◆ SBDebugger

friend class SBDebugger
friend

Definition at line 220 of file SBThread.h.

◆ SBExecutionContext

friend class SBExecutionContext
friend

Definition at line 217 of file SBThread.h.

◆ SBFrame

friend class SBFrame
friend

Definition at line 218 of file SBThread.h.

◆ SBProcess

friend class SBProcess
friend

Definition at line 219 of file SBThread.h.

◆ SBQueueItem

friend class SBQueueItem
friend

Definition at line 223 of file SBThread.h.

◆ SBThreadPlan

friend class SBThreadPlan
friend

Definition at line 224 of file SBThread.h.

◆ SBTrace

friend class SBTrace
friend

Definition at line 225 of file SBThread.h.

◆ SBValue

friend class SBValue
friend

Definition at line 221 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: