LLDB mainline
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Friends | List of all members
lldb::SBTrace Class Reference

#include <SBTrace.h>

Public Member Functions

 SBTrace ()
 Default constructor for an invalid Trace object.
 
SBTraceCursor CreateNewCursor (SBError &error, SBThread &thread)
 Get a TraceCursor for the given thread's trace.
 
SBFileSpec SaveToDisk (SBError &error, const SBFileSpec &bundle_dir, bool compact=false)
 Save the trace to the specified directory, which will be created if needed.
 
const char * GetStartConfigurationHelp ()
 
SBError Start (const SBStructuredData &configuration)
 Start tracing all current and future threads in a live process using a provided configuration.
 
SBError Start (const SBThread &thread, const SBStructuredData &configuration)
 Start tracing a specific thread in a live process using a provided configuration.
 
SBError Stop ()
 Stop tracing all threads in a live process.
 
SBError Stop (const SBThread &thread)
 Stop tracing a specific thread in a live process regardless of whether the thread was traced explicitly or as part of a "process tracing" operation.
 
 operator bool () const
 
bool IsValid ()
 

Static Public Member Functions

static SBTrace LoadTraceFromFile (SBError &error, SBDebugger &debugger, const SBFileSpec &trace_description_file)
 See SBDebugger::LoadTraceFromFile.
 

Protected Member Functions

 SBTrace (const lldb::TraceSP &trace_sp)
 

Protected Attributes

lldb::TraceSP m_opaque_sp
 
lldb::ProcessWP m_opaque_wp
 deprecated
 

Friends

class SBTarget
 

Detailed Description

Definition at line 18 of file SBTrace.h.

Constructor & Destructor Documentation

◆ SBTrace() [1/2]

SBTrace::SBTrace ( )

Default constructor for an invalid Trace object.

Definition at line 25 of file SBTrace.cpp.

References LLDB_INSTRUMENT_VA.

Referenced by LoadTraceFromFile().

◆ SBTrace() [2/2]

SBTrace::SBTrace ( const lldb::TraceSP trace_sp)
protected

Definition at line 27 of file SBTrace.cpp.

References LLDB_INSTRUMENT_VA.

Member Function Documentation

◆ CreateNewCursor()

SBTraceCursor SBTrace::CreateNewCursor ( SBError error,
SBThread thread 
)

Get a TraceCursor for the given thread's trace.

Parameters
[out]errorThis will be set with an error in case of failures.
[in]threadThe thread to get a TraceCursor for.
Returns
A SBTraceCursor. If the thread is not traced or its trace information failed to load, an invalid SBTraceCursor is returned and the error parameter is set.

Definition at line 46 of file SBTrace.cpp.

References error(), lldb_private::Status::FromErrorString(), lldb::SBThread::get(), LLDB_INSTRUMENT_VA, and m_opaque_sp.

◆ GetStartConfigurationHelp()

const char * SBTrace::GetStartConfigurationHelp ( )
Returns
A description of the parameters to use for the SBTrace::Start method, or null if the object is invalid.

Definition at line 87 of file SBTrace.cpp.

References lldb_private::ConstString::GetCString(), LLDB_INSTRUMENT_VA, and m_opaque_sp.

◆ IsValid()

bool SBTrace::IsValid ( )

Definition at line 143 of file SBTrace.cpp.

References LLDB_INSTRUMENT_VA.

◆ LoadTraceFromFile()

SBTrace SBTrace::LoadTraceFromFile ( SBError error,
SBDebugger debugger,
const SBFileSpec trace_description_file 
)
static

◆ operator bool()

SBTrace::operator bool ( ) const
explicit

Definition at line 148 of file SBTrace.cpp.

References LLDB_INSTRUMENT_VA.

◆ SaveToDisk()

SBFileSpec SBTrace::SaveToDisk ( SBError error,
const SBFileSpec bundle_dir,
bool  compact = false 
)

Save the trace to the specified directory, which will be created if needed.

This will also create a file <directory>/trace.json with the main properties of the trace session, along with others files which contain the actual trace data. The trace.json file can be used later as input for the "trace load" command to load the trace in LLDB, or for the method SBDebugger.LoadTraceFromFile().

Parameters
[out]errorThis will be set with an error in case of failures.
[in]bundle_dirThe directory where the trace files will be saved.
[in]compactTry not to save to disk information irrelevant to the traced processes. Each trace plug-in implements this in a different fashion.
Returns
A SBFileSpec pointing to the bundle description file.

Definition at line 68 of file SBTrace.cpp.

References error(), lldb_private::Status::FromErrorString(), LLDB_INSTRUMENT_VA, m_opaque_sp, lldb::SBFileSpec::ref(), and lldb::SBFileSpec::SetFileSpec().

◆ Start() [1/2]

SBError SBTrace::Start ( const SBStructuredData configuration)

Start tracing all current and future threads in a live process using a provided configuration.

This is referred as "process tracing" in the documentation.

This is equivalent to the command "process trace start".

This operation fails if it is invoked twice in a row without first stopping the process trace with SBTrace::Stop().

If a thread is already being traced explicitly, e.g. with SBTrace::Start(const SBThread &thread, const SBStructuredData &configuration), it is left unaffected by this operation.

Parameters
[in]configurationDictionary object with custom fields for the corresponding trace technology.

Full details for the trace start parameters that can be set can be retrieved by calling SBTrace::GetStartConfigurationHelp().

Returns
An error explaining any failures.

Definition at line 95 of file SBTrace.cpp.

References error(), lldb_private::Status::FromErrorString(), LLDB_INSTRUMENT_VA, lldb::SBStructuredData::m_impl_up, and m_opaque_sp.

◆ Start() [2/2]

SBError SBTrace::Start ( const SBThread thread,
const SBStructuredData configuration 
)

Start tracing a specific thread in a live process using a provided configuration.

This is referred as "thread tracing" in the documentation.

This is equivalent to the command "thread trace start".

If the thread is already being traced by a "process tracing" operation, e.g. with SBTrace::Start(const SBStructuredData &configuration), this operation fails.

Parameters
[in]configurationDictionary object with custom fields for the corresponding trace technology.

Full details for the trace start parameters that can be set can be retrieved by calling SBTrace::GetStartConfigurationHelp().

Returns
An error explaining any failures.

Definition at line 106 of file SBTrace.cpp.

References error(), lldb_private::Status::FromErrorString(), LLDB_INSTRUMENT_VA, lldb::SBStructuredData::m_impl_up, and m_opaque_sp.

◆ Stop() [1/2]

SBError SBTrace::Stop ( )

Stop tracing all threads in a live process.

If a "process tracing" operation is active, e.g. SBTrace::Start(const SBStructuredData &configuration), this effectively prevents future threads from being traced.

This is equivalent to the command "process trace stop".

Returns
An error explaining any failures.

Definition at line 123 of file SBTrace.cpp.

References error(), lldb_private::Status::FromErrorString(), LLDB_INSTRUMENT_VA, and m_opaque_sp.

◆ Stop() [2/2]

SBError SBTrace::Stop ( const SBThread thread)

Stop tracing a specific thread in a live process regardless of whether the thread was traced explicitly or as part of a "process tracing" operation.

This is equivalent to the command "thread trace stop".

Returns
An error explaining any failures.

Definition at line 133 of file SBTrace.cpp.

References error(), lldb_private::Status::FromErrorString(), LLDB_INSTRUMENT_VA, and m_opaque_sp.

Friends And Related Function Documentation

◆ SBTarget

friend class SBTarget
friend

Definition at line 138 of file SBTrace.h.

Member Data Documentation

◆ m_opaque_sp

lldb::TraceSP lldb::SBTrace::m_opaque_sp
protected

Definition at line 142 of file SBTrace.h.

Referenced by CreateNewCursor(), GetStartConfigurationHelp(), SaveToDisk(), Start(), and Stop().

◆ m_opaque_wp

lldb::ProcessWP lldb::SBTrace::m_opaque_wp
protected

deprecated

Definition at line 144 of file SBTrace.h.


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