LLDB mainline
Classes | Public Member Functions | Static Public Member Functions | Private Attributes | List of all members
lldb_private::WatchpointOptions Class Reference

"lldb/Breakpoint/WatchpointOptions.h" Class that manages the options on a watchpoint. More...

#include <WatchpointOptions.h>

Classes

class  CommandBaton
 
struct  CommandData
 

Public Member Functions

 WatchpointOptions ()
 Default constructor.
 
 WatchpointOptions (const WatchpointOptions &rhs)
 
 WatchpointOptions (WatchpointHitCallback callback, void *baton, lldb::tid_t thread_id=LLDB_INVALID_THREAD_ID)
 This constructor allows you to specify all the watchpoint options.
 
virtual ~WatchpointOptions ()
 
const WatchpointOptionsoperator= (const WatchpointOptions &rhs)
 
void SetCallback (WatchpointHitCallback callback, const lldb::BatonSP &baton_sp, bool synchronous=false)
 Adds a callback to the watchpoint option set.
 
void ClearCallback ()
 Remove the callback from this option set.
 
bool InvokeCallback (StoppointCallbackContext *context, lldb::user_id_t watch_id)
 Use this function to invoke the callback for a specific stop.
 
bool IsCallbackSynchronous ()
 Used in InvokeCallback to tell whether it is the right time to run this kind of callback.
 
BatonGetBaton ()
 Fetch the baton from the callback.
 
const BatonGetBaton () const
 Fetch a const version of the baton from the callback.
 
const ThreadSpecGetThreadSpecNoCreate () const
 Return the current thread spec for this option.
 
ThreadSpecGetThreadSpec ()
 Returns a pointer to the ThreadSpec for this option, creating it if it hasn't been created already.
 
void SetThreadID (lldb::tid_t thread_id)
 
void GetDescription (Stream *s, lldb::DescriptionLevel level) const
 
void GetCallbackDescription (Stream *s, lldb::DescriptionLevel level) const
 Get description for callback only.
 
bool HasCallback ()
 Returns true if the watchpoint option has a callback set.
 

Static Public Member Functions

static WatchpointOptionsCopyOptionsNoCallback (WatchpointOptions &rhs)
 
static bool NullCallback (void *baton, StoppointCallbackContext *context, lldb::user_id_t watch_id)
 This is the default empty callback.
 

Private Attributes

WatchpointHitCallback m_callback
 
lldb::BatonSP m_callback_baton_sp
 
bool m_callback_is_synchronous = false
 
std::unique_ptr< ThreadSpecm_thread_spec_up
 

Detailed Description

"lldb/Breakpoint/WatchpointOptions.h" Class that manages the options on a watchpoint.

Definition at line 25 of file WatchpointOptions.h.

Constructor & Destructor Documentation

◆ WatchpointOptions() [1/3]

WatchpointOptions::WatchpointOptions ( )

Default constructor.

The watchpoint is enabled, and has no condition, callback, ignore count, etc...

Definition at line 29 of file WatchpointOptions.cpp.

Referenced by CopyOptionsNoCallback().

◆ WatchpointOptions() [2/3]

WatchpointOptions::WatchpointOptions ( const WatchpointOptions rhs)

Definition at line 33 of file WatchpointOptions.cpp.

References m_thread_spec_up.

◆ WatchpointOptions() [3/3]

lldb_private::WatchpointOptions::WatchpointOptions ( WatchpointHitCallback  callback,
void *  baton,
lldb::tid_t  thread_id = LLDB_INVALID_THREAD_ID 
)

This constructor allows you to specify all the watchpoint options.

Parameters
[in]callbackThis is the plugin for some code that gets run, returns true if we are to stop.
[in]batonClient data that will get passed to the callback.
[in]thread_idOnly stop if thread_id hits the watchpoint.

◆ ~WatchpointOptions()

WatchpointOptions::~WatchpointOptions ( )
virtualdefault

Member Function Documentation

◆ ClearCallback()

void WatchpointOptions::ClearCallback ( )

Remove the callback from this option set.

Definition at line 77 of file WatchpointOptions.cpp.

References m_callback, m_callback_baton_sp, m_callback_is_synchronous, and NullCallback().

Referenced by lldb_private::Watchpoint::ClearCallback(), and CopyOptionsNoCallback().

◆ CopyOptionsNoCallback()

WatchpointOptions * WatchpointOptions::CopyOptionsNoCallback ( WatchpointOptions rhs)
static

◆ GetBaton() [1/2]

Baton * WatchpointOptions::GetBaton ( )

Fetch the baton from the callback.

Returns
The baton.

Definition at line 83 of file WatchpointOptions.cpp.

References m_callback_baton_sp.

Referenced by CommandObjectWatchpointCommandList::DoExecute().

◆ GetBaton() [2/2]

const Baton * WatchpointOptions::GetBaton ( ) const

Fetch a const version of the baton from the callback.

Returns
The baton.

Definition at line 85 of file WatchpointOptions.cpp.

References m_callback_baton_sp.

◆ GetCallbackDescription()

void WatchpointOptions::GetCallbackDescription ( Stream s,
lldb::DescriptionLevel  level 
) const

◆ GetDescription()

void WatchpointOptions::GetDescription ( Stream s,
lldb::DescriptionLevel  level 
) const

◆ GetThreadSpec()

ThreadSpec * WatchpointOptions::GetThreadSpec ( )

Returns a pointer to the ThreadSpec for this option, creating it if it hasn't been created already.

This API is used for setting the ThreadSpec items for this WatchpointOptions.

Definition at line 107 of file WatchpointOptions.cpp.

References m_thread_spec_up.

Referenced by SetThreadID().

◆ GetThreadSpecNoCreate()

const ThreadSpec * WatchpointOptions::GetThreadSpecNoCreate ( ) const

Return the current thread spec for this option.

This will return nullptr if the no thread specifications have been set for this WatchpointOptions yet.

Returns
The thread specification pointer for this option, or nullptr if none has been set yet.

Definition at line 103 of file WatchpointOptions.cpp.

References m_thread_spec_up.

Referenced by GetDescription().

◆ HasCallback()

bool WatchpointOptions::HasCallback ( )

Returns true if the watchpoint option has a callback set.

Definition at line 99 of file WatchpointOptions.cpp.

References m_callback, and NullCallback().

◆ InvokeCallback()

bool WatchpointOptions::InvokeCallback ( StoppointCallbackContext context,
lldb::user_id_t  watch_id 
)

Use this function to invoke the callback for a specific stop.

Parameters
[in]contextThe context in which the callback is to be invoked. This includes the stop event, the execution context of the stop (since you might hit the same watchpoint on multiple threads) and whether we are currently executing synchronous or asynchronous callbacks.
[in]watch_idThe watchpoint ID that owns this option set.
Returns
The callback return value.

Definition at line 89 of file WatchpointOptions.cpp.

References lldb_private::StoppointCallbackContext::is_synchronous, IsCallbackSynchronous(), m_callback, and m_callback_baton_sp.

Referenced by lldb_private::Watchpoint::InvokeCallback().

◆ IsCallbackSynchronous()

bool lldb_private::WatchpointOptions::IsCallbackSynchronous ( )
inline

Used in InvokeCallback to tell whether it is the right time to run this kind of callback.

Returns
The synchronicity of our callback.

Definition at line 118 of file WatchpointOptions.h.

References m_callback_is_synchronous.

Referenced by InvokeCallback().

◆ NullCallback()

bool WatchpointOptions::NullCallback ( void *  baton,
StoppointCallbackContext context,
lldb::user_id_t  watch_id 
)
static

This is the default empty callback.

Returns
The thread id for which the watchpoint hit will stop, LLDB_INVALID_THREAD_ID for all threads.

Definition at line 22 of file WatchpointOptions.cpp.

Referenced by ClearCallback(), and HasCallback().

◆ operator=()

const WatchpointOptions & WatchpointOptions::operator= ( const WatchpointOptions rhs)

◆ SetCallback()

void WatchpointOptions::SetCallback ( WatchpointHitCallback  callback,
const lldb::BatonSP baton_sp,
bool  synchronous = false 
)

Adds a callback to the watchpoint option set.

Parameters
[in]callbackThe function to be called when the watchpoint gets hit.
[in]baton_spA baton which will get passed back to the callback when it is invoked.
[in]synchronousWhether this is a synchronous or asynchronous callback. See discussion above.

Definition at line 69 of file WatchpointOptions.cpp.

References m_callback, m_callback_baton_sp, and m_callback_is_synchronous.

Referenced by CopyOptionsNoCallback(), lldb_private::ScriptInterpreterLua::RegisterWatchpointCallback(), and lldb_private::Watchpoint::SetCallback().

◆ SetThreadID()

void WatchpointOptions::SetThreadID ( lldb::tid_t  thread_id)

Definition at line 114 of file WatchpointOptions.cpp.

References GetThreadSpec(), and lldb_private::ThreadSpec::SetTID().

Member Data Documentation

◆ m_callback

WatchpointHitCallback lldb_private::WatchpointOptions::m_callback
private

◆ m_callback_baton_sp

lldb::BatonSP lldb_private::WatchpointOptions::m_callback_baton_sp
private

◆ m_callback_is_synchronous

bool lldb_private::WatchpointOptions::m_callback_is_synchronous = false
private

◆ m_thread_spec_up

std::unique_ptr<ThreadSpec> lldb_private::WatchpointOptions::m_thread_spec_up
private

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