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

#include <SBTrace.h>

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

Public Member Functions

 SBTrace ()
 Default constructor for an invalid Trace object. More...
 
 SBTrace (const lldb::TraceSP &trace_sp)
 
SBTraceCursor CreateNewCursor (SBError &error, SBThread &thread)
 Get a TraceCursor for the given thread's trace. More...
 
SBFileSpec SaveToDisk (SBError &error, const SBFileSpec &bundle_dir, bool compact=false)
 Save the trace to the specified directory, which will be created if needed. More...
 
const char * GetStartConfigurationHelp ()
 
SBError Start (const SBStructuredData &configuration)
 Start tracing all current and future threads in a live process using a provided configuration. More...
 
SBError Start (const SBThread &thread, const SBStructuredData &configuration)
 Start tracing a specific thread in a live process using a provided configuration. More...
 
SBError Stop ()
 Stop tracing all threads in a live process. More...
 
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. More...
 
 operator bool () const
 
bool IsValid ()
 

Static Public Member Functions

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

Protected Attributes

lldb::TraceSP m_opaque_sp
 
lldb::ProcessWP m_opaque_wp
 deprecated More...
 

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)

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::SBThread::get(), LLDB_INSTRUMENT_VA, m_opaque_sp, lldb::SBTraceCursor, and lldb_private::toString().

◆ 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 85 of file SBTrace.cpp.

References LLDB_INSTRUMENT_VA, and m_opaque_sp.

◆ IsValid()

bool SBTrace::IsValid ( )

Definition at line 138 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 143 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 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]directoryThe 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 67 of file SBTrace.cpp.

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

◆ 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 90 of file SBTrace.cpp.

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

◆ 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 101 of file SBTrace.cpp.

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

◆ 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 118 of file SBTrace.cpp.

References error(), LLDB_INSTRUMENT_VA, m_opaque_sp, and lldb_private::toString().

◆ 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 128 of file SBTrace.cpp.

References error(), LLDB_INSTRUMENT_VA, m_opaque_sp, and lldb_private::toString().

Member Data Documentation

◆ m_opaque_sp

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

Definition at line 140 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 142 of file SBTrace.h.


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