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 ()
 

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

References LLDB_RECORD_CONSTRUCTOR_NO_ARGS.

Referenced by GetCurrentExceptionBacktrace().

◆ SBThread() [2/3]

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

Definition at line 70 of file SBThread.cpp.

References lldb_private::clone(), LLDB_RECORD_CONSTRUCTOR, 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 132 of file SBThread.cpp.

References LLDB_RECORD_METHOD_NO_ARGS, and m_opaque_sp.

◆ EventIsThreadEvent()

bool SBThread::EventIsThreadEvent ( const SBEvent event)
static

Definition at line 1199 of file SBThread.cpp.

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

◆ get()

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

◆ GetBroadcasterClassName()

const char * SBThread::GetBroadcasterClassName ( )
static

Definition at line 53 of file SBThread.cpp.

References LLDB_RECORD_STATIC_METHOD_NO_ARGS.

◆ GetCurrentException()

SBValue SBThread::GetCurrentException ( )

Definition at line 1328 of file SBThread.cpp.

References LLDB_RECORD_METHOD_NO_ARGS, LLDB_RECORD_RESULT, m_opaque_sp, and SBValue.

◆ GetCurrentExceptionBacktrace()

SBThread SBThread::GetCurrentExceptionBacktrace ( )

Definition at line 1338 of file SBThread.cpp.

References LLDB_RECORD_METHOD_NO_ARGS, LLDB_RECORD_RESULT, m_opaque_sp, and SBThread().

◆ GetDescription() [1/2]

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

Definition at line 1255 of file SBThread.cpp.

References LLDB_RECORD_METHOD_CONST.

Referenced by GetDescription().

◆ GetDescription() [2/2]

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

◆ GetExtendedBacktraceOriginatingIndexID()

uint32_t SBThread::GetExtendedBacktraceOriginatingIndexID ( )

Definition at line 1318 of file SBThread.cpp.

References LLDB_INVALID_INDEX32, LLDB_RECORD_METHOD_NO_ARGS, 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 392 of file SBThread.cpp.

References LLDB_INVALID_INDEX32, LLDB_RECORD_METHOD_CONST_NO_ARGS, 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 ( )

◆ GetStackFrameFromEvent()

SBFrame SBThread::GetStackFrameFromEvent ( const SBEvent event)
static

◆ 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 212 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_INVALID_BREAK_ID, LLDB_RECORD_METHOD, 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 111 of file SBThread.cpp.

References LLDB_RECORD_METHOD_CONST_NO_ARGS.

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

References LLDB_RECORD_METHOD_CONST, and m_opaque_sp.

◆ operator->()

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

Definition at line 1359 of file SBThread.cpp.

References get().

◆ operator=()

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

◆ operator==()

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

Definition at line 1222 of file SBThread.cpp.

References LLDB_RECORD_METHOD_CONST, and m_opaque_sp.

◆ Resume() [1/2]

bool SBThread::Resume ( )

Definition at line 1054 of file SBThread.cpp.

References error(), and LLDB_RECORD_METHOD_NO_ARGS.

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

References error(), and LLDB_RECORD_METHOD.

Referenced by RunToAddress().

◆ RunToAddress() [2/2]

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

◆ SafeToCallFunctions()

bool SBThread::SafeToCallFunctions ( )

Definition at line 1350 of file SBThread.cpp.

References LLDB_RECORD_METHOD_NO_ARGS, 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 724 of file SBThread.cpp.

References error(), and LLDB_RECORD_METHOD.

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

References error(), LLDB_INVALID_LINE_NUMBER, LLDB_RECORD_METHOD, 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 575 of file SBThread.cpp.

References LLDB_RECORD_METHOD.

Referenced by StepInto().

◆ StepOut() [1/2]

void SBThread::StepOut ( )

Definition at line 642 of file SBThread.cpp.

References error(), and LLDB_RECORD_METHOD_NO_ARGS.

Referenced by StepOut().

◆ StepOut() [2/2]

void SBThread::StepOut ( SBError error)

◆ StepOutOfFrame() [1/2]

void SBThread::StepOutOfFrame ( SBFrame frame)

Definition at line 677 of file SBThread.cpp.

References error(), and LLDB_RECORD_METHOD.

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

References error(), and LLDB_RECORD_METHOD.

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

References LLDB_RECORD_METHOD, and LLDB_RECORD_RESULT.

Referenced by StepUsingScriptedThreadPlan().

◆ StepUsingScriptedThreadPlan() [2/3]

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

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

References error(), and LLDB_RECORD_METHOD_NO_ARGS.

Referenced by Suspend().

◆ 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 220 of file SBThread.h.

◆ SBBreakpoint

friend class SBBreakpoint
friend

Definition at line 212 of file SBThread.h.

◆ SBBreakpointCallbackBaton

friend class SBBreakpointCallbackBaton
friend

Definition at line 214 of file SBThread.h.

◆ SBBreakpointLocation

friend class SBBreakpointLocation
friend

Definition at line 213 of file SBThread.h.

◆ SBDebugger

friend class SBDebugger
friend

Definition at line 218 of file SBThread.h.

◆ SBExecutionContext

friend class SBExecutionContext
friend

Definition at line 215 of file SBThread.h.

◆ SBFrame

friend class SBFrame
friend

Definition at line 216 of file SBThread.h.

◆ SBProcess

friend class SBProcess
friend

Definition at line 217 of file SBThread.h.

◆ SBQueueItem

friend class SBQueueItem
friend

Definition at line 221 of file SBThread.h.

◆ SBThreadPlan

friend class SBThreadPlan
friend

Definition at line 222 of file SBThread.h.

◆ SBTrace

friend class SBTrace
friend

Definition at line 223 of file SBThread.h.

◆ SBValue

friend class SBValue
friend

Definition at line 219 of file SBThread.h.

Referenced by GetCurrentException(), 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: