Update lldb to trunk r290819 and resolve conflicts.

This commit is contained in:
Dimitry Andric 2017-01-02 21:59:52 +00:00
commit 435933dd67
1607 changed files with 435179 additions and 468430 deletions

View File

@ -14,7 +14,6 @@
// C++ Includes
// Other libraries and framework includes
// Project includes
#include "lldb/API/SBDefines.h"
#include "lldb/API/SBAddress.h"
#include "lldb/API/SBAttachInfo.h"
#include "lldb/API/SBBlock.h"
@ -28,6 +27,7 @@
#include "lldb/API/SBData.h"
#include "lldb/API/SBDebugger.h"
#include "lldb/API/SBDeclaration.h"
#include "lldb/API/SBDefines.h"
#include "lldb/API/SBError.h"
#include "lldb/API/SBEvent.h"
#include "lldb/API/SBExecutionContext.h"
@ -55,6 +55,7 @@
#include "lldb/API/SBSourceManager.h"
#include "lldb/API/SBStream.h"
#include "lldb/API/SBStringList.h"
#include "lldb/API/SBStructuredData.h"
#include "lldb/API/SBSymbol.h"
#include "lldb/API/SBSymbolContext.h"
#include "lldb/API/SBSymbolContextList.h"
@ -76,4 +77,4 @@
#include "lldb/API/SBVariablesOptions.h"
#include "lldb/API/SBWatchpoint.h"
#endif // LLDB_LLDB_h_
#endif // LLDB_LLDB_h_

View File

@ -15,138 +15,108 @@
namespace lldb {
class LLDB_API SBAddress
{
class LLDB_API SBAddress {
public:
SBAddress();
SBAddress ();
SBAddress(const lldb::SBAddress &rhs);
SBAddress (const lldb::SBAddress &rhs);
SBAddress(lldb::SBSection section, lldb::addr_t offset);
SBAddress (lldb::SBSection section, lldb::addr_t offset);
// Create an address by resolving a load address using the supplied target
SBAddress(lldb::addr_t load_addr, lldb::SBTarget &target);
// Create an address by resolving a load address using the supplied target
SBAddress (lldb::addr_t load_addr, lldb::SBTarget &target);
~SBAddress();
~SBAddress ();
const lldb::SBAddress &operator=(const lldb::SBAddress &rhs);
const lldb::SBAddress &
operator = (const lldb::SBAddress &rhs);
bool IsValid() const;
bool
IsValid () const;
void Clear();
void
Clear ();
addr_t GetFileAddress() const;
addr_t
GetFileAddress () const;
addr_t GetLoadAddress(const lldb::SBTarget &target) const;
addr_t
GetLoadAddress (const lldb::SBTarget &target) const;
void SetAddress(lldb::SBSection section, lldb::addr_t offset);
void
SetAddress (lldb::SBSection section, lldb::addr_t offset);
void SetLoadAddress(lldb::addr_t load_addr, lldb::SBTarget &target);
bool OffsetAddress(addr_t offset);
void
SetLoadAddress (lldb::addr_t load_addr,
lldb::SBTarget &target);
bool
OffsetAddress (addr_t offset);
bool GetDescription(lldb::SBStream &description);
bool
GetDescription (lldb::SBStream &description);
// The following queries can lookup symbol information for a given address.
// An address might refer to code or data from an existing module, or it
// might refer to something on the stack or heap. The following functions
// will only return valid values if the address has been resolved to a code
// or data address using "void SBAddress::SetLoadAddress(...)" or
// "lldb::SBAddress SBTarget::ResolveLoadAddress (...)".
lldb::SBSymbolContext GetSymbolContext(uint32_t resolve_scope);
// The following queries can lookup symbol information for a given address.
// An address might refer to code or data from an existing module, or it
// might refer to something on the stack or heap. The following functions
// will only return valid values if the address has been resolved to a code
// or data address using "void SBAddress::SetLoadAddress(...)" or
// "lldb::SBAddress SBTarget::ResolveLoadAddress (...)".
lldb::SBSymbolContext
GetSymbolContext (uint32_t resolve_scope);
// The following functions grab individual objects for a given address and
// are less efficient if you want more than one symbol related objects.
// Use one of the following when you want multiple debug symbol related
// objects for an address:
// lldb::SBSymbolContext SBAddress::GetSymbolContext (uint32_t
// resolve_scope);
// lldb::SBSymbolContext SBTarget::ResolveSymbolContextForAddress (const
// SBAddress &addr, uint32_t resolve_scope);
// One or more bits from the SymbolContextItem enumerations can be logically
// OR'ed together to more efficiently retrieve multiple symbol objects.
// The following functions grab individual objects for a given address and
// are less efficient if you want more than one symbol related objects.
// Use one of the following when you want multiple debug symbol related
// objects for an address:
// lldb::SBSymbolContext SBAddress::GetSymbolContext (uint32_t resolve_scope);
// lldb::SBSymbolContext SBTarget::ResolveSymbolContextForAddress (const SBAddress &addr, uint32_t resolve_scope);
// One or more bits from the SymbolContextItem enumerations can be logically
// OR'ed together to more efficiently retrieve multiple symbol objects.
lldb::SBSection GetSection();
lldb::SBSection
GetSection ();
lldb::addr_t GetOffset();
lldb::addr_t
GetOffset ();
lldb::SBModule GetModule();
lldb::SBModule
GetModule ();
lldb::SBCompileUnit
GetCompileUnit ();
lldb::SBCompileUnit GetCompileUnit();
lldb::SBFunction
GetFunction ();
lldb::SBFunction GetFunction();
lldb::SBBlock
GetBlock ();
lldb::SBBlock GetBlock();
lldb::SBSymbol
GetSymbol ();
lldb::SBSymbol GetSymbol();
lldb::SBLineEntry
GetLineEntry ();
lldb::AddressClass
GetAddressClass ();
lldb::SBLineEntry GetLineEntry();
lldb::AddressClass GetAddressClass();
protected:
friend class SBBlock;
friend class SBBreakpointLocation;
friend class SBFrame;
friend class SBFunction;
friend class SBLineEntry;
friend class SBInstruction;
friend class SBModule;
friend class SBSection;
friend class SBSymbol;
friend class SBSymbolContext;
friend class SBTarget;
friend class SBThread;
friend class SBThreadPlan;
friend class SBValue;
friend class SBQueueItem;
friend class SBBlock;
friend class SBBreakpointLocation;
friend class SBFrame;
friend class SBFunction;
friend class SBLineEntry;
friend class SBInstruction;
friend class SBModule;
friend class SBSection;
friend class SBSymbol;
friend class SBSymbolContext;
friend class SBTarget;
friend class SBThread;
friend class SBThreadPlan;
friend class SBValue;
friend class SBQueueItem;
lldb_private::Address *operator->();
lldb_private::Address *
operator->();
const lldb_private::Address *operator->() const;
const lldb_private::Address *
operator->() const;
lldb_private::Address *get();
lldb_private::Address *
get ();
lldb_private::Address &ref();
lldb_private::Address &
ref();
const lldb_private::Address &ref() const;
const lldb_private::Address &
ref() const;
SBAddress(const lldb_private::Address *lldb_object_ptr);
SBAddress (const lldb_private::Address *lldb_object_ptr);
void
SetAddress (const lldb_private::Address *lldb_object_ptr);
void SetAddress(const lldb_private::Address *lldb_object_ptr);
private:
std::unique_ptr<lldb_private::Address> m_opaque_ap;
std::unique_ptr<lldb_private::Address> m_opaque_ap;
};
} // namespace lldb
#endif // LLDB_SBAddress_h_

View File

@ -16,209 +16,175 @@ namespace lldb {
class SBTarget;
class LLDB_API SBAttachInfo
{
class LLDB_API SBAttachInfo {
public:
SBAttachInfo ();
SBAttachInfo();
SBAttachInfo (lldb::pid_t pid);
SBAttachInfo(lldb::pid_t pid);
//------------------------------------------------------------------
/// Attach to a process by name.
///
/// This function implies that a future call to SBTarget::Attach(...)
/// will be synchronous.
///
/// @param[in] path
/// A full or partial name for the process to attach to.
///
/// @param[in] wait_for
/// If \b false, attach to an existing process whose name matches.
/// If \b true, then wait for the next process whose name matches.
//------------------------------------------------------------------
SBAttachInfo (const char *path, bool wait_for);
//------------------------------------------------------------------
/// Attach to a process by name.
///
/// This function implies that a future call to SBTarget::Attach(...)
/// will be synchronous.
///
/// @param[in] path
/// A full or partial name for the process to attach to.
///
/// @param[in] wait_for
/// If \b false, attach to an existing process whose name matches.
/// If \b true, then wait for the next process whose name matches.
//------------------------------------------------------------------
SBAttachInfo(const char *path, bool wait_for);
//------------------------------------------------------------------
/// Attach to a process by name.
///
/// Future calls to SBTarget::Attach(...) will be synchronous or
/// asynchronous depending on the \a async argument.
///
/// @param[in] path
/// A full or partial name for the process to attach to.
///
/// @param[in] wait_for
/// If \b false, attach to an existing process whose name matches.
/// If \b true, then wait for the next process whose name matches.
///
/// @param[in] async
/// If \b false, then the SBTarget::Attach(...) call will be a
/// synchronous call with no way to cancel the attach in
/// progress.
/// If \b true, then the SBTarget::Attach(...) function will
/// return immediately and clients are expected to wait for a
/// process eStateStopped event if a suitable process is
/// eventually found. If the client wants to cancel the event,
/// SBProcess::Stop() can be called and an eStateExited process
/// event will be delivered.
//------------------------------------------------------------------
SBAttachInfo (const char *path, bool wait_for, bool async);
//------------------------------------------------------------------
/// Attach to a process by name.
///
/// Future calls to SBTarget::Attach(...) will be synchronous or
/// asynchronous depending on the \a async argument.
///
/// @param[in] path
/// A full or partial name for the process to attach to.
///
/// @param[in] wait_for
/// If \b false, attach to an existing process whose name matches.
/// If \b true, then wait for the next process whose name matches.
///
/// @param[in] async
/// If \b false, then the SBTarget::Attach(...) call will be a
/// synchronous call with no way to cancel the attach in
/// progress.
/// If \b true, then the SBTarget::Attach(...) function will
/// return immediately and clients are expected to wait for a
/// process eStateStopped event if a suitable process is
/// eventually found. If the client wants to cancel the event,
/// SBProcess::Stop() can be called and an eStateExited process
/// event will be delivered.
//------------------------------------------------------------------
SBAttachInfo(const char *path, bool wait_for, bool async);
SBAttachInfo (const SBAttachInfo &rhs);
SBAttachInfo(const SBAttachInfo &rhs);
~SBAttachInfo();
~SBAttachInfo();
SBAttachInfo &
operator = (const SBAttachInfo &rhs);
SBAttachInfo &operator=(const SBAttachInfo &rhs);
lldb::pid_t
GetProcessID ();
lldb::pid_t GetProcessID();
void
SetProcessID (lldb::pid_t pid);
void SetProcessID(lldb::pid_t pid);
void
SetExecutable (const char *path);
void SetExecutable(const char *path);
void
SetExecutable (lldb::SBFileSpec exe_file);
void SetExecutable(lldb::SBFileSpec exe_file);
bool
GetWaitForLaunch ();
bool GetWaitForLaunch();
//------------------------------------------------------------------
/// Set attach by process name settings.
///
/// Designed to be used after a call to SBAttachInfo::SetExecutable().
/// This function implies that a call to SBTarget::Attach(...) will
/// be synchronous.
///
/// @param[in] wait_for
/// If \b false, attach to an existing process whose name matches.
/// If \b true, then wait for the next process whose name matches.
//------------------------------------------------------------------
void
SetWaitForLaunch (bool b);
//------------------------------------------------------------------
/// Set attach by process name settings.
///
/// Designed to be used after a call to SBAttachInfo::SetExecutable().
/// This function implies that a call to SBTarget::Attach(...) will
/// be synchronous.
///
/// @param[in] wait_for
/// If \b false, attach to an existing process whose name matches.
/// If \b true, then wait for the next process whose name matches.
//------------------------------------------------------------------
void SetWaitForLaunch(bool b);
//------------------------------------------------------------------
/// Set attach by process name settings.
///
/// Designed to be used after a call to SBAttachInfo::SetExecutable().
/// Future calls to SBTarget::Attach(...) will be synchronous or
/// asynchronous depending on the \a async argument.
///
/// @param[in] wait_for
/// If \b false, attach to an existing process whose name matches.
/// If \b true, then wait for the next process whose name matches.
///
/// @param[in] async
/// If \b false, then the SBTarget::Attach(...) call will be a
/// synchronous call with no way to cancel the attach in
/// progress.
/// If \b true, then the SBTarget::Attach(...) function will
/// return immediately and clients are expected to wait for a
/// process eStateStopped event if a suitable process is
/// eventually found. If the client wants to cancel the event,
/// SBProcess::Stop() can be called and an eStateExited process
/// event will be delivered.
//------------------------------------------------------------------
void
SetWaitForLaunch (bool b, bool async);
//------------------------------------------------------------------
/// Set attach by process name settings.
///
/// Designed to be used after a call to SBAttachInfo::SetExecutable().
/// Future calls to SBTarget::Attach(...) will be synchronous or
/// asynchronous depending on the \a async argument.
///
/// @param[in] wait_for
/// If \b false, attach to an existing process whose name matches.
/// If \b true, then wait for the next process whose name matches.
///
/// @param[in] async
/// If \b false, then the SBTarget::Attach(...) call will be a
/// synchronous call with no way to cancel the attach in
/// progress.
/// If \b true, then the SBTarget::Attach(...) function will
/// return immediately and clients are expected to wait for a
/// process eStateStopped event if a suitable process is
/// eventually found. If the client wants to cancel the event,
/// SBProcess::Stop() can be called and an eStateExited process
/// event will be delivered.
//------------------------------------------------------------------
void SetWaitForLaunch(bool b, bool async);
bool
GetIgnoreExisting ();
bool GetIgnoreExisting();
void
SetIgnoreExisting (bool b);
void SetIgnoreExisting(bool b);
uint32_t
GetResumeCount ();
uint32_t GetResumeCount();
void
SetResumeCount (uint32_t c);
void SetResumeCount(uint32_t c);
const char *
GetProcessPluginName ();
const char *GetProcessPluginName();
void
SetProcessPluginName (const char *plugin_name);
void SetProcessPluginName(const char *plugin_name);
uint32_t
GetUserID();
uint32_t GetUserID();
uint32_t
GetGroupID();
uint32_t GetGroupID();
bool
UserIDIsValid ();
bool UserIDIsValid();
bool
GroupIDIsValid ();
bool GroupIDIsValid();
void
SetUserID (uint32_t uid);
void SetUserID(uint32_t uid);
void
SetGroupID (uint32_t gid);
void SetGroupID(uint32_t gid);
uint32_t
GetEffectiveUserID();
uint32_t GetEffectiveUserID();
uint32_t
GetEffectiveGroupID();
uint32_t GetEffectiveGroupID();
bool
EffectiveUserIDIsValid ();
bool EffectiveUserIDIsValid();
bool
EffectiveGroupIDIsValid ();
bool EffectiveGroupIDIsValid();
void
SetEffectiveUserID (uint32_t uid);
void SetEffectiveUserID(uint32_t uid);
void
SetEffectiveGroupID (uint32_t gid);
void SetEffectiveGroupID(uint32_t gid);
lldb::pid_t
GetParentProcessID ();
lldb::pid_t GetParentProcessID();
void
SetParentProcessID (lldb::pid_t pid);
void SetParentProcessID(lldb::pid_t pid);
bool
ParentProcessIDIsValid();
bool ParentProcessIDIsValid();
//----------------------------------------------------------------------
/// Get the listener that will be used to receive process events.
///
/// If no listener has been set via a call to
/// SBLaunchInfo::SetListener(), then an invalid SBListener will be
/// returned (SBListener::IsValid() will return false). If a listener
/// has been set, then the valid listener object will be returned.
//----------------------------------------------------------------------
SBListener
GetListener ();
//----------------------------------------------------------------------
/// Set the listener that will be used to receive process events.
///
/// By default the SBDebugger, which has a listener, that the SBTarget
/// belongs to will listen for the process events. Calling this function
/// allows a different listener to be used to listen for process events.
//----------------------------------------------------------------------
void
SetListener (SBListener &listener);
//----------------------------------------------------------------------
/// Get the listener that will be used to receive process events.
///
/// If no listener has been set via a call to
/// SBLaunchInfo::SetListener(), then an invalid SBListener will be
/// returned (SBListener::IsValid() will return false). If a listener
/// has been set, then the valid listener object will be returned.
//----------------------------------------------------------------------
SBListener GetListener();
//----------------------------------------------------------------------
/// Set the listener that will be used to receive process events.
///
/// By default the SBDebugger, which has a listener, that the SBTarget
/// belongs to will listen for the process events. Calling this function
/// allows a different listener to be used to listen for process events.
//----------------------------------------------------------------------
void SetListener(SBListener &listener);
protected:
friend class SBTarget;
friend class SBTarget;
lldb_private::ProcessAttachInfo &
ref ();
lldb_private::ProcessAttachInfo &ref();
ProcessAttachInfoSP m_opaque_sp;
ProcessAttachInfoSP m_opaque_sp;
};
} // namespace lldb
#endif // LLDB_SBAttachInfo_h_
#endif // LLDB_SBAttachInfo_h_

View File

@ -17,107 +17,80 @@
namespace lldb {
class LLDB_API SBBlock
{
class LLDB_API SBBlock {
public:
SBBlock();
SBBlock ();
SBBlock(const lldb::SBBlock &rhs);
SBBlock (const lldb::SBBlock &rhs);
~SBBlock();
~SBBlock ();
const lldb::SBBlock &operator=(const lldb::SBBlock &rhs);
const lldb::SBBlock &
operator = (const lldb::SBBlock &rhs);
bool IsInlined() const;
bool
IsInlined () const;
bool IsValid() const;
bool
IsValid () const;
const char *GetInlinedName() const;
const char *
GetInlinedName () const;
lldb::SBFileSpec GetInlinedCallSiteFile() const;
lldb::SBFileSpec
GetInlinedCallSiteFile () const;
uint32_t GetInlinedCallSiteLine() const;
uint32_t
GetInlinedCallSiteLine () const;
uint32_t GetInlinedCallSiteColumn() const;
uint32_t
GetInlinedCallSiteColumn () const;
lldb::SBBlock GetParent();
lldb::SBBlock
GetParent ();
lldb::SBBlock
GetSibling ();
lldb::SBBlock
GetFirstChild ();
lldb::SBBlock GetSibling();
uint32_t
GetNumRanges ();
lldb::SBBlock GetFirstChild();
lldb::SBAddress
GetRangeStartAddress (uint32_t idx);
uint32_t GetNumRanges();
lldb::SBAddress
GetRangeEndAddress (uint32_t idx);
lldb::SBAddress GetRangeStartAddress(uint32_t idx);
uint32_t
GetRangeIndexForBlockAddress (lldb::SBAddress block_addr);
lldb::SBAddress GetRangeEndAddress(uint32_t idx);
lldb::SBValueList
GetVariables (lldb::SBFrame& frame,
bool arguments,
bool locals,
bool statics,
lldb::DynamicValueType use_dynamic);
lldb::SBValueList
GetVariables (lldb::SBTarget& target,
bool arguments,
bool locals,
bool statics);
//------------------------------------------------------------------
/// Get the inlined block that contains this block.
///
/// @return
/// If this block is inlined, it will return this block, else
/// parent blocks will be searched to see if any contain this
/// block and are themselves inlined. An invalid SBBlock will
/// be returned if this block nor any parent blocks are inlined
/// function blocks.
//------------------------------------------------------------------
lldb::SBBlock
GetContainingInlinedBlock ();
uint32_t GetRangeIndexForBlockAddress(lldb::SBAddress block_addr);
bool
GetDescription (lldb::SBStream &description);
lldb::SBValueList GetVariables(lldb::SBFrame &frame, bool arguments,
bool locals, bool statics,
lldb::DynamicValueType use_dynamic);
lldb::SBValueList GetVariables(lldb::SBTarget &target, bool arguments,
bool locals, bool statics);
//------------------------------------------------------------------
/// Get the inlined block that contains this block.
///
/// @return
/// If this block is inlined, it will return this block, else
/// parent blocks will be searched to see if any contain this
/// block and are themselves inlined. An invalid SBBlock will
/// be returned if this block nor any parent blocks are inlined
/// function blocks.
//------------------------------------------------------------------
lldb::SBBlock GetContainingInlinedBlock();
bool GetDescription(lldb::SBStream &description);
private:
friend class SBAddress;
friend class SBFrame;
friend class SBFunction;
friend class SBSymbolContext;
friend class SBAddress;
friend class SBFrame;
friend class SBFunction;
friend class SBSymbolContext;
lldb_private::Block *
GetPtr ();
lldb_private::Block *GetPtr();
void
SetPtr (lldb_private::Block *lldb_object_ptr);
void SetPtr(lldb_private::Block *lldb_object_ptr);
SBBlock (lldb_private::Block *lldb_object_ptr);
SBBlock(lldb_private::Block *lldb_object_ptr);
void
AppendVariables (bool can_create, bool get_parent_variables, lldb_private::VariableList *var_list);
void AppendVariables(bool can_create, bool get_parent_variables,
lldb_private::VariableList *var_list);
lldb_private::Block *m_opaque_ptr;
lldb_private::Block *m_opaque_ptr;
};
} // namespace lldb
#endif // LLDB_SBBlock_h_

View File

@ -12,182 +12,171 @@
#include "lldb/API/SBDefines.h"
class SBBreakpointListImpl;
namespace lldb {
class LLDB_API SBBreakpoint
{
class LLDB_API SBBreakpoint {
public:
typedef bool (*BreakpointHitCallback)(void *baton, SBProcess &process,
SBThread &thread,
lldb::SBBreakpointLocation &location);
typedef bool (*BreakpointHitCallback) (void *baton,
SBProcess &process,
SBThread &thread,
lldb::SBBreakpointLocation &location);
SBBreakpoint();
SBBreakpoint ();
SBBreakpoint(const lldb::SBBreakpoint &rhs);
SBBreakpoint (const lldb::SBBreakpoint& rhs);
~SBBreakpoint();
~SBBreakpoint();
const lldb::SBBreakpoint &operator=(const lldb::SBBreakpoint &rhs);
const lldb::SBBreakpoint &
operator = (const lldb::SBBreakpoint& rhs);
// Tests to see if the opaque breakpoint object in this object matches the
// opaque breakpoint object in "rhs".
bool
operator == (const lldb::SBBreakpoint& rhs);
// Tests to see if the opaque breakpoint object in this object matches the
// opaque breakpoint object in "rhs".
bool operator==(const lldb::SBBreakpoint &rhs);
bool
operator != (const lldb::SBBreakpoint& rhs);
break_id_t
GetID () const;
bool operator!=(const lldb::SBBreakpoint &rhs);
bool
IsValid() const;
break_id_t GetID() const;
void
ClearAllBreakpointSites ();
bool IsValid() const;
lldb::SBBreakpointLocation
FindLocationByAddress (lldb::addr_t vm_addr);
void ClearAllBreakpointSites();
lldb::break_id_t
FindLocationIDByAddress (lldb::addr_t vm_addr);
lldb::SBBreakpointLocation FindLocationByAddress(lldb::addr_t vm_addr);
lldb::SBBreakpointLocation
FindLocationByID (lldb::break_id_t bp_loc_id);
lldb::break_id_t FindLocationIDByAddress(lldb::addr_t vm_addr);
lldb::SBBreakpointLocation
GetLocationAtIndex (uint32_t index);
lldb::SBBreakpointLocation FindLocationByID(lldb::break_id_t bp_loc_id);
void
SetEnabled (bool enable);
lldb::SBBreakpointLocation GetLocationAtIndex(uint32_t index);
bool
IsEnabled ();
void
SetOneShot (bool one_shot);
void SetEnabled(bool enable);
bool
IsOneShot () const;
bool
IsInternal ();
bool IsEnabled();
uint32_t
GetHitCount () const;
void SetOneShot(bool one_shot);
void
SetIgnoreCount (uint32_t count);
bool IsOneShot() const;
uint32_t
GetIgnoreCount () const;
void
SetCondition (const char *condition);
const char *
GetCondition ();
bool IsInternal();
void
SetThreadID (lldb::tid_t sb_thread_id);
uint32_t GetHitCount() const;
lldb::tid_t
GetThreadID ();
void
SetThreadIndex (uint32_t index);
uint32_t
GetThreadIndex() const;
void
SetThreadName (const char *thread_name);
const char *
GetThreadName () const;
void
SetQueueName (const char *queue_name);
const char *
GetQueueName () const;
void SetIgnoreCount(uint32_t count);
void
SetCallback (BreakpointHitCallback callback, void *baton);
void
SetScriptCallbackFunction (const char *callback_function_name);
SBError
SetScriptCallbackBody (const char *script_body_text);
uint32_t GetIgnoreCount() const;
bool
AddName (const char *new_name);
void SetCondition(const char *condition);
void
RemoveName (const char *name_to_remove);
const char *GetCondition();
bool
MatchesName (const char *name);
void SetThreadID(lldb::tid_t sb_thread_id);
void
GetNames (SBStringList &names);
size_t
GetNumResolvedLocations() const;
lldb::tid_t GetThreadID();
size_t
GetNumLocations() const;
void SetThreadIndex(uint32_t index);
bool
GetDescription (lldb::SBStream &description);
uint32_t GetThreadIndex() const;
static bool
EventIsBreakpointEvent (const lldb::SBEvent &event);
static lldb::BreakpointEventType
GetBreakpointEventTypeFromEvent (const lldb::SBEvent& event);
void SetThreadName(const char *thread_name);
static lldb::SBBreakpoint
GetBreakpointFromEvent (const lldb::SBEvent& event);
static lldb::SBBreakpointLocation
GetBreakpointLocationAtIndexFromEvent (const lldb::SBEvent& event, uint32_t loc_idx);
static uint32_t
GetNumBreakpointLocationsFromEvent (const lldb::SBEvent &event_sp);
const char *GetThreadName() const;
void SetQueueName(const char *queue_name);
const char *GetQueueName() const;
void SetCallback(BreakpointHitCallback callback, void *baton);
void SetScriptCallbackFunction(const char *callback_function_name);
void SetCommandLineCommands(SBStringList &commands);
bool GetCommandLineCommands(SBStringList &commands);
SBError SetScriptCallbackBody(const char *script_body_text);
bool AddName(const char *new_name);
void RemoveName(const char *name_to_remove);
bool MatchesName(const char *name);
void GetNames(SBStringList &names);
size_t GetNumResolvedLocations() const;
size_t GetNumLocations() const;
bool GetDescription(lldb::SBStream &description);
bool GetDescription(lldb::SBStream &description, bool include_locations);
static bool EventIsBreakpointEvent(const lldb::SBEvent &event);
static lldb::BreakpointEventType
GetBreakpointEventTypeFromEvent(const lldb::SBEvent &event);
static lldb::SBBreakpoint GetBreakpointFromEvent(const lldb::SBEvent &event);
static lldb::SBBreakpointLocation
GetBreakpointLocationAtIndexFromEvent(const lldb::SBEvent &event,
uint32_t loc_idx);
static uint32_t
GetNumBreakpointLocationsFromEvent(const lldb::SBEvent &event_sp);
private:
friend class SBBreakpointLocation;
friend class SBTarget;
friend class SBBreakpointList;
friend class SBBreakpointLocation;
friend class SBTarget;
SBBreakpoint (const lldb::BreakpointSP &bp_sp);
SBBreakpoint(const lldb::BreakpointSP &bp_sp);
lldb_private::Breakpoint *
operator->() const;
lldb_private::Breakpoint *operator->() const;
lldb_private::Breakpoint *
get() const;
lldb_private::Breakpoint *get() const;
lldb::BreakpointSP &
operator *();
lldb::BreakpointSP &operator*();
const lldb::BreakpointSP &
operator *() const;
const lldb::BreakpointSP &operator*() const;
static bool
PrivateBreakpointHitCallback (void *baton,
lldb_private::StoppointCallbackContext *context,
lldb::user_id_t break_id,
lldb::user_id_t break_loc_id);
lldb::BreakpointSP m_opaque_sp;
static bool PrivateBreakpointHitCallback(
void *baton, lldb_private::StoppointCallbackContext *context,
lldb::user_id_t break_id, lldb::user_id_t break_loc_id);
lldb::BreakpointSP m_opaque_sp;
};
class LLDB_API SBBreakpointList {
public:
SBBreakpointList(SBTarget &target);
~SBBreakpointList();
size_t GetSize() const;
SBBreakpoint GetBreakpointAtIndex(size_t idx);
SBBreakpoint FindBreakpointByID(lldb::break_id_t);
void Append(const SBBreakpoint &sb_file);
bool AppendIfUnique(const SBBreakpoint &sb_file);
void AppendByID(lldb::break_id_t id);
void Clear();
protected:
friend class SBTarget;
void CopyToBreakpointIDList(lldb_private::BreakpointIDList &bp_id_list);
private:
std::shared_ptr<SBBreakpointListImpl> m_opaque_sp;
};
} // namespace lldb
#endif // LLDB_SBBreakpoint_h_
#endif // LLDB_SBBreakpoint_h_

View File

@ -10,105 +10,78 @@
#ifndef LLDB_SBBreakpointLocation_h_
#define LLDB_SBBreakpointLocation_h_
#include "lldb/API/SBDefines.h"
#include "lldb/API/SBBreakpoint.h"
#include "lldb/API/SBDefines.h"
namespace lldb {
class LLDB_API SBBreakpointLocation
{
class LLDB_API SBBreakpointLocation {
public:
SBBreakpointLocation();
SBBreakpointLocation ();
SBBreakpointLocation(const lldb::SBBreakpointLocation &rhs);
SBBreakpointLocation (const lldb::SBBreakpointLocation &rhs);
~SBBreakpointLocation();
~SBBreakpointLocation ();
const lldb::SBBreakpointLocation &
operator=(const lldb::SBBreakpointLocation &rhs);
const lldb::SBBreakpointLocation &
operator = (const lldb::SBBreakpointLocation &rhs);
break_id_t GetID();
break_id_t
GetID ();
bool
IsValid() const;
bool IsValid() const;
lldb::SBAddress
GetAddress ();
lldb::addr_t
GetLoadAddress ();
lldb::SBAddress GetAddress();
void
SetEnabled(bool enabled);
lldb::addr_t GetLoadAddress();
bool
IsEnabled ();
void SetEnabled(bool enabled);
uint32_t
GetIgnoreCount ();
bool IsEnabled();
void
SetIgnoreCount (uint32_t n);
uint32_t GetIgnoreCount();
void
SetCondition (const char *condition);
const char *
GetCondition ();
void SetIgnoreCount(uint32_t n);
void
SetScriptCallbackFunction (const char *callback_function_name);
void SetCondition(const char *condition);
SBError
SetScriptCallbackBody (const char *script_body_text);
void
SetThreadID (lldb::tid_t sb_thread_id);
const char *GetCondition();
lldb::tid_t
GetThreadID ();
void
SetThreadIndex (uint32_t index);
uint32_t
GetThreadIndex() const;
void
SetThreadName (const char *thread_name);
const char *
GetThreadName () const;
void
SetQueueName (const char *queue_name);
const char *
GetQueueName () const;
void SetScriptCallbackFunction(const char *callback_function_name);
bool
IsResolved ();
SBError SetScriptCallbackBody(const char *script_body_text);
bool
GetDescription (lldb::SBStream &description, DescriptionLevel level);
void SetThreadID(lldb::tid_t sb_thread_id);
SBBreakpoint
GetBreakpoint ();
lldb::tid_t GetThreadID();
SBBreakpointLocation (const lldb::BreakpointLocationSP &break_loc_sp);
void SetThreadIndex(uint32_t index);
uint32_t GetThreadIndex() const;
void SetThreadName(const char *thread_name);
const char *GetThreadName() const;
void SetQueueName(const char *queue_name);
const char *GetQueueName() const;
bool IsResolved();
bool GetDescription(lldb::SBStream &description, DescriptionLevel level);
SBBreakpoint GetBreakpoint();
SBBreakpointLocation(const lldb::BreakpointLocationSP &break_loc_sp);
private:
friend class SBBreakpoint;
friend class SBBreakpoint;
void
SetLocation (const lldb::BreakpointLocationSP &break_loc_sp);
lldb::BreakpointLocationSP m_opaque_sp;
void SetLocation(const lldb::BreakpointLocationSP &break_loc_sp);
lldb::BreakpointLocationSP m_opaque_sp;
};
} // namespace lldb
#endif // LLDB_SBBreakpointLocation_h_
#endif // LLDB_SBBreakpointLocation_h_

View File

@ -14,84 +14,70 @@
namespace lldb {
class LLDB_API SBBroadcaster
{
class LLDB_API SBBroadcaster {
public:
SBBroadcaster ();
SBBroadcaster();
SBBroadcaster (const char *name);
SBBroadcaster(const char *name);
SBBroadcaster (const SBBroadcaster &rhs);
const SBBroadcaster &
operator = (const SBBroadcaster &rhs);
SBBroadcaster(const SBBroadcaster &rhs);
~SBBroadcaster();
const SBBroadcaster &operator=(const SBBroadcaster &rhs);
bool
IsValid () const;
~SBBroadcaster();
void
Clear ();
bool IsValid() const;
void
BroadcastEventByType (uint32_t event_type, bool unique = false);
void Clear();
void
BroadcastEvent (const lldb::SBEvent &event, bool unique = false);
void BroadcastEventByType(uint32_t event_type, bool unique = false);
void
AddInitialEventsToListener (const lldb::SBListener &listener, uint32_t requested_events);
void BroadcastEvent(const lldb::SBEvent &event, bool unique = false);
uint32_t
AddListener (const lldb::SBListener &listener, uint32_t event_mask);
void AddInitialEventsToListener(const lldb::SBListener &listener,
uint32_t requested_events);
const char *
GetName () const;
uint32_t AddListener(const lldb::SBListener &listener, uint32_t event_mask);
bool
EventTypeHasListeners (uint32_t event_type);
const char *GetName() const;
bool
RemoveListener (const lldb::SBListener &listener, uint32_t event_mask = UINT32_MAX);
bool EventTypeHasListeners(uint32_t event_type);
// This comparison is checking if the internal opaque pointer value
// is equal to that in "rhs".
bool
operator == (const lldb::SBBroadcaster &rhs) const;
bool RemoveListener(const lldb::SBListener &listener,
uint32_t event_mask = UINT32_MAX);
// This comparison is checking if the internal opaque pointer value
// is not equal to that in "rhs".
bool
operator != (const lldb::SBBroadcaster &rhs) const;
// This comparison is checking if the internal opaque pointer value
// is equal to that in "rhs".
bool operator==(const lldb::SBBroadcaster &rhs) const;
// This comparison is checking if the internal opaque pointer value
// is less than that in "rhs" so SBBroadcaster objects can be contained
// in ordered containers.
bool
operator < (const lldb::SBBroadcaster &rhs) const;
// This comparison is checking if the internal opaque pointer value
// is not equal to that in "rhs".
bool operator!=(const lldb::SBBroadcaster &rhs) const;
// This comparison is checking if the internal opaque pointer value
// is less than that in "rhs" so SBBroadcaster objects can be contained
// in ordered containers.
bool operator<(const lldb::SBBroadcaster &rhs) const;
protected:
friend class SBCommandInterpreter;
friend class SBCommunication;
friend class SBEvent;
friend class SBListener;
friend class SBProcess;
friend class SBTarget;
friend class SBCommandInterpreter;
friend class SBCommunication;
friend class SBEvent;
friend class SBListener;
friend class SBProcess;
friend class SBTarget;
SBBroadcaster (lldb_private::Broadcaster *broadcaster, bool owns);
SBBroadcaster(lldb_private::Broadcaster *broadcaster, bool owns);
lldb_private::Broadcaster *
get () const;
lldb_private::Broadcaster *get() const;
void
reset (lldb_private::Broadcaster *broadcaster, bool owns);
void reset(lldb_private::Broadcaster *broadcaster, bool owns);
private:
lldb::BroadcasterSP m_opaque_sp;
lldb_private::Broadcaster *m_opaque_ptr;
lldb::BroadcasterSP m_opaque_sp;
lldb_private::Broadcaster *m_opaque_ptr;
};
} // namespace lldb
#endif // LLDB_SBBroadcaster_h_
#endif // LLDB_SBBroadcaster_h_

View File

@ -16,305 +16,267 @@
// Other libraries and framework includes
// Project includes
#include "lldb/API/SBDefines.h"
#include "lldb/API/SBDebugger.h"
#include "lldb/API/SBDefines.h"
namespace lldb {
class LLDB_API SBCommandInterpreterRunOptions
{
friend class SBDebugger;
friend class SBCommandInterpreter;
class LLDB_API SBCommandInterpreterRunOptions {
friend class SBDebugger;
friend class SBCommandInterpreter;
public:
SBCommandInterpreterRunOptions();
~SBCommandInterpreterRunOptions();
SBCommandInterpreterRunOptions();
~SBCommandInterpreterRunOptions();
bool
GetStopOnContinue () const;
bool GetStopOnContinue() const;
void
SetStopOnContinue (bool);
void SetStopOnContinue(bool);
bool
GetStopOnError () const;
bool GetStopOnError() const;
void
SetStopOnError (bool);
void SetStopOnError(bool);
bool
GetStopOnCrash () const;
bool GetStopOnCrash() const;
void
SetStopOnCrash (bool);
void SetStopOnCrash(bool);
bool
GetEchoCommands () const;
bool GetEchoCommands() const;
void
SetEchoCommands (bool);
void SetEchoCommands(bool);
bool
GetPrintResults () const;
bool GetPrintResults() const;
void
SetPrintResults (bool);
void SetPrintResults(bool);
bool
GetAddToHistory () const;
bool GetAddToHistory() const;
void
SetAddToHistory (bool);
void SetAddToHistory(bool);
private:
lldb_private::CommandInterpreterRunOptions *
get () const;
lldb_private::CommandInterpreterRunOptions *get() const;
lldb_private::CommandInterpreterRunOptions &
ref () const;
lldb_private::CommandInterpreterRunOptions &ref() const;
// This is set in the constructor and will always be valid.
mutable std::unique_ptr<lldb_private::CommandInterpreterRunOptions> m_opaque_up;
// This is set in the constructor and will always be valid.
mutable std::unique_ptr<lldb_private::CommandInterpreterRunOptions>
m_opaque_up;
};
class SBCommandInterpreter
{
class SBCommandInterpreter {
public:
enum
{
eBroadcastBitThreadShouldExit = (1 << 0),
eBroadcastBitResetPrompt = (1 << 1),
eBroadcastBitQuitCommandReceived = (1 << 2), // User entered quit
eBroadcastBitAsynchronousOutputData = (1 << 3),
eBroadcastBitAsynchronousErrorData = (1 << 4)
};
enum {
eBroadcastBitThreadShouldExit = (1 << 0),
eBroadcastBitResetPrompt = (1 << 1),
eBroadcastBitQuitCommandReceived = (1 << 2), // User entered quit
eBroadcastBitAsynchronousOutputData = (1 << 3),
eBroadcastBitAsynchronousErrorData = (1 << 4)
};
SBCommandInterpreter (const lldb::SBCommandInterpreter &rhs);
~SBCommandInterpreter ();
SBCommandInterpreter(const lldb::SBCommandInterpreter &rhs);
const lldb::SBCommandInterpreter &
operator = (const lldb::SBCommandInterpreter &rhs);
~SBCommandInterpreter();
static const char *
GetArgumentTypeAsCString (const lldb::CommandArgumentType arg_type);
static const char *
GetArgumentDescriptionAsCString (const lldb::CommandArgumentType arg_type);
const lldb::SBCommandInterpreter &
operator=(const lldb::SBCommandInterpreter &rhs);
static bool
EventIsCommandInterpreterEvent (const lldb::SBEvent &event);
bool
IsValid() const;
static const char *
GetArgumentTypeAsCString(const lldb::CommandArgumentType arg_type);
bool
CommandExists (const char *cmd);
static const char *
GetArgumentDescriptionAsCString(const lldb::CommandArgumentType arg_type);
bool
AliasExists (const char *cmd);
static bool EventIsCommandInterpreterEvent(const lldb::SBEvent &event);
lldb::SBBroadcaster
GetBroadcaster ();
static const char *
GetBroadcasterClass ();
bool IsValid() const;
bool
HasCommands ();
bool CommandExists(const char *cmd);
bool
HasAliases ();
bool AliasExists(const char *cmd);
bool
HasAliasOptions ();
lldb::SBBroadcaster GetBroadcaster();
lldb::SBProcess
GetProcess ();
lldb::SBDebugger
GetDebugger ();
lldb::SBCommand
AddMultiwordCommand (const char* name, const char* help);
lldb::SBCommand
AddCommand (const char* name, lldb::SBCommandPluginInterface *impl, const char* help);
static const char *GetBroadcasterClass();
void
SourceInitFileInHomeDirectory (lldb::SBCommandReturnObject &result);
bool HasCommands();
void
SourceInitFileInCurrentWorkingDirectory (lldb::SBCommandReturnObject &result);
bool HasAliases();
lldb::ReturnStatus
HandleCommand (const char *command_line, lldb::SBCommandReturnObject &result, bool add_to_history = false);
bool HasAliasOptions();
lldb::ReturnStatus
HandleCommand (const char *command_line, SBExecutionContext &exe_ctx, SBCommandReturnObject &result, bool add_to_history = false);
lldb::SBProcess GetProcess();
void
HandleCommandsFromFile (lldb::SBFileSpec &file,
lldb::SBExecutionContext &override_context,
lldb::SBCommandInterpreterRunOptions &options,
lldb::SBCommandReturnObject result);
lldb::SBDebugger GetDebugger();
// The pointer based interface is not useful in SWIG, since the cursor & last_char arguments are string pointers INTO current_line
// and you can't do that in a scripting language interface in general...
// In either case, the way this works is that the you give it a line and cursor position in the line. The function
// will return the number of completions. The matches list will contain number_of_completions + 1 elements. The first
// element is the common substring after the cursor position for all the matches. The rest of the elements are the
// matches. The first element is useful if you are emulating the common shell behavior where the tab completes
// to the string that is common among all the matches, then you should first check if the first element is non-empty,
// and if so just insert it and move the cursor to the end of the insertion. The next tab will return an empty
// common substring, and a list of choices (if any), at which point you should display the choices and let the user
// type further to disambiguate.
int
HandleCompletion (const char *current_line,
const char *cursor,
const char *last_char,
int match_start_point,
int max_return_elements,
lldb::SBStringList &matches);
lldb::SBCommand AddMultiwordCommand(const char *name, const char *help);
int
HandleCompletion (const char *current_line,
uint32_t cursor_pos,
int match_start_point,
int max_return_elements,
lldb::SBStringList &matches);
lldb::SBCommand AddCommand(const char *name,
lldb::SBCommandPluginInterface *impl,
const char *help);
// Catch commands before they execute by registering a callback that will
// get called when the command gets executed. This allows GUI or command
// line interfaces to intercept a command and stop it from happening
bool
SetCommandOverrideCallback (const char *command_name,
lldb::CommandOverrideCallback callback,
void *baton);
SBCommandInterpreter(lldb_private::CommandInterpreter *interpreter_ptr = nullptr); // Access using SBDebugger::GetCommandInterpreter();
//----------------------------------------------------------------------
/// Return true if the command interpreter is the active IO handler.
///
/// This indicates that any input coming into the debugger handles will
/// go to the command interpreter and will result in LLDB command line
/// commands being executed.
//----------------------------------------------------------------------
bool
IsActive ();
//----------------------------------------------------------------------
/// Get the string that needs to be written to the debugger stdin file
/// handle when a control character is typed.
///
/// Some GUI programs will intercept "control + char" sequences and want
/// to have them do what normally would happen when using a real
/// terminal, so this function allows GUI programs to emulate this
/// functionality.
///
/// @param[in] ch
/// The character that was typed along with the control key
///
/// @return
/// The string that should be written into the file handle that is
/// feeding the input stream for the debugger, or nullptr if there is
/// no string for this control key.
//----------------------------------------------------------------------
const char *
GetIOHandlerControlSequence(char ch);
lldb::SBCommand AddCommand(const char *name,
lldb::SBCommandPluginInterface *impl,
const char *help, const char *syntax);
bool
GetPromptOnQuit();
void SourceInitFileInHomeDirectory(lldb::SBCommandReturnObject &result);
void
SetPromptOnQuit(bool b);
void
SourceInitFileInCurrentWorkingDirectory(lldb::SBCommandReturnObject &result);
//----------------------------------------------------------------------
/// Resolve the command just as HandleCommand would, expanding abbreviations
/// and aliases. If successful, result->GetOutput has the full expansion.
//----------------------------------------------------------------------
void
ResolveCommand(const char *command_line, SBCommandReturnObject &result);
lldb::ReturnStatus HandleCommand(const char *command_line,
lldb::SBCommandReturnObject &result,
bool add_to_history = false);
lldb::ReturnStatus HandleCommand(const char *command_line,
SBExecutionContext &exe_ctx,
SBCommandReturnObject &result,
bool add_to_history = false);
void HandleCommandsFromFile(lldb::SBFileSpec &file,
lldb::SBExecutionContext &override_context,
lldb::SBCommandInterpreterRunOptions &options,
lldb::SBCommandReturnObject result);
// The pointer based interface is not useful in SWIG, since the cursor &
// last_char arguments are string pointers INTO current_line
// and you can't do that in a scripting language interface in general...
// In either case, the way this works is that the you give it a line and
// cursor position in the line. The function
// will return the number of completions. The matches list will contain
// number_of_completions + 1 elements. The first
// element is the common substring after the cursor position for all the
// matches. The rest of the elements are the
// matches. The first element is useful if you are emulating the common shell
// behavior where the tab completes
// to the string that is common among all the matches, then you should first
// check if the first element is non-empty,
// and if so just insert it and move the cursor to the end of the insertion.
// The next tab will return an empty
// common substring, and a list of choices (if any), at which point you should
// display the choices and let the user
// type further to disambiguate.
int HandleCompletion(const char *current_line, const char *cursor,
const char *last_char, int match_start_point,
int max_return_elements, lldb::SBStringList &matches);
int HandleCompletion(const char *current_line, uint32_t cursor_pos,
int match_start_point, int max_return_elements,
lldb::SBStringList &matches);
// Catch commands before they execute by registering a callback that will
// get called when the command gets executed. This allows GUI or command
// line interfaces to intercept a command and stop it from happening
bool SetCommandOverrideCallback(const char *command_name,
lldb::CommandOverrideCallback callback,
void *baton);
SBCommandInterpreter(
lldb_private::CommandInterpreter *interpreter_ptr =
nullptr); // Access using SBDebugger::GetCommandInterpreter();
//----------------------------------------------------------------------
/// Return true if the command interpreter is the active IO handler.
///
/// This indicates that any input coming into the debugger handles will
/// go to the command interpreter and will result in LLDB command line
/// commands being executed.
//----------------------------------------------------------------------
bool IsActive();
//----------------------------------------------------------------------
/// Get the string that needs to be written to the debugger stdin file
/// handle when a control character is typed.
///
/// Some GUI programs will intercept "control + char" sequences and want
/// to have them do what normally would happen when using a real
/// terminal, so this function allows GUI programs to emulate this
/// functionality.
///
/// @param[in] ch
/// The character that was typed along with the control key
///
/// @return
/// The string that should be written into the file handle that is
/// feeding the input stream for the debugger, or nullptr if there is
/// no string for this control key.
//----------------------------------------------------------------------
const char *GetIOHandlerControlSequence(char ch);
bool GetPromptOnQuit();
void SetPromptOnQuit(bool b);
//----------------------------------------------------------------------
/// Resolve the command just as HandleCommand would, expanding abbreviations
/// and aliases. If successful, result->GetOutput has the full expansion.
//----------------------------------------------------------------------
void ResolveCommand(const char *command_line, SBCommandReturnObject &result);
protected:
lldb_private::CommandInterpreter &
ref ();
lldb_private::CommandInterpreter &ref();
lldb_private::CommandInterpreter *
get ();
lldb_private::CommandInterpreter *get();
void
reset (lldb_private::CommandInterpreter *);
void reset(lldb_private::CommandInterpreter *);
private:
friend class SBDebugger;
friend class SBDebugger;
static void
InitializeSWIG ();
static void InitializeSWIG();
lldb_private::CommandInterpreter *m_opaque_ptr;
lldb_private::CommandInterpreter *m_opaque_ptr;
};
class SBCommandPluginInterface
{
class SBCommandPluginInterface {
public:
virtual
~SBCommandPluginInterface() = default;
virtual ~SBCommandPluginInterface() = default;
virtual bool
DoExecute (lldb::SBDebugger /*debugger*/,
char** /*command*/,
lldb::SBCommandReturnObject & /*result*/)
{
return false;
}
virtual bool DoExecute(lldb::SBDebugger /*debugger*/, char ** /*command*/,
lldb::SBCommandReturnObject & /*result*/) {
return false;
}
};
class SBCommand
{
class SBCommand {
public:
SBCommand ();
bool
IsValid ();
const char*
GetName ();
const char*
GetHelp ();
const char*
GetHelpLong ();
void
SetHelp (const char*);
void
SetHelpLong (const char*);
uint32_t
GetFlags ();
void
SetFlags (uint32_t flags);
lldb::SBCommand
AddMultiwordCommand(const char* name, const char* help = nullptr);
lldb::SBCommand
AddCommand(const char* name, lldb::SBCommandPluginInterface* impl, const char* help = nullptr);
SBCommand();
bool IsValid();
const char *GetName();
const char *GetHelp();
const char *GetHelpLong();
void SetHelp(const char *);
void SetHelpLong(const char *);
uint32_t GetFlags();
void SetFlags(uint32_t flags);
lldb::SBCommand AddMultiwordCommand(const char *name,
const char *help = nullptr);
lldb::SBCommand AddCommand(const char *name,
lldb::SBCommandPluginInterface *impl,
const char *help = nullptr);
lldb::SBCommand AddCommand(const char *name,
lldb::SBCommandPluginInterface *impl,
const char *help, const char *syntax);
private:
friend class SBDebugger;
friend class SBCommandInterpreter;
SBCommand (lldb::CommandObjectSP cmd_sp);
lldb::CommandObjectSP m_opaque_sp;
friend class SBDebugger;
friend class SBCommandInterpreter;
SBCommand(lldb::CommandObjectSP cmd_sp);
lldb::CommandObjectSP m_opaque_sp;
};
} // namespace lldb

View File

@ -22,122 +22,90 @@
namespace lldb {
class LLDB_API SBCommandReturnObject
{
class LLDB_API SBCommandReturnObject {
public:
SBCommandReturnObject ();
SBCommandReturnObject();
SBCommandReturnObject (const lldb::SBCommandReturnObject &rhs);
SBCommandReturnObject(const lldb::SBCommandReturnObject &rhs);
~SBCommandReturnObject ();
~SBCommandReturnObject();
const lldb::SBCommandReturnObject &
operator = (const lldb::SBCommandReturnObject &rhs);
const lldb::SBCommandReturnObject &
operator=(const lldb::SBCommandReturnObject &rhs);
SBCommandReturnObject (lldb_private::CommandReturnObject *ptr);
lldb_private::CommandReturnObject *
Release ();
SBCommandReturnObject(lldb_private::CommandReturnObject *ptr);
bool
IsValid() const;
lldb_private::CommandReturnObject *Release();
const char *
GetOutput ();
bool IsValid() const;
const char *
GetError ();
const char *GetOutput();
size_t
PutOutput (FILE *fh);
const char *GetError();
size_t
GetOutputSize ();
size_t PutOutput(FILE *fh);
size_t
GetErrorSize ();
size_t GetOutputSize();
size_t
PutError (FILE *fh);
size_t GetErrorSize();
void
Clear();
size_t PutError(FILE *fh);
lldb::ReturnStatus
GetStatus();
void
SetStatus (lldb::ReturnStatus status);
void Clear();
bool
Succeeded ();
lldb::ReturnStatus GetStatus();
bool
HasResult ();
void SetStatus(lldb::ReturnStatus status);
void
AppendMessage (const char *message);
bool Succeeded();
bool HasResult();
void AppendMessage(const char *message);
void AppendWarning(const char *message);
bool GetDescription(lldb::SBStream &description);
// deprecated, these two functions do not take
// ownership of file handle
void SetImmediateOutputFile(FILE *fh);
void SetImmediateErrorFile(FILE *fh);
void SetImmediateOutputFile(FILE *fh, bool transfer_ownership);
void SetImmediateErrorFile(FILE *fh, bool transfer_ownership);
void PutCString(const char *string, int len = -1);
size_t Printf(const char *format, ...) __attribute__((format(printf, 2, 3)));
const char *GetOutput(bool only_if_no_immediate);
const char *GetError(bool only_if_no_immediate);
void SetError(lldb::SBError &error,
const char *fallback_error_cstr = nullptr);
void SetError(const char *error_cstr);
void
AppendWarning (const char *message);
bool
GetDescription (lldb::SBStream &description);
// deprecated, these two functions do not take
// ownership of file handle
void
SetImmediateOutputFile (FILE *fh);
void
SetImmediateErrorFile (FILE *fh);
void
SetImmediateOutputFile (FILE *fh, bool transfer_ownership);
void
SetImmediateErrorFile (FILE *fh, bool transfer_ownership);
void
PutCString(const char* string, int len = -1);
size_t
Printf(const char* format, ...) __attribute__ ((format (printf, 2, 3)));
const char *
GetOutput (bool only_if_no_immediate);
const char *
GetError (bool only_if_no_immediate);
void
SetError(lldb::SBError &error,
const char *fallback_error_cstr = nullptr);
void
SetError (const char* error_cstr);
protected:
friend class SBCommandInterpreter;
friend class SBOptions;
friend class SBCommandInterpreter;
friend class SBOptions;
lldb_private::CommandReturnObject *
operator->() const;
lldb_private::CommandReturnObject *operator->() const;
lldb_private::CommandReturnObject *
get() const;
lldb_private::CommandReturnObject *get() const;
lldb_private::CommandReturnObject &
operator*() const;
lldb_private::CommandReturnObject &operator*() const;
lldb_private::CommandReturnObject &
ref() const;
lldb_private::CommandReturnObject &ref() const;
void
SetLLDBObjectPtr (lldb_private::CommandReturnObject *ptr);
void SetLLDBObjectPtr(lldb_private::CommandReturnObject *ptr);
private:
std::unique_ptr<lldb_private::CommandReturnObject> m_opaque_ap;
std::unique_ptr<lldb_private::CommandReturnObject> m_opaque_ap;
};
} // namespace lldb

View File

@ -15,86 +15,68 @@
namespace lldb {
class LLDB_API SBCommunication
{
class LLDB_API SBCommunication {
public:
FLAGS_ANONYMOUS_ENUM()
{
eBroadcastBitDisconnected = (1 << 0), ///< Sent when the communications connection is lost.
eBroadcastBitReadThreadGotBytes = (1 << 1), ///< Sent by the read thread when bytes become available.
eBroadcastBitReadThreadDidExit = (1 << 2), ///< Sent by the read thread when it exits to inform clients.
eBroadcastBitReadThreadShouldExit = (1 << 3), ///< Sent by clients that need to cancel the read thread.
eBroadcastBitPacketAvailable = (1 << 4), ///< Sent when data received makes a complete packet.
eAllEventBits = 0xffffffff
};
FLAGS_ANONYMOUS_ENUM(){
eBroadcastBitDisconnected =
(1 << 0), ///< Sent when the communications connection is lost.
eBroadcastBitReadThreadGotBytes =
(1 << 1), ///< Sent by the read thread when bytes become available.
eBroadcastBitReadThreadDidExit =
(1
<< 2), ///< Sent by the read thread when it exits to inform clients.
eBroadcastBitReadThreadShouldExit =
(1 << 3), ///< Sent by clients that need to cancel the read thread.
eBroadcastBitPacketAvailable =
(1 << 4), ///< Sent when data received makes a complete packet.
eAllEventBits = 0xffffffff};
typedef void (*ReadThreadBytesReceived) (void *baton, const void *src, size_t src_len);
typedef void (*ReadThreadBytesReceived)(void *baton, const void *src,
size_t src_len);
SBCommunication ();
SBCommunication (const char * broadcaster_name);
~SBCommunication ();
SBCommunication();
SBCommunication(const char *broadcaster_name);
~SBCommunication();
bool IsValid() const;
bool
IsValid () const;
lldb::SBBroadcaster GetBroadcaster();
lldb::SBBroadcaster
GetBroadcaster ();
static const char *GetBroadcasterClass();
static const char *GetBroadcasterClass();
lldb::ConnectionStatus
AdoptFileDesriptor (int fd, bool owns_fd);
lldb::ConnectionStatus AdoptFileDesriptor(int fd, bool owns_fd);
lldb::ConnectionStatus
Connect (const char *url);
lldb::ConnectionStatus Connect(const char *url);
lldb::ConnectionStatus
Disconnect ();
lldb::ConnectionStatus Disconnect();
bool
IsConnected () const;
bool IsConnected() const;
bool
GetCloseOnEOF ();
bool GetCloseOnEOF();
void
SetCloseOnEOF (bool b);
void SetCloseOnEOF(bool b);
size_t
Read (void *dst,
size_t dst_len,
uint32_t timeout_usec,
lldb::ConnectionStatus &status);
size_t Read(void *dst, size_t dst_len, uint32_t timeout_usec,
lldb::ConnectionStatus &status);
size_t
Write (const void *src,
size_t src_len,
lldb::ConnectionStatus &status);
size_t Write(const void *src, size_t src_len, lldb::ConnectionStatus &status);
bool
ReadThreadStart ();
bool ReadThreadStart();
bool
ReadThreadStop ();
bool ReadThreadStop();
bool
ReadThreadIsRunning ();
bool
SetReadThreadBytesReceivedCallback (ReadThreadBytesReceived callback,
void *callback_baton);
bool ReadThreadIsRunning();
bool SetReadThreadBytesReceivedCallback(ReadThreadBytesReceived callback,
void *callback_baton);
private:
DISALLOW_COPY_AND_ASSIGN(SBCommunication);
DISALLOW_COPY_AND_ASSIGN (SBCommunication);
lldb_private::Communication *m_opaque;
bool m_opaque_owned;
lldb_private::Communication *m_opaque;
bool m_opaque_owned;
};
} // namespace lldb
#endif // LLDB_SBCommunication_h_

View File

@ -15,105 +15,82 @@
namespace lldb {
class LLDB_API SBCompileUnit
{
class LLDB_API SBCompileUnit {
public:
SBCompileUnit();
SBCompileUnit ();
SBCompileUnit(const lldb::SBCompileUnit &rhs);
SBCompileUnit (const lldb::SBCompileUnit &rhs);
~SBCompileUnit();
~SBCompileUnit ();
const lldb::SBCompileUnit &operator=(const lldb::SBCompileUnit &rhs);
const lldb::SBCompileUnit &
operator = (const lldb::SBCompileUnit &rhs);
bool IsValid() const;
bool
IsValid () const;
lldb::SBFileSpec GetFileSpec() const;
lldb::SBFileSpec
GetFileSpec () const;
uint32_t GetNumLineEntries() const;
uint32_t
GetNumLineEntries () const;
lldb::SBLineEntry GetLineEntryAtIndex(uint32_t idx) const;
lldb::SBLineEntry
GetLineEntryAtIndex (uint32_t idx) const;
uint32_t FindLineEntryIndex(uint32_t start_idx, uint32_t line,
lldb::SBFileSpec *inline_file_spec) const;
uint32_t
FindLineEntryIndex (uint32_t start_idx,
uint32_t line,
lldb::SBFileSpec *inline_file_spec) const;
uint32_t FindLineEntryIndex(uint32_t start_idx, uint32_t line,
lldb::SBFileSpec *inline_file_spec,
bool exact) const;
uint32_t
FindLineEntryIndex (uint32_t start_idx,
uint32_t line,
lldb::SBFileSpec *inline_file_spec,
bool exact) const;
SBFileSpec GetSupportFileAtIndex(uint32_t idx) const;
SBFileSpec
GetSupportFileAtIndex (uint32_t idx) const;
uint32_t GetNumSupportFiles() const;
uint32_t
GetNumSupportFiles () const;
uint32_t FindSupportFileIndex(uint32_t start_idx, const SBFileSpec &sb_file,
bool full);
uint32_t
FindSupportFileIndex (uint32_t start_idx, const SBFileSpec &sb_file, bool full);
//------------------------------------------------------------------
/// Get all types matching \a type_mask from debug info in this
/// compile unit.
///
/// @param[in] type_mask
/// A bitfield that consists of one or more bits logically OR'ed
/// together from the lldb::TypeClass enumeration. This allows
/// you to request only structure types, or only class, struct
/// and union types. Passing in lldb::eTypeClassAny will return
/// all types found in the debug information for this compile
/// unit.
///
/// @return
/// A list of types in this compile unit that match \a type_mask
//------------------------------------------------------------------
lldb::SBTypeList
GetTypes (uint32_t type_mask = lldb::eTypeClassAny);
//------------------------------------------------------------------
/// Get all types matching \a type_mask from debug info in this
/// compile unit.
///
/// @param[in] type_mask
/// A bitfield that consists of one or more bits logically OR'ed
/// together from the lldb::TypeClass enumeration. This allows
/// you to request only structure types, or only class, struct
/// and union types. Passing in lldb::eTypeClassAny will return
/// all types found in the debug information for this compile
/// unit.
///
/// @return
/// A list of types in this compile unit that match \a type_mask
//------------------------------------------------------------------
lldb::SBTypeList GetTypes(uint32_t type_mask = lldb::eTypeClassAny);
lldb::LanguageType
GetLanguage ();
bool
operator == (const lldb::SBCompileUnit &rhs) const;
lldb::LanguageType GetLanguage();
bool
operator != (const lldb::SBCompileUnit &rhs) const;
bool operator==(const lldb::SBCompileUnit &rhs) const;
bool
GetDescription (lldb::SBStream &description);
bool operator!=(const lldb::SBCompileUnit &rhs) const;
bool GetDescription(lldb::SBStream &description);
private:
friend class SBAddress;
friend class SBFrame;
friend class SBSymbolContext;
friend class SBModule;
friend class SBAddress;
friend class SBFrame;
friend class SBSymbolContext;
friend class SBModule;
SBCompileUnit (lldb_private::CompileUnit *lldb_object_ptr);
SBCompileUnit(lldb_private::CompileUnit *lldb_object_ptr);
const lldb_private::CompileUnit *
operator->() const;
const lldb_private::CompileUnit *operator->() const;
const lldb_private::CompileUnit &
operator*() const;
lldb_private::CompileUnit *
get ();
void
reset (lldb_private::CompileUnit *lldb_object_ptr);
const lldb_private::CompileUnit &operator*() const;
lldb_private::CompileUnit *m_opaque_ptr;
lldb_private::CompileUnit *get();
void reset(lldb_private::CompileUnit *lldb_object_ptr);
lldb_private::CompileUnit *m_opaque_ptr;
};
} // namespace lldb
#endif // LLDB_SBCompileUnit_h_

View File

@ -14,168 +14,143 @@
namespace lldb {
class LLDB_API SBData
{
class LLDB_API SBData {
public:
SBData();
SBData ();
SBData(const SBData &rhs);
SBData (const SBData &rhs);
const SBData &
operator = (const SBData &rhs);
const SBData &operator=(const SBData &rhs);
~SBData ();
uint8_t
GetAddressByteSize ();
void
SetAddressByteSize (uint8_t addr_byte_size);
void
Clear ();
bool
IsValid();
size_t
GetByteSize ();
lldb::ByteOrder
GetByteOrder();
void
SetByteOrder (lldb::ByteOrder endian);
float
GetFloat (lldb::SBError& error, lldb::offset_t offset);
double
GetDouble (lldb::SBError& error, lldb::offset_t offset);
~SBData();
long double
GetLongDouble (lldb::SBError& error, lldb::offset_t offset);
lldb::addr_t
GetAddress (lldb::SBError& error, lldb::offset_t offset);
uint8_t
GetUnsignedInt8 (lldb::SBError& error, lldb::offset_t offset);
uint8_t GetAddressByteSize();
uint16_t
GetUnsignedInt16 (lldb::SBError& error, lldb::offset_t offset);
void SetAddressByteSize(uint8_t addr_byte_size);
uint32_t
GetUnsignedInt32 (lldb::SBError& error, lldb::offset_t offset);
void Clear();
uint64_t
GetUnsignedInt64 (lldb::SBError& error, lldb::offset_t offset);
int8_t
GetSignedInt8 (lldb::SBError& error, lldb::offset_t offset);
int16_t
GetSignedInt16 (lldb::SBError& error, lldb::offset_t offset);
int32_t
GetSignedInt32 (lldb::SBError& error, lldb::offset_t offset);
int64_t
GetSignedInt64 (lldb::SBError& error, lldb::offset_t offset);
const char*
GetString (lldb::SBError& error, lldb::offset_t offset);
size_t
ReadRawData (lldb::SBError& error,
lldb::offset_t offset,
void *buf,
size_t size);
bool
GetDescription (lldb::SBStream &description, lldb::addr_t base_addr = LLDB_INVALID_ADDRESS);
// it would be nice to have SetData(SBError, const void*, size_t) when endianness and address size can be
// inferred from the existing DataExtractor, but having two SetData() signatures triggers a SWIG bug where
// the typemap isn't applied before resolving the overload, and thus the right function never gets called
void
SetData (lldb::SBError& error, const void *buf, size_t size, lldb::ByteOrder endian, uint8_t addr_size);
// see SetData() for why we don't have Append(const void* buf, size_t size)
bool
Append (const SBData& rhs);
static lldb::SBData
CreateDataFromCString (lldb::ByteOrder endian, uint32_t addr_byte_size, const char* data);
// in the following CreateData*() and SetData*() prototypes, the two parameters array and array_len
// should not be renamed or rearranged, because doing so will break the SWIG typemap
static lldb::SBData
CreateDataFromUInt64Array (lldb::ByteOrder endian, uint32_t addr_byte_size, uint64_t* array, size_t array_len);
static lldb::SBData
CreateDataFromUInt32Array (lldb::ByteOrder endian, uint32_t addr_byte_size, uint32_t* array, size_t array_len);
static lldb::SBData
CreateDataFromSInt64Array (lldb::ByteOrder endian, uint32_t addr_byte_size, int64_t* array, size_t array_len);
static lldb::SBData
CreateDataFromSInt32Array (lldb::ByteOrder endian, uint32_t addr_byte_size, int32_t* array, size_t array_len);
static lldb::SBData
CreateDataFromDoubleArray (lldb::ByteOrder endian, uint32_t addr_byte_size, double* array, size_t array_len);
bool
SetDataFromCString (const char* data);
bool
SetDataFromUInt64Array (uint64_t* array, size_t array_len);
bool
SetDataFromUInt32Array (uint32_t* array, size_t array_len);
bool
SetDataFromSInt64Array (int64_t* array, size_t array_len);
bool
SetDataFromSInt32Array (int32_t* array, size_t array_len);
bool
SetDataFromDoubleArray (double* array, size_t array_len);
bool IsValid();
size_t GetByteSize();
lldb::ByteOrder GetByteOrder();
void SetByteOrder(lldb::ByteOrder endian);
float GetFloat(lldb::SBError &error, lldb::offset_t offset);
double GetDouble(lldb::SBError &error, lldb::offset_t offset);
long double GetLongDouble(lldb::SBError &error, lldb::offset_t offset);
lldb::addr_t GetAddress(lldb::SBError &error, lldb::offset_t offset);
uint8_t GetUnsignedInt8(lldb::SBError &error, lldb::offset_t offset);
uint16_t GetUnsignedInt16(lldb::SBError &error, lldb::offset_t offset);
uint32_t GetUnsignedInt32(lldb::SBError &error, lldb::offset_t offset);
uint64_t GetUnsignedInt64(lldb::SBError &error, lldb::offset_t offset);
int8_t GetSignedInt8(lldb::SBError &error, lldb::offset_t offset);
int16_t GetSignedInt16(lldb::SBError &error, lldb::offset_t offset);
int32_t GetSignedInt32(lldb::SBError &error, lldb::offset_t offset);
int64_t GetSignedInt64(lldb::SBError &error, lldb::offset_t offset);
const char *GetString(lldb::SBError &error, lldb::offset_t offset);
size_t ReadRawData(lldb::SBError &error, lldb::offset_t offset, void *buf,
size_t size);
bool GetDescription(lldb::SBStream &description,
lldb::addr_t base_addr = LLDB_INVALID_ADDRESS);
// it would be nice to have SetData(SBError, const void*, size_t) when
// endianness and address size can be
// inferred from the existing DataExtractor, but having two SetData()
// signatures triggers a SWIG bug where
// the typemap isn't applied before resolving the overload, and thus the right
// function never gets called
void SetData(lldb::SBError &error, const void *buf, size_t size,
lldb::ByteOrder endian, uint8_t addr_size);
// see SetData() for why we don't have Append(const void* buf, size_t size)
bool Append(const SBData &rhs);
static lldb::SBData CreateDataFromCString(lldb::ByteOrder endian,
uint32_t addr_byte_size,
const char *data);
// in the following CreateData*() and SetData*() prototypes, the two
// parameters array and array_len
// should not be renamed or rearranged, because doing so will break the SWIG
// typemap
static lldb::SBData CreateDataFromUInt64Array(lldb::ByteOrder endian,
uint32_t addr_byte_size,
uint64_t *array,
size_t array_len);
static lldb::SBData CreateDataFromUInt32Array(lldb::ByteOrder endian,
uint32_t addr_byte_size,
uint32_t *array,
size_t array_len);
static lldb::SBData CreateDataFromSInt64Array(lldb::ByteOrder endian,
uint32_t addr_byte_size,
int64_t *array,
size_t array_len);
static lldb::SBData CreateDataFromSInt32Array(lldb::ByteOrder endian,
uint32_t addr_byte_size,
int32_t *array,
size_t array_len);
static lldb::SBData CreateDataFromDoubleArray(lldb::ByteOrder endian,
uint32_t addr_byte_size,
double *array,
size_t array_len);
bool SetDataFromCString(const char *data);
bool SetDataFromUInt64Array(uint64_t *array, size_t array_len);
bool SetDataFromUInt32Array(uint32_t *array, size_t array_len);
bool SetDataFromSInt64Array(int64_t *array, size_t array_len);
bool SetDataFromSInt32Array(int32_t *array, size_t array_len);
bool SetDataFromDoubleArray(double *array, size_t array_len);
protected:
// Mimic shared pointer...
lldb_private::DataExtractor *
get() const;
lldb_private::DataExtractor *
operator->() const;
lldb::DataExtractorSP &
operator*();
const lldb::DataExtractorSP &
operator*() const;
// Mimic shared pointer...
lldb_private::DataExtractor *get() const;
SBData (const lldb::DataExtractorSP &data_sp);
lldb_private::DataExtractor *operator->() const;
void
SetOpaque (const lldb::DataExtractorSP &data_sp);
lldb::DataExtractorSP &operator*();
const lldb::DataExtractorSP &operator*() const;
SBData(const lldb::DataExtractorSP &data_sp);
void SetOpaque(const lldb::DataExtractorSP &data_sp);
private:
friend class SBInstruction;
friend class SBProcess;
friend class SBSection;
friend class SBTarget;
friend class SBValue;
friend class SBInstruction;
friend class SBProcess;
friend class SBSection;
friend class SBTarget;
friend class SBValue;
lldb::DataExtractorSP m_opaque_sp;
lldb::DataExtractorSP m_opaque_sp;
};
} // namespace lldb
#endif // LLDB_SBData_h_

View File

@ -16,349 +16,255 @@
#include "lldb/API/SBPlatform.h"
namespace lldb {
class LLDB_API SBInputReader
{
public:
SBInputReader() = default;
~SBInputReader() = default;
SBError Initialize(lldb::SBDebugger&, unsigned long (*)(void*, lldb::SBInputReader*, lldb::InputReaderAction, char const*, unsigned long), void*, lldb::InputReaderGranularity, char const*, char const*, bool);
void SetIsDone(bool);
bool IsActive() const;
class LLDB_API SBInputReader {
public:
SBInputReader() = default;
~SBInputReader() = default;
SBError Initialize(lldb::SBDebugger &,
unsigned long (*)(void *, lldb::SBInputReader *,
lldb::InputReaderAction, char const *,
unsigned long),
void *, lldb::InputReaderGranularity, char const *,
char const *, bool);
void SetIsDone(bool);
bool IsActive() const;
};
class LLDB_API SBDebugger
{
class LLDB_API SBDebugger {
public:
SBDebugger();
SBDebugger();
SBDebugger(const lldb::SBDebugger &rhs);
SBDebugger(const lldb::SBDebugger &rhs);
SBDebugger(const lldb::DebuggerSP &debugger_sp);
SBDebugger(const lldb::DebuggerSP &debugger_sp);
~SBDebugger();
~SBDebugger();
lldb::SBDebugger &
operator = (const lldb::SBDebugger &rhs);
lldb::SBDebugger &operator=(const lldb::SBDebugger &rhs);
static void
Initialize();
static void
Terminate();
// Deprecated, use the one that takes a source_init_files bool.
static lldb::SBDebugger
Create();
static void Initialize();
static lldb::SBDebugger
Create(bool source_init_files);
static void Terminate();
static lldb::SBDebugger
Create(bool source_init_files, lldb::LogOutputCallback log_callback, void *baton);
// Deprecated, use the one that takes a source_init_files bool.
static lldb::SBDebugger Create();
static void
Destroy (lldb::SBDebugger &debugger);
static lldb::SBDebugger Create(bool source_init_files);
static void
MemoryPressureDetected ();
static lldb::SBDebugger Create(bool source_init_files,
lldb::LogOutputCallback log_callback,
void *baton);
bool
IsValid() const;
static void Destroy(lldb::SBDebugger &debugger);
void
Clear ();
static void MemoryPressureDetected();
void
SetAsync (bool b);
bool
GetAsync ();
bool IsValid() const;
void
SkipLLDBInitFiles (bool b);
void Clear();
void
SkipAppInitFiles (bool b);
void SetAsync(bool b);
void
SetInputFileHandle (FILE *f, bool transfer_ownership);
bool GetAsync();
void
SetOutputFileHandle (FILE *f, bool transfer_ownership);
void SkipLLDBInitFiles(bool b);
void
SetErrorFileHandle (FILE *f, bool transfer_ownership);
FILE *
GetInputFileHandle ();
void SkipAppInitFiles(bool b);
FILE *
GetOutputFileHandle ();
void SetInputFileHandle(FILE *f, bool transfer_ownership);
FILE *
GetErrorFileHandle ();
void SetOutputFileHandle(FILE *f, bool transfer_ownership);
void
SaveInputTerminalState();
void
RestoreInputTerminalState();
void SetErrorFileHandle(FILE *f, bool transfer_ownership);
lldb::SBCommandInterpreter
GetCommandInterpreter ();
FILE *GetInputFileHandle();
void
HandleCommand (const char *command);
FILE *GetOutputFileHandle();
lldb::SBListener
GetListener ();
FILE *GetErrorFileHandle();
void
HandleProcessEvent (const lldb::SBProcess &process,
const lldb::SBEvent &event,
FILE *out,
FILE *err);
void SaveInputTerminalState();
lldb::SBTarget
CreateTarget (const char *filename,
const char *target_triple,
const char *platform_name,
bool add_dependent_modules,
lldb::SBError& error);
void RestoreInputTerminalState();
lldb::SBTarget
CreateTargetWithFileAndTargetTriple (const char *filename,
const char *target_triple);
lldb::SBCommandInterpreter GetCommandInterpreter();
lldb::SBTarget
CreateTargetWithFileAndArch (const char *filename,
const char *archname);
void HandleCommand(const char *command);
lldb::SBTarget
CreateTarget (const char *filename);
// Return true if target is deleted from the target list of the debugger.
bool
DeleteTarget (lldb::SBTarget &target);
lldb::SBTarget
GetTargetAtIndex (uint32_t idx);
uint32_t
GetIndexOfTarget (lldb::SBTarget target);
lldb::SBListener GetListener();
lldb::SBTarget
FindTargetWithProcessID (pid_t pid);
void HandleProcessEvent(const lldb::SBProcess &process,
const lldb::SBEvent &event, FILE *out, FILE *err);
lldb::SBTarget
FindTargetWithFileAndArch (const char *filename,
const char *arch);
lldb::SBTarget CreateTarget(const char *filename, const char *target_triple,
const char *platform_name,
bool add_dependent_modules, lldb::SBError &error);
uint32_t
GetNumTargets ();
lldb::SBTarget CreateTargetWithFileAndTargetTriple(const char *filename,
const char *target_triple);
lldb::SBTarget
GetSelectedTarget ();
lldb::SBTarget CreateTargetWithFileAndArch(const char *filename,
const char *archname);
void
SetSelectedTarget (SBTarget& target);
lldb::SBTarget CreateTarget(const char *filename);
lldb::SBPlatform
GetSelectedPlatform();
// Return true if target is deleted from the target list of the debugger.
bool DeleteTarget(lldb::SBTarget &target);
void
SetSelectedPlatform(lldb::SBPlatform &platform);
lldb::SBSourceManager
GetSourceManager ();
lldb::SBTarget GetTargetAtIndex(uint32_t idx);
// REMOVE: just for a quick fix, need to expose platforms through
// SBPlatform from this class.
lldb::SBError
SetCurrentPlatform (const char *platform_name);
bool
SetCurrentPlatformSDKRoot (const char *sysroot);
// FIXME: Once we get the set show stuff in place, the driver won't need
// an interface to the Set/Get UseExternalEditor.
bool
SetUseExternalEditor (bool input);
bool
GetUseExternalEditor ();
bool
SetUseColor (bool use_color);
bool
GetUseColor () const;
static bool
GetDefaultArchitecture (char *arch_name, size_t arch_name_len);
static bool
SetDefaultArchitecture (const char *arch_name);
lldb::ScriptLanguage
GetScriptingLanguage (const char *script_language_name);
static const char *
GetVersionString ();
static const char *
StateAsCString (lldb::StateType state);
static bool
StateIsRunningState (lldb::StateType state);
static bool
StateIsStoppedState (lldb::StateType state);
bool
EnableLog (const char *channel, const char **categories);
void
SetLoggingCallback (lldb::LogOutputCallback log_callback, void *baton);
// DEPRECATED
void
DispatchInput (void* baton,
const void* data,
size_t data_len);
void
DispatchInput (const void *data, size_t data_len);
void
DispatchInputInterrupt ();
void
DispatchInputEndOfFile ();
void
PushInputReader (lldb::SBInputReader &reader);
const char *
GetInstanceName ();
static SBDebugger
FindDebuggerWithID (int id);
static lldb::SBError
SetInternalVariable (const char *var_name, const char *value, const char *debugger_instance_name);
static lldb::SBStringList
GetInternalVariableValue (const char *var_name, const char *debugger_instance_name);
bool
GetDescription (lldb::SBStream &description);
uint32_t
GetTerminalWidth () const;
void
SetTerminalWidth (uint32_t term_width);
lldb::user_id_t
GetID ();
const char *
GetPrompt() const;
void
SetPrompt (const char *prompt);
lldb::ScriptLanguage
GetScriptLanguage() const;
void
SetScriptLanguage (lldb::ScriptLanguage script_lang);
bool
GetCloseInputOnEOF () const;
void
SetCloseInputOnEOF (bool b);
SBTypeCategory
GetCategory (const char* category_name);
SBTypeCategory
GetCategory (lldb::LanguageType lang_type);
SBTypeCategory
CreateCategory (const char* category_name);
bool
DeleteCategory (const char* category_name);
uint32_t
GetNumCategories ();
SBTypeCategory
GetCategoryAtIndex (uint32_t);
SBTypeCategory
GetDefaultCategory();
SBTypeFormat
GetFormatForType (SBTypeNameSpecifier);
uint32_t GetIndexOfTarget(lldb::SBTarget target);
lldb::SBTarget FindTargetWithProcessID(pid_t pid);
lldb::SBTarget FindTargetWithFileAndArch(const char *filename,
const char *arch);
uint32_t GetNumTargets();
lldb::SBTarget GetSelectedTarget();
void SetSelectedTarget(SBTarget &target);
lldb::SBPlatform GetSelectedPlatform();
void SetSelectedPlatform(lldb::SBPlatform &platform);
lldb::SBSourceManager GetSourceManager();
// REMOVE: just for a quick fix, need to expose platforms through
// SBPlatform from this class.
lldb::SBError SetCurrentPlatform(const char *platform_name);
bool SetCurrentPlatformSDKRoot(const char *sysroot);
// FIXME: Once we get the set show stuff in place, the driver won't need
// an interface to the Set/Get UseExternalEditor.
bool SetUseExternalEditor(bool input);
bool GetUseExternalEditor();
bool SetUseColor(bool use_color);
bool GetUseColor() const;
static bool GetDefaultArchitecture(char *arch_name, size_t arch_name_len);
static bool SetDefaultArchitecture(const char *arch_name);
lldb::ScriptLanguage GetScriptingLanguage(const char *script_language_name);
static const char *GetVersionString();
static const char *StateAsCString(lldb::StateType state);
static bool StateIsRunningState(lldb::StateType state);
static bool StateIsStoppedState(lldb::StateType state);
bool EnableLog(const char *channel, const char **categories);
void SetLoggingCallback(lldb::LogOutputCallback log_callback, void *baton);
// DEPRECATED
void DispatchInput(void *baton, const void *data, size_t data_len);
void DispatchInput(const void *data, size_t data_len);
void DispatchInputInterrupt();
void DispatchInputEndOfFile();
void PushInputReader(lldb::SBInputReader &reader);
const char *GetInstanceName();
static SBDebugger FindDebuggerWithID(int id);
static lldb::SBError SetInternalVariable(const char *var_name,
const char *value,
const char *debugger_instance_name);
static lldb::SBStringList
GetInternalVariableValue(const char *var_name,
const char *debugger_instance_name);
bool GetDescription(lldb::SBStream &description);
uint32_t GetTerminalWidth() const;
void SetTerminalWidth(uint32_t term_width);
lldb::user_id_t GetID();
const char *GetPrompt() const;
void SetPrompt(const char *prompt);
lldb::ScriptLanguage GetScriptLanguage() const;
void SetScriptLanguage(lldb::ScriptLanguage script_lang);
bool GetCloseInputOnEOF() const;
void SetCloseInputOnEOF(bool b);
SBTypeCategory GetCategory(const char *category_name);
SBTypeCategory GetCategory(lldb::LanguageType lang_type);
SBTypeCategory CreateCategory(const char *category_name);
bool DeleteCategory(const char *category_name);
uint32_t GetNumCategories();
SBTypeCategory GetCategoryAtIndex(uint32_t);
SBTypeCategory GetDefaultCategory();
SBTypeFormat GetFormatForType(SBTypeNameSpecifier);
#ifndef LLDB_DISABLE_PYTHON
SBTypeSummary
GetSummaryForType (SBTypeNameSpecifier);
SBTypeSummary GetSummaryForType(SBTypeNameSpecifier);
#endif
SBTypeFilter
GetFilterForType (SBTypeNameSpecifier);
SBTypeFilter GetFilterForType(SBTypeNameSpecifier);
#ifndef LLDB_DISABLE_PYTHON
SBTypeSynthetic
GetSyntheticForType (SBTypeNameSpecifier);
SBTypeSynthetic GetSyntheticForType(SBTypeNameSpecifier);
#endif
void
RunCommandInterpreter (bool auto_handle_events,
bool spawn_thread);
void RunCommandInterpreter(bool auto_handle_events, bool spawn_thread);
void
RunCommandInterpreter (bool auto_handle_events,
bool spawn_thread,
SBCommandInterpreterRunOptions &options,
int &num_errors,
bool &quit_requested,
bool &stopped_for_crash);
SBError
RunREPL (lldb::LanguageType language, const char *repl_options);
void RunCommandInterpreter(bool auto_handle_events, bool spawn_thread,
SBCommandInterpreterRunOptions &options,
int &num_errors, bool &quit_requested,
bool &stopped_for_crash);
SBError RunREPL(lldb::LanguageType language, const char *repl_options);
private:
friend class SBCommandInterpreter;
friend class SBInputReader;
friend class SBListener;
friend class SBProcess;
friend class SBSourceManager;
friend class SBTarget;
lldb::SBTarget
FindTargetWithLLDBProcess (const lldb::ProcessSP &processSP);
friend class SBCommandInterpreter;
friend class SBInputReader;
friend class SBListener;
friend class SBProcess;
friend class SBSourceManager;
friend class SBTarget;
void
reset (const lldb::DebuggerSP &debugger_sp);
lldb::SBTarget FindTargetWithLLDBProcess(const lldb::ProcessSP &processSP);
lldb_private::Debugger *
get () const;
void reset(const lldb::DebuggerSP &debugger_sp);
lldb_private::Debugger &
ref () const;
lldb_private::Debugger *get() const;
const lldb::DebuggerSP &
get_sp () const;
lldb::DebuggerSP m_opaque_sp;
lldb_private::Debugger &ref() const;
const lldb::DebuggerSP &get_sp() const;
lldb::DebuggerSP m_opaque_sp;
}; // class SBDebugger

View File

@ -1,4 +1,5 @@
//===-- SBDeclaration.h -------------------------------------------*- C++ -*-===//
//===-- SBDeclaration.h -------------------------------------------*- C++
//-*-===//
//
// The LLVM Compiler Infrastructure
//
@ -14,76 +15,56 @@
#include "lldb/API/SBFileSpec.h"
namespace lldb {
class LLDB_API SBDeclaration
{
public:
SBDeclaration ();
SBDeclaration (const lldb::SBDeclaration &rhs);
~SBDeclaration ();
const lldb::SBDeclaration &
operator = (const lldb::SBDeclaration &rhs);
bool
IsValid () const;
lldb::SBFileSpec
GetFileSpec () const;
uint32_t
GetLine () const;
uint32_t
GetColumn () const;
void
SetFileSpec (lldb::SBFileSpec filespec);
void
SetLine (uint32_t line);
void
SetColumn (uint32_t column);
bool
operator == (const lldb::SBDeclaration &rhs) const;
bool
operator != (const lldb::SBDeclaration &rhs) const;
bool
GetDescription (lldb::SBStream &description);
protected:
lldb_private::Declaration *
get ();
private:
friend class SBValue;
const lldb_private::Declaration *
operator->() const;
lldb_private::Declaration &
ref();
const lldb_private::Declaration &
ref() const;
SBDeclaration (const lldb_private::Declaration *lldb_object_ptr);
void
SetDeclaration (const lldb_private::Declaration &lldb_object_ref);
std::unique_ptr<lldb_private::Declaration> m_opaque_ap;
};
class LLDB_API SBDeclaration {
public:
SBDeclaration();
SBDeclaration(const lldb::SBDeclaration &rhs);
~SBDeclaration();
const lldb::SBDeclaration &operator=(const lldb::SBDeclaration &rhs);
bool IsValid() const;
lldb::SBFileSpec GetFileSpec() const;
uint32_t GetLine() const;
uint32_t GetColumn() const;
void SetFileSpec(lldb::SBFileSpec filespec);
void SetLine(uint32_t line);
void SetColumn(uint32_t column);
bool operator==(const lldb::SBDeclaration &rhs) const;
bool operator!=(const lldb::SBDeclaration &rhs) const;
bool GetDescription(lldb::SBStream &description);
protected:
lldb_private::Declaration *get();
private:
friend class SBValue;
const lldb_private::Declaration *operator->() const;
lldb_private::Declaration &ref();
const lldb_private::Declaration &ref() const;
SBDeclaration(const lldb_private::Declaration *lldb_object_ptr);
void SetDeclaration(const lldb_private::Declaration &lldb_object_ref);
std::unique_ptr<lldb_private::Declaration> m_opaque_ap;
};
} // namespace lldb
#endif // LLDB_SBDeclaration_h_

View File

@ -71,6 +71,7 @@ class LLDB_API SBSection;
class LLDB_API SBSourceManager;
class LLDB_API SBStream;
class LLDB_API SBStringList;
class LLDB_API SBStructuredData;
class LLDB_API SBSymbol;
class LLDB_API SBSymbolContext;
class LLDB_API SBSymbolContextList;
@ -95,7 +96,6 @@ class LLDB_API SBValueList;
class LLDB_API SBVariablesOptions;
class LLDB_API SBWatchpoint;
class LLDB_API SBUnixSignals;
}
#endif // LLDB_SBDefines_h_
#endif // LLDB_SBDefines_h_

View File

@ -16,93 +16,73 @@ namespace lldb {
class LLDB_API SBError {
public:
SBError ();
SBError();
SBError (const lldb::SBError &rhs);
SBError(const lldb::SBError &rhs);
~SBError();
~SBError();
const SBError &
operator =(const lldb::SBError &rhs);
const SBError &operator=(const lldb::SBError &rhs);
const char *
GetCString () const;
const char *GetCString() const;
void
Clear ();
void Clear();
bool
Fail () const;
bool Fail() const;
bool
Success () const;
bool Success() const;
uint32_t
GetError () const;
uint32_t GetError() const;
lldb::ErrorType
GetType () const;
lldb::ErrorType GetType() const;
void
SetError (uint32_t err, lldb::ErrorType type);
void SetError(uint32_t err, lldb::ErrorType type);
void
SetErrorToErrno ();
void SetErrorToErrno();
void
SetErrorToGenericError ();
void SetErrorToGenericError();
void
SetErrorString (const char *err_str);
void SetErrorString(const char *err_str);
int
SetErrorStringWithFormat (const char *format, ...) __attribute__ ((format (printf, 2, 3)));
int SetErrorStringWithFormat(const char *format, ...)
__attribute__((format(printf, 2, 3)));
bool
IsValid () const;
bool IsValid() const;
bool
GetDescription (lldb::SBStream &description);
bool GetDescription(lldb::SBStream &description);
protected:
friend class SBCommandReturnObject;
friend class SBData;
friend class SBDebugger;
friend class SBCommunication;
friend class SBHostOS;
friend class SBPlatform;
friend class SBProcess;
friend class SBStructuredData;
friend class SBThread;
friend class SBTarget;
friend class SBValue;
friend class SBWatchpoint;
friend class SBBreakpoint;
friend class SBBreakpointLocation;
friend class SBCommandReturnObject;
friend class SBData;
friend class SBDebugger;
friend class SBCommunication;
friend class SBHostOS;
friend class SBPlatform;
friend class SBProcess;
friend class SBThread;
friend class SBTarget;
friend class SBValue;
friend class SBWatchpoint;
friend class SBBreakpoint;
friend class SBBreakpointLocation;
lldb_private::Error *get();
lldb_private::Error *
get();
lldb_private::Error *operator->();
lldb_private::Error *
operator->();
const lldb_private::Error &operator*() const;
const lldb_private::Error &
operator*() const;
lldb_private::Error &ref();
lldb_private::Error &
ref();
void
SetError (const lldb_private::Error &lldb_error);
void SetError(const lldb_private::Error &lldb_error);
private:
std::unique_ptr<lldb_private::Error> m_opaque_ap;
std::unique_ptr<lldb_private::Error> m_opaque_ap;
void
CreateIfNeeded ();
void CreateIfNeeded();
};
} // namespace lldb
#endif // LLDB_SBError_h_

View File

@ -15,91 +15,72 @@
#include <stdio.h>
#include <vector>
namespace lldb {
class SBBroadcaster;
class LLDB_API SBEvent
{
class LLDB_API SBEvent {
public:
SBEvent();
SBEvent();
SBEvent (const lldb::SBEvent &rhs);
// Make an event that contains a C string.
SBEvent (uint32_t event, const char *cstr, uint32_t cstr_len);
SBEvent(const lldb::SBEvent &rhs);
SBEvent (lldb::EventSP &event_sp);
// Make an event that contains a C string.
SBEvent(uint32_t event, const char *cstr, uint32_t cstr_len);
SBEvent (lldb_private::Event *event_sp);
SBEvent(lldb::EventSP &event_sp);
~SBEvent();
SBEvent(lldb_private::Event *event_sp);
const SBEvent &
operator = (const lldb::SBEvent &rhs);
~SBEvent();
bool
IsValid() const;
const SBEvent &operator=(const lldb::SBEvent &rhs);
const char *
GetDataFlavor ();
bool IsValid() const;
uint32_t
GetType () const;
const char *GetDataFlavor();
lldb::SBBroadcaster
GetBroadcaster () const;
uint32_t GetType() const;
const char *
GetBroadcasterClass () const;
lldb::SBBroadcaster GetBroadcaster() const;
bool
BroadcasterMatchesPtr (const lldb::SBBroadcaster *broadcaster);
const char *GetBroadcasterClass() const;
bool
BroadcasterMatchesRef (const lldb::SBBroadcaster &broadcaster);
bool BroadcasterMatchesPtr(const lldb::SBBroadcaster *broadcaster);
void
Clear();
bool BroadcasterMatchesRef(const lldb::SBBroadcaster &broadcaster);
static const char *
GetCStringFromEvent (const lldb::SBEvent &event);
void Clear();
bool
GetDescription (lldb::SBStream &description);
static const char *GetCStringFromEvent(const lldb::SBEvent &event);
bool
GetDescription (lldb::SBStream &description) const;
bool GetDescription(lldb::SBStream &description);
bool GetDescription(lldb::SBStream &description) const;
protected:
friend class SBListener;
friend class SBBroadcaster;
friend class SBBreakpoint;
friend class SBDebugger;
friend class SBProcess;
friend class SBTarget;
friend class SBThread;
friend class SBWatchpoint;
friend class SBListener;
friend class SBBroadcaster;
friend class SBBreakpoint;
friend class SBDebugger;
friend class SBProcess;
friend class SBTarget;
friend class SBThread;
friend class SBWatchpoint;
lldb::EventSP &
GetSP () const;
lldb::EventSP &GetSP() const;
void
reset (lldb::EventSP &event_sp);
void reset(lldb::EventSP &event_sp);
void
reset (lldb_private::Event* event);
void reset(lldb_private::Event *event);
lldb_private::Event *
get () const;
lldb_private::Event *get() const;
private:
mutable lldb::EventSP m_event_sp;
mutable lldb_private::Event *m_opaque_ptr;
mutable lldb::EventSP m_event_sp;
mutable lldb_private::Event *m_opaque_ptr;
};
} // namespace lldb
#endif // LLDB_SBEvent_h_
#endif // LLDB_SBEvent_h_

View File

@ -1,4 +1,5 @@
//===-- SBExecutionContext.h -----------------------------------------*- C++ -*-===//
//===-- SBExecutionContext.h -----------------------------------------*- C++
//-*-===//
//
// The LLVM Compiler Infrastructure
//
@ -15,60 +16,51 @@
#include <stdio.h>
#include <vector>
namespace lldb {
class LLDB_API SBExecutionContext
{
friend class SBCommandInterpreter;
class LLDB_API SBExecutionContext {
friend class SBCommandInterpreter;
public:
SBExecutionContext();
SBExecutionContext (const lldb::SBExecutionContext &rhs);
SBExecutionContext (lldb::ExecutionContextRefSP exe_ctx_ref_sp);
SBExecutionContext (const lldb::SBTarget &target);
SBExecutionContext (const lldb::SBProcess &process);
SBExecutionContext (lldb::SBThread thread); // can't be a const& because SBThread::get() isn't itself a const function
SBExecutionContext (const lldb::SBFrame &frame);
~SBExecutionContext();
const SBExecutionContext &
operator = (const lldb::SBExecutionContext &rhs);
SBTarget
GetTarget () const;
SBProcess
GetProcess () const;
SBExecutionContext();
SBThread
GetThread () const;
SBExecutionContext(const lldb::SBExecutionContext &rhs);
SBExecutionContext(lldb::ExecutionContextRefSP exe_ctx_ref_sp);
SBExecutionContext(const lldb::SBTarget &target);
SBExecutionContext(const lldb::SBProcess &process);
SBExecutionContext(lldb::SBThread thread); // can't be a const& because
// SBThread::get() isn't itself a
// const function
SBExecutionContext(const lldb::SBFrame &frame);
~SBExecutionContext();
const SBExecutionContext &operator=(const lldb::SBExecutionContext &rhs);
SBTarget GetTarget() const;
SBProcess GetProcess() const;
SBThread GetThread() const;
SBFrame GetFrame() const;
SBFrame
GetFrame () const;
protected:
ExecutionContextRefSP &
GetSP () const;
void
reset (lldb::ExecutionContextRefSP &event_sp);
lldb_private::ExecutionContextRef *
get () const;
ExecutionContextRefSP &GetSP() const;
void reset(lldb::ExecutionContextRefSP &event_sp);
lldb_private::ExecutionContextRef *get() const;
private:
mutable lldb::ExecutionContextRefSP m_exe_ctx_sp;
mutable lldb::ExecutionContextRefSP m_exe_ctx_sp;
};
} // namespace lldb
#endif // LLDB_SBExecutionContext_h_
#endif // LLDB_SBExecutionContext_h_

View File

@ -16,133 +16,100 @@
namespace lldb {
class LLDB_API SBExpressionOptions
{
class LLDB_API SBExpressionOptions {
public:
SBExpressionOptions();
SBExpressionOptions();
SBExpressionOptions (const lldb::SBExpressionOptions &rhs);
~SBExpressionOptions();
SBExpressionOptions(const lldb::SBExpressionOptions &rhs);
const SBExpressionOptions &
operator = (const lldb::SBExpressionOptions &rhs);
~SBExpressionOptions();
bool
GetCoerceResultToId () const;
void
SetCoerceResultToId (bool coerce = true);
bool
GetUnwindOnError () const;
void
SetUnwindOnError (bool unwind = true);
bool
GetIgnoreBreakpoints () const;
void
SetIgnoreBreakpoints (bool ignore = true);
lldb::DynamicValueType
GetFetchDynamicValue () const;
void
SetFetchDynamicValue (lldb::DynamicValueType dynamic = lldb::eDynamicCanRunTarget);
uint32_t
GetTimeoutInMicroSeconds () const;
// Set the timeout for the expression, 0 means wait forever.
void
SetTimeoutInMicroSeconds (uint32_t timeout = 0);
uint32_t
GetOneThreadTimeoutInMicroSeconds () const;
// Set the timeout for running on one thread, 0 means use the default behavior.
// If you set this higher than the overall timeout, you'll get an error when you
// try to run the expression.
void
SetOneThreadTimeoutInMicroSeconds (uint32_t timeout = 0);
bool
GetTryAllThreads () const;
void
SetTryAllThreads (bool run_others = true);
bool
GetStopOthers() const;
void
SetStopOthers(bool stop_others = true);
const SBExpressionOptions &operator=(const lldb::SBExpressionOptions &rhs);
bool
GetTrapExceptions () const;
void
SetTrapExceptions (bool trap_exceptions = true);
void
SetLanguage (lldb::LanguageType language);
bool GetCoerceResultToId() const;
void
SetCancelCallback (lldb::ExpressionCancelCallback callback, void *baton);
void SetCoerceResultToId(bool coerce = true);
bool
GetGenerateDebugInfo ();
void
SetGenerateDebugInfo (bool b = true);
bool
GetSuppressPersistentResult ();
void
SetSuppressPersistentResult (bool b = false);
bool GetUnwindOnError() const;
const char *
GetPrefix () const;
void SetUnwindOnError(bool unwind = true);
void
SetPrefix (const char *prefix);
void
SetAutoApplyFixIts(bool b = true);
bool
GetAutoApplyFixIts();
bool
GetTopLevel ();
bool GetIgnoreBreakpoints() const;
void
SetTopLevel (bool b = true);
void SetIgnoreBreakpoints(bool ignore = true);
lldb::DynamicValueType GetFetchDynamicValue() const;
void SetFetchDynamicValue(
lldb::DynamicValueType dynamic = lldb::eDynamicCanRunTarget);
uint32_t GetTimeoutInMicroSeconds() const;
// Set the timeout for the expression, 0 means wait forever.
void SetTimeoutInMicroSeconds(uint32_t timeout = 0);
uint32_t GetOneThreadTimeoutInMicroSeconds() const;
// Set the timeout for running on one thread, 0 means use the default
// behavior.
// If you set this higher than the overall timeout, you'll get an error when
// you
// try to run the expression.
void SetOneThreadTimeoutInMicroSeconds(uint32_t timeout = 0);
bool GetTryAllThreads() const;
void SetTryAllThreads(bool run_others = true);
bool GetStopOthers() const;
void SetStopOthers(bool stop_others = true);
bool GetTrapExceptions() const;
void SetTrapExceptions(bool trap_exceptions = true);
void SetLanguage(lldb::LanguageType language);
void SetCancelCallback(lldb::ExpressionCancelCallback callback, void *baton);
bool GetGenerateDebugInfo();
void SetGenerateDebugInfo(bool b = true);
bool GetSuppressPersistentResult();
void SetSuppressPersistentResult(bool b = false);
const char *GetPrefix() const;
void SetPrefix(const char *prefix);
void SetAutoApplyFixIts(bool b = true);
bool GetAutoApplyFixIts();
bool GetTopLevel();
void SetTopLevel(bool b = true);
protected:
SBExpressionOptions(
lldb_private::EvaluateExpressionOptions &expression_options);
SBExpressionOptions (lldb_private::EvaluateExpressionOptions &expression_options);
lldb_private::EvaluateExpressionOptions *get() const;
lldb_private::EvaluateExpressionOptions *
get () const;
lldb_private::EvaluateExpressionOptions &ref() const;
lldb_private::EvaluateExpressionOptions &
ref () const;
friend class SBFrame;
friend class SBValue;
friend class SBTarget;
friend class SBFrame;
friend class SBValue;
friend class SBTarget;
private:
// This auto_pointer is made in the constructor and is always valid.
mutable std::unique_ptr<lldb_private::EvaluateExpressionOptions> m_opaque_ap;
// This auto_pointer is made in the constructor and is always valid.
mutable std::unique_ptr<lldb_private::EvaluateExpressionOptions> m_opaque_ap;
};
} // namespace lldb
#endif // LLDB_SBExpressionOptions_h_
#endif // LLDB_SBExpressionOptions_h_

View File

@ -14,94 +14,76 @@
namespace lldb {
class LLDB_API SBFileSpec
{
class LLDB_API SBFileSpec {
public:
SBFileSpec ();
SBFileSpec();
SBFileSpec (const lldb::SBFileSpec &rhs);
SBFileSpec(const lldb::SBFileSpec &rhs);
SBFileSpec (const char *path);// Deprecated, use SBFileSpec (const char *path, bool resolve)
SBFileSpec(const char *path); // Deprecated, use SBFileSpec (const char *path,
// bool resolve)
SBFileSpec (const char *path, bool resolve);
SBFileSpec(const char *path, bool resolve);
~SBFileSpec ();
~SBFileSpec();
const SBFileSpec &
operator = (const lldb::SBFileSpec &rhs);
const SBFileSpec &operator=(const lldb::SBFileSpec &rhs);
bool
IsValid() const;
bool IsValid() const;
bool
Exists () const;
bool Exists() const;
bool
ResolveExecutableLocation ();
bool ResolveExecutableLocation();
const char *
GetFilename() const;
const char *GetFilename() const;
const char *
GetDirectory() const;
const char *GetDirectory() const;
void
SetFilename(const char *filename);
void
SetDirectory(const char *directory);
void SetFilename(const char *filename);
uint32_t
GetPath (char *dst_path, size_t dst_len) const;
void SetDirectory(const char *directory);
static int
ResolvePath (const char *src_path, char *dst_path, size_t dst_len);
uint32_t GetPath(char *dst_path, size_t dst_len) const;
bool
GetDescription (lldb::SBStream &description) const;
static int ResolvePath(const char *src_path, char *dst_path, size_t dst_len);
void
AppendPathComponent (const char *file_or_directory);
bool GetDescription(lldb::SBStream &description) const;
void AppendPathComponent(const char *file_or_directory);
private:
friend class SBAttachInfo;
friend class SBBlock;
friend class SBCommandInterpreter;
friend class SBCompileUnit;
friend class SBDeclaration;
friend class SBFileSpecList;
friend class SBHostOS;
friend class SBLaunchInfo;
friend class SBLineEntry;
friend class SBModule;
friend class SBModuleSpec;
friend class SBPlatform;
friend class SBProcess;
friend class SBSourceManager;
friend class SBThread;
friend class SBTarget;
friend class SBAttachInfo;
friend class SBBlock;
friend class SBCommandInterpreter;
friend class SBCompileUnit;
friend class SBDeclaration;
friend class SBFileSpecList;
friend class SBHostOS;
friend class SBLaunchInfo;
friend class SBLineEntry;
friend class SBModule;
friend class SBModuleSpec;
friend class SBPlatform;
friend class SBProcess;
friend class SBSourceManager;
friend class SBThread;
friend class SBTarget;
SBFileSpec (const lldb_private::FileSpec& fspec);
SBFileSpec(const lldb_private::FileSpec &fspec);
void
SetFileSpec (const lldb_private::FileSpec& fspec);
void SetFileSpec(const lldb_private::FileSpec &fspec);
const lldb_private::FileSpec *
operator->() const;
const lldb_private::FileSpec *operator->() const;
const lldb_private::FileSpec *
get() const;
const lldb_private::FileSpec *get() const;
const lldb_private::FileSpec &
operator*() const;
const lldb_private::FileSpec &operator*() const;
const lldb_private::FileSpec &
ref() const;
const lldb_private::FileSpec &ref() const;
std::unique_ptr<lldb_private::FileSpec> m_opaque_ap;
std::unique_ptr<lldb_private::FileSpec> m_opaque_ap;
};
} // namespace lldb
#endif // LLDB_SBFileSpec_h_

View File

@ -1,4 +1,5 @@
//===-- SBFileSpecList.h --------------------------------------------*- C++ -*-===//
//===-- SBFileSpecList.h --------------------------------------------*- C++
//-*-===//
//
// The LLVM Compiler Infrastructure
//
@ -14,59 +15,44 @@
namespace lldb {
class LLDB_API SBFileSpecList
{
class LLDB_API SBFileSpecList {
public:
SBFileSpecList ();
SBFileSpecList();
SBFileSpecList (const lldb::SBFileSpecList &rhs);
SBFileSpecList(const lldb::SBFileSpecList &rhs);
~SBFileSpecList ();
~SBFileSpecList();
const SBFileSpecList &
operator = (const lldb::SBFileSpecList &rhs);
const SBFileSpecList &operator=(const lldb::SBFileSpecList &rhs);
uint32_t
GetSize () const;
uint32_t GetSize() const;
bool
GetDescription (SBStream &description) const;
void
Append (const SBFileSpec &sb_file);
bool
AppendIfUnique (const SBFileSpec &sb_file);
void
Clear();
uint32_t
FindFileIndex (uint32_t idx, const SBFileSpec &sb_file, bool full);
const SBFileSpec
GetFileSpecAtIndex (uint32_t idx) const;
bool GetDescription(SBStream &description) const;
void Append(const SBFileSpec &sb_file);
bool AppendIfUnique(const SBFileSpec &sb_file);
void Clear();
uint32_t FindFileIndex(uint32_t idx, const SBFileSpec &sb_file, bool full);
const SBFileSpec GetFileSpecAtIndex(uint32_t idx) const;
private:
friend class SBTarget;
friend class SBTarget;
const lldb_private::FileSpecList *operator->() const;
const lldb_private::FileSpecList *
operator->() const;
const lldb_private::FileSpecList *get() const;
const lldb_private::FileSpecList *
get() const;
const lldb_private::FileSpecList &operator*() const;
const lldb_private::FileSpecList &
operator*() const;
const lldb_private::FileSpecList &ref() const;
const lldb_private::FileSpecList &
ref() const;
std::unique_ptr<lldb_private::FileSpecList> m_opaque_ap;
std::unique_ptr<lldb_private::FileSpecList> m_opaque_ap;
};
} // namespace lldb
#endif // LLDB_SBFileSpecList_h_

View File

@ -15,227 +15,182 @@
namespace lldb {
class LLDB_API SBFrame
{
class LLDB_API SBFrame {
public:
SBFrame ();
SBFrame();
SBFrame (const lldb::SBFrame &rhs);
const lldb::SBFrame &
operator =(const lldb::SBFrame &rhs);
SBFrame(const lldb::SBFrame &rhs);
~SBFrame();
const lldb::SBFrame &operator=(const lldb::SBFrame &rhs);
bool
IsEqual (const lldb::SBFrame &that) const;
~SBFrame();
bool
IsValid() const;
bool IsEqual(const lldb::SBFrame &that) const;
uint32_t
GetFrameID () const;
bool IsValid() const;
lldb::addr_t
GetCFA () const;
uint32_t GetFrameID() const;
lldb::addr_t
GetPC () const;
lldb::addr_t GetCFA() const;
bool
SetPC (lldb::addr_t new_pc);
lldb::addr_t GetPC() const;
lldb::addr_t
GetSP () const;
bool SetPC(lldb::addr_t new_pc);
lldb::addr_t
GetFP () const;
lldb::addr_t GetSP() const;
lldb::SBAddress
GetPCAddress () const;
lldb::addr_t GetFP() const;
lldb::SBSymbolContext
GetSymbolContext (uint32_t resolve_scope) const;
lldb::SBAddress GetPCAddress() const;
lldb::SBModule
GetModule () const;
lldb::SBSymbolContext GetSymbolContext(uint32_t resolve_scope) const;
lldb::SBCompileUnit
GetCompileUnit () const;
lldb::SBModule GetModule() const;
lldb::SBFunction
GetFunction () const;
lldb::SBCompileUnit GetCompileUnit() const;
lldb::SBSymbol
GetSymbol () const;
lldb::SBFunction GetFunction() const;
/// Gets the deepest block that contains the frame PC.
///
/// See also GetFrameBlock().
lldb::SBBlock
GetBlock () const;
lldb::SBSymbol GetSymbol() const;
/// Get the appropriate function name for this frame. Inlined functions in
/// LLDB are represented by Blocks that have inlined function information, so
/// just looking at the SBFunction or SBSymbol for a frame isn't enough.
/// This function will return the appropriate function, symbol or inlined
/// function name for the frame.
///
/// This function returns:
/// - the name of the inlined function (if there is one)
/// - the name of the concrete function (if there is one)
/// - the name of the symbol (if there is one)
/// - NULL
///
/// See also IsInlined().
const char *
GetFunctionName();
// Get an appropriate function name for this frame that is suitable for display to a user
const char *
GetDisplayFunctionName ();
/// Gets the deepest block that contains the frame PC.
///
/// See also GetFrameBlock().
lldb::SBBlock GetBlock() const;
const char *
GetFunctionName() const;
/// Get the appropriate function name for this frame. Inlined functions in
/// LLDB are represented by Blocks that have inlined function information, so
/// just looking at the SBFunction or SBSymbol for a frame isn't enough.
/// This function will return the appropriate function, symbol or inlined
/// function name for the frame.
///
/// This function returns:
/// - the name of the inlined function (if there is one)
/// - the name of the concrete function (if there is one)
/// - the name of the symbol (if there is one)
/// - NULL
///
/// See also IsInlined().
const char *GetFunctionName();
/// Return true if this frame represents an inlined function.
///
/// See also GetFunctionName().
bool
IsInlined();
// Get an appropriate function name for this frame that is suitable for
// display to a user
const char *GetDisplayFunctionName();
bool
IsInlined() const;
const char *GetFunctionName() const;
/// The version that doesn't supply a 'use_dynamic' value will use the
/// target's default.
lldb::SBValue
EvaluateExpression (const char *expr);
/// Return true if this frame represents an inlined function.
///
/// See also GetFunctionName().
bool IsInlined();
lldb::SBValue
EvaluateExpression (const char *expr, lldb::DynamicValueType use_dynamic);
bool IsInlined() const;
lldb::SBValue
EvaluateExpression (const char *expr, lldb::DynamicValueType use_dynamic, bool unwind_on_error);
lldb::SBValue
EvaluateExpression (const char *expr, const SBExpressionOptions &options);
/// The version that doesn't supply a 'use_dynamic' value will use the
/// target's default.
lldb::SBValue EvaluateExpression(const char *expr);
/// Gets the lexical block that defines the stack frame. Another way to think
/// of this is it will return the block that contains all of the variables
/// for a stack frame. Inlined functions are represented as SBBlock objects
/// that have inlined function information: the name of the inlined function,
/// where it was called from. The block that is returned will be the first
/// block at or above the block for the PC (SBFrame::GetBlock()) that defines
/// the scope of the frame. When a function contains no inlined functions,
/// this will be the top most lexical block that defines the function.
/// When a function has inlined functions and the PC is currently
/// in one of those inlined functions, this method will return the inlined
/// block that defines this frame. If the PC isn't currently in an inlined
/// function, the lexical block that defines the function is returned.
lldb::SBBlock
GetFrameBlock () const;
lldb::SBValue EvaluateExpression(const char *expr,
lldb::DynamicValueType use_dynamic);
lldb::SBLineEntry
GetLineEntry () const;
lldb::SBValue EvaluateExpression(const char *expr,
lldb::DynamicValueType use_dynamic,
bool unwind_on_error);
lldb::SBThread
GetThread () const;
lldb::SBValue EvaluateExpression(const char *expr,
const SBExpressionOptions &options);
const char *
Disassemble () const;
/// Gets the lexical block that defines the stack frame. Another way to think
/// of this is it will return the block that contains all of the variables
/// for a stack frame. Inlined functions are represented as SBBlock objects
/// that have inlined function information: the name of the inlined function,
/// where it was called from. The block that is returned will be the first
/// block at or above the block for the PC (SBFrame::GetBlock()) that defines
/// the scope of the frame. When a function contains no inlined functions,
/// this will be the top most lexical block that defines the function.
/// When a function has inlined functions and the PC is currently
/// in one of those inlined functions, this method will return the inlined
/// block that defines this frame. If the PC isn't currently in an inlined
/// function, the lexical block that defines the function is returned.
lldb::SBBlock GetFrameBlock() const;
void
Clear();
lldb::SBLineEntry GetLineEntry() const;
bool
operator == (const lldb::SBFrame &rhs) const;
lldb::SBThread GetThread() const;
bool
operator != (const lldb::SBFrame &rhs) const;
const char *Disassemble() const;
/// The version that doesn't supply a 'use_dynamic' value will use the
/// target's default.
lldb::SBValueList
GetVariables (bool arguments,
bool locals,
bool statics,
bool in_scope_only);
void Clear();
lldb::SBValueList
GetVariables (bool arguments,
bool locals,
bool statics,
bool in_scope_only,
lldb::DynamicValueType use_dynamic);
bool operator==(const lldb::SBFrame &rhs) const;
lldb::SBValueList
GetVariables (const lldb::SBVariablesOptions& options);
lldb::SBValueList
GetRegisters ();
bool operator!=(const lldb::SBFrame &rhs) const;
lldb::SBValue
FindRegister (const char *name);
/// The version that doesn't supply a 'use_dynamic' value will use the
/// target's default.
lldb::SBValueList GetVariables(bool arguments, bool locals, bool statics,
bool in_scope_only);
/// The version that doesn't supply a 'use_dynamic' value will use the
/// target's default.
lldb::SBValue
FindVariable (const char *var_name);
lldb::SBValueList GetVariables(bool arguments, bool locals, bool statics,
bool in_scope_only,
lldb::DynamicValueType use_dynamic);
lldb::SBValue
FindVariable (const char *var_name, lldb::DynamicValueType use_dynamic);
lldb::SBValueList GetVariables(const lldb::SBVariablesOptions &options);
// Find a value for a variable expression path like "rect.origin.x" or
// "pt_ptr->x", "*self", "*this->obj_ptr". The returned value is _not_
// and expression result and is not a constant object like
// SBFrame::EvaluateExpression(...) returns, but a child object of
// the variable value.
lldb::SBValue
GetValueForVariablePath (const char *var_expr_cstr,
DynamicValueType use_dynamic);
lldb::SBValueList GetRegisters();
/// The version that doesn't supply a 'use_dynamic' value will use the
/// target's default.
lldb::SBValue
GetValueForVariablePath (const char *var_path);
lldb::SBValue FindRegister(const char *name);
/// Find variables, register sets, registers, or persistent variables using
/// the frame as the scope.
///
/// NB. This function does not look up ivars in the function object pointer.
/// To do that use GetValueForVariablePath.
///
/// The version that doesn't supply a 'use_dynamic' value will use the
/// target's default.
lldb::SBValue
FindValue (const char *name, ValueType value_type);
/// The version that doesn't supply a 'use_dynamic' value will use the
/// target's default.
lldb::SBValue FindVariable(const char *var_name);
lldb::SBValue
FindValue (const char *name, ValueType value_type, lldb::DynamicValueType use_dynamic);
lldb::SBValue FindVariable(const char *var_name,
lldb::DynamicValueType use_dynamic);
bool
GetDescription (lldb::SBStream &description);
// Find a value for a variable expression path like "rect.origin.x" or
// "pt_ptr->x", "*self", "*this->obj_ptr". The returned value is _not_
// and expression result and is not a constant object like
// SBFrame::EvaluateExpression(...) returns, but a child object of
// the variable value.
lldb::SBValue GetValueForVariablePath(const char *var_expr_cstr,
DynamicValueType use_dynamic);
SBFrame (const lldb::StackFrameSP &lldb_object_sp);
/// The version that doesn't supply a 'use_dynamic' value will use the
/// target's default.
lldb::SBValue GetValueForVariablePath(const char *var_path);
/// Find variables, register sets, registers, or persistent variables using
/// the frame as the scope.
///
/// NB. This function does not look up ivars in the function object pointer.
/// To do that use GetValueForVariablePath.
///
/// The version that doesn't supply a 'use_dynamic' value will use the
/// target's default.
lldb::SBValue FindValue(const char *name, ValueType value_type);
lldb::SBValue FindValue(const char *name, ValueType value_type,
lldb::DynamicValueType use_dynamic);
bool GetDescription(lldb::SBStream &description);
SBFrame(const lldb::StackFrameSP &lldb_object_sp);
protected:
friend class SBBlock;
friend class SBExecutionContext;
friend class SBInstruction;
friend class SBThread;
friend class SBValue;
friend class SBBlock;
friend class SBExecutionContext;
friend class SBInstruction;
friend class SBThread;
friend class SBValue;
lldb::StackFrameSP GetFrameSP() const;
lldb::StackFrameSP
GetFrameSP() const;
void SetFrameSP(const lldb::StackFrameSP &lldb_object_sp);
void
SetFrameSP (const lldb::StackFrameSP &lldb_object_sp);
lldb::ExecutionContextRefSP m_opaque_sp;
lldb::ExecutionContextRefSP m_opaque_sp;
};
} // namespace lldb
#endif // LLDB_SBFrame_h_
#endif // LLDB_SBFrame_h_

View File

@ -10,96 +10,72 @@
#ifndef LLDB_SBFunction_h_
#define LLDB_SBFunction_h_
#include "lldb/API/SBDefines.h"
#include "lldb/API/SBAddress.h"
#include "lldb/API/SBDefines.h"
#include "lldb/API/SBInstructionList.h"
namespace lldb {
class LLDB_API SBFunction
{
class LLDB_API SBFunction {
public:
SBFunction();
SBFunction ();
SBFunction(const lldb::SBFunction &rhs);
SBFunction (const lldb::SBFunction &rhs);
const lldb::SBFunction &operator=(const lldb::SBFunction &rhs);
const lldb::SBFunction &
operator = (const lldb::SBFunction &rhs);
~SBFunction();
~SBFunction ();
bool IsValid() const;
bool
IsValid () const;
const char *GetName() const;
const char *
GetName() const;
const char *GetDisplayName() const;
const char *
GetDisplayName() const;
const char *
GetMangledName () const;
const char *GetMangledName() const;
lldb::SBInstructionList
GetInstructions (lldb::SBTarget target);
lldb::SBInstructionList GetInstructions(lldb::SBTarget target);
lldb::SBInstructionList
GetInstructions (lldb::SBTarget target, const char *flavor);
lldb::SBInstructionList GetInstructions(lldb::SBTarget target,
const char *flavor);
lldb::SBAddress
GetStartAddress ();
lldb::SBAddress GetStartAddress();
lldb::SBAddress
GetEndAddress ();
lldb::SBAddress GetEndAddress();
const char *
GetArgumentName (uint32_t arg_idx);
const char *GetArgumentName(uint32_t arg_idx);
uint32_t
GetPrologueByteSize ();
uint32_t GetPrologueByteSize();
lldb::SBType
GetType ();
lldb::SBType GetType();
lldb::SBBlock
GetBlock ();
lldb::LanguageType
GetLanguage ();
lldb::SBBlock GetBlock();
bool
GetIsOptimized ();
lldb::LanguageType GetLanguage();
bool
operator == (const lldb::SBFunction &rhs) const;
bool GetIsOptimized();
bool
operator != (const lldb::SBFunction &rhs) const;
bool operator==(const lldb::SBFunction &rhs) const;
bool
GetDescription (lldb::SBStream &description);
bool operator!=(const lldb::SBFunction &rhs) const;
bool GetDescription(lldb::SBStream &description);
protected:
lldb_private::Function *get();
lldb_private::Function *
get ();
void
reset (lldb_private::Function *lldb_object_ptr);
void reset(lldb_private::Function *lldb_object_ptr);
private:
friend class SBAddress;
friend class SBFrame;
friend class SBSymbolContext;
friend class SBAddress;
friend class SBFrame;
friend class SBSymbolContext;
SBFunction (lldb_private::Function *lldb_object_ptr);
SBFunction(lldb_private::Function *lldb_object_ptr);
lldb_private::Function *m_opaque_ptr;
lldb_private::Function *m_opaque_ptr;
};
} // namespace lldb
#endif // LLDB_SBFunction_h_

View File

@ -15,49 +15,31 @@
namespace lldb {
class LLDB_API SBHostOS
{
class LLDB_API SBHostOS {
public:
static lldb::SBFileSpec GetProgramFileSpec();
static lldb::SBFileSpec
GetProgramFileSpec ();
static lldb::SBFileSpec
GetLLDBPythonPath ();
static lldb::SBFileSpec GetLLDBPythonPath();
static lldb::SBFileSpec
GetLLDBPath (lldb::PathType path_type);
static lldb::SBFileSpec GetLLDBPath(lldb::PathType path_type);
static lldb::SBFileSpec
GetUserHomeDirectory ();
static lldb::SBFileSpec GetUserHomeDirectory();
static void
ThreadCreated (const char *name);
static void ThreadCreated(const char *name);
static lldb::thread_t
ThreadCreate (const char *name,
lldb::thread_func_t thread_function,
void *thread_arg,
lldb::SBError *err);
static lldb::thread_t ThreadCreate(const char *name,
lldb::thread_func_t thread_function,
void *thread_arg, lldb::SBError *err);
static bool
ThreadCancel (lldb::thread_t thread,
lldb::SBError *err);
static bool
ThreadDetach (lldb::thread_t thread,
lldb::SBError *err);
static bool
ThreadJoin (lldb::thread_t thread,
lldb::thread_result_t *result,
lldb::SBError *err);
static bool ThreadCancel(lldb::thread_t thread, lldb::SBError *err);
static bool ThreadDetach(lldb::thread_t thread, lldb::SBError *err);
static bool ThreadJoin(lldb::thread_t thread, lldb::thread_result_t *result,
lldb::SBError *err);
private:
};
} // namespace lldb
#endif // LLDB_SBHostOS_h_

View File

@ -10,93 +10,76 @@
#ifndef LLDB_SBInstruction_h_
#define LLDB_SBInstruction_h_
#include "lldb/API/SBDefines.h"
#include "lldb/API/SBData.h"
#include "lldb/API/SBDefines.h"
#include <stdio.h>
// There's a lot to be fixed here, but need to wait for underlying insn implementation
// There's a lot to be fixed here, but need to wait for underlying insn
// implementation
// to be revised & settle down first.
class InstructionImpl;
namespace lldb {
class LLDB_API SBInstruction
{
class LLDB_API SBInstruction {
public:
SBInstruction();
SBInstruction ();
SBInstruction(const SBInstruction &rhs);
SBInstruction (const SBInstruction &rhs);
const SBInstruction &
operator = (const SBInstruction &rhs);
const SBInstruction &operator=(const SBInstruction &rhs);
~SBInstruction ();
~SBInstruction();
bool
IsValid();
bool IsValid();
SBAddress
GetAddress();
lldb::AddressClass
GetAddressClass ();
const char *
GetMnemonic (lldb::SBTarget target);
SBAddress GetAddress();
const char *
GetOperands (lldb::SBTarget target);
const char *
GetComment (lldb::SBTarget target);
lldb::AddressClass GetAddressClass();
lldb::SBData
GetData (lldb::SBTarget target);
const char *GetMnemonic(lldb::SBTarget target);
size_t
GetByteSize ();
const char *GetOperands(lldb::SBTarget target);
bool
DoesBranch ();
const char *GetComment(lldb::SBTarget target);
bool
HasDelaySlot ();
lldb::SBData GetData(lldb::SBTarget target);
void
Print (FILE *out);
size_t GetByteSize();
bool
GetDescription (lldb::SBStream &description);
bool DoesBranch();
bool
EmulateWithFrame (lldb::SBFrame &frame, uint32_t evaluate_options);
bool HasDelaySlot();
bool
DumpEmulation (const char * triple); // triple is to specify the architecture, e.g. 'armv6' or 'armv7-apple-ios'
bool
TestEmulation (lldb::SBStream &output_stream, const char *test_file);
void Print(FILE *out);
bool GetDescription(lldb::SBStream &description);
bool EmulateWithFrame(lldb::SBFrame &frame, uint32_t evaluate_options);
bool DumpEmulation(const char *triple); // triple is to specify the
// architecture, e.g. 'armv6' or
// 'armv7-apple-ios'
bool TestEmulation(lldb::SBStream &output_stream, const char *test_file);
protected:
friend class SBInstructionList;
friend class SBInstructionList;
SBInstruction(const lldb::DisassemblerSP &disasm_sp, const lldb::InstructionSP &inst_sp);
SBInstruction(const lldb::DisassemblerSP &disasm_sp,
const lldb::InstructionSP &inst_sp);
void
SetOpaque(const lldb::DisassemblerSP &disasm_sp, const lldb::InstructionSP& inst_sp);
void SetOpaque(const lldb::DisassemblerSP &disasm_sp,
const lldb::InstructionSP &inst_sp);
lldb::InstructionSP
GetOpaque();
lldb::InstructionSP GetOpaque();
private:
std::shared_ptr<InstructionImpl> m_opaque_sp;
std::shared_ptr<InstructionImpl> m_opaque_sp;
};
} // namespace lldb
#endif // LLDB_SBInstruction_h_

View File

@ -16,56 +16,43 @@
namespace lldb {
class LLDB_API SBInstructionList
{
class LLDB_API SBInstructionList {
public:
SBInstructionList();
SBInstructionList ();
SBInstructionList(const SBInstructionList &rhs);
SBInstructionList (const SBInstructionList &rhs);
const SBInstructionList &
operator = (const SBInstructionList &rhs);
const SBInstructionList &operator=(const SBInstructionList &rhs);
~SBInstructionList ();
~SBInstructionList();
bool
IsValid () const;
bool IsValid() const;
size_t
GetSize ();
size_t GetSize();
lldb::SBInstruction
GetInstructionAtIndex (uint32_t idx);
lldb::SBInstruction GetInstructionAtIndex(uint32_t idx);
void
Clear ();
void Clear();
void
AppendInstruction (lldb::SBInstruction inst);
void AppendInstruction(lldb::SBInstruction inst);
void
Print (FILE *out);
void Print(FILE *out);
bool
GetDescription (lldb::SBStream &description);
bool
DumpEmulationForAllInstructions (const char *triple);
bool GetDescription(lldb::SBStream &description);
bool DumpEmulationForAllInstructions(const char *triple);
protected:
friend class SBFunction;
friend class SBSymbol;
friend class SBTarget;
void
SetDisassembler (const lldb::DisassemblerSP &opaque_sp);
friend class SBFunction;
friend class SBSymbol;
friend class SBTarget;
private:
lldb::DisassemblerSP m_opaque_sp;
void SetDisassembler(const lldb::DisassemblerSP &opaque_sp);
private:
lldb::DisassemblerSP m_opaque_sp;
};
} // namespace lldb
#endif // LLDB_SBInstructionList_h_

View File

@ -14,14 +14,11 @@
namespace lldb {
class SBLanguageRuntime
{
class SBLanguageRuntime {
public:
static lldb::LanguageType
GetLanguageTypeFromString (const char *string);
static const char *
GetNameForLanguageType (lldb::LanguageType language);
static lldb::LanguageType GetLanguageTypeFromString(const char *string);
static const char *GetNameForLanguageType(lldb::LanguageType language);
};
} // namespace lldb

View File

@ -17,179 +17,137 @@ namespace lldb {
class SBPlatform;
class SBTarget;
class LLDB_API SBLaunchInfo
{
class LLDB_API SBLaunchInfo {
public:
SBLaunchInfo (const char **argv);
SBLaunchInfo(const char **argv);
~SBLaunchInfo();
~SBLaunchInfo();
lldb::pid_t
GetProcessID();
lldb::pid_t GetProcessID();
uint32_t
GetUserID();
uint32_t GetUserID();
uint32_t
GetGroupID();
uint32_t GetGroupID();
bool
UserIDIsValid ();
bool UserIDIsValid();
bool
GroupIDIsValid ();
bool GroupIDIsValid();
void
SetUserID (uint32_t uid);
void SetUserID(uint32_t uid);
void
SetGroupID (uint32_t gid);
void SetGroupID(uint32_t gid);
SBFileSpec
GetExecutableFile ();
SBFileSpec GetExecutableFile();
//----------------------------------------------------------------------
/// Set the executable file that will be used to launch the process and
/// optionally set it as the first argument in the argument vector.
///
/// This only needs to be specified if clients wish to carefully control
/// the exact path will be used to launch a binary. If you create a
/// target with a symlink, that symlink will get resolved in the target
/// and the resolved path will get used to launch the process. Calling
/// this function can help you still launch your process using the
/// path of your choice.
///
/// If this function is not called prior to launching with
/// SBTarget::Launch(...), the target will use the resolved executable
/// path that was used to create the target.
///
/// @param[in] exe_file
/// The override path to use when launching the executable.
///
/// @param[in] add_as_first_arg
/// If true, then the path will be inserted into the argument vector
/// prior to launching. Otherwise the argument vector will be left
/// alone.
//----------------------------------------------------------------------
void
SetExecutableFile (SBFileSpec exe_file, bool add_as_first_arg);
//----------------------------------------------------------------------
/// Set the executable file that will be used to launch the process and
/// optionally set it as the first argument in the argument vector.
///
/// This only needs to be specified if clients wish to carefully control
/// the exact path will be used to launch a binary. If you create a
/// target with a symlink, that symlink will get resolved in the target
/// and the resolved path will get used to launch the process. Calling
/// this function can help you still launch your process using the
/// path of your choice.
///
/// If this function is not called prior to launching with
/// SBTarget::Launch(...), the target will use the resolved executable
/// path that was used to create the target.
///
/// @param[in] exe_file
/// The override path to use when launching the executable.
///
/// @param[in] add_as_first_arg
/// If true, then the path will be inserted into the argument vector
/// prior to launching. Otherwise the argument vector will be left
/// alone.
//----------------------------------------------------------------------
void SetExecutableFile(SBFileSpec exe_file, bool add_as_first_arg);
//----------------------------------------------------------------------
/// Get the listener that will be used to receive process events.
///
/// If no listener has been set via a call to
/// SBLaunchInfo::SetListener(), then an invalid SBListener will be
/// returned (SBListener::IsValid() will return false). If a listener
/// has been set, then the valid listener object will be returned.
//----------------------------------------------------------------------
SBListener GetListener();
//----------------------------------------------------------------------
/// Get the listener that will be used to receive process events.
///
/// If no listener has been set via a call to
/// SBLaunchInfo::SetListener(), then an invalid SBListener will be
/// returned (SBListener::IsValid() will return false). If a listener
/// has been set, then the valid listener object will be returned.
//----------------------------------------------------------------------
SBListener
GetListener ();
//----------------------------------------------------------------------
/// Set the listener that will be used to receive process events.
///
/// By default the SBDebugger, which has a listener, that the SBTarget
/// belongs to will listen for the process events. Calling this function
/// allows a different listener to be used to listen for process events.
//----------------------------------------------------------------------
void SetListener(SBListener &listener);
//----------------------------------------------------------------------
/// Set the listener that will be used to receive process events.
///
/// By default the SBDebugger, which has a listener, that the SBTarget
/// belongs to will listen for the process events. Calling this function
/// allows a different listener to be used to listen for process events.
//----------------------------------------------------------------------
void
SetListener (SBListener &listener);
uint32_t GetNumArguments();
uint32_t
GetNumArguments ();
const char *GetArgumentAtIndex(uint32_t idx);
const char *
GetArgumentAtIndex (uint32_t idx);
void SetArguments(const char **argv, bool append);
void
SetArguments (const char **argv, bool append);
uint32_t GetNumEnvironmentEntries();
uint32_t
GetNumEnvironmentEntries ();
const char *GetEnvironmentEntryAtIndex(uint32_t idx);
const char *
GetEnvironmentEntryAtIndex (uint32_t idx);
void SetEnvironmentEntries(const char **envp, bool append);
void
SetEnvironmentEntries (const char **envp, bool append);
void Clear();
void
Clear ();
const char *GetWorkingDirectory() const;
const char *
GetWorkingDirectory () const;
void SetWorkingDirectory(const char *working_dir);
void
SetWorkingDirectory (const char *working_dir);
uint32_t GetLaunchFlags();
uint32_t
GetLaunchFlags ();
void SetLaunchFlags(uint32_t flags);
void
SetLaunchFlags (uint32_t flags);
const char *GetProcessPluginName();
const char *
GetProcessPluginName ();
void SetProcessPluginName(const char *plugin_name);
void
SetProcessPluginName (const char *plugin_name);
const char *GetShell();
const char *
GetShell ();
void SetShell(const char *path);
void
SetShell (const char * path);
bool
GetShellExpandArguments ();
void
SetShellExpandArguments (bool expand);
uint32_t
GetResumeCount ();
bool GetShellExpandArguments();
void
SetResumeCount (uint32_t c);
void SetShellExpandArguments(bool expand);
bool
AddCloseFileAction (int fd);
uint32_t GetResumeCount();
bool
AddDuplicateFileAction (int fd, int dup_fd);
void SetResumeCount(uint32_t c);
bool
AddOpenFileAction (int fd, const char *path, bool read, bool write);
bool AddCloseFileAction(int fd);
bool
AddSuppressFileAction (int fd, bool read, bool write);
bool AddDuplicateFileAction(int fd, int dup_fd);
void
SetLaunchEventData (const char *data);
bool AddOpenFileAction(int fd, const char *path, bool read, bool write);
const char *
GetLaunchEventData () const;
bool AddSuppressFileAction(int fd, bool read, bool write);
bool
GetDetachOnError() const;
void SetLaunchEventData(const char *data);
void
SetDetachOnError(bool enable);
const char *GetLaunchEventData() const;
bool GetDetachOnError() const;
void SetDetachOnError(bool enable);
protected:
friend class SBPlatform;
friend class SBTarget;
friend class SBPlatform;
friend class SBTarget;
lldb_private::ProcessLaunchInfo &
ref ();
lldb_private::ProcessLaunchInfo &ref();
const lldb_private::ProcessLaunchInfo &
ref () const;
const lldb_private::ProcessLaunchInfo &ref() const;
ProcessLaunchInfoSP m_opaque_sp;
ProcessLaunchInfoSP m_opaque_sp;
};
} // namespace lldb
#endif // LLDB_SBLaunchInfo_h_
#endif // LLDB_SBLaunchInfo_h_

View File

@ -10,90 +10,68 @@
#ifndef LLDB_SBLineEntry_h_
#define LLDB_SBLineEntry_h_
#include "lldb/API/SBDefines.h"
#include "lldb/API/SBAddress.h"
#include "lldb/API/SBDefines.h"
#include "lldb/API/SBFileSpec.h"
namespace lldb {
class LLDB_API SBLineEntry
{
class LLDB_API SBLineEntry {
public:
SBLineEntry();
SBLineEntry ();
SBLineEntry(const lldb::SBLineEntry &rhs);
SBLineEntry (const lldb::SBLineEntry &rhs);
~SBLineEntry();
~SBLineEntry ();
const lldb::SBLineEntry &operator=(const lldb::SBLineEntry &rhs);
const lldb::SBLineEntry &
operator = (const lldb::SBLineEntry &rhs);
lldb::SBAddress GetStartAddress() const;
lldb::SBAddress
GetStartAddress () const;
lldb::SBAddress GetEndAddress() const;
lldb::SBAddress
GetEndAddress () const;
bool IsValid() const;
bool
IsValid () const;
lldb::SBFileSpec GetFileSpec() const;
lldb::SBFileSpec
GetFileSpec () const;
uint32_t GetLine() const;
uint32_t
GetLine () const;
uint32_t GetColumn() const;
uint32_t
GetColumn () const;
void SetFileSpec(lldb::SBFileSpec filespec);
void
SetFileSpec (lldb::SBFileSpec filespec);
void
SetLine (uint32_t line);
void
SetColumn (uint32_t column);
void SetLine(uint32_t line);
bool
operator == (const lldb::SBLineEntry &rhs) const;
void SetColumn(uint32_t column);
bool
operator != (const lldb::SBLineEntry &rhs) const;
bool operator==(const lldb::SBLineEntry &rhs) const;
bool
GetDescription (lldb::SBStream &description);
bool operator!=(const lldb::SBLineEntry &rhs) const;
bool GetDescription(lldb::SBStream &description);
protected:
lldb_private::LineEntry *get();
lldb_private::LineEntry *
get ();
private:
friend class SBAddress;
friend class SBCompileUnit;
friend class SBFrame;
friend class SBSymbolContext;
friend class SBAddress;
friend class SBCompileUnit;
friend class SBFrame;
friend class SBSymbolContext;
const lldb_private::LineEntry *
operator->() const;
const lldb_private::LineEntry *operator->() const;
lldb_private::LineEntry &
ref();
lldb_private::LineEntry &ref();
const lldb_private::LineEntry &
ref() const;
const lldb_private::LineEntry &ref() const;
SBLineEntry (const lldb_private::LineEntry *lldb_object_ptr);
SBLineEntry(const lldb_private::LineEntry *lldb_object_ptr);
void
SetLineEntry (const lldb_private::LineEntry &lldb_object_ref);
void SetLineEntry(const lldb_private::LineEntry &lldb_object_ref);
std::unique_ptr<lldb_private::LineEntry> m_opaque_ap;
std::unique_ptr<lldb_private::LineEntry> m_opaque_ap;
};
} // namespace lldb
#endif // LLDB_SBLineEntry_h_

View File

@ -14,121 +14,94 @@
namespace lldb {
class LLDB_API SBListener
{
class LLDB_API SBListener {
public:
SBListener ();
SBListener();
SBListener (const char *name);
SBListener(const char *name);
SBListener (const SBListener &rhs);
SBListener(const SBListener &rhs);
~SBListener ();
~SBListener();
const lldb::SBListener &
operator = (const lldb::SBListener &rhs);
const lldb::SBListener &operator=(const lldb::SBListener &rhs);
void
AddEvent (const lldb::SBEvent &event);
void AddEvent(const lldb::SBEvent &event);
void
Clear ();
void Clear();
bool
IsValid () const;
bool IsValid() const;
uint32_t
StartListeningForEventClass (SBDebugger &debugger,
const char *broadcaster_class,
uint32_t event_mask);
bool
StopListeningForEventClass (SBDebugger &debugger,
const char *broadcaster_class,
uint32_t event_mask);
uint32_t
StartListeningForEvents (const lldb::SBBroadcaster& broadcaster,
uint32_t event_mask);
uint32_t StartListeningForEventClass(SBDebugger &debugger,
const char *broadcaster_class,
uint32_t event_mask);
bool
StopListeningForEvents (const lldb::SBBroadcaster& broadcaster,
uint32_t event_mask);
bool StopListeningForEventClass(SBDebugger &debugger,
const char *broadcaster_class,
uint32_t event_mask);
// Returns true if an event was received, false if we timed out.
bool
WaitForEvent (uint32_t num_seconds,
lldb::SBEvent &event);
uint32_t StartListeningForEvents(const lldb::SBBroadcaster &broadcaster,
uint32_t event_mask);
bool
WaitForEventForBroadcaster (uint32_t num_seconds,
const lldb::SBBroadcaster &broadcaster,
lldb::SBEvent &sb_event);
bool StopListeningForEvents(const lldb::SBBroadcaster &broadcaster,
uint32_t event_mask);
bool
WaitForEventForBroadcasterWithType (uint32_t num_seconds,
const lldb::SBBroadcaster &broadcaster,
// Returns true if an event was received, false if we timed out.
bool WaitForEvent(uint32_t num_seconds, lldb::SBEvent &event);
bool WaitForEventForBroadcaster(uint32_t num_seconds,
const lldb::SBBroadcaster &broadcaster,
lldb::SBEvent &sb_event);
bool WaitForEventForBroadcasterWithType(
uint32_t num_seconds, const lldb::SBBroadcaster &broadcaster,
uint32_t event_type_mask, lldb::SBEvent &sb_event);
bool PeekAtNextEvent(lldb::SBEvent &sb_event);
bool PeekAtNextEventForBroadcaster(const lldb::SBBroadcaster &broadcaster,
lldb::SBEvent &sb_event);
bool
PeekAtNextEventForBroadcasterWithType(const lldb::SBBroadcaster &broadcaster,
uint32_t event_type_mask,
lldb::SBEvent &sb_event);
bool
PeekAtNextEvent (lldb::SBEvent &sb_event);
bool GetNextEvent(lldb::SBEvent &sb_event);
bool
PeekAtNextEventForBroadcaster (const lldb::SBBroadcaster &broadcaster,
lldb::SBEvent &sb_event);
bool GetNextEventForBroadcaster(const lldb::SBBroadcaster &broadcaster,
lldb::SBEvent &sb_event);
bool
PeekAtNextEventForBroadcasterWithType (const lldb::SBBroadcaster &broadcaster,
uint32_t event_type_mask,
lldb::SBEvent &sb_event);
bool
GetNextEventForBroadcasterWithType(const lldb::SBBroadcaster &broadcaster,
uint32_t event_type_mask,
lldb::SBEvent &sb_event);
bool
GetNextEvent (lldb::SBEvent &sb_event);
bool
GetNextEventForBroadcaster (const lldb::SBBroadcaster &broadcaster,
lldb::SBEvent &sb_event);
bool
GetNextEventForBroadcasterWithType (const lldb::SBBroadcaster &broadcaster,
uint32_t event_type_mask,
lldb::SBEvent &sb_event);
bool
HandleBroadcastEvent (const lldb::SBEvent &event);
bool HandleBroadcastEvent(const lldb::SBEvent &event);
protected:
friend class SBAttachInfo;
friend class SBBroadcaster;
friend class SBCommandInterpreter;
friend class SBDebugger;
friend class SBLaunchInfo;
friend class SBTarget;
friend class SBAttachInfo;
friend class SBBroadcaster;
friend class SBCommandInterpreter;
friend class SBDebugger;
friend class SBLaunchInfo;
friend class SBTarget;
SBListener (const lldb::ListenerSP &listener_sp);
SBListener(const lldb::ListenerSP &listener_sp);
lldb::ListenerSP
GetSP ()
{
return m_opaque_sp;
}
lldb::ListenerSP GetSP() { return m_opaque_sp; }
private:
lldb_private::Listener *operator->() const;
lldb_private::Listener *
operator->() const;
lldb_private::Listener *get() const;
lldb_private::Listener *
get() const;
void reset(lldb::ListenerSP listener_sp);
void
reset(lldb::ListenerSP listener_sp);
lldb::ListenerSP m_opaque_sp;
lldb_private::Listener *m_unused_ptr;
lldb::ListenerSP m_opaque_sp;
lldb_private::Listener *m_unused_ptr;
};
} // namespace lldb
#endif // LLDB_SBListener_h_
#endif // LLDB_SBListener_h_

View File

@ -10,108 +10,103 @@
#ifndef LLDB_SBMemoryRegionInfo_h_
#define LLDB_SBMemoryRegionInfo_h_
#include "lldb/API/SBDefines.h"
#include "lldb/API/SBData.h"
#include "lldb/API/SBDefines.h"
namespace lldb {
class LLDB_API SBMemoryRegionInfo
{
class LLDB_API SBMemoryRegionInfo {
public:
SBMemoryRegionInfo();
SBMemoryRegionInfo ();
SBMemoryRegionInfo(const lldb::SBMemoryRegionInfo &rhs);
SBMemoryRegionInfo (const lldb::SBMemoryRegionInfo &rhs);
~SBMemoryRegionInfo();
~SBMemoryRegionInfo ();
const lldb::SBMemoryRegionInfo &
operator=(const lldb::SBMemoryRegionInfo &rhs);
const lldb::SBMemoryRegionInfo &
operator = (const lldb::SBMemoryRegionInfo &rhs);
void Clear();
void
Clear();
//------------------------------------------------------------------
/// Get the base address of this memory range.
///
/// @return
/// The base address of this memory range.
//------------------------------------------------------------------
lldb::addr_t GetRegionBase();
//------------------------------------------------------------------
/// Get the base address of this memory range.
///
/// @return
/// The base address of this memory range.
//------------------------------------------------------------------
lldb::addr_t
GetRegionBase ();
//------------------------------------------------------------------
/// Get the end address of this memory range.
///
/// @return
/// The base address of this memory range.
//------------------------------------------------------------------
lldb::addr_t GetRegionEnd();
//------------------------------------------------------------------
/// Get the end address of this memory range.
///
/// @return
/// The base address of this memory range.
//------------------------------------------------------------------
lldb::addr_t
GetRegionEnd ();
//------------------------------------------------------------------
/// Check if this memory address is marked readable to the process.
///
/// @return
/// true if this memory address is marked readable
//------------------------------------------------------------------
bool IsReadable();
//------------------------------------------------------------------
/// Check if this memory address is marked readable to the process.
///
/// @return
/// true if this memory address is marked readable
//------------------------------------------------------------------
bool
IsReadable ();
//------------------------------------------------------------------
/// Check if this memory address is marked writable to the process.
///
/// @return
/// true if this memory address is marked writable
//------------------------------------------------------------------
bool IsWritable();
//------------------------------------------------------------------
/// Check if this memory address is marked writable to the process.
///
/// @return
/// true if this memory address is marked writable
//------------------------------------------------------------------
bool
IsWritable ();
//------------------------------------------------------------------
/// Check if this memory address is marked executable to the process.
///
/// @return
/// true if this memory address is marked executable
//------------------------------------------------------------------
bool IsExecutable();
//------------------------------------------------------------------
/// Check if this memory address is marked executable to the process.
///
/// @return
/// true if this memory address is marked executable
//------------------------------------------------------------------
bool
IsExecutable ();
//------------------------------------------------------------------
/// Check if this memory address is mapped into the process address
/// space.
///
/// @return
/// true if this memory address is in the process address space.
//------------------------------------------------------------------
bool IsMapped();
//------------------------------------------------------------------
/// Check if this memory address is mapped into the process address
/// space.
///
/// @return
/// true if this memory address is in the process address space.
//------------------------------------------------------------------
bool
IsMapped ();
//------------------------------------------------------------------
/// Returns the name of the memory region mapped at the given
/// address.
///
/// @return
/// In case of memory mapped files it is the absolute path of
/// the file otherwise it is a name associated with the memory
/// region. If no name can be determined the returns nullptr.
//------------------------------------------------------------------
const char *GetName();
bool
operator == (const lldb::SBMemoryRegionInfo &rhs) const;
bool operator==(const lldb::SBMemoryRegionInfo &rhs) const;
bool
operator != (const lldb::SBMemoryRegionInfo &rhs) const;
bool operator!=(const lldb::SBMemoryRegionInfo &rhs) const;
bool
GetDescription (lldb::SBStream &description);
bool GetDescription(lldb::SBStream &description);
private:
friend class SBProcess;
friend class SBMemoryRegionInfoList;
friend class SBProcess;
friend class SBMemoryRegionInfoList;
lldb_private::MemoryRegionInfo &ref();
lldb_private::MemoryRegionInfo &
ref();
const lldb_private::MemoryRegionInfo &ref() const;
const lldb_private::MemoryRegionInfo &
ref() const;
SBMemoryRegionInfo(const lldb_private::MemoryRegionInfo *lldb_object_ptr);
SBMemoryRegionInfo (const lldb_private::MemoryRegionInfo *lldb_object_ptr);
lldb::MemoryRegionInfoUP m_opaque_ap;
lldb::MemoryRegionInfoUP m_opaque_ap;
};
} // namespace lldb
#endif // LLDB_SBMemoryRegionInfo_h_

View File

@ -16,46 +16,33 @@ class MemoryRegionInfoListImpl;
namespace lldb {
class LLDB_API SBMemoryRegionInfoList
{
class LLDB_API SBMemoryRegionInfoList {
public:
SBMemoryRegionInfoList();
SBMemoryRegionInfoList ();
SBMemoryRegionInfoList(const lldb::SBMemoryRegionInfoList &rhs);
SBMemoryRegionInfoList (const lldb::SBMemoryRegionInfoList &rhs);
const SBMemoryRegionInfoList &operator=(const SBMemoryRegionInfoList &rhs);
const SBMemoryRegionInfoList &
operator = (const SBMemoryRegionInfoList &rhs);
~SBMemoryRegionInfoList();
~SBMemoryRegionInfoList ();
uint32_t GetSize() const;
uint32_t
GetSize () const;
bool GetMemoryRegionAtIndex(uint32_t idx, SBMemoryRegionInfo &region_info);
bool
GetMemoryRegionAtIndex (uint32_t idx, SBMemoryRegionInfo &region_info);
void Append(lldb::SBMemoryRegionInfo &region);
void
Append (lldb::SBMemoryRegionInfo &region);
void Append(lldb::SBMemoryRegionInfoList &region_list);
void
Append (lldb::SBMemoryRegionInfoList &region_list);
void
Clear ();
void Clear();
protected:
const MemoryRegionInfoListImpl *operator->() const;
const MemoryRegionInfoListImpl *
operator->() const;
const MemoryRegionInfoListImpl &
operator*() const;
const MemoryRegionInfoListImpl &operator*() const;
private:
std::unique_ptr<MemoryRegionInfoListImpl> m_opaque_ap;
std::unique_ptr<MemoryRegionInfoListImpl> m_opaque_ap;
};
} // namespace lldb

View File

@ -18,342 +18,299 @@
namespace lldb {
class LLDB_API SBModule
{
class LLDB_API SBModule {
public:
SBModule();
SBModule ();
SBModule(const SBModule &rhs);
SBModule (const SBModule &rhs);
SBModule(const SBModuleSpec &module_spec);
SBModule (const SBModuleSpec &module_spec);
const SBModule &operator=(const SBModule &rhs);
const SBModule &
operator = (const SBModule &rhs);
SBModule(lldb::SBProcess &process, lldb::addr_t header_addr);
SBModule (lldb::SBProcess &process,
lldb::addr_t header_addr);
~SBModule();
~SBModule ();
bool IsValid() const;
bool
IsValid () const;
void Clear();
void
Clear();
//------------------------------------------------------------------
/// Get const accessor for the module file specification.
///
/// This function returns the file for the module on the host system
/// that is running LLDB. This can differ from the path on the
/// platform since we might be doing remote debugging.
///
/// @return
/// A const reference to the file specification object.
//------------------------------------------------------------------
lldb::SBFileSpec GetFileSpec() const;
//------------------------------------------------------------------
/// Get const accessor for the module file specification.
///
/// This function returns the file for the module on the host system
/// that is running LLDB. This can differ from the path on the
/// platform since we might be doing remote debugging.
///
/// @return
/// A const reference to the file specification object.
//------------------------------------------------------------------
lldb::SBFileSpec
GetFileSpec () const;
//------------------------------------------------------------------
/// Get accessor for the module platform file specification.
///
/// Platform file refers to the path of the module as it is known on
/// the remote system on which it is being debugged. For local
/// debugging this is always the same as Module::GetFileSpec(). But
/// remote debugging might mention a file '/usr/lib/liba.dylib'
/// which might be locally downloaded and cached. In this case the
/// platform file could be something like:
/// '/tmp/lldb/platform-cache/remote.host.computer/usr/lib/liba.dylib'
/// The file could also be cached in a local developer kit directory.
///
/// @return
/// A const reference to the file specification object.
//------------------------------------------------------------------
lldb::SBFileSpec GetPlatformFileSpec() const;
//------------------------------------------------------------------
/// Get accessor for the module platform file specification.
///
/// Platform file refers to the path of the module as it is known on
/// the remote system on which it is being debugged. For local
/// debugging this is always the same as Module::GetFileSpec(). But
/// remote debugging might mention a file '/usr/lib/liba.dylib'
/// which might be locally downloaded and cached. In this case the
/// platform file could be something like:
/// '/tmp/lldb/platform-cache/remote.host.computer/usr/lib/liba.dylib'
/// The file could also be cached in a local developer kit directory.
///
/// @return
/// A const reference to the file specification object.
//------------------------------------------------------------------
lldb::SBFileSpec
GetPlatformFileSpec () const;
bool SetPlatformFileSpec(const lldb::SBFileSpec &platform_file);
bool
SetPlatformFileSpec (const lldb::SBFileSpec &platform_file);
//------------------------------------------------------------------
/// Get accessor for the remote install path for a module.
///
/// When debugging to a remote platform by connecting to a remote
/// platform, the install path of the module can be set. If the
/// install path is set, every time the process is about to launch
/// the target will install this module on the remote platform prior
/// to launching.
///
/// @return
/// A file specification object.
//------------------------------------------------------------------
lldb::SBFileSpec GetRemoteInstallFileSpec();
//------------------------------------------------------------------
/// Get accessor for the remote install path for a module.
///
/// When debugging to a remote platform by connecting to a remote
/// platform, the install path of the module can be set. If the
/// install path is set, every time the process is about to launch
/// the target will install this module on the remote platform prior
/// to launching.
///
/// @return
/// A file specification object.
//------------------------------------------------------------------
lldb::SBFileSpec
GetRemoteInstallFileSpec ();
//------------------------------------------------------------------
/// Set accessor for the remote install path for a module.
///
/// When debugging to a remote platform by connecting to a remote
/// platform, the install path of the module can be set. If the
/// install path is set, every time the process is about to launch
/// the target will install this module on the remote platform prior
/// to launching.
///
/// If \a file specifies a full path to an install location, the
/// module will be installed to this path. If the path is relative
/// (no directory specified, or the path is partial like "usr/lib"
/// or "./usr/lib", then the install path will be resolved using
/// the platform's current working directory as the base path.
///
/// @param[in] file
/// A file specification object.
//------------------------------------------------------------------
bool
SetRemoteInstallFileSpec (lldb::SBFileSpec &file);
lldb::ByteOrder
GetByteOrder ();
uint32_t
GetAddressByteSize();
const char *
GetTriple ();
//------------------------------------------------------------------
/// Set accessor for the remote install path for a module.
///
/// When debugging to a remote platform by connecting to a remote
/// platform, the install path of the module can be set. If the
/// install path is set, every time the process is about to launch
/// the target will install this module on the remote platform prior
/// to launching.
///
/// If \a file specifies a full path to an install location, the
/// module will be installed to this path. If the path is relative
/// (no directory specified, or the path is partial like "usr/lib"
/// or "./usr/lib", then the install path will be resolved using
/// the platform's current working directory as the base path.
///
/// @param[in] file
/// A file specification object.
//------------------------------------------------------------------
bool SetRemoteInstallFileSpec(lldb::SBFileSpec &file);
const uint8_t *
GetUUIDBytes () const;
lldb::ByteOrder GetByteOrder();
const char *
GetUUIDString () const;
uint32_t GetAddressByteSize();
bool
operator == (const lldb::SBModule &rhs) const;
const char *GetTriple();
bool
operator != (const lldb::SBModule &rhs) const;
const uint8_t *GetUUIDBytes() const;
lldb::SBSection
FindSection (const char *sect_name);
const char *GetUUIDString() const;
lldb::SBAddress
ResolveFileAddress (lldb::addr_t vm_addr);
bool operator==(const lldb::SBModule &rhs) const;
lldb::SBSymbolContext
ResolveSymbolContextForAddress (const lldb::SBAddress& addr,
uint32_t resolve_scope);
bool operator!=(const lldb::SBModule &rhs) const;
bool
GetDescription (lldb::SBStream &description);
lldb::SBSection FindSection(const char *sect_name);
uint32_t
GetNumCompileUnits();
lldb::SBAddress ResolveFileAddress(lldb::addr_t vm_addr);
lldb::SBCompileUnit
GetCompileUnitAtIndex (uint32_t);
lldb::SBSymbolContext
ResolveSymbolContextForAddress(const lldb::SBAddress &addr,
uint32_t resolve_scope);
size_t
GetNumSymbols ();
lldb::SBSymbol
GetSymbolAtIndex (size_t idx);
bool GetDescription(lldb::SBStream &description);
lldb::SBSymbol
FindSymbol (const char *name,
lldb::SymbolType type = eSymbolTypeAny);
uint32_t GetNumCompileUnits();
lldb::SBSymbolContextList
FindSymbols (const char *name,
lldb::SymbolType type = eSymbolTypeAny);
lldb::SBCompileUnit GetCompileUnitAtIndex(uint32_t);
size_t
GetNumSections ();
lldb::SBSection
GetSectionAtIndex (size_t idx);
//------------------------------------------------------------------
/// Find functions by name.
///
/// @param[in] name
/// The name of the function we are looking for.
///
/// @param[in] name_type_mask
/// A logical OR of one or more FunctionNameType enum bits that
/// indicate what kind of names should be used when doing the
/// lookup. Bits include fully qualified names, base names,
/// C++ methods, or ObjC selectors.
/// See FunctionNameType for more details.
///
/// @return
/// A lldb::SBSymbolContextList that gets filled in with all of
/// the symbol contexts for all the matches.
//------------------------------------------------------------------
lldb::SBSymbolContextList
FindFunctions (const char *name,
uint32_t name_type_mask = lldb::eFunctionNameTypeAny);
size_t GetNumSymbols();
//------------------------------------------------------------------
/// Find global and static variables by name.
///
/// @param[in] target
/// A valid SBTarget instance representing the debuggee.
///
/// @param[in] name
/// The name of the global or static variable we are looking
/// for.
///
/// @param[in] max_matches
/// Allow the number of matches to be limited to \a max_matches.
///
/// @return
/// A list of matched variables in an SBValueList.
//------------------------------------------------------------------
lldb::SBValueList
FindGlobalVariables (lldb::SBTarget &target,
const char *name,
uint32_t max_matches);
//------------------------------------------------------------------
/// Find the first global (or static) variable by name.
///
/// @param[in] target
/// A valid SBTarget instance representing the debuggee.
///
/// @param[in] name
/// The name of the global or static variable we are looking
/// for.
///
/// @return
/// An SBValue that gets filled in with the found variable (if any).
//------------------------------------------------------------------
lldb::SBValue
FindFirstGlobalVariable (lldb::SBTarget &target, const char *name);
lldb::SBType
FindFirstType (const char* name);
lldb::SBTypeList
FindTypes (const char* type);
//------------------------------------------------------------------
/// Get a type using its type ID.
///
/// Each symbol file reader will assign different user IDs to their
/// types, but it is sometimes useful when debugging type issues to
/// be able to grab a type using its type ID.
///
/// For DWARF debug info, the type ID is the DIE offset.
///
/// @param[in] uid
/// The type user ID.
///
/// @return
/// An SBType for the given type ID, or an empty SBType if the
/// type was not found.
//------------------------------------------------------------------
lldb::SBType
GetTypeByID (lldb::user_id_t uid);
lldb::SBSymbol GetSymbolAtIndex(size_t idx);
lldb::SBType
GetBasicType(lldb::BasicType type);
lldb::SBSymbol FindSymbol(const char *name,
lldb::SymbolType type = eSymbolTypeAny);
//------------------------------------------------------------------
/// Get all types matching \a type_mask from debug info in this
/// module.
///
/// @param[in] type_mask
/// A bitfield that consists of one or more bits logically OR'ed
/// together from the lldb::TypeClass enumeration. This allows
/// you to request only structure types, or only class, struct
/// and union types. Passing in lldb::eTypeClassAny will return
/// all types found in the debug information for this module.
///
/// @return
/// A list of types in this module that match \a type_mask
//------------------------------------------------------------------
lldb::SBTypeList
GetTypes (uint32_t type_mask = lldb::eTypeClassAny);
lldb::SBSymbolContextList FindSymbols(const char *name,
lldb::SymbolType type = eSymbolTypeAny);
//------------------------------------------------------------------
/// Get the module version numbers.
///
/// Many object files have a set of version numbers that describe
/// the version of the executable or shared library. Typically there
/// are major, minor and build, but there may be more. This function
/// will extract the versions from object files if they are available.
///
/// If \a versions is NULL, or if \a num_versions is 0, the return
/// value will indicate how many version numbers are available in
/// this object file. Then a subsequent call can be made to this
/// function with a value of \a versions and \a num_versions that
/// has enough storage to store some or all version numbers.
///
/// @param[out] versions
/// A pointer to an array of uint32_t types that is \a num_versions
/// long. If this value is NULL, the return value will indicate
/// how many version numbers are required for a subsequent call
/// to this function so that all versions can be retrieved. If
/// the value is non-NULL, then at most \a num_versions of the
/// existing versions numbers will be filled into \a versions.
/// If there is no version information available, \a versions
/// will be filled with \a num_versions UINT32_MAX values
/// and zero will be returned.
///
/// @param[in] num_versions
/// The maximum number of entries to fill into \a versions. If
/// this value is zero, then the return value will indicate
/// how many version numbers there are in total so another call
/// to this function can be make with adequate storage in
/// \a versions to get all of the version numbers. If \a
/// num_versions is less than the actual number of version
/// numbers in this object file, only \a num_versions will be
/// filled into \a versions (if \a versions is non-NULL).
///
/// @return
/// This function always returns the number of version numbers
/// that this object file has regardless of the number of
/// version numbers that were copied into \a versions.
//------------------------------------------------------------------
uint32_t
GetVersion (uint32_t *versions,
uint32_t num_versions);
size_t GetNumSections();
//------------------------------------------------------------------
/// Get accessor for the symbol file specification.
///
/// When debugging an object file an additional debug information can
/// be provided in separate file. Therefore if you debugging something
/// like '/usr/lib/liba.dylib' then debug information can be located
/// in folder like '/usr/lib/liba.dylib.dSYM/'.
///
/// @return
/// A const reference to the file specification object.
//------------------------------------------------------------------
lldb::SBFileSpec
GetSymbolFileSpec() const;
lldb::SBSection GetSectionAtIndex(size_t idx);
//------------------------------------------------------------------
/// Find functions by name.
///
/// @param[in] name
/// The name of the function we are looking for.
///
/// @param[in] name_type_mask
/// A logical OR of one or more FunctionNameType enum bits that
/// indicate what kind of names should be used when doing the
/// lookup. Bits include fully qualified names, base names,
/// C++ methods, or ObjC selectors.
/// See FunctionNameType for more details.
///
/// @return
/// A lldb::SBSymbolContextList that gets filled in with all of
/// the symbol contexts for all the matches.
//------------------------------------------------------------------
lldb::SBSymbolContextList
FindFunctions(const char *name,
uint32_t name_type_mask = lldb::eFunctionNameTypeAny);
lldb::SBAddress
GetObjectFileHeaderAddress() const;
//------------------------------------------------------------------
/// Find global and static variables by name.
///
/// @param[in] target
/// A valid SBTarget instance representing the debuggee.
///
/// @param[in] name
/// The name of the global or static variable we are looking
/// for.
///
/// @param[in] max_matches
/// Allow the number of matches to be limited to \a max_matches.
///
/// @return
/// A list of matched variables in an SBValueList.
//------------------------------------------------------------------
lldb::SBValueList FindGlobalVariables(lldb::SBTarget &target,
const char *name, uint32_t max_matches);
//------------------------------------------------------------------
/// Find the first global (or static) variable by name.
///
/// @param[in] target
/// A valid SBTarget instance representing the debuggee.
///
/// @param[in] name
/// The name of the global or static variable we are looking
/// for.
///
/// @return
/// An SBValue that gets filled in with the found variable (if any).
//------------------------------------------------------------------
lldb::SBValue FindFirstGlobalVariable(lldb::SBTarget &target,
const char *name);
lldb::SBType FindFirstType(const char *name);
lldb::SBTypeList FindTypes(const char *type);
//------------------------------------------------------------------
/// Get a type using its type ID.
///
/// Each symbol file reader will assign different user IDs to their
/// types, but it is sometimes useful when debugging type issues to
/// be able to grab a type using its type ID.
///
/// For DWARF debug info, the type ID is the DIE offset.
///
/// @param[in] uid
/// The type user ID.
///
/// @return
/// An SBType for the given type ID, or an empty SBType if the
/// type was not found.
//------------------------------------------------------------------
lldb::SBType GetTypeByID(lldb::user_id_t uid);
lldb::SBType GetBasicType(lldb::BasicType type);
//------------------------------------------------------------------
/// Get all types matching \a type_mask from debug info in this
/// module.
///
/// @param[in] type_mask
/// A bitfield that consists of one or more bits logically OR'ed
/// together from the lldb::TypeClass enumeration. This allows
/// you to request only structure types, or only class, struct
/// and union types. Passing in lldb::eTypeClassAny will return
/// all types found in the debug information for this module.
///
/// @return
/// A list of types in this module that match \a type_mask
//------------------------------------------------------------------
lldb::SBTypeList GetTypes(uint32_t type_mask = lldb::eTypeClassAny);
//------------------------------------------------------------------
/// Get the module version numbers.
///
/// Many object files have a set of version numbers that describe
/// the version of the executable or shared library. Typically there
/// are major, minor and build, but there may be more. This function
/// will extract the versions from object files if they are available.
///
/// If \a versions is NULL, or if \a num_versions is 0, the return
/// value will indicate how many version numbers are available in
/// this object file. Then a subsequent call can be made to this
/// function with a value of \a versions and \a num_versions that
/// has enough storage to store some or all version numbers.
///
/// @param[out] versions
/// A pointer to an array of uint32_t types that is \a num_versions
/// long. If this value is NULL, the return value will indicate
/// how many version numbers are required for a subsequent call
/// to this function so that all versions can be retrieved. If
/// the value is non-NULL, then at most \a num_versions of the
/// existing versions numbers will be filled into \a versions.
/// If there is no version information available, \a versions
/// will be filled with \a num_versions UINT32_MAX values
/// and zero will be returned.
///
/// @param[in] num_versions
/// The maximum number of entries to fill into \a versions. If
/// this value is zero, then the return value will indicate
/// how many version numbers there are in total so another call
/// to this function can be make with adequate storage in
/// \a versions to get all of the version numbers. If \a
/// num_versions is less than the actual number of version
/// numbers in this object file, only \a num_versions will be
/// filled into \a versions (if \a versions is non-NULL).
///
/// @return
/// This function always returns the number of version numbers
/// that this object file has regardless of the number of
/// version numbers that were copied into \a versions.
//------------------------------------------------------------------
uint32_t GetVersion(uint32_t *versions, uint32_t num_versions);
//------------------------------------------------------------------
/// Get accessor for the symbol file specification.
///
/// When debugging an object file an additional debug information can
/// be provided in separate file. Therefore if you debugging something
/// like '/usr/lib/liba.dylib' then debug information can be located
/// in folder like '/usr/lib/liba.dylib.dSYM/'.
///
/// @return
/// A const reference to the file specification object.
//------------------------------------------------------------------
lldb::SBFileSpec GetSymbolFileSpec() const;
lldb::SBAddress GetObjectFileHeaderAddress() const;
private:
friend class SBAddress;
friend class SBFrame;
friend class SBSection;
friend class SBSymbolContext;
friend class SBTarget;
friend class SBAddress;
friend class SBFrame;
friend class SBSection;
friend class SBSymbolContext;
friend class SBTarget;
explicit SBModule (const lldb::ModuleSP& module_sp);
explicit SBModule(const lldb::ModuleSP &module_sp);
ModuleSP
GetSP () const;
void
SetSP (const ModuleSP &module_sp);
ModuleSP GetSP() const;
lldb::ModuleSP m_opaque_sp;
void SetSP(const ModuleSP &module_sp);
lldb::ModuleSP m_opaque_sp;
};
} // namespace lldb
#endif // LLDB_SBModule_h_

View File

@ -15,138 +15,109 @@
namespace lldb {
class LLDB_API SBModuleSpec
{
class LLDB_API SBModuleSpec {
public:
SBModuleSpec();
SBModuleSpec ();
SBModuleSpec(const SBModuleSpec &rhs);
SBModuleSpec (const SBModuleSpec &rhs);
~SBModuleSpec();
~SBModuleSpec ();
const SBModuleSpec &operator=(const SBModuleSpec &rhs);
const SBModuleSpec &
operator = (const SBModuleSpec &rhs);
bool IsValid() const;
bool
IsValid () const;
void Clear();
void
Clear();
//------------------------------------------------------------------
/// Get const accessor for the module file.
///
/// This function returns the file for the module on the host system
/// that is running LLDB. This can differ from the path on the
/// platform since we might be doing remote debugging.
///
/// @return
/// A const reference to the file specification object.
//------------------------------------------------------------------
lldb::SBFileSpec GetFileSpec();
//------------------------------------------------------------------
/// Get const accessor for the module file.
///
/// This function returns the file for the module on the host system
/// that is running LLDB. This can differ from the path on the
/// platform since we might be doing remote debugging.
///
/// @return
/// A const reference to the file specification object.
//------------------------------------------------------------------
lldb::SBFileSpec
GetFileSpec ();
void SetFileSpec(const lldb::SBFileSpec &fspec);
void
SetFileSpec (const lldb::SBFileSpec &fspec);
//------------------------------------------------------------------
/// Get accessor for the module platform file.
///
/// Platform file refers to the path of the module as it is known on
/// the remote system on which it is being debugged. For local
/// debugging this is always the same as Module::GetFileSpec(). But
/// remote debugging might mention a file '/usr/lib/liba.dylib'
/// which might be locally downloaded and cached. In this case the
/// platform file could be something like:
/// '/tmp/lldb/platform-cache/remote.host.computer/usr/lib/liba.dylib'
/// The file could also be cached in a local developer kit directory.
///
/// @return
/// A const reference to the file specification object.
//------------------------------------------------------------------
lldb::SBFileSpec GetPlatformFileSpec();
//------------------------------------------------------------------
/// Get accessor for the module platform file.
///
/// Platform file refers to the path of the module as it is known on
/// the remote system on which it is being debugged. For local
/// debugging this is always the same as Module::GetFileSpec(). But
/// remote debugging might mention a file '/usr/lib/liba.dylib'
/// which might be locally downloaded and cached. In this case the
/// platform file could be something like:
/// '/tmp/lldb/platform-cache/remote.host.computer/usr/lib/liba.dylib'
/// The file could also be cached in a local developer kit directory.
///
/// @return
/// A const reference to the file specification object.
//------------------------------------------------------------------
lldb::SBFileSpec
GetPlatformFileSpec ();
void SetPlatformFileSpec(const lldb::SBFileSpec &fspec);
void
SetPlatformFileSpec (const lldb::SBFileSpec &fspec);
lldb::SBFileSpec GetSymbolFileSpec();
lldb::SBFileSpec
GetSymbolFileSpec ();
void
SetSymbolFileSpec (const lldb::SBFileSpec &fspec);
void SetSymbolFileSpec(const lldb::SBFileSpec &fspec);
const char *
GetObjectName ();
void
SetObjectName (const char *name);
const char *GetObjectName();
const char *
GetTriple ();
void SetObjectName(const char *name);
void
SetTriple (const char *triple);
const char *GetTriple();
const uint8_t *
GetUUIDBytes ();
void SetTriple(const char *triple);
size_t
GetUUIDLength ();
const uint8_t *GetUUIDBytes();
bool
SetUUIDBytes (const uint8_t *uuid, size_t uuid_len);
size_t GetUUIDLength();
bool SetUUIDBytes(const uint8_t *uuid, size_t uuid_len);
bool GetDescription(lldb::SBStream &description);
bool
GetDescription (lldb::SBStream &description);
private:
friend class SBModuleSpecList;
friend class SBModule;
friend class SBTarget;
friend class SBModuleSpecList;
friend class SBModule;
friend class SBTarget;
std::unique_ptr<lldb_private::ModuleSpec> m_opaque_ap;
std::unique_ptr<lldb_private::ModuleSpec> m_opaque_ap;
};
class SBModuleSpecList
{
class SBModuleSpecList {
public:
SBModuleSpecList();
SBModuleSpecList();
SBModuleSpecList (const SBModuleSpecList &rhs);
SBModuleSpecList(const SBModuleSpecList &rhs);
~SBModuleSpecList();
~SBModuleSpecList();
SBModuleSpecList &
operator = (const SBModuleSpecList &rhs);
static SBModuleSpecList
GetModuleSpecifications (const char *path);
void
Append (const SBModuleSpec &spec);
void
Append (const SBModuleSpecList &spec_list);
SBModuleSpecList &operator=(const SBModuleSpecList &rhs);
SBModuleSpec
FindFirstMatchingSpec (const SBModuleSpec &match_spec);
static SBModuleSpecList GetModuleSpecifications(const char *path);
SBModuleSpecList
FindMatchingSpecs (const SBModuleSpec &match_spec);
void Append(const SBModuleSpec &spec);
size_t
GetSize();
SBModuleSpec
GetSpecAtIndex (size_t i);
void Append(const SBModuleSpecList &spec_list);
SBModuleSpec FindFirstMatchingSpec(const SBModuleSpec &match_spec);
SBModuleSpecList FindMatchingSpecs(const SBModuleSpec &match_spec);
size_t GetSize();
SBModuleSpec GetSpecAtIndex(size_t i);
bool GetDescription(lldb::SBStream &description);
bool
GetDescription (lldb::SBStream &description);
private:
std::unique_ptr<lldb_private::ModuleSpecList> m_opaque_ap;
std::unique_ptr<lldb_private::ModuleSpecList> m_opaque_ap;
};
} // namespace lldb

View File

@ -19,195 +19,147 @@ struct PlatformShellCommand;
namespace lldb {
class SBLaunchInfo;
class SBLaunchInfo;
class LLDB_API SBPlatformConnectOptions
{
public:
SBPlatformConnectOptions (const char *url);
class LLDB_API SBPlatformConnectOptions {
public:
SBPlatformConnectOptions(const char *url);
SBPlatformConnectOptions (const SBPlatformConnectOptions &rhs);
SBPlatformConnectOptions(const SBPlatformConnectOptions &rhs);
~SBPlatformConnectOptions ();
void
operator=(const SBPlatformConnectOptions &rhs);
~SBPlatformConnectOptions();
const char *
GetURL();
void
SetURL(const char *url);
bool
GetRsyncEnabled();
void
EnableRsync (const char *options,
const char *remote_path_prefix,
bool omit_remote_hostname);
void
DisableRsync ();
const char *
GetLocalCacheDirectory();
void operator=(const SBPlatformConnectOptions &rhs);
void
SetLocalCacheDirectory(const char *path);
protected:
PlatformConnectOptions *m_opaque_ptr;
};
const char *GetURL();
class LLDB_API SBPlatformShellCommand
{
public:
SBPlatformShellCommand (const char *shell_command);
SBPlatformShellCommand (const SBPlatformShellCommand &rhs);
~SBPlatformShellCommand();
void
Clear();
void SetURL(const char *url);
const char *
GetCommand();
bool GetRsyncEnabled();
void
SetCommand(const char *shell_command);
const char *
GetWorkingDirectory ();
void EnableRsync(const char *options, const char *remote_path_prefix,
bool omit_remote_hostname);
void
SetWorkingDirectory (const char *path);
void DisableRsync();
uint32_t
GetTimeoutSeconds ();
void
SetTimeoutSeconds (uint32_t sec);
int
GetSignal ();
int
GetStatus ();
const char *
GetOutput ();
const char *GetLocalCacheDirectory();
protected:
friend class SBPlatform;
void SetLocalCacheDirectory(const char *path);
PlatformShellCommand *m_opaque_ptr;
};
protected:
PlatformConnectOptions *m_opaque_ptr;
};
class LLDB_API SBPlatform
{
public:
SBPlatform ();
SBPlatform (const char *platform_name);
~SBPlatform();
bool
IsValid () const;
void
Clear ();
class LLDB_API SBPlatformShellCommand {
public:
SBPlatformShellCommand(const char *shell_command);
const char *
GetWorkingDirectory();
SBPlatformShellCommand(const SBPlatformShellCommand &rhs);
bool
SetWorkingDirectory(const char *path);
~SBPlatformShellCommand();
const char *
GetName ();
void Clear();
SBError
ConnectRemote (SBPlatformConnectOptions &connect_options);
const char *GetCommand();
void
DisconnectRemote ();
bool
IsConnected();
void SetCommand(const char *shell_command);
//----------------------------------------------------------------------
// The following functions will work if the platform is connected
//----------------------------------------------------------------------
const char *
GetTriple();
const char *GetWorkingDirectory();
const char *
GetHostname ();
const char *
GetOSBuild ();
const char *
GetOSDescription ();
void SetWorkingDirectory(const char *path);
uint32_t
GetOSMajorVersion ();
uint32_t GetTimeoutSeconds();
uint32_t
GetOSMinorVersion ();
void SetTimeoutSeconds(uint32_t sec);
uint32_t
GetOSUpdateVersion ();
int GetSignal();
SBError
Put (SBFileSpec &src, SBFileSpec &dst);
SBError
Get (SBFileSpec &src, SBFileSpec &dst);
int GetStatus();
SBError
Install (SBFileSpec& src, SBFileSpec& dst);
const char *GetOutput();
SBError
Run (SBPlatformShellCommand &shell_command);
protected:
friend class SBPlatform;
SBError
Launch (SBLaunchInfo &launch_info);
PlatformShellCommand *m_opaque_ptr;
};
SBError
Kill (const lldb::pid_t pid);
class LLDB_API SBPlatform {
public:
SBPlatform();
SBError
MakeDirectory (const char *path, uint32_t file_permissions = eFilePermissionsDirectoryDefault);
SBPlatform(const char *platform_name);
uint32_t
GetFilePermissions (const char *path);
SBError
SetFilePermissions (const char *path, uint32_t file_permissions);
~SBPlatform();
SBUnixSignals
GetUnixSignals() const;
bool IsValid() const;
protected:
friend class SBDebugger;
friend class SBTarget;
void Clear();
lldb::PlatformSP
GetSP () const;
void
SetSP (const lldb::PlatformSP& platform_sp);
const char *GetWorkingDirectory();
SBError
ExecuteConnected (const std::function<lldb_private::Error(const lldb::PlatformSP&)>& func);
bool SetWorkingDirectory(const char *path);
lldb::PlatformSP m_opaque_sp;
};
const char *GetName();
SBError ConnectRemote(SBPlatformConnectOptions &connect_options);
void DisconnectRemote();
bool IsConnected();
//----------------------------------------------------------------------
// The following functions will work if the platform is connected
//----------------------------------------------------------------------
const char *GetTriple();
const char *GetHostname();
const char *GetOSBuild();
const char *GetOSDescription();
uint32_t GetOSMajorVersion();
uint32_t GetOSMinorVersion();
uint32_t GetOSUpdateVersion();
SBError Put(SBFileSpec &src, SBFileSpec &dst);
SBError Get(SBFileSpec &src, SBFileSpec &dst);
SBError Install(SBFileSpec &src, SBFileSpec &dst);
SBError Run(SBPlatformShellCommand &shell_command);
SBError Launch(SBLaunchInfo &launch_info);
SBError Kill(const lldb::pid_t pid);
SBError
MakeDirectory(const char *path,
uint32_t file_permissions = eFilePermissionsDirectoryDefault);
uint32_t GetFilePermissions(const char *path);
SBError SetFilePermissions(const char *path, uint32_t file_permissions);
SBUnixSignals GetUnixSignals() const;
protected:
friend class SBDebugger;
friend class SBTarget;
lldb::PlatformSP GetSP() const;
void SetSP(const lldb::PlatformSP &platform_sp);
SBError ExecuteConnected(
const std::function<lldb_private::Error(const lldb::PlatformSP &)> &func);
lldb::PlatformSP m_opaque_sp;
};
} // namespace lldb

View File

@ -12,438 +12,368 @@
#include "lldb/API/SBDefines.h"
#include "lldb/API/SBError.h"
#include "lldb/API/SBTarget.h"
#include "lldb/API/SBQueue.h"
#include "lldb/API/SBTarget.h"
#include <stdio.h>
namespace lldb {
class SBEvent;
class LLDB_API SBProcess
{
class LLDB_API SBProcess {
public:
//------------------------------------------------------------------
/// Broadcaster event bits definitions.
//------------------------------------------------------------------
FLAGS_ANONYMOUS_ENUM()
{
eBroadcastBitStateChanged = (1 << 0),
eBroadcastBitInterrupt = (1 << 1),
eBroadcastBitSTDOUT = (1 << 2),
eBroadcastBitSTDERR = (1 << 3),
eBroadcastBitProfileData = (1 << 4)
};
//------------------------------------------------------------------
/// Broadcaster event bits definitions.
//------------------------------------------------------------------
FLAGS_ANONYMOUS_ENUM(){eBroadcastBitStateChanged = (1 << 0),
eBroadcastBitInterrupt = (1 << 1),
eBroadcastBitSTDOUT = (1 << 2),
eBroadcastBitSTDERR = (1 << 3),
eBroadcastBitProfileData = (1 << 4),
eBroadcastBitStructuredData = (1 << 5)};
SBProcess ();
SBProcess();
SBProcess (const lldb::SBProcess& rhs);
SBProcess(const lldb::SBProcess &rhs);
const lldb::SBProcess&
operator = (const lldb::SBProcess& rhs);
const lldb::SBProcess &operator=(const lldb::SBProcess &rhs);
SBProcess (const lldb::ProcessSP &process_sp);
~SBProcess();
SBProcess(const lldb::ProcessSP &process_sp);
static const char *
GetBroadcasterClassName ();
const char *
GetPluginName ();
// DEPRECATED: use GetPluginName()
const char *
GetShortPluginName ();
void
Clear ();
~SBProcess();
bool
IsValid() const;
static const char *GetBroadcasterClassName();
lldb::SBTarget
GetTarget() const;
const char *GetPluginName();
lldb::ByteOrder
GetByteOrder() const;
// DEPRECATED: use GetPluginName()
const char *GetShortPluginName();
size_t
PutSTDIN (const char *src, size_t src_len);
void Clear();
size_t
GetSTDOUT (char *dst, size_t dst_len) const;
bool IsValid() const;
size_t
GetSTDERR (char *dst, size_t dst_len) const;
lldb::SBTarget GetTarget() const;
size_t
GetAsyncProfileData(char *dst, size_t dst_len) const;
void
ReportEventState (const lldb::SBEvent &event, FILE *out) const;
lldb::ByteOrder GetByteOrder() const;
void
AppendEventStateReport (const lldb::SBEvent &event, lldb::SBCommandReturnObject &result);
size_t PutSTDIN(const char *src, size_t src_len);
//------------------------------------------------------------------
/// Remote connection related functions. These will fail if the
/// process is not in eStateConnected. They are intended for use
/// when connecting to an externally managed debugserver instance.
//------------------------------------------------------------------
bool
RemoteAttachToProcessWithID (lldb::pid_t pid,
lldb::SBError& error);
bool
RemoteLaunch (char const **argv,
char const **envp,
const char *stdin_path,
const char *stdout_path,
const char *stderr_path,
const char *working_directory,
uint32_t launch_flags,
bool stop_at_entry,
lldb::SBError& error);
//------------------------------------------------------------------
// Thread related functions
//------------------------------------------------------------------
uint32_t
GetNumThreads ();
size_t GetSTDOUT(char *dst, size_t dst_len) const;
lldb::SBThread
GetThreadAtIndex (size_t index);
size_t GetSTDERR(char *dst, size_t dst_len) const;
lldb::SBThread
GetThreadByID (lldb::tid_t sb_thread_id);
size_t GetAsyncProfileData(char *dst, size_t dst_len) const;
lldb::SBThread
GetThreadByIndexID (uint32_t index_id);
void ReportEventState(const lldb::SBEvent &event, FILE *out) const;
lldb::SBThread
GetSelectedThread () const;
void AppendEventStateReport(const lldb::SBEvent &event,
lldb::SBCommandReturnObject &result);
//------------------------------------------------------------------
// Function for lazily creating a thread using the current OS
// plug-in. This function will be removed in the future when there
// are APIs to create SBThread objects through the interface and add
// them to the process through the SBProcess API.
//------------------------------------------------------------------
lldb::SBThread
CreateOSPluginThread (lldb::tid_t tid, lldb::addr_t context);
//------------------------------------------------------------------
/// Remote connection related functions. These will fail if the
/// process is not in eStateConnected. They are intended for use
/// when connecting to an externally managed debugserver instance.
//------------------------------------------------------------------
bool RemoteAttachToProcessWithID(lldb::pid_t pid, lldb::SBError &error);
bool
SetSelectedThread (const lldb::SBThread &thread);
bool RemoteLaunch(char const **argv, char const **envp,
const char *stdin_path, const char *stdout_path,
const char *stderr_path, const char *working_directory,
uint32_t launch_flags, bool stop_at_entry,
lldb::SBError &error);
bool
SetSelectedThreadByID (lldb::tid_t tid);
bool
SetSelectedThreadByIndexID (uint32_t index_id);
//------------------------------------------------------------------
// Thread related functions
//------------------------------------------------------------------
uint32_t GetNumThreads();
//------------------------------------------------------------------
// Queue related functions
//------------------------------------------------------------------
uint32_t
GetNumQueues ();
lldb::SBThread GetThreadAtIndex(size_t index);
lldb::SBQueue
GetQueueAtIndex (size_t index);
lldb::SBThread GetThreadByID(lldb::tid_t sb_thread_id);
//------------------------------------------------------------------
// Stepping related functions
//------------------------------------------------------------------
lldb::SBThread GetThreadByIndexID(uint32_t index_id);
lldb::StateType
GetState ();
lldb::SBThread GetSelectedThread() const;
int
GetExitStatus ();
//------------------------------------------------------------------
// Function for lazily creating a thread using the current OS
// plug-in. This function will be removed in the future when there
// are APIs to create SBThread objects through the interface and add
// them to the process through the SBProcess API.
//------------------------------------------------------------------
lldb::SBThread CreateOSPluginThread(lldb::tid_t tid, lldb::addr_t context);
const char *
GetExitDescription ();
bool SetSelectedThread(const lldb::SBThread &thread);
//------------------------------------------------------------------
/// Gets the process ID
///
/// Returns the process identifier for the process as it is known
/// on the system on which the process is running. For unix systems
/// this is typically the same as if you called "getpid()" in the
/// process.
///
/// @return
/// Returns LLDB_INVALID_PROCESS_ID if this object does not
/// contain a valid process object, or if the process has not
/// been launched. Returns a valid process ID if the process is
/// valid.
//------------------------------------------------------------------
lldb::pid_t
GetProcessID ();
bool SetSelectedThreadByID(lldb::tid_t tid);
//------------------------------------------------------------------
/// Gets the unique ID associated with this process object
///
/// Unique IDs start at 1 and increment up with each new process
/// instance. Since starting a process on a system might always
/// create a process with the same process ID, there needs to be a
/// way to tell two process instances apart.
///
/// @return
/// Returns a non-zero integer ID if this object contains a
/// valid process object, zero if this object does not contain
/// a valid process object.
//------------------------------------------------------------------
uint32_t
GetUniqueID();
bool SetSelectedThreadByIndexID(uint32_t index_id);
uint32_t
GetAddressByteSize() const;
//------------------------------------------------------------------
// Queue related functions
//------------------------------------------------------------------
uint32_t GetNumQueues();
lldb::SBError
Destroy ();
lldb::SBQueue GetQueueAtIndex(size_t index);
lldb::SBError
Continue ();
//------------------------------------------------------------------
// Stepping related functions
//------------------------------------------------------------------
lldb::SBError
Stop ();
lldb::StateType GetState();
lldb::SBError
Kill ();
int GetExitStatus();
lldb::SBError
Detach ();
const char *GetExitDescription();
lldb::SBError
Detach (bool keep_stopped);
//------------------------------------------------------------------
/// Gets the process ID
///
/// Returns the process identifier for the process as it is known
/// on the system on which the process is running. For unix systems
/// this is typically the same as if you called "getpid()" in the
/// process.
///
/// @return
/// Returns LLDB_INVALID_PROCESS_ID if this object does not
/// contain a valid process object, or if the process has not
/// been launched. Returns a valid process ID if the process is
/// valid.
//------------------------------------------------------------------
lldb::pid_t GetProcessID();
lldb::SBError
Signal (int signal);
//------------------------------------------------------------------
/// Gets the unique ID associated with this process object
///
/// Unique IDs start at 1 and increment up with each new process
/// instance. Since starting a process on a system might always
/// create a process with the same process ID, there needs to be a
/// way to tell two process instances apart.
///
/// @return
/// Returns a non-zero integer ID if this object contains a
/// valid process object, zero if this object does not contain
/// a valid process object.
//------------------------------------------------------------------
uint32_t GetUniqueID();
lldb::SBUnixSignals
GetUnixSignals();
uint32_t GetAddressByteSize() const;
void
SendAsyncInterrupt();
uint32_t
GetStopID(bool include_expression_stops = false);
lldb::SBError Destroy();
//------------------------------------------------------------------
/// Gets the stop event corresponding to stop ID.
//
/// Note that it wasn't fully implemented and tracks only the stop
/// event for the last natural stop ID.
///
/// @param [in] stop_id
/// The ID of the stop event to return.
///
/// @return
/// The stop event corresponding to stop ID.
//------------------------------------------------------------------
lldb::SBEvent
GetStopEventForStopID(uint32_t stop_id);
lldb::SBError Continue();
size_t
ReadMemory (addr_t addr, void *buf, size_t size, lldb::SBError &error);
lldb::SBError Stop();
size_t
WriteMemory (addr_t addr, const void *buf, size_t size, lldb::SBError &error);
lldb::SBError Kill();
size_t
ReadCStringFromMemory (addr_t addr, void *buf, size_t size, lldb::SBError &error);
lldb::SBError Detach();
uint64_t
ReadUnsignedFromMemory (addr_t addr, uint32_t byte_size, lldb::SBError &error);
lldb::SBError Detach(bool keep_stopped);
lldb::addr_t
ReadPointerFromMemory (addr_t addr, lldb::SBError &error);
lldb::SBError Signal(int signal);
// Events
static lldb::StateType
GetStateFromEvent (const lldb::SBEvent &event);
lldb::SBUnixSignals GetUnixSignals();
static bool
GetRestartedFromEvent (const lldb::SBEvent &event);
static size_t
GetNumRestartedReasonsFromEvent (const lldb::SBEvent &event);
static const char *
GetRestartedReasonAtIndexFromEvent (const lldb::SBEvent &event, size_t idx);
void SendAsyncInterrupt();
static lldb::SBProcess
GetProcessFromEvent (const lldb::SBEvent &event);
uint32_t GetStopID(bool include_expression_stops = false);
static bool
GetInterruptedFromEvent (const lldb::SBEvent &event);
static bool
EventIsProcessEvent (const lldb::SBEvent &event);
//------------------------------------------------------------------
/// Gets the stop event corresponding to stop ID.
//
/// Note that it wasn't fully implemented and tracks only the stop
/// event for the last natural stop ID.
///
/// @param [in] stop_id
/// The ID of the stop event to return.
///
/// @return
/// The stop event corresponding to stop ID.
//------------------------------------------------------------------
lldb::SBEvent GetStopEventForStopID(uint32_t stop_id);
lldb::SBBroadcaster
GetBroadcaster () const;
size_t ReadMemory(addr_t addr, void *buf, size_t size, lldb::SBError &error);
static const char *
GetBroadcasterClass ();
size_t WriteMemory(addr_t addr, const void *buf, size_t size,
lldb::SBError &error);
bool
GetDescription (lldb::SBStream &description);
size_t ReadCStringFromMemory(addr_t addr, void *buf, size_t size,
lldb::SBError &error);
uint32_t
GetNumSupportedHardwareWatchpoints (lldb::SBError &error) const;
uint64_t ReadUnsignedFromMemory(addr_t addr, uint32_t byte_size,
lldb::SBError &error);
//------------------------------------------------------------------
/// Load a shared library into this process.
///
/// @param[in] remote_image_spec
/// The path for the shared library on the target what you want
/// to load.
///
/// @param[out] error
/// An error object that gets filled in with any errors that
/// might occur when trying to load the shared library.
///
/// @return
/// A token that represents the shared library that can be
/// later used to unload the shared library. A value of
/// LLDB_INVALID_IMAGE_TOKEN will be returned if the shared
/// library can't be opened.
//------------------------------------------------------------------
uint32_t
LoadImage (lldb::SBFileSpec &remote_image_spec, lldb::SBError &error);
lldb::addr_t ReadPointerFromMemory(addr_t addr, lldb::SBError &error);
//------------------------------------------------------------------
/// Load a shared library into this process.
///
/// @param[in] local_image_spec
/// The file spec that points to the shared library that you
/// want to load if the library is located on the host. The
/// library will be copied over to the location specified by
/// remote_image_spec or into the current working directory with
/// the same filename if the remote_image_spec isn't specified.
///
/// @param[in] remote_image_spec
/// If local_image_spec is specified then the location where the
/// library should be copied over from the host. If
/// local_image_spec isn't specified, then the path for the
/// shared library on the target what you want to load.
///
/// @param[out] error
/// An error object that gets filled in with any errors that
/// might occur when trying to load the shared library.
///
/// @return
/// A token that represents the shared library that can be
/// later used to unload the shared library. A value of
/// LLDB_INVALID_IMAGE_TOKEN will be returned if the shared
/// library can't be opened.
//------------------------------------------------------------------
uint32_t
LoadImage (const lldb::SBFileSpec &local_image_spec,
const lldb::SBFileSpec &remote_image_spec,
lldb::SBError &error);
lldb::SBError
UnloadImage (uint32_t image_token);
lldb::SBError
SendEventData (const char *data);
//------------------------------------------------------------------
/// Return the number of different thread-origin extended backtraces
/// this process can support.
///
/// When the process is stopped and you have an SBThread, lldb may be
/// able to show a backtrace of when that thread was originally created,
/// or the work item was enqueued to it (in the case of a libdispatch
/// queue).
///
/// @return
/// The number of thread-origin extended backtrace types that may be
/// available.
//------------------------------------------------------------------
uint32_t
GetNumExtendedBacktraceTypes ();
// Events
static lldb::StateType GetStateFromEvent(const lldb::SBEvent &event);
//------------------------------------------------------------------
/// Return the name of one of the thread-origin extended backtrace
/// methods.
///
/// @param [in] idx
/// The index of the name to return. They will be returned in
/// the order that the user will most likely want to see them.
/// e.g. if the type at index 0 is not available for a thread,
/// see if the type at index 1 provides an extended backtrace.
///
/// @return
/// The name at that index.
//------------------------------------------------------------------
const char *
GetExtendedBacktraceTypeAtIndex (uint32_t idx);
lldb::SBThreadCollection
GetHistoryThreads (addr_t addr);
bool
IsInstrumentationRuntimePresent(InstrumentationRuntimeType type);
static bool GetRestartedFromEvent(const lldb::SBEvent &event);
// Save the state of the process in a core file (or mini dump on Windows).
lldb::SBError
SaveCore(const char *file_name);
static size_t GetNumRestartedReasonsFromEvent(const lldb::SBEvent &event);
//------------------------------------------------------------------
/// Query the address load_addr and store the details of the memory
/// region that contains it in the supplied SBMemoryRegionInfo object.
/// To iterate over all memory regions use GetMemoryRegionList.
///
/// @param[in] load_addr
/// The address to be queried.
///
/// @param[out] region_info
/// A reference to an SBMemoryRegionInfo object that will contain
/// the details of the memory region containing load_addr.
///
/// @return
/// An error object describes any errors that occurred while
/// querying load_addr.
//------------------------------------------------------------------
lldb::SBError
GetMemoryRegionInfo (lldb::addr_t load_addr, lldb::SBMemoryRegionInfo &region_info);
static const char *
GetRestartedReasonAtIndexFromEvent(const lldb::SBEvent &event, size_t idx);
//------------------------------------------------------------------
/// Return the list of memory regions within the process.
///
/// @return
/// A list of all witin the process memory regions.
//------------------------------------------------------------------
lldb::SBMemoryRegionInfoList
GetMemoryRegions();
static lldb::SBProcess GetProcessFromEvent(const lldb::SBEvent &event);
static bool GetInterruptedFromEvent(const lldb::SBEvent &event);
static lldb::SBStructuredData
GetStructuredDataFromEvent(const lldb::SBEvent &event);
static bool EventIsProcessEvent(const lldb::SBEvent &event);
static bool EventIsStructuredDataEvent(const lldb::SBEvent &event);
lldb::SBBroadcaster GetBroadcaster() const;
static const char *GetBroadcasterClass();
bool GetDescription(lldb::SBStream &description);
uint32_t GetNumSupportedHardwareWatchpoints(lldb::SBError &error) const;
//------------------------------------------------------------------
/// Load a shared library into this process.
///
/// @param[in] remote_image_spec
/// The path for the shared library on the target what you want
/// to load.
///
/// @param[out] error
/// An error object that gets filled in with any errors that
/// might occur when trying to load the shared library.
///
/// @return
/// A token that represents the shared library that can be
/// later used to unload the shared library. A value of
/// LLDB_INVALID_IMAGE_TOKEN will be returned if the shared
/// library can't be opened.
//------------------------------------------------------------------
uint32_t LoadImage(lldb::SBFileSpec &remote_image_spec, lldb::SBError &error);
//------------------------------------------------------------------
/// Load a shared library into this process.
///
/// @param[in] local_image_spec
/// The file spec that points to the shared library that you
/// want to load if the library is located on the host. The
/// library will be copied over to the location specified by
/// remote_image_spec or into the current working directory with
/// the same filename if the remote_image_spec isn't specified.
///
/// @param[in] remote_image_spec
/// If local_image_spec is specified then the location where the
/// library should be copied over from the host. If
/// local_image_spec isn't specified, then the path for the
/// shared library on the target what you want to load.
///
/// @param[out] error
/// An error object that gets filled in with any errors that
/// might occur when trying to load the shared library.
///
/// @return
/// A token that represents the shared library that can be
/// later used to unload the shared library. A value of
/// LLDB_INVALID_IMAGE_TOKEN will be returned if the shared
/// library can't be opened.
//------------------------------------------------------------------
uint32_t LoadImage(const lldb::SBFileSpec &local_image_spec,
const lldb::SBFileSpec &remote_image_spec,
lldb::SBError &error);
lldb::SBError UnloadImage(uint32_t image_token);
lldb::SBError SendEventData(const char *data);
//------------------------------------------------------------------
/// Return the number of different thread-origin extended backtraces
/// this process can support.
///
/// When the process is stopped and you have an SBThread, lldb may be
/// able to show a backtrace of when that thread was originally created,
/// or the work item was enqueued to it (in the case of a libdispatch
/// queue).
///
/// @return
/// The number of thread-origin extended backtrace types that may be
/// available.
//------------------------------------------------------------------
uint32_t GetNumExtendedBacktraceTypes();
//------------------------------------------------------------------
/// Return the name of one of the thread-origin extended backtrace
/// methods.
///
/// @param [in] idx
/// The index of the name to return. They will be returned in
/// the order that the user will most likely want to see them.
/// e.g. if the type at index 0 is not available for a thread,
/// see if the type at index 1 provides an extended backtrace.
///
/// @return
/// The name at that index.
//------------------------------------------------------------------
const char *GetExtendedBacktraceTypeAtIndex(uint32_t idx);
lldb::SBThreadCollection GetHistoryThreads(addr_t addr);
bool IsInstrumentationRuntimePresent(InstrumentationRuntimeType type);
// Save the state of the process in a core file (or mini dump on Windows).
lldb::SBError SaveCore(const char *file_name);
//------------------------------------------------------------------
/// Query the address load_addr and store the details of the memory
/// region that contains it in the supplied SBMemoryRegionInfo object.
/// To iterate over all memory regions use GetMemoryRegionList.
///
/// @param[in] load_addr
/// The address to be queried.
///
/// @param[out] region_info
/// A reference to an SBMemoryRegionInfo object that will contain
/// the details of the memory region containing load_addr.
///
/// @return
/// An error object describes any errors that occurred while
/// querying load_addr.
//------------------------------------------------------------------
lldb::SBError GetMemoryRegionInfo(lldb::addr_t load_addr,
lldb::SBMemoryRegionInfo &region_info);
//------------------------------------------------------------------
/// Return the list of memory regions within the process.
///
/// @return
/// A list of all witin the process memory regions.
//------------------------------------------------------------------
lldb::SBMemoryRegionInfoList GetMemoryRegions();
protected:
friend class SBAddress;
friend class SBBreakpoint;
friend class SBBreakpointLocation;
friend class SBCommandInterpreter;
friend class SBDebugger;
friend class SBExecutionContext;
friend class SBFunction;
friend class SBModule;
friend class SBTarget;
friend class SBThread;
friend class SBValue;
friend class lldb_private::QueueImpl;
friend class SBAddress;
friend class SBBreakpoint;
friend class SBBreakpointLocation;
friend class SBCommandInterpreter;
friend class SBDebugger;
friend class SBExecutionContext;
friend class SBFunction;
friend class SBModule;
friend class SBTarget;
friend class SBThread;
friend class SBValue;
friend class lldb_private::QueueImpl;
lldb::ProcessSP
GetSP() const;
void
SetSP (const lldb::ProcessSP &process_sp);
lldb::ProcessSP GetSP() const;
lldb::ProcessWP m_opaque_wp;
void SetSP(const lldb::ProcessSP &process_sp);
lldb::ProcessWP m_opaque_wp;
};
} // namespace lldb
} // namespace lldb
#endif // LLDB_SBProcess_h_
#endif // LLDB_SBProcess_h_

View File

@ -12,78 +12,61 @@
#include <vector>
#include "lldb/lldb-forward.h"
#include "lldb/API/SBDefines.h"
#include "lldb/lldb-forward.h"
namespace lldb {
class LLDB_API SBQueue
{
class LLDB_API SBQueue {
public:
SBQueue ();
SBQueue();
SBQueue (const QueueSP& queue_sp);
SBQueue (const SBQueue& rhs);
SBQueue(const QueueSP &queue_sp);
const SBQueue &
operator= (const lldb::SBQueue& rhs);
SBQueue(const SBQueue &rhs);
~SBQueue();
const SBQueue &operator=(const lldb::SBQueue &rhs);
bool
IsValid() const;
~SBQueue();
void
Clear ();
bool IsValid() const;
lldb::SBProcess
GetProcess ();
void Clear();
lldb::queue_id_t
GetQueueID () const;
lldb::SBProcess GetProcess();
const char *
GetName () const;
lldb::queue_id_t GetQueueID() const;
uint32_t
GetIndexID () const;
const char *GetName() const;
uint32_t
GetNumThreads ();
uint32_t GetIndexID() const;
lldb::SBThread
GetThreadAtIndex (uint32_t);
uint32_t GetNumThreads();
uint32_t
GetNumPendingItems ();
lldb::SBThread GetThreadAtIndex(uint32_t);
lldb::SBQueueItem
GetPendingItemAtIndex (uint32_t);
uint32_t GetNumPendingItems();
uint32_t
GetNumRunningItems ();
lldb::SBQueueItem GetPendingItemAtIndex(uint32_t);
lldb::QueueKind
GetKind ();
uint32_t GetNumRunningItems();
lldb::QueueKind GetKind();
protected:
friend class SBProcess;
friend class SBThread;
friend class SBProcess;
friend class SBThread;
void
SetQueue (const lldb::QueueSP& queue_sp);
void SetQueue(const lldb::QueueSP &queue_sp);
void
FetchThreads ();
void FetchThreads();
void
FetchItems ();
void FetchItems();
private:
std::shared_ptr<lldb_private::QueueImpl> m_opaque_sp;
std::shared_ptr<lldb_private::QueueImpl> m_opaque_sp;
};
} // namespace lldb
#endif // LLDB_SBQueue_h_
#endif // LLDB_SBQueue_h_

View File

@ -10,48 +10,39 @@
#ifndef LLDB_SBQueueItem_h_
#define LLDB_SBQueueItem_h_
#include "lldb/API/SBDefines.h"
#include "lldb/API/SBAddress.h"
#include "lldb/API/SBDefines.h"
namespace lldb {
class LLDB_API SBQueueItem
{
class LLDB_API SBQueueItem {
public:
SBQueueItem ();
SBQueueItem();
SBQueueItem (const lldb::QueueItemSP& queue_item_sp);
~SBQueueItem();
SBQueueItem(const lldb::QueueItemSP &queue_item_sp);
bool
IsValid() const;
~SBQueueItem();
void
Clear ();
bool IsValid() const;
lldb::QueueItemKind
GetKind () const;
void Clear();
void
SetKind (lldb::QueueItemKind kind);
lldb::QueueItemKind GetKind() const;
lldb::SBAddress
GetAddress () const;
void SetKind(lldb::QueueItemKind kind);
void
SetAddress (lldb::SBAddress addr);
lldb::SBAddress GetAddress() const;
void
SetQueueItem (const lldb::QueueItemSP& queue_item_sp);
void SetAddress(lldb::SBAddress addr);
SBThread
GetExtendedBacktraceThread (const char *type);
void SetQueueItem(const lldb::QueueItemSP &queue_item_sp);
SBThread GetExtendedBacktraceThread(const char *type);
private:
lldb::QueueItemSP m_queue_item_sp;
lldb::QueueItemSP m_queue_item_sp;
};
} // namespace lldb
#endif // LLDB_SBQueueItem_h_
#endif // LLDB_SBQueueItem_h_

View File

@ -10,107 +10,95 @@
#ifndef LLDB_SBSection_h_
#define LLDB_SBSection_h_
#include "lldb/API/SBDefines.h"
#include "lldb/API/SBData.h"
#include "lldb/API/SBDefines.h"
namespace lldb {
class LLDB_API SBSection
{
class LLDB_API SBSection {
public:
SBSection();
SBSection ();
SBSection(const lldb::SBSection &rhs);
SBSection (const lldb::SBSection &rhs);
~SBSection();
~SBSection ();
const lldb::SBSection &operator=(const lldb::SBSection &rhs);
const lldb::SBSection &
operator = (const lldb::SBSection &rhs);
bool IsValid() const;
bool
IsValid () const;
const char *GetName();
const char *
GetName ();
lldb::SBSection GetParent();
lldb::SBSection
GetParent();
lldb::SBSection FindSubSection(const char *sect_name);
lldb::SBSection
FindSubSection (const char *sect_name);
size_t GetNumSubSections();
size_t
GetNumSubSections ();
lldb::SBSection GetSubSectionAtIndex(size_t idx);
lldb::SBSection
GetSubSectionAtIndex (size_t idx);
lldb::addr_t GetFileAddress();
lldb::addr_t
GetFileAddress ();
lldb::addr_t GetLoadAddress(lldb::SBTarget &target);
lldb::addr_t
GetLoadAddress (lldb::SBTarget &target);
lldb::addr_t
GetByteSize ();
lldb::addr_t GetByteSize();
uint64_t
GetFileOffset ();
uint64_t GetFileOffset();
uint64_t
GetFileByteSize ();
lldb::SBData
GetSectionData ();
uint64_t GetFileByteSize();
lldb::SBData
GetSectionData (uint64_t offset,
uint64_t size);
SectionType
GetSectionType ();
lldb::SBData GetSectionData();
//------------------------------------------------------------------
/// Return the size of a target's byte represented by this section
/// in numbers of host bytes. Note that certain architectures have
/// varying minimum addressable unit (i.e. byte) size for their
/// CODE or DATA buses.
///
/// @return
/// The number of host (8-bit) bytes needed to hold a target byte
//------------------------------------------------------------------
uint32_t
GetTargetByteSize ();
lldb::SBData GetSectionData(uint64_t offset, uint64_t size);
bool
operator == (const lldb::SBSection &rhs);
SectionType GetSectionType();
bool
operator != (const lldb::SBSection &rhs);
//------------------------------------------------------------------
/// Gets the permissions (RWX) of the section of the object file
///
/// Returns a mask of bits of enum lldb::Permissions for this section.
/// Sections for which permissions are not defined, 0 is returned for
/// them. The binary representation of this value corresponds to [XRW]
/// i.e. for a section having read and execute permissions, the value
/// returned is 6
///
/// @return
/// Returns an unsigned value for Permissions for the section.
//------------------------------------------------------------------
uint32_t
GetPermissions() const;
bool
GetDescription (lldb::SBStream &description);
//------------------------------------------------------------------
/// Return the size of a target's byte represented by this section
/// in numbers of host bytes. Note that certain architectures have
/// varying minimum addressable unit (i.e. byte) size for their
/// CODE or DATA buses.
///
/// @return
/// The number of host (8-bit) bytes needed to hold a target byte
//------------------------------------------------------------------
uint32_t GetTargetByteSize();
bool operator==(const lldb::SBSection &rhs);
bool operator!=(const lldb::SBSection &rhs);
bool GetDescription(lldb::SBStream &description);
private:
friend class SBAddress;
friend class SBModule;
friend class SBTarget;
friend class SBAddress;
friend class SBModule;
friend class SBTarget;
SBSection (const lldb::SectionSP &section_sp);
SBSection(const lldb::SectionSP &section_sp);
lldb::SectionSP
GetSP() const;
void
SetSP(const lldb::SectionSP &section_sp);
lldb::SectionWP m_opaque_wp;
lldb::SectionSP GetSP() const;
void SetSP(const lldb::SectionSP &section_sp);
lldb::SectionWP m_opaque_wp;
};
} // namespace lldb
#endif // LLDB_SBSection_h_

View File

@ -16,38 +16,35 @@
namespace lldb {
class LLDB_API SBSourceManager
{
class LLDB_API SBSourceManager {
public:
SBSourceManager (const SBDebugger &debugger);
SBSourceManager (const SBTarget &target);
SBSourceManager (const SBSourceManager &rhs);
~SBSourceManager();
SBSourceManager(const SBDebugger &debugger);
SBSourceManager(const SBTarget &target);
SBSourceManager(const SBSourceManager &rhs);
const lldb::SBSourceManager &
operator = (const lldb::SBSourceManager &rhs);
~SBSourceManager();
size_t
DisplaySourceLinesWithLineNumbers (const lldb::SBFileSpec &file,
uint32_t line,
uint32_t context_before,
uint32_t context_after,
const char* current_line_cstr,
lldb::SBStream &s);
const lldb::SBSourceManager &operator=(const lldb::SBSourceManager &rhs);
size_t DisplaySourceLinesWithLineNumbers(
const lldb::SBFileSpec &file, uint32_t line, uint32_t context_before,
uint32_t context_after, const char *current_line_cstr, lldb::SBStream &s);
size_t DisplaySourceLinesWithLineNumbersAndColumn(
const lldb::SBFileSpec &file, uint32_t line, uint32_t column,
uint32_t context_before, uint32_t context_after,
const char *current_line_cstr, lldb::SBStream &s);
protected:
friend class SBCommandInterpreter;
friend class SBDebugger;
friend class SBCommandInterpreter;
friend class SBDebugger;
SBSourceManager(lldb_private::SourceManager *source_manager);
SBSourceManager(lldb_private::SourceManager *source_manager);
private:
std::unique_ptr<lldb_private::SourceManagerImpl> m_opaque_ap;
std::unique_ptr<lldb_private::SourceManagerImpl> m_opaque_ap;
};
} // namespace lldb
#endif // LLDB_SBSourceManager_h_
#endif // LLDB_SBSourceManager_h_

View File

@ -16,100 +16,87 @@
namespace lldb {
class LLDB_API SBStream
{
class LLDB_API SBStream {
public:
SBStream();
SBStream ();
SBStream(SBStream &&rhs);
SBStream (SBStream &&rhs);
~SBStream();
~SBStream ();
bool IsValid() const;
bool
IsValid() const;
// If this stream is not redirected to a file, it will maintain a local
// cache for the stream data which can be accessed using this accessor.
const char *GetData();
// If this stream is not redirected to a file, it will maintain a local
// cache for the stream data which can be accessed using this accessor.
const char *
GetData ();
// If this stream is not redirected to a file, it will maintain a local
// cache for the stream output whose length can be accessed using this
// accessor.
size_t GetSize();
// If this stream is not redirected to a file, it will maintain a local
// cache for the stream output whose length can be accessed using this
// accessor.
size_t
GetSize();
void Printf(const char *format, ...) __attribute__((format(printf, 2, 3)));
void
Printf (const char *format, ...) __attribute__ ((format (printf, 2, 3)));
void RedirectToFile(const char *path, bool append);
void
RedirectToFile (const char *path, bool append);
void RedirectToFileHandle(FILE *fh, bool transfer_fh_ownership);
void
RedirectToFileHandle (FILE *fh, bool transfer_fh_ownership);
void RedirectToFileDescriptor(int fd, bool transfer_fh_ownership);
void
RedirectToFileDescriptor (int fd, bool transfer_fh_ownership);
// If the stream is redirected to a file, forget about the file and if
// ownership of the file was transferred to this object, close the file.
// If the stream is backed by a local cache, clear this cache.
void
Clear ();
// If the stream is redirected to a file, forget about the file and if
// ownership of the file was transferred to this object, close the file.
// If the stream is backed by a local cache, clear this cache.
void Clear();
protected:
friend class SBAddress;
friend class SBBlock;
friend class SBBreakpoint;
friend class SBBreakpointLocation;
friend class SBCommandReturnObject;
friend class SBCompileUnit;
friend class SBData;
friend class SBDebugger;
friend class SBDeclaration;
friend class SBEvent;
friend class SBFileSpec;
friend class SBFileSpecList;
friend class SBFrame;
friend class SBFunction;
friend class SBInstruction;
friend class SBInstructionList;
friend class SBLineEntry;
friend class SBMemoryRegionInfo;
friend class SBModule;
friend class SBModuleSpec;
friend class SBModuleSpecList;
friend class SBProcess;
friend class SBSection;
friend class SBSourceManager;
friend class SBSymbol;
friend class SBSymbolContext;
friend class SBSymbolContextList;
friend class SBTarget;
friend class SBThread;
friend class SBThreadPlan;
friend class SBType;
friend class SBTypeEnumMember;
friend class SBTypeMemberFunction;
friend class SBTypeMember;
friend class SBValue;
friend class SBWatchpoint;
friend class SBAddress;
friend class SBBlock;
friend class SBBreakpoint;
friend class SBBreakpointLocation;
friend class SBCommandReturnObject;
friend class SBCompileUnit;
friend class SBData;
friend class SBDebugger;
friend class SBDeclaration;
friend class SBEvent;
friend class SBFileSpec;
friend class SBFileSpecList;
friend class SBFrame;
friend class SBFunction;
friend class SBInstruction;
friend class SBInstructionList;
friend class SBLineEntry;
friend class SBMemoryRegionInfo;
friend class SBModule;
friend class SBModuleSpec;
friend class SBModuleSpecList;
friend class SBProcess;
friend class SBSection;
friend class SBSourceManager;
friend class SBStructuredData;
friend class SBSymbol;
friend class SBSymbolContext;
friend class SBSymbolContextList;
friend class SBTarget;
friend class SBThread;
friend class SBThreadPlan;
friend class SBType;
friend class SBTypeEnumMember;
friend class SBTypeMemberFunction;
friend class SBTypeMember;
friend class SBValue;
friend class SBWatchpoint;
lldb_private::Stream *
operator->();
lldb_private::Stream *operator->();
lldb_private::Stream *
get();
lldb_private::Stream *get();
lldb_private::Stream &
ref();
lldb_private::Stream &ref();
private:
DISALLOW_COPY_AND_ASSIGN (SBStream);
std::unique_ptr<lldb_private::Stream> m_opaque_ap;
bool m_is_file;
DISALLOW_COPY_AND_ASSIGN(SBStream);
std::unique_ptr<lldb_private::Stream> m_opaque_ap;
bool m_is_file;
};
} // namespace lldb

View File

@ -14,59 +14,47 @@
namespace lldb {
class LLDB_API SBStringList
{
class LLDB_API SBStringList {
public:
SBStringList();
SBStringList ();
SBStringList(const lldb::SBStringList &rhs);
SBStringList (const lldb::SBStringList &rhs);
const SBStringList &
operator = (const SBStringList &rhs);
const SBStringList &operator=(const SBStringList &rhs);
~SBStringList ();
~SBStringList();
bool
IsValid() const;
bool IsValid() const;
void
AppendString (const char *str);
void AppendString(const char *str);
void
AppendList (const char **strv, int strc);
void AppendList(const char **strv, int strc);
void
AppendList (const lldb::SBStringList &strings);
void AppendList(const lldb::SBStringList &strings);
uint32_t
GetSize () const;
uint32_t GetSize() const;
const char *
GetStringAtIndex (size_t idx);
const char *GetStringAtIndex(size_t idx);
const char *
GetStringAtIndex (size_t idx) const;
const char *GetStringAtIndex(size_t idx) const;
void
Clear ();
void Clear();
protected:
friend class SBCommandInterpreter;
friend class SBDebugger;
friend class SBCommandInterpreter;
friend class SBDebugger;
friend class SBBreakpoint;
SBStringList (const lldb_private::StringList *lldb_strings);
SBStringList(const lldb_private::StringList *lldb_strings);
const lldb_private::StringList *
operator->() const;
void AppendList(const lldb_private::StringList &strings);
const lldb_private::StringList &
operator*() const;
const lldb_private::StringList *operator->() const;
const lldb_private::StringList &operator*() const;
private:
std::unique_ptr<lldb_private::StringList> m_opaque_ap;
std::unique_ptr<lldb_private::StringList> m_opaque_ap;
};
} // namespace lldb

View File

@ -0,0 +1,45 @@
//===-- SBStructuredData.h --------------------------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#ifndef SBStructuredData_h
#define SBStructuredData_h
#include "lldb/API/SBDefines.h"
#include "lldb/API/SBModule.h"
class StructuredDataImpl;
namespace lldb {
class SBStructuredData {
public:
SBStructuredData();
SBStructuredData(const lldb::SBStructuredData &rhs);
SBStructuredData(const lldb::EventSP &event_sp);
~SBStructuredData();
lldb::SBStructuredData &operator=(const lldb::SBStructuredData &rhs);
bool IsValid() const;
void Clear();
lldb::SBError GetAsJSON(lldb::SBStream &stream) const;
lldb::SBError GetDescription(lldb::SBStream &stream) const;
private:
std::unique_ptr<StructuredDataImpl> m_impl_up;
};
}
#endif /* SBStructuredData_h */

View File

@ -10,103 +10,80 @@
#ifndef LLDB_SBSymbol_h_
#define LLDB_SBSymbol_h_
#include "lldb/API/SBDefines.h"
#include "lldb/API/SBAddress.h"
#include "lldb/API/SBDefines.h"
#include "lldb/API/SBInstructionList.h"
#include "lldb/API/SBTarget.h"
namespace lldb {
class LLDB_API SBSymbol
{
class LLDB_API SBSymbol {
public:
SBSymbol();
SBSymbol ();
~SBSymbol();
~SBSymbol ();
SBSymbol(const lldb::SBSymbol &rhs);
SBSymbol (const lldb::SBSymbol &rhs);
const lldb::SBSymbol &operator=(const lldb::SBSymbol &rhs);
const lldb::SBSymbol &
operator = (const lldb::SBSymbol &rhs);
bool IsValid() const;
bool
IsValid () const;
const char *GetName() const;
const char *GetDisplayName() const;
const char *
GetName() const;
const char *GetMangledName() const;
const char *
GetDisplayName() const;
const char *
GetMangledName () const;
lldb::SBInstructionList GetInstructions(lldb::SBTarget target);
lldb::SBInstructionList
GetInstructions (lldb::SBTarget target);
lldb::SBInstructionList GetInstructions(lldb::SBTarget target,
const char *flavor_string);
lldb::SBInstructionList
GetInstructions (lldb::SBTarget target, const char *flavor_string);
SBAddress GetStartAddress();
SBAddress
GetStartAddress ();
SBAddress
GetEndAddress ();
uint32_t
GetPrologueByteSize ();
SBAddress GetEndAddress();
SymbolType
GetType ();
uint32_t GetPrologueByteSize();
bool
operator == (const lldb::SBSymbol &rhs) const;
SymbolType GetType();
bool
operator != (const lldb::SBSymbol &rhs) const;
bool operator==(const lldb::SBSymbol &rhs) const;
bool
GetDescription (lldb::SBStream &description);
bool operator!=(const lldb::SBSymbol &rhs) const;
//----------------------------------------------------------------------
// Returns true if the symbol is externally visible in the module that
// it is defined in
//----------------------------------------------------------------------
bool
IsExternal();
bool GetDescription(lldb::SBStream &description);
//----------------------------------------------------------------------
// Returns true if the symbol was synthetically generated from something
// other than the actual symbol table itself in the object file.
//----------------------------------------------------------------------
bool
IsSynthetic();
//----------------------------------------------------------------------
// Returns true if the symbol is externally visible in the module that
// it is defined in
//----------------------------------------------------------------------
bool IsExternal();
//----------------------------------------------------------------------
// Returns true if the symbol was synthetically generated from something
// other than the actual symbol table itself in the object file.
//----------------------------------------------------------------------
bool IsSynthetic();
protected:
lldb_private::Symbol *get();
lldb_private::Symbol *
get ();
void reset(lldb_private::Symbol *);
void
reset (lldb_private::Symbol *);
private:
friend class SBAddress;
friend class SBFrame;
friend class SBModule;
friend class SBSymbolContext;
friend class SBAddress;
friend class SBFrame;
friend class SBModule;
friend class SBSymbolContext;
SBSymbol (lldb_private::Symbol *lldb_object_ptr);
void
SetSymbol (lldb_private::Symbol *lldb_object_ptr);
SBSymbol(lldb_private::Symbol *lldb_object_ptr);
lldb_private::Symbol *m_opaque_ptr;
void SetSymbol(lldb_private::Symbol *lldb_object_ptr);
lldb_private::Symbol *m_opaque_ptr;
};
} // namespace lldb
#endif // LLDB_SBSymbol_h_

View File

@ -10,9 +10,9 @@
#ifndef LLDB_SBSymbolContext_h_
#define LLDB_SBSymbolContext_h_
#include "lldb/API/SBDefines.h"
#include "lldb/API/SBBlock.h"
#include "lldb/API/SBCompileUnit.h"
#include "lldb/API/SBDefines.h"
#include "lldb/API/SBFunction.h"
#include "lldb/API/SBLineEntry.h"
#include "lldb/API/SBModule.h"
@ -20,75 +20,63 @@
namespace lldb {
class LLDB_API SBSymbolContext
{
class LLDB_API SBSymbolContext {
public:
SBSymbolContext ();
SBSymbolContext();
SBSymbolContext (const lldb::SBSymbolContext& rhs);
SBSymbolContext(const lldb::SBSymbolContext &rhs);
~SBSymbolContext ();
~SBSymbolContext();
bool
IsValid () const;
bool IsValid() const;
const lldb::SBSymbolContext &
operator = (const lldb::SBSymbolContext &rhs);
const lldb::SBSymbolContext &operator=(const lldb::SBSymbolContext &rhs);
lldb::SBModule GetModule ();
lldb::SBCompileUnit GetCompileUnit ();
lldb::SBFunction GetFunction ();
lldb::SBBlock GetBlock ();
lldb::SBLineEntry GetLineEntry ();
lldb::SBSymbol GetSymbol ();
lldb::SBModule GetModule();
lldb::SBCompileUnit GetCompileUnit();
lldb::SBFunction GetFunction();
lldb::SBBlock GetBlock();
lldb::SBLineEntry GetLineEntry();
lldb::SBSymbol GetSymbol();
void SetModule (lldb::SBModule module);
void SetCompileUnit (lldb::SBCompileUnit compile_unit);
void SetFunction (lldb::SBFunction function);
void SetBlock (lldb::SBBlock block);
void SetLineEntry (lldb::SBLineEntry line_entry);
void SetSymbol (lldb::SBSymbol symbol);
void SetModule(lldb::SBModule module);
void SetCompileUnit(lldb::SBCompileUnit compile_unit);
void SetFunction(lldb::SBFunction function);
void SetBlock(lldb::SBBlock block);
void SetLineEntry(lldb::SBLineEntry line_entry);
void SetSymbol(lldb::SBSymbol symbol);
SBSymbolContext
GetParentOfInlinedScope (const SBAddress &curr_frame_pc,
SBAddress &parent_frame_addr) const;
SBSymbolContext GetParentOfInlinedScope(const SBAddress &curr_frame_pc,
SBAddress &parent_frame_addr) const;
bool
GetDescription (lldb::SBStream &description);
bool GetDescription(lldb::SBStream &description);
protected:
friend class SBAddress;
friend class SBFrame;
friend class SBModule;
friend class SBThread;
friend class SBTarget;
friend class SBSymbolContextList;
friend class SBAddress;
friend class SBFrame;
friend class SBModule;
friend class SBThread;
friend class SBTarget;
friend class SBSymbolContextList;
lldb_private::SymbolContext*
operator->() const;
lldb_private::SymbolContext *operator->() const;
lldb_private::SymbolContext&
operator*();
lldb_private::SymbolContext &operator*();
lldb_private::SymbolContext&
ref();
lldb_private::SymbolContext &ref();
const lldb_private::SymbolContext&
operator*() const;
const lldb_private::SymbolContext &operator*() const;
lldb_private::SymbolContext *
get() const;
lldb_private::SymbolContext *get() const;
SBSymbolContext (const lldb_private::SymbolContext *sc_ptr);
SBSymbolContext(const lldb_private::SymbolContext *sc_ptr);
void
SetSymbolContext (const lldb_private::SymbolContext *sc_ptr);
void SetSymbolContext(const lldb_private::SymbolContext *sc_ptr);
private:
std::unique_ptr<lldb_private::SymbolContext> m_opaque_ap;
std::unique_ptr<lldb_private::SymbolContext> m_opaque_ap;
};
} // namespace lldb
#endif // LLDB_SBSymbolContext_h_

View File

@ -15,55 +15,43 @@
namespace lldb {
class LLDB_API SBSymbolContextList
{
class LLDB_API SBSymbolContextList {
public:
SBSymbolContextList ();
SBSymbolContextList();
SBSymbolContextList (const lldb::SBSymbolContextList& rhs);
SBSymbolContextList(const lldb::SBSymbolContextList &rhs);
~SBSymbolContextList ();
~SBSymbolContextList();
const lldb::SBSymbolContextList &
operator = (const lldb::SBSymbolContextList &rhs);
const lldb::SBSymbolContextList &
operator=(const lldb::SBSymbolContextList &rhs);
bool
IsValid () const;
bool IsValid() const;
uint32_t
GetSize() const;
uint32_t GetSize() const;
lldb::SBSymbolContext
GetContextAtIndex (uint32_t idx);
bool
GetDescription (lldb::SBStream &description);
lldb::SBSymbolContext GetContextAtIndex(uint32_t idx);
void
Append (lldb::SBSymbolContext &sc);
void
Append (lldb::SBSymbolContextList &sc_list);
void
Clear();
bool GetDescription(lldb::SBStream &description);
void Append(lldb::SBSymbolContext &sc);
void Append(lldb::SBSymbolContextList &sc_list);
void Clear();
protected:
friend class SBModule;
friend class SBTarget;
friend class SBModule;
friend class SBTarget;
lldb_private::SymbolContextList *operator->() const;
lldb_private::SymbolContextList*
operator->() const;
lldb_private::SymbolContextList&
operator*() const;
lldb_private::SymbolContextList &operator*() const;
private:
std::unique_ptr<lldb_private::SymbolContextList> m_opaque_ap;
std::unique_ptr<lldb_private::SymbolContextList> m_opaque_ap;
};
} // namespace lldb
#endif // LLDB_SBSymbolContextList_h_

File diff suppressed because it is too large Load Diff

View File

@ -18,254 +18,203 @@ namespace lldb {
class SBFrame;
class LLDB_API SBThread
{
class LLDB_API SBThread {
public:
enum
{
eBroadcastBitStackChanged = (1 << 0),
eBroadcastBitThreadSuspended = (1 << 1),
eBroadcastBitThreadResumed = (1 << 2),
eBroadcastBitSelectedFrameChanged = (1 << 3),
eBroadcastBitThreadSelected = (1 << 4)
};
enum {
eBroadcastBitStackChanged = (1 << 0),
eBroadcastBitThreadSuspended = (1 << 1),
eBroadcastBitThreadResumed = (1 << 2),
eBroadcastBitSelectedFrameChanged = (1 << 3),
eBroadcastBitThreadSelected = (1 << 4)
};
static const char *
GetBroadcasterClassName ();
SBThread ();
static const char *GetBroadcasterClassName();
SBThread (const lldb::SBThread &thread);
SBThread (const lldb::ThreadSP& lldb_object_sp);
SBThread();
~SBThread();
SBThread(const lldb::SBThread &thread);
lldb::SBQueue
GetQueue () const;
SBThread(const lldb::ThreadSP &lldb_object_sp);
bool
IsValid() const;
~SBThread();
void
Clear ();
lldb::SBQueue GetQueue() const;
lldb::StopReason
GetStopReason();
bool IsValid() const;
/// Get the number of words associated with the stop reason.
/// See also GetStopReasonDataAtIndex().
size_t
GetStopReasonDataCount();
void Clear();
//--------------------------------------------------------------------------
/// 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
/// eStopReasonPlanComplete 0
//--------------------------------------------------------------------------
uint64_t
GetStopReasonDataAtIndex(uint32_t idx);
bool
GetStopReasonExtendedInfoAsJSON (lldb::SBStream &stream);
SBThreadCollection
GetStopReasonExtendedBacktraces (InstrumentationRuntimeType type);
size_t
GetStopDescription (char *dst, size_t dst_len);
SBValue
GetStopReturnValue ();
lldb::StopReason GetStopReason();
lldb::tid_t
GetThreadID () const;
/// Get the number of words associated with the stop reason.
/// See also GetStopReasonDataAtIndex().
size_t GetStopReasonDataCount();
uint32_t
GetIndexID () const;
//--------------------------------------------------------------------------
/// 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
/// eStopReasonPlanComplete 0
//--------------------------------------------------------------------------
uint64_t GetStopReasonDataAtIndex(uint32_t idx);
const char *
GetName () const;
bool GetStopReasonExtendedInfoAsJSON(lldb::SBStream &stream);
const char *
GetQueueName() const;
SBThreadCollection
GetStopReasonExtendedBacktraces(InstrumentationRuntimeType type);
lldb::queue_id_t
GetQueueID() const;
size_t GetStopDescription(char *dst, size_t dst_len);
bool
GetInfoItemByPathAsString ( const char *path, SBStream &strm);
SBValue GetStopReturnValue();
void
StepOver (lldb::RunMode stop_other_threads = lldb::eOnlyDuringStepping);
lldb::tid_t GetThreadID() const;
void
StepInto (lldb::RunMode stop_other_threads = lldb::eOnlyDuringStepping);
uint32_t GetIndexID() const;
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 ();
const char *GetName() const;
void
StepOutOfFrame (lldb::SBFrame &frame);
const char *GetQueueName() const;
void
StepInstruction(bool step_over);
lldb::queue_id_t GetQueueID() const;
SBError
StepOverUntil (lldb::SBFrame &frame,
lldb::SBFileSpec &file_spec,
uint32_t line);
bool GetInfoItemByPathAsString(const char *path, SBStream &strm);
SBError
StepUsingScriptedThreadPlan (const char *script_class_name);
void StepOver(lldb::RunMode stop_other_threads = lldb::eOnlyDuringStepping);
SBError
JumpToLine (lldb::SBFileSpec &file_spec, uint32_t line);
void StepInto(lldb::RunMode stop_other_threads = lldb::eOnlyDuringStepping);
void
RunToAddress (lldb::addr_t addr);
SBError
ReturnFromFrame (SBFrame &frame, SBValue &return_value);
void StepInto(const char *target_name,
lldb::RunMode stop_other_threads = lldb::eOnlyDuringStepping);
SBError
UnwindInnermostExpression();
void StepInto(const char *target_name, uint32_t end_line, SBError &error,
lldb::RunMode stop_other_threads = lldb::eOnlyDuringStepping);
//--------------------------------------------------------------------------
/// 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.
//--------------------------------------------------------------------------
bool
Suspend();
bool
Resume ();
bool
IsSuspended();
void StepOut();
bool
IsStopped();
void StepOutOfFrame(lldb::SBFrame &frame);
uint32_t
GetNumFrames ();
void StepInstruction(bool step_over);
lldb::SBFrame
GetFrameAtIndex (uint32_t idx);
SBError StepOverUntil(lldb::SBFrame &frame, lldb::SBFileSpec &file_spec,
uint32_t line);
lldb::SBFrame
GetSelectedFrame ();
SBError StepUsingScriptedThreadPlan(const char *script_class_name);
lldb::SBFrame
SetSelectedFrame (uint32_t frame_idx);
static bool
EventIsThreadEvent (const SBEvent &event);
static SBFrame
GetStackFrameFromEvent (const SBEvent &event);
static SBThread
GetThreadFromEvent (const SBEvent &event);
SBError StepUsingScriptedThreadPlan(const char *script_class_name,
bool resume_immediately);
lldb::SBProcess
GetProcess ();
SBError JumpToLine(lldb::SBFileSpec &file_spec, uint32_t line);
const lldb::SBThread &
operator = (const lldb::SBThread &rhs);
void RunToAddress(lldb::addr_t addr);
bool
operator == (const lldb::SBThread &rhs) const;
SBError ReturnFromFrame(SBFrame &frame, SBValue &return_value);
bool
operator != (const lldb::SBThread &rhs) const;
SBError UnwindInnermostExpression();
bool
GetDescription (lldb::SBStream &description) const;
bool
GetStatus (lldb::SBStream &status) const;
//--------------------------------------------------------------------------
/// 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.
//--------------------------------------------------------------------------
bool Suspend();
SBThread
GetExtendedBacktraceThread (const char *type);
bool Resume();
uint32_t
GetExtendedBacktraceOriginatingIndexID ();
bool IsSuspended();
bool
SafeToCallFunctions ();
bool IsStopped();
uint32_t GetNumFrames();
lldb::SBFrame GetFrameAtIndex(uint32_t idx);
lldb::SBFrame GetSelectedFrame();
lldb::SBFrame SetSelectedFrame(uint32_t frame_idx);
static bool EventIsThreadEvent(const SBEvent &event);
static SBFrame GetStackFrameFromEvent(const SBEvent &event);
static SBThread GetThreadFromEvent(const SBEvent &event);
lldb::SBProcess GetProcess();
const lldb::SBThread &operator=(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();
bool SafeToCallFunctions();
#ifndef SWIG
lldb_private::Thread *
operator->();
lldb_private::Thread *operator->();
lldb_private::Thread *
get();
lldb_private::Thread *get();
#endif
protected:
friend class SBBreakpoint;
friend class SBBreakpointLocation;
friend class SBExecutionContext;
friend class SBFrame;
friend class SBProcess;
friend class SBDebugger;
friend class SBValue;
friend class lldb_private::QueueImpl;
friend class SBQueueItem;
friend class SBBreakpoint;
friend class SBBreakpointLocation;
friend class SBExecutionContext;
friend class SBFrame;
friend class SBProcess;
friend class SBDebugger;
friend class SBValue;
friend class lldb_private::QueueImpl;
friend class SBQueueItem;
void
SetThread (const lldb::ThreadSP& lldb_object_sp);
void SetThread(const lldb::ThreadSP &lldb_object_sp);
#ifndef SWIG
SBError
ResumeNewPlan (lldb_private::ExecutionContext &exe_ctx, lldb_private::ThreadPlan *new_plan);
SBError ResumeNewPlan(lldb_private::ExecutionContext &exe_ctx,
lldb_private::ThreadPlan *new_plan);
#endif
private:
lldb::ExecutionContextRefSP m_opaque_sp;
lldb::ExecutionContextRefSP m_opaque_sp;
};
} // namespace lldb
#endif // LLDB_SBThread_h_
#endif // LLDB_SBThread_h_

View File

@ -13,57 +13,44 @@
#include "lldb/API/SBDefines.h"
namespace lldb {
class LLDB_API SBThreadCollection
{
public:
SBThreadCollection ();
SBThreadCollection (const SBThreadCollection &rhs);
const SBThreadCollection &
operator = (const SBThreadCollection &rhs);
~SBThreadCollection ();
bool
IsValid () const;
size_t
GetSize ();
lldb::SBThread
GetThreadAtIndex (size_t idx);
protected:
// Mimic shared pointer...
lldb_private::ThreadCollection *
get() const;
lldb_private::ThreadCollection *
operator->() const;
lldb::ThreadCollectionSP &
operator*();
const lldb::ThreadCollectionSP &
operator*() const;
SBThreadCollection (const lldb::ThreadCollectionSP &threads);
void
SetOpaque (const lldb::ThreadCollectionSP &threads);
class LLDB_API SBThreadCollection {
public:
SBThreadCollection();
SBThreadCollection(const SBThreadCollection &rhs);
const SBThreadCollection &operator=(const SBThreadCollection &rhs);
~SBThreadCollection();
bool IsValid() const;
size_t GetSize();
lldb::SBThread GetThreadAtIndex(size_t idx);
protected:
// Mimic shared pointer...
lldb_private::ThreadCollection *get() const;
lldb_private::ThreadCollection *operator->() const;
lldb::ThreadCollectionSP &operator*();
const lldb::ThreadCollectionSP &operator*() const;
SBThreadCollection(const lldb::ThreadCollectionSP &threads);
void SetOpaque(const lldb::ThreadCollectionSP &threads);
private:
friend class SBProcess;
friend class SBThread;
lldb::ThreadCollectionSP m_opaque_sp;
friend class SBProcess;
friend class SBThread;
lldb::ThreadCollectionSP m_opaque_sp;
};
} // namespace lldb
#endif // LLDB_SBThreadCollection_h_

View File

@ -16,114 +16,100 @@
namespace lldb {
class LLDB_API SBThreadPlan
{
class LLDB_API SBThreadPlan {
friend class lldb_private::ThreadPlan;
friend class lldb_private::ThreadPlan;
public:
SBThreadPlan ();
SBThreadPlan();
SBThreadPlan (const lldb::SBThreadPlan &threadPlan);
SBThreadPlan (const lldb::ThreadPlanSP& lldb_object_sp);
SBThreadPlan(const lldb::SBThreadPlan &threadPlan);
SBThreadPlan (lldb::SBThread &thread, const char *class_name);
SBThreadPlan(const lldb::ThreadPlanSP &lldb_object_sp);
~SBThreadPlan ();
SBThreadPlan(lldb::SBThread &thread, const char *class_name);
bool
IsValid() const;
~SBThreadPlan();
void
Clear ();
bool IsValid() const;
lldb::StopReason
GetStopReason();
void Clear();
/// Get the number of words associated with the stop reason.
/// See also GetStopReasonDataAtIndex().
size_t
GetStopReasonDataCount();
lldb::StopReason GetStopReason();
//--------------------------------------------------------------------------
/// 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
/// eStopReasonPlanComplete 0
//--------------------------------------------------------------------------
uint64_t
GetStopReasonDataAtIndex(uint32_t idx);
/// Get the number of words associated with the stop reason.
/// See also GetStopReasonDataAtIndex().
size_t GetStopReasonDataCount();
SBThread
GetThread () const;
//--------------------------------------------------------------------------
/// 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
/// eStopReasonPlanComplete 0
//--------------------------------------------------------------------------
uint64_t GetStopReasonDataAtIndex(uint32_t idx);
const lldb::SBThreadPlan &
operator = (const lldb::SBThreadPlan &rhs);
SBThread GetThread() const;
bool
GetDescription (lldb::SBStream &description) const;
const lldb::SBThreadPlan &operator=(const lldb::SBThreadPlan &rhs);
void
SetPlanComplete (bool success);
bool GetDescription(lldb::SBStream &description) const;
bool
IsPlanComplete();
void SetPlanComplete(bool success);
bool
IsValid();
bool IsPlanComplete();
// This section allows an SBThreadPlan to push another of the common types of plans...
SBThreadPlan
QueueThreadPlanForStepOverRange (SBAddress &start_address,
lldb::addr_t range_size);
bool IsPlanStale();
SBThreadPlan
QueueThreadPlanForStepInRange (SBAddress &start_address,
lldb::addr_t range_size);
bool IsValid();
SBThreadPlan
QueueThreadPlanForStepOut (uint32_t frame_idx_to_step_to, bool first_insn = false);
// This section allows an SBThreadPlan to push another of the common types of
// plans...
SBThreadPlan QueueThreadPlanForStepOverRange(SBAddress &start_address,
lldb::addr_t range_size);
SBThreadPlan
QueueThreadPlanForRunToAddress (SBAddress address);
SBThreadPlan QueueThreadPlanForStepInRange(SBAddress &start_address,
lldb::addr_t range_size);
SBThreadPlan QueueThreadPlanForStepOut(uint32_t frame_idx_to_step_to,
bool first_insn = false);
SBThreadPlan QueueThreadPlanForRunToAddress(SBAddress address);
#ifndef SWIG
lldb_private::ThreadPlan *
get();
lldb_private::ThreadPlan *get();
#endif
protected:
friend class SBBreakpoint;
friend class SBBreakpointLocation;
friend class SBFrame;
friend class SBProcess;
friend class SBDebugger;
friend class SBValue;
friend class lldb_private::QueueImpl;
friend class SBQueueItem;
friend class SBBreakpoint;
friend class SBBreakpointLocation;
friend class SBFrame;
friend class SBProcess;
friend class SBDebugger;
friend class SBValue;
friend class lldb_private::QueueImpl;
friend class SBQueueItem;
#ifndef SWIG
void
SetThreadPlan (const lldb::ThreadPlanSP& lldb_object_sp);
void SetThreadPlan(const lldb::ThreadPlanSP &lldb_object_sp);
#endif
private:
lldb::ThreadPlanSP m_opaque_sp;
lldb::ThreadPlanSP m_opaque_sp;
};
} // namespace lldb
#endif // LLDB_SBThreadPlan_h_
#endif // LLDB_SBThreadPlan_h_

View File

@ -14,328 +14,241 @@
namespace lldb {
class SBTypeList;
class SBTypeList;
class LLDB_API SBTypeMember
{
class LLDB_API SBTypeMember {
public:
SBTypeMember ();
SBTypeMember (const lldb::SBTypeMember& rhs);
~SBTypeMember();
SBTypeMember();
lldb::SBTypeMember&
operator = (const lldb::SBTypeMember& rhs);
SBTypeMember(const lldb::SBTypeMember &rhs);
bool
IsValid() const;
const char *
GetName ();
lldb::SBType
GetType ();
uint64_t
GetOffsetInBytes();
uint64_t
GetOffsetInBits();
~SBTypeMember();
bool
IsBitfield();
uint32_t
GetBitfieldSizeInBits();
lldb::SBTypeMember &operator=(const lldb::SBTypeMember &rhs);
bool IsValid() const;
const char *GetName();
lldb::SBType GetType();
uint64_t GetOffsetInBytes();
uint64_t GetOffsetInBits();
bool IsBitfield();
uint32_t GetBitfieldSizeInBits();
bool GetDescription(lldb::SBStream &description,
lldb::DescriptionLevel description_level);
bool
GetDescription (lldb::SBStream &description,
lldb::DescriptionLevel description_level);
protected:
friend class SBType;
friend class SBType;
void
reset (lldb_private::TypeMemberImpl *);
void reset(lldb_private::TypeMemberImpl *);
lldb_private::TypeMemberImpl &
ref ();
lldb_private::TypeMemberImpl &ref();
const lldb_private::TypeMemberImpl &
ref () const;
const lldb_private::TypeMemberImpl &ref() const;
std::unique_ptr<lldb_private::TypeMemberImpl> m_opaque_ap;
};
class SBTypeMemberFunction
{
public:
SBTypeMemberFunction ();
SBTypeMemberFunction (const lldb::SBTypeMemberFunction& rhs);
~SBTypeMemberFunction();
lldb::SBTypeMemberFunction&
operator = (const lldb::SBTypeMemberFunction& rhs);
bool
IsValid() const;
const char *
GetName ();
const char *
GetDemangledName ();
const char *
GetMangledName ();
lldb::SBType
GetType ();
lldb::SBType
GetReturnType ();
uint32_t
GetNumberOfArguments ();
lldb::SBType
GetArgumentTypeAtIndex (uint32_t);
lldb::MemberFunctionKind
GetKind();
bool
GetDescription (lldb::SBStream &description,
lldb::DescriptionLevel description_level);
protected:
friend class SBType;
void
reset (lldb_private::TypeMemberFunctionImpl *);
lldb_private::TypeMemberFunctionImpl &
ref ();
const lldb_private::TypeMemberFunctionImpl &
ref () const;
lldb::TypeMemberFunctionImplSP m_opaque_sp;
std::unique_ptr<lldb_private::TypeMemberImpl> m_opaque_ap;
};
class SBType
{
class SBTypeMemberFunction {
public:
SBTypeMemberFunction();
SBType();
SBTypeMemberFunction(const lldb::SBTypeMemberFunction &rhs);
SBType (const lldb::SBType &rhs);
~SBTypeMemberFunction();
~SBType ();
lldb::SBTypeMemberFunction &operator=(const lldb::SBTypeMemberFunction &rhs);
bool
IsValid() const;
uint64_t
GetByteSize();
bool IsValid() const;
bool
IsPointerType();
bool
IsReferenceType();
bool
IsFunctionType ();
bool
IsPolymorphicClass ();
bool
IsArrayType ();
bool
IsVectorType ();
bool
IsTypedefType ();
bool
IsAnonymousType ();
lldb::SBType
GetPointerType();
lldb::SBType
GetPointeeType();
lldb::SBType
GetReferenceType();
lldb::SBType
GetTypedefedType();
const char *GetName();
lldb::SBType
GetDereferencedType();
const char *GetDemangledName();
lldb::SBType
GetUnqualifiedType();
lldb::SBType
GetArrayElementType ();
lldb::SBType
GetVectorElementType ();
const char *GetMangledName();
lldb::SBType
GetCanonicalType();
// Get the "lldb::BasicType" enumeration for a type. If a type is not a basic
// type eBasicTypeInvalid will be returned
lldb::BasicType
GetBasicType();
lldb::SBType GetType();
// The call below confusing and should really be renamed to "CreateBasicType"
lldb::SBType
GetBasicType(lldb::BasicType type);
uint32_t
GetNumberOfFields ();
uint32_t
GetNumberOfDirectBaseClasses ();
lldb::SBType GetReturnType();
uint32_t
GetNumberOfVirtualBaseClasses ();
lldb::SBTypeMember
GetFieldAtIndex (uint32_t idx);
lldb::SBTypeMember
GetDirectBaseClassAtIndex (uint32_t idx);
uint32_t GetNumberOfArguments();
lldb::SBTypeMember
GetVirtualBaseClassAtIndex (uint32_t idx);
lldb::SBType GetArgumentTypeAtIndex(uint32_t);
lldb::SBTypeEnumMemberList
GetEnumMembers();
lldb::MemberFunctionKind GetKind();
uint32_t
GetNumberOfTemplateArguments ();
lldb::SBType
GetTemplateArgumentType (uint32_t idx);
bool GetDescription(lldb::SBStream &description,
lldb::DescriptionLevel description_level);
lldb::TemplateArgumentKind
GetTemplateArgumentKind (uint32_t idx);
lldb::SBType
GetFunctionReturnType ();
lldb::SBTypeList
GetFunctionArgumentTypes ();
uint32_t
GetNumberOfMemberFunctions ();
lldb::SBTypeMemberFunction
GetMemberFunctionAtIndex (uint32_t idx);
const char*
GetName();
const char *
GetDisplayTypeName ();
lldb::TypeClass
GetTypeClass ();
bool
IsTypeComplete ();
uint32_t
GetTypeFlags ();
bool
GetDescription (lldb::SBStream &description,
lldb::DescriptionLevel description_level);
lldb::SBType &
operator = (const lldb::SBType &rhs);
bool
operator == (lldb::SBType &rhs);
bool
operator != (lldb::SBType &rhs);
protected:
friend class SBType;
lldb_private::TypeImpl &
ref ();
const lldb_private::TypeImpl &
ref () const;
lldb::TypeImplSP
GetSP ();
void reset(lldb_private::TypeMemberFunctionImpl *);
void
SetSP (const lldb::TypeImplSP &type_impl_sp);
lldb_private::TypeMemberFunctionImpl &ref();
lldb::TypeImplSP m_opaque_sp;
friend class SBFunction;
friend class SBModule;
friend class SBTarget;
friend class SBTypeEnumMember;
friend class SBTypeEnumMemberList;
friend class SBTypeNameSpecifier;
friend class SBTypeMember;
friend class SBTypeMemberFunction;
friend class SBTypeList;
friend class SBValue;
SBType (const lldb_private::CompilerType &);
SBType (const lldb::TypeSP &);
SBType (const lldb::TypeImplSP &);
const lldb_private::TypeMemberFunctionImpl &ref() const;
lldb::TypeMemberFunctionImplSP m_opaque_sp;
};
class SBTypeList
{
class SBType {
public:
SBTypeList();
SBTypeList(const lldb::SBTypeList& rhs);
~SBTypeList();
SBType();
lldb::SBTypeList&
operator = (const lldb::SBTypeList& rhs);
bool
IsValid();
SBType(const lldb::SBType &rhs);
~SBType();
bool IsValid() const;
uint64_t GetByteSize();
bool IsPointerType();
bool IsReferenceType();
bool IsFunctionType();
bool IsPolymorphicClass();
bool IsArrayType();
bool IsVectorType();
bool IsTypedefType();
bool IsAnonymousType();
lldb::SBType GetPointerType();
lldb::SBType GetPointeeType();
lldb::SBType GetReferenceType();
lldb::SBType GetTypedefedType();
lldb::SBType GetDereferencedType();
lldb::SBType GetUnqualifiedType();
lldb::SBType GetArrayElementType();
lldb::SBType GetArrayType(uint64_t size);
lldb::SBType GetVectorElementType();
lldb::SBType GetCanonicalType();
// Get the "lldb::BasicType" enumeration for a type. If a type is not a basic
// type eBasicTypeInvalid will be returned
lldb::BasicType GetBasicType();
// The call below confusing and should really be renamed to "CreateBasicType"
lldb::SBType GetBasicType(lldb::BasicType type);
uint32_t GetNumberOfFields();
uint32_t GetNumberOfDirectBaseClasses();
uint32_t GetNumberOfVirtualBaseClasses();
lldb::SBTypeMember GetFieldAtIndex(uint32_t idx);
lldb::SBTypeMember GetDirectBaseClassAtIndex(uint32_t idx);
lldb::SBTypeMember GetVirtualBaseClassAtIndex(uint32_t idx);
lldb::SBTypeEnumMemberList GetEnumMembers();
uint32_t GetNumberOfTemplateArguments();
lldb::SBType GetTemplateArgumentType(uint32_t idx);
lldb::TemplateArgumentKind GetTemplateArgumentKind(uint32_t idx);
lldb::SBType GetFunctionReturnType();
lldb::SBTypeList GetFunctionArgumentTypes();
uint32_t GetNumberOfMemberFunctions();
lldb::SBTypeMemberFunction GetMemberFunctionAtIndex(uint32_t idx);
const char *GetName();
const char *GetDisplayTypeName();
lldb::TypeClass GetTypeClass();
bool IsTypeComplete();
uint32_t GetTypeFlags();
bool GetDescription(lldb::SBStream &description,
lldb::DescriptionLevel description_level);
lldb::SBType &operator=(const lldb::SBType &rhs);
bool operator==(lldb::SBType &rhs);
bool operator!=(lldb::SBType &rhs);
protected:
lldb_private::TypeImpl &ref();
const lldb_private::TypeImpl &ref() const;
lldb::TypeImplSP GetSP();
void SetSP(const lldb::TypeImplSP &type_impl_sp);
lldb::TypeImplSP m_opaque_sp;
friend class SBFunction;
friend class SBModule;
friend class SBTarget;
friend class SBTypeEnumMember;
friend class SBTypeEnumMemberList;
friend class SBTypeNameSpecifier;
friend class SBTypeMember;
friend class SBTypeMemberFunction;
friend class SBTypeList;
friend class SBValue;
SBType(const lldb_private::CompilerType &);
SBType(const lldb::TypeSP &);
SBType(const lldb::TypeImplSP &);
};
class SBTypeList {
public:
SBTypeList();
SBTypeList(const lldb::SBTypeList &rhs);
~SBTypeList();
lldb::SBTypeList &operator=(const lldb::SBTypeList &rhs);
bool IsValid();
void Append(lldb::SBType type);
lldb::SBType GetTypeAtIndex(uint32_t index);
uint32_t GetSize();
void
Append (lldb::SBType type);
lldb::SBType
GetTypeAtIndex (uint32_t index);
uint32_t
GetSize();
private:
std::unique_ptr<lldb_private::TypeListImpl> m_opaque_ap;
friend class SBModule;
friend class SBCompileUnit;
std::unique_ptr<lldb_private::TypeListImpl> m_opaque_ap;
friend class SBModule;
friend class SBCompileUnit;
};
} // namespace lldb

View File

@ -1,4 +1,5 @@
//===-- SBTypeCategory.h --------------------------------------------*- C++ -*-===//
//===-- SBTypeCategory.h --------------------------------------------*- C++
//-*-===//
//
// The LLVM Compiler Infrastructure
//
@ -13,165 +14,120 @@
#include "lldb/API/SBDefines.h"
namespace lldb {
class LLDB_API SBTypeCategory
{
public:
SBTypeCategory();
SBTypeCategory (const lldb::SBTypeCategory &rhs);
~SBTypeCategory ();
bool
IsValid() const;
bool
GetEnabled ();
void
SetEnabled (bool);
const char*
GetName();
lldb::LanguageType
GetLanguageAtIndex (uint32_t idx);
uint32_t
GetNumLanguages ();
void
AddLanguage (lldb::LanguageType language);
bool
GetDescription (lldb::SBStream &description,
lldb::DescriptionLevel description_level);
uint32_t
GetNumFormats ();
uint32_t
GetNumSummaries ();
uint32_t
GetNumFilters ();
#ifndef LLDB_DISABLE_PYTHON
uint32_t
GetNumSynthetics ();
#endif
SBTypeNameSpecifier
GetTypeNameSpecifierForFilterAtIndex (uint32_t);
SBTypeNameSpecifier
GetTypeNameSpecifierForFormatAtIndex (uint32_t);
SBTypeNameSpecifier
GetTypeNameSpecifierForSummaryAtIndex (uint32_t);
class LLDB_API SBTypeCategory {
public:
SBTypeCategory();
SBTypeCategory(const lldb::SBTypeCategory &rhs);
~SBTypeCategory();
bool IsValid() const;
bool GetEnabled();
void SetEnabled(bool);
const char *GetName();
lldb::LanguageType GetLanguageAtIndex(uint32_t idx);
uint32_t GetNumLanguages();
void AddLanguage(lldb::LanguageType language);
bool GetDescription(lldb::SBStream &description,
lldb::DescriptionLevel description_level);
uint32_t GetNumFormats();
uint32_t GetNumSummaries();
uint32_t GetNumFilters();
#ifndef LLDB_DISABLE_PYTHON
SBTypeNameSpecifier
GetTypeNameSpecifierForSyntheticAtIndex (uint32_t);
uint32_t GetNumSynthetics();
#endif
SBTypeFilter
GetFilterForType (SBTypeNameSpecifier);
SBTypeFormat
GetFormatForType (SBTypeNameSpecifier);
SBTypeNameSpecifier GetTypeNameSpecifierForFilterAtIndex(uint32_t);
SBTypeNameSpecifier GetTypeNameSpecifierForFormatAtIndex(uint32_t);
SBTypeNameSpecifier GetTypeNameSpecifierForSummaryAtIndex(uint32_t);
#ifndef LLDB_DISABLE_PYTHON
SBTypeSummary
GetSummaryForType (SBTypeNameSpecifier);
SBTypeNameSpecifier GetTypeNameSpecifierForSyntheticAtIndex(uint32_t);
#endif
SBTypeFilter GetFilterForType(SBTypeNameSpecifier);
SBTypeFormat GetFormatForType(SBTypeNameSpecifier);
#ifndef LLDB_DISABLE_PYTHON
SBTypeSummary GetSummaryForType(SBTypeNameSpecifier);
#endif
#ifndef LLDB_DISABLE_PYTHON
SBTypeSynthetic
GetSyntheticForType (SBTypeNameSpecifier);
SBTypeSynthetic GetSyntheticForType(SBTypeNameSpecifier);
#endif
#ifndef LLDB_DISABLE_PYTHON
SBTypeFilter
GetFilterAtIndex (uint32_t);
SBTypeFilter GetFilterAtIndex(uint32_t);
#endif
SBTypeFormat
GetFormatAtIndex (uint32_t);
SBTypeFormat GetFormatAtIndex(uint32_t);
#ifndef LLDB_DISABLE_PYTHON
SBTypeSummary
GetSummaryAtIndex (uint32_t);
SBTypeSummary GetSummaryAtIndex(uint32_t);
#endif
#ifndef LLDB_DISABLE_PYTHON
SBTypeSynthetic
GetSyntheticAtIndex (uint32_t);
SBTypeSynthetic GetSyntheticAtIndex(uint32_t);
#endif
bool
AddTypeFormat (SBTypeNameSpecifier,
SBTypeFormat);
bool
DeleteTypeFormat (SBTypeNameSpecifier);
bool AddTypeFormat(SBTypeNameSpecifier, SBTypeFormat);
bool DeleteTypeFormat(SBTypeNameSpecifier);
#ifndef LLDB_DISABLE_PYTHON
bool
AddTypeSummary (SBTypeNameSpecifier,
SBTypeSummary);
bool AddTypeSummary(SBTypeNameSpecifier, SBTypeSummary);
#endif
bool
DeleteTypeSummary (SBTypeNameSpecifier);
bool
AddTypeFilter (SBTypeNameSpecifier,
SBTypeFilter);
bool
DeleteTypeFilter (SBTypeNameSpecifier);
bool DeleteTypeSummary(SBTypeNameSpecifier);
bool AddTypeFilter(SBTypeNameSpecifier, SBTypeFilter);
bool DeleteTypeFilter(SBTypeNameSpecifier);
#ifndef LLDB_DISABLE_PYTHON
bool
AddTypeSynthetic (SBTypeNameSpecifier,
SBTypeSynthetic);
bool
DeleteTypeSynthetic (SBTypeNameSpecifier);
bool AddTypeSynthetic(SBTypeNameSpecifier, SBTypeSynthetic);
bool DeleteTypeSynthetic(SBTypeNameSpecifier);
#endif
lldb::SBTypeCategory &
operator = (const lldb::SBTypeCategory &rhs);
bool
operator == (lldb::SBTypeCategory &rhs);
bool
operator != (lldb::SBTypeCategory &rhs);
protected:
friend class SBDebugger;
lldb::TypeCategoryImplSP
GetSP ();
void
SetSP (const lldb::TypeCategoryImplSP &typecategory_impl_sp);
TypeCategoryImplSP m_opaque_sp;
SBTypeCategory (const lldb::TypeCategoryImplSP &);
SBTypeCategory (const char*);
bool
IsDefaultCategory();
};
lldb::SBTypeCategory &operator=(const lldb::SBTypeCategory &rhs);
bool operator==(lldb::SBTypeCategory &rhs);
bool operator!=(lldb::SBTypeCategory &rhs);
protected:
friend class SBDebugger;
lldb::TypeCategoryImplSP GetSP();
void SetSP(const lldb::TypeCategoryImplSP &typecategory_impl_sp);
TypeCategoryImplSP m_opaque_sp;
SBTypeCategory(const lldb::TypeCategoryImplSP &);
SBTypeCategory(const char *);
bool IsDefaultCategory();
};
} // namespace lldb
#endif // LLDB_SBTypeCategory_h_

View File

@ -15,82 +15,64 @@
namespace lldb {
class LLDB_API SBTypeEnumMember
{
class LLDB_API SBTypeEnumMember {
public:
SBTypeEnumMember ();
SBTypeEnumMember();
SBTypeEnumMember (const SBTypeEnumMember& rhs);
SBTypeEnumMember(const SBTypeEnumMember &rhs);
~SBTypeEnumMember();
~SBTypeEnumMember();
SBTypeEnumMember&
operator = (const SBTypeEnumMember& rhs);
SBTypeEnumMember &operator=(const SBTypeEnumMember &rhs);
bool
IsValid() const;
bool IsValid() const;
int64_t
GetValueAsSigned();
int64_t GetValueAsSigned();
uint64_t
GetValueAsUnsigned();
uint64_t GetValueAsUnsigned();
const char *
GetName ();
const char *GetName();
lldb::SBType
GetType ();
lldb::SBType GetType();
bool
GetDescription (lldb::SBStream &description,
lldb::DescriptionLevel description_level);
bool GetDescription(lldb::SBStream &description,
lldb::DescriptionLevel description_level);
protected:
friend class SBType;
friend class SBTypeEnumMemberList;
friend class SBType;
friend class SBTypeEnumMemberList;
void
reset (lldb_private::TypeEnumMemberImpl *);
void reset(lldb_private::TypeEnumMemberImpl *);
lldb_private::TypeEnumMemberImpl &
ref ();
lldb_private::TypeEnumMemberImpl &ref();
const lldb_private::TypeEnumMemberImpl &
ref () const;
const lldb_private::TypeEnumMemberImpl &ref() const;
lldb::TypeEnumMemberImplSP m_opaque_sp;
lldb::TypeEnumMemberImplSP m_opaque_sp;
SBTypeEnumMember (const lldb::TypeEnumMemberImplSP &);
SBTypeEnumMember(const lldb::TypeEnumMemberImplSP &);
};
class SBTypeEnumMemberList
{
class SBTypeEnumMemberList {
public:
SBTypeEnumMemberList();
SBTypeEnumMemberList();
SBTypeEnumMemberList(const SBTypeEnumMemberList& rhs);
SBTypeEnumMemberList(const SBTypeEnumMemberList &rhs);
~SBTypeEnumMemberList();
~SBTypeEnumMemberList();
SBTypeEnumMemberList&
operator = (const SBTypeEnumMemberList& rhs);
SBTypeEnumMemberList &operator=(const SBTypeEnumMemberList &rhs);
bool
IsValid();
bool IsValid();
void
Append (SBTypeEnumMember entry);
void Append(SBTypeEnumMember entry);
SBTypeEnumMember
GetTypeEnumMemberAtIndex (uint32_t index);
uint32_t
GetSize();
SBTypeEnumMember GetTypeEnumMemberAtIndex(uint32_t index);
uint32_t GetSize();
private:
std::unique_ptr<lldb_private::TypeEnumMemberListImpl> m_opaque_ap;
std::unique_ptr<lldb_private::TypeEnumMemberListImpl> m_opaque_ap;
};
} // namespace lldb

View File

@ -1,4 +1,5 @@
//===-- SBTypeFilter.h --------------------------------------------*- C++ -*-===//
//===-- SBTypeFilter.h --------------------------------------------*- C++
//-*-===//
//
// The LLVM Compiler Infrastructure
//
@ -13,80 +14,60 @@
#include "lldb/API/SBDefines.h"
namespace lldb {
class LLDB_API SBTypeFilter
{
public:
SBTypeFilter();
SBTypeFilter (uint32_t options); // see lldb::eTypeOption values
SBTypeFilter (const lldb::SBTypeFilter &rhs);
~SBTypeFilter ();
bool
IsValid() const;
uint32_t
GetNumberOfExpressionPaths ();
const char*
GetExpressionPathAtIndex (uint32_t i);
bool
ReplaceExpressionPathAtIndex (uint32_t i, const char* item);
void
AppendExpressionPath (const char* item);
void
Clear();
uint32_t
GetOptions();
void
SetOptions (uint32_t);
bool
GetDescription (lldb::SBStream &description,
lldb::DescriptionLevel description_level);
lldb::SBTypeFilter &
operator = (const lldb::SBTypeFilter &rhs);
bool
IsEqualTo (lldb::SBTypeFilter &rhs);
bool
operator == (lldb::SBTypeFilter &rhs);
class LLDB_API SBTypeFilter {
public:
SBTypeFilter();
SBTypeFilter(uint32_t options); // see lldb::eTypeOption values
SBTypeFilter(const lldb::SBTypeFilter &rhs);
~SBTypeFilter();
bool IsValid() const;
uint32_t GetNumberOfExpressionPaths();
const char *GetExpressionPathAtIndex(uint32_t i);
bool ReplaceExpressionPathAtIndex(uint32_t i, const char *item);
void AppendExpressionPath(const char *item);
void Clear();
uint32_t GetOptions();
void SetOptions(uint32_t);
bool GetDescription(lldb::SBStream &description,
lldb::DescriptionLevel description_level);
lldb::SBTypeFilter &operator=(const lldb::SBTypeFilter &rhs);
bool IsEqualTo(lldb::SBTypeFilter &rhs);
bool operator==(lldb::SBTypeFilter &rhs);
bool operator!=(lldb::SBTypeFilter &rhs);
protected:
friend class SBDebugger;
friend class SBTypeCategory;
friend class SBValue;
lldb::TypeFilterImplSP GetSP();
void SetSP(const lldb::TypeFilterImplSP &typefilter_impl_sp);
lldb::TypeFilterImplSP m_opaque_sp;
SBTypeFilter(const lldb::TypeFilterImplSP &);
bool CopyOnWrite_Impl();
};
bool
operator != (lldb::SBTypeFilter &rhs);
protected:
friend class SBDebugger;
friend class SBTypeCategory;
friend class SBValue;
lldb::TypeFilterImplSP
GetSP ();
void
SetSP (const lldb::TypeFilterImplSP &typefilter_impl_sp);
lldb::TypeFilterImplSP m_opaque_sp;
SBTypeFilter (const lldb::TypeFilterImplSP &);
bool
CopyOnWrite_Impl();
};
} // namespace lldb
#endif // LLDB_SBTypeFilter_h_

View File

@ -1,4 +1,5 @@
//===-- SBTypeFormat.h --------------------------------------------*- C++ -*-===//
//===-- SBTypeFormat.h --------------------------------------------*- C++
//-*-===//
//
// The LLVM Compiler Infrastructure
//
@ -14,87 +15,63 @@
namespace lldb {
class LLDB_API SBTypeFormat
{
class LLDB_API SBTypeFormat {
public:
SBTypeFormat();
SBTypeFormat (lldb::Format format,
uint32_t options = 0); // see lldb::eTypeOption values
SBTypeFormat();
SBTypeFormat (const char* type,
uint32_t options = 0); // see lldb::eTypeOption values
SBTypeFormat (const lldb::SBTypeFormat &rhs);
~SBTypeFormat ();
bool
IsValid() const;
lldb::Format
GetFormat ();
const char*
GetTypeName ();
uint32_t
GetOptions();
void
SetFormat (lldb::Format);
void
SetTypeName (const char*);
void
SetOptions (uint32_t);
bool
GetDescription (lldb::SBStream &description,
lldb::DescriptionLevel description_level);
lldb::SBTypeFormat &
operator = (const lldb::SBTypeFormat &rhs);
bool
IsEqualTo (lldb::SBTypeFormat &rhs);
SBTypeFormat(lldb::Format format,
uint32_t options = 0); // see lldb::eTypeOption values
SBTypeFormat(const char *type,
uint32_t options = 0); // see lldb::eTypeOption values
SBTypeFormat(const lldb::SBTypeFormat &rhs);
~SBTypeFormat();
bool IsValid() const;
lldb::Format GetFormat();
const char *GetTypeName();
uint32_t GetOptions();
void SetFormat(lldb::Format);
void SetTypeName(const char *);
void SetOptions(uint32_t);
bool GetDescription(lldb::SBStream &description,
lldb::DescriptionLevel description_level);
lldb::SBTypeFormat &operator=(const lldb::SBTypeFormat &rhs);
bool IsEqualTo(lldb::SBTypeFormat &rhs);
bool operator==(lldb::SBTypeFormat &rhs);
bool operator!=(lldb::SBTypeFormat &rhs);
bool
operator == (lldb::SBTypeFormat &rhs);
bool
operator != (lldb::SBTypeFormat &rhs);
protected:
friend class SBDebugger;
friend class SBTypeCategory;
friend class SBValue;
lldb::TypeFormatImplSP
GetSP ();
void
SetSP (const lldb::TypeFormatImplSP &typeformat_impl_sp);
lldb::TypeFormatImplSP m_opaque_sp;
SBTypeFormat (const lldb::TypeFormatImplSP &);
enum class Type
{
eTypeKeepSame,
eTypeFormat,
eTypeEnum
};
bool
CopyOnWrite_Impl(Type);
friend class SBDebugger;
friend class SBTypeCategory;
friend class SBValue;
lldb::TypeFormatImplSP GetSP();
void SetSP(const lldb::TypeFormatImplSP &typeformat_impl_sp);
lldb::TypeFormatImplSP m_opaque_sp;
SBTypeFormat(const lldb::TypeFormatImplSP &);
enum class Type { eTypeKeepSame, eTypeFormat, eTypeEnum };
bool CopyOnWrite_Impl(Type);
};
} // namespace lldb
#endif // LLDB_SBTypeFormat_h_

View File

@ -1,4 +1,5 @@
//===-- SBTypeNameSpecifier.h --------------------------------------*- C++ -*-===//
//===-- SBTypeNameSpecifier.h --------------------------------------*- C++
//-*-===//
//
// The LLVM Compiler Infrastructure
//
@ -13,65 +14,51 @@
#include "lldb/API/SBDefines.h"
namespace lldb {
class LLDB_API SBTypeNameSpecifier
{
public:
SBTypeNameSpecifier();
SBTypeNameSpecifier (const char* name,
bool is_regex = false);
SBTypeNameSpecifier (SBType type);
SBTypeNameSpecifier (const lldb::SBTypeNameSpecifier &rhs);
~SBTypeNameSpecifier ();
bool
IsValid() const;
const char*
GetName();
SBType
GetType ();
bool
IsRegex();
bool
GetDescription (lldb::SBStream &description,
lldb::DescriptionLevel description_level);
lldb::SBTypeNameSpecifier &
operator = (const lldb::SBTypeNameSpecifier &rhs);
bool
IsEqualTo (lldb::SBTypeNameSpecifier &rhs);
class LLDB_API SBTypeNameSpecifier {
public:
SBTypeNameSpecifier();
SBTypeNameSpecifier(const char *name, bool is_regex = false);
SBTypeNameSpecifier(SBType type);
SBTypeNameSpecifier(const lldb::SBTypeNameSpecifier &rhs);
~SBTypeNameSpecifier();
bool IsValid() const;
const char *GetName();
SBType GetType();
bool IsRegex();
bool GetDescription(lldb::SBStream &description,
lldb::DescriptionLevel description_level);
lldb::SBTypeNameSpecifier &operator=(const lldb::SBTypeNameSpecifier &rhs);
bool IsEqualTo(lldb::SBTypeNameSpecifier &rhs);
bool operator==(lldb::SBTypeNameSpecifier &rhs);
bool operator!=(lldb::SBTypeNameSpecifier &rhs);
protected:
friend class SBDebugger;
friend class SBTypeCategory;
lldb::TypeNameSpecifierImplSP GetSP();
void SetSP(const lldb::TypeNameSpecifierImplSP &type_namespec_sp);
lldb::TypeNameSpecifierImplSP m_opaque_sp;
SBTypeNameSpecifier(const lldb::TypeNameSpecifierImplSP &);
};
bool
operator == (lldb::SBTypeNameSpecifier &rhs);
bool
operator != (lldb::SBTypeNameSpecifier &rhs);
protected:
friend class SBDebugger;
friend class SBTypeCategory;
lldb::TypeNameSpecifierImplSP
GetSP ();
void
SetSP (const lldb::TypeNameSpecifierImplSP &type_namespec_sp);
lldb::TypeNameSpecifierImplSP m_opaque_sp;
SBTypeNameSpecifier (const lldb::TypeNameSpecifierImplSP &);
};
} // namespace lldb
#endif // LLDB_SBTypeNameSpecifier_h_

View File

@ -1,4 +1,5 @@
//===-- SBTypeSummary.h -------------------------------------------*- C++ -*-===//
//===-- SBTypeSummary.h -------------------------------------------*- C++
//-*-===//
//
// The LLVM Compiler Infrastructure
//
@ -13,160 +14,123 @@
#include "lldb/API/SBDefines.h"
namespace lldb {
class LLDB_API SBTypeSummaryOptions
{
public:
SBTypeSummaryOptions();
class LLDB_API SBTypeSummaryOptions {
public:
SBTypeSummaryOptions();
SBTypeSummaryOptions (const lldb::SBTypeSummaryOptions &rhs);
SBTypeSummaryOptions (const lldb_private::TypeSummaryOptions *lldb_object_ptr);
~SBTypeSummaryOptions ();
bool
IsValid ();
lldb::LanguageType
GetLanguage ();
lldb::TypeSummaryCapping
GetCapping ();
void
SetLanguage (lldb::LanguageType);
void
SetCapping (lldb::TypeSummaryCapping);
protected:
friend class SBValue;
lldb_private::TypeSummaryOptions *
operator->();
const lldb_private::TypeSummaryOptions *
operator->() const;
lldb_private::TypeSummaryOptions *
get ();
lldb_private::TypeSummaryOptions &
ref();
const lldb_private::TypeSummaryOptions &
ref() const;
void
SetOptions (const lldb_private::TypeSummaryOptions *lldb_object_ptr);
private:
std::unique_ptr<lldb_private::TypeSummaryOptions> m_opaque_ap;
};
class SBTypeSummary
{
public:
SBTypeSummary();
SBTypeSummaryOptions(const lldb::SBTypeSummaryOptions &rhs);
// Native function summary formatter callback
typedef bool (*FormatCallback) (SBValue, SBTypeSummaryOptions, SBStream&);
static SBTypeSummary
CreateWithSummaryString (const char* data,
uint32_t options = 0); // see lldb::eTypeOption values
static SBTypeSummary
CreateWithFunctionName (const char* data,
uint32_t options = 0); // see lldb::eTypeOption values
static SBTypeSummary
CreateWithScriptCode (const char* data,
uint32_t options = 0); // see lldb::eTypeOption values
SBTypeSummaryOptions(const lldb_private::TypeSummaryOptions *lldb_object_ptr);
static SBTypeSummary
CreateWithCallback (FormatCallback cb,
uint32_t options = 0,
const char* description = nullptr);
SBTypeSummary (const lldb::SBTypeSummary &rhs);
~SBTypeSummary ();
bool
IsValid() const;
bool
IsFunctionCode();
bool
IsFunctionName();
bool
IsSummaryString();
const char*
GetData ();
void
SetSummaryString (const char* data);
void
SetFunctionName (const char* data);
void
SetFunctionCode (const char* data);
uint32_t
GetOptions ();
void
SetOptions (uint32_t);
bool
GetDescription (lldb::SBStream &description,
lldb::DescriptionLevel description_level);
lldb::SBTypeSummary &
operator = (const lldb::SBTypeSummary &rhs);
bool
DoesPrintValue (lldb::SBValue value);
bool
IsEqualTo (lldb::SBTypeSummary &rhs);
~SBTypeSummaryOptions();
bool IsValid();
lldb::LanguageType GetLanguage();
lldb::TypeSummaryCapping GetCapping();
void SetLanguage(lldb::LanguageType);
void SetCapping(lldb::TypeSummaryCapping);
protected:
friend class SBValue;
lldb_private::TypeSummaryOptions *operator->();
const lldb_private::TypeSummaryOptions *operator->() const;
lldb_private::TypeSummaryOptions *get();
lldb_private::TypeSummaryOptions &ref();
const lldb_private::TypeSummaryOptions &ref() const;
void SetOptions(const lldb_private::TypeSummaryOptions *lldb_object_ptr);
private:
std::unique_ptr<lldb_private::TypeSummaryOptions> m_opaque_ap;
};
class SBTypeSummary {
public:
SBTypeSummary();
// Native function summary formatter callback
typedef bool (*FormatCallback)(SBValue, SBTypeSummaryOptions, SBStream &);
static SBTypeSummary
CreateWithSummaryString(const char *data,
uint32_t options = 0); // see lldb::eTypeOption values
static SBTypeSummary
CreateWithFunctionName(const char *data,
uint32_t options = 0); // see lldb::eTypeOption values
static SBTypeSummary
CreateWithScriptCode(const char *data,
uint32_t options = 0); // see lldb::eTypeOption values
static SBTypeSummary CreateWithCallback(FormatCallback cb,
uint32_t options = 0,
const char *description = nullptr);
SBTypeSummary(const lldb::SBTypeSummary &rhs);
~SBTypeSummary();
bool IsValid() const;
bool IsFunctionCode();
bool IsFunctionName();
bool IsSummaryString();
const char *GetData();
void SetSummaryString(const char *data);
void SetFunctionName(const char *data);
void SetFunctionCode(const char *data);
uint32_t GetOptions();
void SetOptions(uint32_t);
bool GetDescription(lldb::SBStream &description,
lldb::DescriptionLevel description_level);
lldb::SBTypeSummary &operator=(const lldb::SBTypeSummary &rhs);
bool DoesPrintValue(lldb::SBValue value);
bool IsEqualTo(lldb::SBTypeSummary &rhs);
bool operator==(lldb::SBTypeSummary &rhs);
bool operator!=(lldb::SBTypeSummary &rhs);
protected:
friend class SBDebugger;
friend class SBTypeCategory;
friend class SBValue;
lldb::TypeSummaryImplSP GetSP();
void SetSP(const lldb::TypeSummaryImplSP &typefilter_impl_sp);
lldb::TypeSummaryImplSP m_opaque_sp;
SBTypeSummary(const lldb::TypeSummaryImplSP &);
bool CopyOnWrite_Impl();
bool ChangeSummaryType(bool want_script);
};
bool
operator == (lldb::SBTypeSummary &rhs);
bool
operator != (lldb::SBTypeSummary &rhs);
protected:
friend class SBDebugger;
friend class SBTypeCategory;
friend class SBValue;
lldb::TypeSummaryImplSP
GetSP ();
void
SetSP (const lldb::TypeSummaryImplSP &typefilter_impl_sp);
lldb::TypeSummaryImplSP m_opaque_sp;
SBTypeSummary (const lldb::TypeSummaryImplSP &);
bool
CopyOnWrite_Impl();
bool
ChangeSummaryType (bool want_script);
};
} // namespace lldb
#endif // LLDB_SBTypeSummary_h_

View File

@ -1,4 +1,5 @@
//===-- SBTypeSynthetic.h -----------------------------------------*- C++ -*-===//
//===-- SBTypeSynthetic.h -----------------------------------------*- C++
//-*-===//
//
// The LLVM Compiler Infrastructure
//
@ -15,86 +16,66 @@
#ifndef LLDB_DISABLE_PYTHON
namespace lldb {
class LLDB_API SBTypeSynthetic
{
public:
SBTypeSynthetic();
static SBTypeSynthetic
CreateWithClassName (const char* data,
uint32_t options = 0); // see lldb::eTypeOption values
static SBTypeSynthetic
CreateWithScriptCode (const char* data,
uint32_t options = 0); // see lldb::eTypeOption values
SBTypeSynthetic (const lldb::SBTypeSynthetic &rhs);
~SBTypeSynthetic ();
bool
IsValid() const;
bool
IsClassCode();
bool
IsClassName();
const char*
GetData ();
void
SetClassName (const char* data);
void
SetClassCode (const char* data);
uint32_t
GetOptions ();
void
SetOptions (uint32_t);
bool
GetDescription (lldb::SBStream &description,
lldb::DescriptionLevel description_level);
lldb::SBTypeSynthetic &
operator = (const lldb::SBTypeSynthetic &rhs);
class LLDB_API SBTypeSynthetic {
public:
SBTypeSynthetic();
static SBTypeSynthetic
CreateWithClassName(const char *data,
uint32_t options = 0); // see lldb::eTypeOption values
static SBTypeSynthetic
CreateWithScriptCode(const char *data,
uint32_t options = 0); // see lldb::eTypeOption values
SBTypeSynthetic(const lldb::SBTypeSynthetic &rhs);
~SBTypeSynthetic();
bool IsValid() const;
bool IsClassCode();
bool IsClassName();
const char *GetData();
void SetClassName(const char *data);
void SetClassCode(const char *data);
uint32_t GetOptions();
void SetOptions(uint32_t);
bool GetDescription(lldb::SBStream &description,
lldb::DescriptionLevel description_level);
lldb::SBTypeSynthetic &operator=(const lldb::SBTypeSynthetic &rhs);
bool IsEqualTo(lldb::SBTypeSynthetic &rhs);
bool operator==(lldb::SBTypeSynthetic &rhs);
bool operator!=(lldb::SBTypeSynthetic &rhs);
protected:
friend class SBDebugger;
friend class SBTypeCategory;
friend class SBValue;
lldb::ScriptedSyntheticChildrenSP GetSP();
void SetSP(const lldb::ScriptedSyntheticChildrenSP &typefilter_impl_sp);
lldb::ScriptedSyntheticChildrenSP m_opaque_sp;
SBTypeSynthetic(const lldb::ScriptedSyntheticChildrenSP &);
bool CopyOnWrite_Impl();
};
bool
IsEqualTo (lldb::SBTypeSynthetic &rhs);
bool
operator == (lldb::SBTypeSynthetic &rhs);
bool
operator != (lldb::SBTypeSynthetic &rhs);
protected:
friend class SBDebugger;
friend class SBTypeCategory;
friend class SBValue;
lldb::ScriptedSyntheticChildrenSP
GetSP ();
void
SetSP (const lldb::ScriptedSyntheticChildrenSP &typefilter_impl_sp);
lldb::ScriptedSyntheticChildrenSP m_opaque_sp;
SBTypeSynthetic (const lldb::ScriptedSyntheticChildrenSP &);
bool
CopyOnWrite_Impl();
};
} // namespace lldb
#endif // LLDB_DISABLE_PYTHON

View File

@ -1,4 +1,5 @@
//===-- SBUnixSignals.h -----------------------------------------------*- C++ -*-===//
//===-- SBUnixSignals.h -----------------------------------------------*- C++
//-*-===//
//
// The LLVM Compiler Infrastructure
//
@ -16,72 +17,54 @@ namespace lldb {
class LLDB_API SBUnixSignals {
public:
SBUnixSignals ();
SBUnixSignals();
SBUnixSignals (const lldb::SBUnixSignals &rhs);
SBUnixSignals(const lldb::SBUnixSignals &rhs);
~SBUnixSignals();
~SBUnixSignals();
const SBUnixSignals &
operator =(const lldb::SBUnixSignals &rhs);
const SBUnixSignals &operator=(const lldb::SBUnixSignals &rhs);
void
Clear ();
void Clear();
bool
IsValid () const;
bool IsValid() const;
const char *
GetSignalAsCString (int32_t signo) const;
const char *GetSignalAsCString(int32_t signo) const;
int32_t
GetSignalNumberFromName (const char *name) const;
int32_t GetSignalNumberFromName(const char *name) const;
bool
GetShouldSuppress (int32_t signo) const;
bool GetShouldSuppress(int32_t signo) const;
bool
SetShouldSuppress (int32_t signo,
bool value);
bool SetShouldSuppress(int32_t signo, bool value);
bool
GetShouldStop (int32_t signo) const;
bool GetShouldStop(int32_t signo) const;
bool
SetShouldStop (int32_t signo,
bool value);
bool SetShouldStop(int32_t signo, bool value);
bool
GetShouldNotify (int32_t signo) const;
bool GetShouldNotify(int32_t signo) const;
bool
SetShouldNotify (int32_t signo, bool value);
bool SetShouldNotify(int32_t signo, bool value);
int32_t
GetNumSignals () const;
int32_t GetNumSignals() const;
int32_t
GetSignalAtIndex (int32_t index) const;
int32_t GetSignalAtIndex(int32_t index) const;
protected:
friend class SBProcess;
friend class SBPlatform;
friend class SBProcess;
friend class SBPlatform;
SBUnixSignals(lldb::ProcessSP &process_sp);
SBUnixSignals(lldb::ProcessSP &process_sp);
SBUnixSignals(lldb::PlatformSP &platform_sp);
SBUnixSignals(lldb::PlatformSP &platform_sp);
lldb::UnixSignalsSP
GetSP() const;
lldb::UnixSignalsSP GetSP() const;
void
SetSP(const lldb::UnixSignalsSP &signals_sp);
void SetSP(const lldb::UnixSignalsSP &signals_sp);
private:
lldb::UnixSignalsWP m_opaque_wp;
lldb::UnixSignalsWP m_opaque_wp;
};
} // namespace lldb
#endif // LLDB_SBUnixSignals_h_

View File

@ -19,498 +19,428 @@ class ValueLocker;
namespace lldb {
class LLDB_API SBValue
{
class LLDB_API SBValue {
public:
SBValue ();
SBValue();
SBValue (const lldb::SBValue &rhs);
SBValue(const lldb::SBValue &rhs);
lldb::SBValue &
operator =(const lldb::SBValue &rhs);
~SBValue ();
lldb::SBValue &operator=(const lldb::SBValue &rhs);
bool
IsValid();
void
Clear();
SBError
GetError();
~SBValue();
lldb::user_id_t
GetID ();
const char *
GetName();
bool IsValid();
const char *
GetTypeName ();
const char *
GetDisplayTypeName ();
void Clear();
size_t
GetByteSize ();
SBError GetError();
bool
IsInScope ();
lldb::user_id_t GetID();
lldb::Format
GetFormat ();
void
SetFormat (lldb::Format format);
const char *GetName();
const char *
GetValue ();
const char *GetTypeName();
int64_t
GetValueAsSigned (lldb::SBError& error, int64_t fail_value=0);
uint64_t
GetValueAsUnsigned (lldb::SBError& error, uint64_t fail_value=0);
int64_t
GetValueAsSigned(int64_t fail_value=0);
uint64_t
GetValueAsUnsigned(uint64_t fail_value=0);
const char *GetDisplayTypeName();
ValueType
GetValueType ();
size_t GetByteSize();
// If you call this on a newly created ValueObject, it will always return false.
bool
GetValueDidChange ();
bool IsInScope();
const char *
GetSummary ();
const char *
GetSummary (lldb::SBStream& stream,
lldb::SBTypeSummaryOptions& options);
const char *
GetObjectDescription ();
const char *
GetTypeValidatorResult ();
lldb::SBValue
GetDynamicValue (lldb::DynamicValueType use_dynamic);
lldb::SBValue
GetStaticValue ();
lldb::SBValue
GetNonSyntheticValue ();
lldb::DynamicValueType
GetPreferDynamicValue ();
void
SetPreferDynamicValue (lldb::DynamicValueType use_dynamic);
bool
GetPreferSyntheticValue ();
void
SetPreferSyntheticValue (bool use_synthetic);
bool
IsDynamic ();
bool
IsSynthetic ();
bool
IsSyntheticChildrenGenerated ();
void
SetSyntheticChildrenGenerated (bool);
lldb::Format GetFormat();
const char *
GetLocation ();
void SetFormat(lldb::Format format);
// Deprecated - use the one that takes SBError&
bool
SetValueFromCString (const char *value_str);
const char *GetValue();
bool
SetValueFromCString (const char *value_str, lldb::SBError& error);
lldb::SBTypeFormat
GetTypeFormat ();
lldb::SBTypeSummary
GetTypeSummary ();
int64_t GetValueAsSigned(lldb::SBError &error, int64_t fail_value = 0);
uint64_t GetValueAsUnsigned(lldb::SBError &error, uint64_t fail_value = 0);
int64_t GetValueAsSigned(int64_t fail_value = 0);
uint64_t GetValueAsUnsigned(uint64_t fail_value = 0);
ValueType GetValueType();
// If you call this on a newly created ValueObject, it will always return
// false.
bool GetValueDidChange();
const char *GetSummary();
const char *GetSummary(lldb::SBStream &stream,
lldb::SBTypeSummaryOptions &options);
const char *GetObjectDescription();
const char *GetTypeValidatorResult();
lldb::SBValue GetDynamicValue(lldb::DynamicValueType use_dynamic);
lldb::SBValue GetStaticValue();
lldb::SBValue GetNonSyntheticValue();
lldb::DynamicValueType GetPreferDynamicValue();
void SetPreferDynamicValue(lldb::DynamicValueType use_dynamic);
bool GetPreferSyntheticValue();
void SetPreferSyntheticValue(bool use_synthetic);
bool IsDynamic();
bool IsSynthetic();
bool IsSyntheticChildrenGenerated();
void SetSyntheticChildrenGenerated(bool);
const char *GetLocation();
// Deprecated - use the one that takes SBError&
bool SetValueFromCString(const char *value_str);
bool SetValueFromCString(const char *value_str, lldb::SBError &error);
lldb::SBTypeFormat GetTypeFormat();
lldb::SBTypeSummary GetTypeSummary();
lldb::SBTypeFilter GetTypeFilter();
lldb::SBTypeFilter
GetTypeFilter ();
#ifndef LLDB_DISABLE_PYTHON
lldb::SBTypeSynthetic
GetTypeSynthetic ();
lldb::SBTypeSynthetic GetTypeSynthetic();
#endif
lldb::SBValue
GetChildAtIndex (uint32_t idx);
lldb::SBValue
CreateChildAtOffset (const char *name, uint32_t offset, lldb::SBType type);
// Deprecated - use the expression evaluator to perform type casting
lldb::SBValue
Cast (lldb::SBType type);
lldb::SBValue
CreateValueFromExpression (const char *name, const char* expression);
lldb::SBValue
CreateValueFromExpression (const char *name, const char* expression, SBExpressionOptions &options);
lldb::SBValue
CreateValueFromAddress (const char* name,
lldb::addr_t address,
lldb::SBType type);
// this has no address! GetAddress() and GetLoadAddress() as well as AddressOf()
// on the return of this call all return invalid
lldb::SBValue
CreateValueFromData (const char* name,
lldb::SBData data,
lldb::SBType type);
lldb::SBValue GetChildAtIndex(uint32_t idx);
//------------------------------------------------------------------
/// Get a child value by index from a value.
///
/// Structs, unions, classes, arrays and pointers have child
/// values that can be access by index.
///
/// Structs and unions access child members using a zero based index
/// for each child member. For
///
/// Classes reserve the first indexes for base classes that have
/// members (empty base classes are omitted), and all members of the
/// current class will then follow the base classes.
///
/// Pointers differ depending on what they point to. If the pointer
/// points to a simple type, the child at index zero
/// is the only child value available, unless \a synthetic_allowed
/// is \b true, in which case the pointer will be used as an array
/// and can create 'synthetic' child values using positive or
/// negative indexes. If the pointer points to an aggregate type
/// (an array, class, union, struct), then the pointee is
/// transparently skipped and any children are going to be the indexes
/// of the child values within the aggregate type. For example if
/// we have a 'Point' type and we have a SBValue that contains a
/// pointer to a 'Point' type, then the child at index zero will be
/// the 'x' member, and the child at index 1 will be the 'y' member
/// (the child at index zero won't be a 'Point' instance).
///
/// If you actually need an SBValue that represents the type pointed
/// to by a SBValue for which GetType().IsPointeeType() returns true,
/// regardless of the pointee type, you can do that with SBValue::Dereference.
///
/// Arrays have a preset number of children that can be accessed by
/// index and will returns invalid child values for indexes that are
/// out of bounds unless the \a synthetic_allowed is \b true. In this
/// case the array can create 'synthetic' child values for indexes
/// that aren't in the array bounds using positive or negative
/// indexes.
///
/// @param[in] idx
/// The index of the child value to get
///
/// @param[in] use_dynamic
/// An enumeration that specifies whether to get dynamic values,
/// and also if the target can be run to figure out the dynamic
/// type of the child value.
///
/// @param[in] can_create_synthetic
/// If \b true, then allow child values to be created by index
/// for pointers and arrays for indexes that normally wouldn't
/// be allowed.
///
/// @return
/// A new SBValue object that represents the child member value.
//------------------------------------------------------------------
lldb::SBValue
GetChildAtIndex (uint32_t idx,
lldb::DynamicValueType use_dynamic,
bool can_create_synthetic);
lldb::SBValue CreateChildAtOffset(const char *name, uint32_t offset,
lldb::SBType type);
// Matches children of this object only and will match base classes and
// member names if this is a clang typed object.
uint32_t
GetIndexOfChildWithName (const char *name);
// Deprecated - use the expression evaluator to perform type casting
lldb::SBValue Cast(lldb::SBType type);
// Matches child members of this object and child members of any base
// classes.
lldb::SBValue
GetChildMemberWithName (const char *name);
lldb::SBValue CreateValueFromExpression(const char *name,
const char *expression);
// Matches child members of this object and child members of any base
// classes.
lldb::SBValue
GetChildMemberWithName (const char *name, lldb::DynamicValueType use_dynamic);
// Expands nested expressions like .a->b[0].c[1]->d
lldb::SBValue
GetValueForExpressionPath(const char* expr_path);
lldb::SBValue
AddressOf();
lldb::addr_t
GetLoadAddress();
lldb::SBAddress
GetAddress();
lldb::SBValue CreateValueFromExpression(const char *name,
const char *expression,
SBExpressionOptions &options);
//------------------------------------------------------------------
/// Get an SBData wrapping what this SBValue points to.
///
/// This method will dereference the current SBValue, if its
/// data type is a T* or T[], and extract item_count elements
/// of type T from it, copying their contents in an SBData.
///
/// @param[in] item_idx
/// The index of the first item to retrieve. For an array
/// this is equivalent to array[item_idx], for a pointer
/// to *(pointer + item_idx). In either case, the measurement
/// unit for item_idx is the sizeof(T) rather than the byte
///
/// @param[in] item_count
/// How many items should be copied into the output. By default
/// only one item is copied, but more can be asked for.
///
/// @return
/// An SBData with the contents of the copied items, on success.
/// An empty SBData otherwise.
//------------------------------------------------------------------
lldb::SBData
GetPointeeData (uint32_t item_idx = 0,
uint32_t item_count = 1);
//------------------------------------------------------------------
/// Get an SBData wrapping the contents of this SBValue.
///
/// This method will read the contents of this object in memory
/// and copy them into an SBData for future use.
///
/// @return
/// An SBData with the contents of this SBValue, on success.
/// An empty SBData otherwise.
//------------------------------------------------------------------
lldb::SBData
GetData ();
bool
SetData (lldb::SBData &data, lldb::SBError& error);
lldb::SBDeclaration
GetDeclaration ();
//------------------------------------------------------------------
/// Find out if a SBValue might have children.
///
/// This call is much more efficient than GetNumChildren() as it
/// doesn't need to complete the underlying type. This is designed
/// to be used in a UI environment in order to detect if the
/// disclosure triangle should be displayed or not.
///
/// This function returns true for class, union, structure,
/// pointers, references, arrays and more. Again, it does so without
/// doing any expensive type completion.
///
/// @return
/// Returns \b true if the SBValue might have children, or \b
/// false otherwise.
//------------------------------------------------------------------
bool
MightHaveChildren ();
bool
IsRuntimeSupportValue ();
lldb::SBValue CreateValueFromAddress(const char *name, lldb::addr_t address,
lldb::SBType type);
uint32_t
GetNumChildren ();
// this has no address! GetAddress() and GetLoadAddress() as well as
// AddressOf()
// on the return of this call all return invalid
lldb::SBValue CreateValueFromData(const char *name, lldb::SBData data,
lldb::SBType type);
uint32_t
GetNumChildren (uint32_t max);
//------------------------------------------------------------------
/// Get a child value by index from a value.
///
/// Structs, unions, classes, arrays and pointers have child
/// values that can be access by index.
///
/// Structs and unions access child members using a zero based index
/// for each child member. For
///
/// Classes reserve the first indexes for base classes that have
/// members (empty base classes are omitted), and all members of the
/// current class will then follow the base classes.
///
/// Pointers differ depending on what they point to. If the pointer
/// points to a simple type, the child at index zero
/// is the only child value available, unless \a synthetic_allowed
/// is \b true, in which case the pointer will be used as an array
/// and can create 'synthetic' child values using positive or
/// negative indexes. If the pointer points to an aggregate type
/// (an array, class, union, struct), then the pointee is
/// transparently skipped and any children are going to be the indexes
/// of the child values within the aggregate type. For example if
/// we have a 'Point' type and we have a SBValue that contains a
/// pointer to a 'Point' type, then the child at index zero will be
/// the 'x' member, and the child at index 1 will be the 'y' member
/// (the child at index zero won't be a 'Point' instance).
///
/// If you actually need an SBValue that represents the type pointed
/// to by a SBValue for which GetType().IsPointeeType() returns true,
/// regardless of the pointee type, you can do that with SBValue::Dereference.
///
/// Arrays have a preset number of children that can be accessed by
/// index and will returns invalid child values for indexes that are
/// out of bounds unless the \a synthetic_allowed is \b true. In this
/// case the array can create 'synthetic' child values for indexes
/// that aren't in the array bounds using positive or negative
/// indexes.
///
/// @param[in] idx
/// The index of the child value to get
///
/// @param[in] use_dynamic
/// An enumeration that specifies whether to get dynamic values,
/// and also if the target can be run to figure out the dynamic
/// type of the child value.
///
/// @param[in] can_create_synthetic
/// If \b true, then allow child values to be created by index
/// for pointers and arrays for indexes that normally wouldn't
/// be allowed.
///
/// @return
/// A new SBValue object that represents the child member value.
//------------------------------------------------------------------
lldb::SBValue GetChildAtIndex(uint32_t idx,
lldb::DynamicValueType use_dynamic,
bool can_create_synthetic);
void *
GetOpaqueType();
// Matches children of this object only and will match base classes and
// member names if this is a clang typed object.
uint32_t GetIndexOfChildWithName(const char *name);
lldb::SBTarget
GetTarget();
lldb::SBProcess
GetProcess();
lldb::SBThread
GetThread();
// Matches child members of this object and child members of any base
// classes.
lldb::SBValue GetChildMemberWithName(const char *name);
lldb::SBFrame
GetFrame();
lldb::SBValue
Dereference ();
// Matches child members of this object and child members of any base
// classes.
lldb::SBValue GetChildMemberWithName(const char *name,
lldb::DynamicValueType use_dynamic);
// Deprecated - please use GetType().IsPointerType() instead.
bool
TypeIsPointerType ();
lldb::SBType
GetType();
lldb::SBValue
Persist ();
// Expands nested expressions like .a->b[0].c[1]->d
lldb::SBValue GetValueForExpressionPath(const char *expr_path);
bool
GetDescription (lldb::SBStream &description);
lldb::SBValue AddressOf();
bool
GetExpressionPath (lldb::SBStream &description);
bool
GetExpressionPath (lldb::SBStream &description,
bool qualify_cxx_base_classes);
lldb::addr_t GetLoadAddress();
SBValue (const lldb::ValueObjectSP &value_sp);
lldb::SBAddress GetAddress();
//------------------------------------------------------------------
/// Watch this value if it resides in memory.
///
/// Sets a watchpoint on the value.
///
/// @param[in] resolve_location
/// Resolve the location of this value once and watch its address.
/// This value must currently be set to \b true as watching all
/// locations of a variable or a variable path is not yet supported,
/// though we plan to support it in the future.
///
/// @param[in] read
/// Stop when this value is accessed.
///
/// @param[in] write
/// Stop when this value is modified
///
/// @param[out] error
/// An error object. Contains the reason if there is some failure.
///
/// @return
/// An SBWatchpoint object. This object might not be valid upon
/// return due to a value not being contained in memory, too
/// large, or watchpoint resources are not available or all in
/// use.
//------------------------------------------------------------------
lldb::SBWatchpoint
Watch (bool resolve_location, bool read, bool write, SBError &error);
//------------------------------------------------------------------
/// Get an SBData wrapping what this SBValue points to.
///
/// This method will dereference the current SBValue, if its
/// data type is a T* or T[], and extract item_count elements
/// of type T from it, copying their contents in an SBData.
///
/// @param[in] item_idx
/// The index of the first item to retrieve. For an array
/// this is equivalent to array[item_idx], for a pointer
/// to *(pointer + item_idx). In either case, the measurement
/// unit for item_idx is the sizeof(T) rather than the byte
///
/// @param[in] item_count
/// How many items should be copied into the output. By default
/// only one item is copied, but more can be asked for.
///
/// @return
/// An SBData with the contents of the copied items, on success.
/// An empty SBData otherwise.
//------------------------------------------------------------------
lldb::SBData GetPointeeData(uint32_t item_idx = 0, uint32_t item_count = 1);
// Backward compatibility fix in the interim.
lldb::SBWatchpoint
Watch (bool resolve_location, bool read, bool write);
//------------------------------------------------------------------
/// Get an SBData wrapping the contents of this SBValue.
///
/// This method will read the contents of this object in memory
/// and copy them into an SBData for future use.
///
/// @return
/// An SBData with the contents of this SBValue, on success.
/// An empty SBData otherwise.
//------------------------------------------------------------------
lldb::SBData GetData();
//------------------------------------------------------------------
/// Watch this value that this value points to in memory
///
/// Sets a watchpoint on the value.
///
/// @param[in] resolve_location
/// Resolve the location of this value once and watch its address.
/// This value must currently be set to \b true as watching all
/// locations of a variable or a variable path is not yet supported,
/// though we plan to support it in the future.
///
/// @param[in] read
/// Stop when this value is accessed.
///
/// @param[in] write
/// Stop when this value is modified
///
/// @param[out] error
/// An error object. Contains the reason if there is some failure.
///
/// @return
/// An SBWatchpoint object. This object might not be valid upon
/// return due to a value not being contained in memory, too
/// large, or watchpoint resources are not available or all in
/// use.
//------------------------------------------------------------------
lldb::SBWatchpoint
WatchPointee (bool resolve_location, bool read, bool write, SBError &error);
bool SetData(lldb::SBData &data, lldb::SBError &error);
//------------------------------------------------------------------
/// Same as the protected version of GetSP that takes a locker, except that we make the
/// locker locally in the function. Since the Target API mutex is recursive, and the
/// StopLocker is a read lock, you can call this function even if you are already
/// holding the two above-mentioned locks.
///
/// @return
/// A ValueObjectSP of the best kind (static, dynamic or synthetic) we
/// can cons up, in accordance with the SBValue's settings.
//------------------------------------------------------------------
lldb::ValueObjectSP
GetSP () const;
lldb::SBDeclaration GetDeclaration();
//------------------------------------------------------------------
/// Find out if a SBValue might have children.
///
/// This call is much more efficient than GetNumChildren() as it
/// doesn't need to complete the underlying type. This is designed
/// to be used in a UI environment in order to detect if the
/// disclosure triangle should be displayed or not.
///
/// This function returns true for class, union, structure,
/// pointers, references, arrays and more. Again, it does so without
/// doing any expensive type completion.
///
/// @return
/// Returns \b true if the SBValue might have children, or \b
/// false otherwise.
//------------------------------------------------------------------
bool MightHaveChildren();
bool IsRuntimeSupportValue();
uint32_t GetNumChildren();
uint32_t GetNumChildren(uint32_t max);
void *GetOpaqueType();
lldb::SBTarget GetTarget();
lldb::SBProcess GetProcess();
lldb::SBThread GetThread();
lldb::SBFrame GetFrame();
lldb::SBValue Dereference();
// Deprecated - please use GetType().IsPointerType() instead.
bool TypeIsPointerType();
lldb::SBType GetType();
lldb::SBValue Persist();
bool GetDescription(lldb::SBStream &description);
bool GetExpressionPath(lldb::SBStream &description);
bool GetExpressionPath(lldb::SBStream &description,
bool qualify_cxx_base_classes);
SBValue(const lldb::ValueObjectSP &value_sp);
//------------------------------------------------------------------
/// Watch this value if it resides in memory.
///
/// Sets a watchpoint on the value.
///
/// @param[in] resolve_location
/// Resolve the location of this value once and watch its address.
/// This value must currently be set to \b true as watching all
/// locations of a variable or a variable path is not yet supported,
/// though we plan to support it in the future.
///
/// @param[in] read
/// Stop when this value is accessed.
///
/// @param[in] write
/// Stop when this value is modified
///
/// @param[out] error
/// An error object. Contains the reason if there is some failure.
///
/// @return
/// An SBWatchpoint object. This object might not be valid upon
/// return due to a value not being contained in memory, too
/// large, or watchpoint resources are not available or all in
/// use.
//------------------------------------------------------------------
lldb::SBWatchpoint Watch(bool resolve_location, bool read, bool write,
SBError &error);
// Backward compatibility fix in the interim.
lldb::SBWatchpoint Watch(bool resolve_location, bool read, bool write);
//------------------------------------------------------------------
/// Watch this value that this value points to in memory
///
/// Sets a watchpoint on the value.
///
/// @param[in] resolve_location
/// Resolve the location of this value once and watch its address.
/// This value must currently be set to \b true as watching all
/// locations of a variable or a variable path is not yet supported,
/// though we plan to support it in the future.
///
/// @param[in] read
/// Stop when this value is accessed.
///
/// @param[in] write
/// Stop when this value is modified
///
/// @param[out] error
/// An error object. Contains the reason if there is some failure.
///
/// @return
/// An SBWatchpoint object. This object might not be valid upon
/// return due to a value not being contained in memory, too
/// large, or watchpoint resources are not available or all in
/// use.
//------------------------------------------------------------------
lldb::SBWatchpoint WatchPointee(bool resolve_location, bool read, bool write,
SBError &error);
//------------------------------------------------------------------
/// Same as the protected version of GetSP that takes a locker, except that we
/// make the
/// locker locally in the function. Since the Target API mutex is recursive,
/// and the
/// StopLocker is a read lock, you can call this function even if you are
/// already
/// holding the two above-mentioned locks.
///
/// @return
/// A ValueObjectSP of the best kind (static, dynamic or synthetic) we
/// can cons up, in accordance with the SBValue's settings.
//------------------------------------------------------------------
lldb::ValueObjectSP GetSP() const;
protected:
friend class SBBlock;
friend class SBFrame;
friend class SBTarget;
friend class SBThread;
friend class SBValueList;
friend class SBBlock;
friend class SBFrame;
friend class SBTarget;
friend class SBThread;
friend class SBValueList;
//------------------------------------------------------------------
/// Get the appropriate ValueObjectSP from this SBValue, consulting the
/// use_dynamic and use_synthetic options passed in to SetSP when the
/// SBValue's contents were set. Since this often requires examining memory,
/// and maybe even running code, it needs to acquire the Target API and Process StopLock.
/// Those are held in an opaque class ValueLocker which is currently local to SBValue.cpp.
/// So you don't have to get these yourself just default construct a ValueLocker, and pass it into this.
/// If we need to make a ValueLocker and use it in some other .cpp file, we'll have to move it to
/// ValueObject.h/cpp or somewhere else convenient. We haven't needed to so far.
///
/// @param[in] value_locker
/// An object that will hold the Target API, and Process RunLocks, and
/// auto-destroy them when it goes out of scope. Currently this is only useful in
/// SBValue.cpp.
///
/// @return
/// A ValueObjectSP of the best kind (static, dynamic or synthetic) we
/// can cons up, in accordance with the SBValue's settings.
//------------------------------------------------------------------
lldb::ValueObjectSP
GetSP (ValueLocker &value_locker) const;
// these calls do the right thing WRT adjusting their settings according to the target's preferences
void
SetSP (const lldb::ValueObjectSP &sp);
//------------------------------------------------------------------
/// Get the appropriate ValueObjectSP from this SBValue, consulting the
/// use_dynamic and use_synthetic options passed in to SetSP when the
/// SBValue's contents were set. Since this often requires examining memory,
/// and maybe even running code, it needs to acquire the Target API and
/// Process StopLock.
/// Those are held in an opaque class ValueLocker which is currently local to
/// SBValue.cpp.
/// So you don't have to get these yourself just default construct a
/// ValueLocker, and pass it into this.
/// If we need to make a ValueLocker and use it in some other .cpp file, we'll
/// have to move it to
/// ValueObject.h/cpp or somewhere else convenient. We haven't needed to so
/// far.
///
/// @param[in] value_locker
/// An object that will hold the Target API, and Process RunLocks, and
/// auto-destroy them when it goes out of scope. Currently this is only
/// useful in
/// SBValue.cpp.
///
/// @return
/// A ValueObjectSP of the best kind (static, dynamic or synthetic) we
/// can cons up, in accordance with the SBValue's settings.
//------------------------------------------------------------------
lldb::ValueObjectSP GetSP(ValueLocker &value_locker) const;
void
SetSP (const lldb::ValueObjectSP &sp, bool use_synthetic);
void
SetSP (const lldb::ValueObjectSP &sp, lldb::DynamicValueType use_dynamic);
// these calls do the right thing WRT adjusting their settings according to
// the target's preferences
void SetSP(const lldb::ValueObjectSP &sp);
void SetSP(const lldb::ValueObjectSP &sp, bool use_synthetic);
void SetSP(const lldb::ValueObjectSP &sp, lldb::DynamicValueType use_dynamic);
void SetSP(const lldb::ValueObjectSP &sp, lldb::DynamicValueType use_dynamic,
bool use_synthetic);
void SetSP(const lldb::ValueObjectSP &sp, lldb::DynamicValueType use_dynamic,
bool use_synthetic, const char *name);
void
SetSP (const lldb::ValueObjectSP &sp, lldb::DynamicValueType use_dynamic, bool use_synthetic);
void
SetSP (const lldb::ValueObjectSP &sp, lldb::DynamicValueType use_dynamic, bool use_synthetic, const char *name);
private:
typedef std::shared_ptr<ValueImpl> ValueImplSP;
ValueImplSP m_opaque_sp;
void
SetSP (ValueImplSP impl_sp);
typedef std::shared_ptr<ValueImpl> ValueImplSP;
ValueImplSP m_opaque_sp;
void SetSP(ValueImplSP impl_sp);
};
} // namespace lldb
#endif // LLDB_SBValue_h_
#endif // LLDB_SBValue_h_

View File

@ -16,81 +16,59 @@ class ValueListImpl;
namespace lldb {
class LLDB_API SBValueList
{
class LLDB_API SBValueList {
public:
SBValueList();
SBValueList ();
SBValueList(const lldb::SBValueList &rhs);
SBValueList (const lldb::SBValueList &rhs);
~SBValueList();
~SBValueList();
bool IsValid() const;
bool
IsValid() const;
void
Clear();
void Clear();
void
Append (const lldb::SBValue &val_obj);
void Append(const lldb::SBValue &val_obj);
void
Append (const lldb::SBValueList& value_list);
void Append(const lldb::SBValueList &value_list);
uint32_t
GetSize() const;
uint32_t GetSize() const;
lldb::SBValue
GetValueAtIndex (uint32_t idx) const;
lldb::SBValue
GetFirstValueByName (const char* name) const;
lldb::SBValue GetValueAtIndex(uint32_t idx) const;
lldb::SBValue
FindValueObjectByUID (lldb::user_id_t uid);
lldb::SBValue GetFirstValueByName(const char *name) const;
const lldb::SBValueList &
operator = (const lldb::SBValueList &rhs);
lldb::SBValue FindValueObjectByUID(lldb::user_id_t uid);
const lldb::SBValueList &operator=(const lldb::SBValueList &rhs);
protected:
// only useful for visualizing the pointer or comparing two SBValueLists
// to see if they are backed by the same underlying Impl.
void *
opaque_ptr ();
// only useful for visualizing the pointer or comparing two SBValueLists
// to see if they are backed by the same underlying Impl.
void *opaque_ptr();
private:
friend class SBFrame;
SBValueList (const ValueListImpl *lldb_object_ptr);
friend class SBFrame;
void
Append (lldb::ValueObjectSP& val_obj_sp);
SBValueList(const ValueListImpl *lldb_object_ptr);
void
CreateIfNeeded ();
void Append(lldb::ValueObjectSP &val_obj_sp);
ValueListImpl *
operator -> ();
ValueListImpl &
operator* ();
const ValueListImpl *
operator -> () const;
const ValueListImpl &
operator* () const;
ValueListImpl &
ref ();
std::unique_ptr<ValueListImpl> m_opaque_ap;
void CreateIfNeeded();
ValueListImpl *operator->();
ValueListImpl &operator*();
const ValueListImpl *operator->() const;
const ValueListImpl &operator*() const;
ValueListImpl &ref();
std::unique_ptr<ValueListImpl> m_opaque_ap;
};
} // namespace lldb
#endif // LLDB_SBValueList_h_
#endif // LLDB_SBValueList_h_

View File

@ -1,4 +1,5 @@
//===-- SBVariablesOptions.h ------------------------------------------*- C++ -*-===//
//===-- SBVariablesOptions.h ------------------------------------------*- C++
//-*-===//
//
// The LLVM Compiler Infrastructure
//
@ -16,83 +17,61 @@ class VariablesOptionsImpl;
namespace lldb {
class LLDB_API SBVariablesOptions
{
class LLDB_API SBVariablesOptions {
public:
SBVariablesOptions ();
SBVariablesOptions (const SBVariablesOptions& options);
SBVariablesOptions&
operator = (const SBVariablesOptions& options);
~SBVariablesOptions ();
bool
IsValid () const;
bool
GetIncludeArguments () const;
void
SetIncludeArguments (bool);
bool
GetIncludeLocals () const;
void
SetIncludeLocals (bool);
bool
GetIncludeStatics () const;
void
SetIncludeStatics (bool);
bool
GetInScopeOnly () const;
void
SetInScopeOnly (bool);
bool
GetIncludeRuntimeSupportValues () const;
void
SetIncludeRuntimeSupportValues (bool);
lldb::DynamicValueType
GetUseDynamic () const;
void
SetUseDynamic (lldb::DynamicValueType);
SBVariablesOptions();
SBVariablesOptions(const SBVariablesOptions &options);
SBVariablesOptions &operator=(const SBVariablesOptions &options);
~SBVariablesOptions();
bool IsValid() const;
bool GetIncludeArguments() const;
void SetIncludeArguments(bool);
bool GetIncludeLocals() const;
void SetIncludeLocals(bool);
bool GetIncludeStatics() const;
void SetIncludeStatics(bool);
bool GetInScopeOnly() const;
void SetInScopeOnly(bool);
bool GetIncludeRuntimeSupportValues() const;
void SetIncludeRuntimeSupportValues(bool);
lldb::DynamicValueType GetUseDynamic() const;
void SetUseDynamic(lldb::DynamicValueType);
protected:
VariablesOptionsImpl *
operator->();
const VariablesOptionsImpl *
operator->() const;
VariablesOptionsImpl *
get ();
VariablesOptionsImpl &
ref();
const VariablesOptionsImpl &
ref() const;
SBVariablesOptions (VariablesOptionsImpl *lldb_object_ptr);
void
SetOptions (VariablesOptionsImpl *lldb_object_ptr);
VariablesOptionsImpl *operator->();
const VariablesOptionsImpl *operator->() const;
VariablesOptionsImpl *get();
VariablesOptionsImpl &ref();
const VariablesOptionsImpl &ref() const;
SBVariablesOptions(VariablesOptionsImpl *lldb_object_ptr);
void SetOptions(VariablesOptionsImpl *lldb_object_ptr);
private:
std::unique_ptr<VariablesOptionsImpl> m_opaque_ap;
std::unique_ptr<VariablesOptionsImpl> m_opaque_ap;
};
} // namespace lldb
#endif // LLDB_SBValue_h_
#endif // LLDB_SBValue_h_

View File

@ -14,91 +14,67 @@
namespace lldb {
class LLDB_API SBWatchpoint
{
class LLDB_API SBWatchpoint {
public:
SBWatchpoint();
SBWatchpoint ();
SBWatchpoint(const lldb::SBWatchpoint &rhs);
SBWatchpoint (const lldb::SBWatchpoint &rhs);
SBWatchpoint(const lldb::WatchpointSP &wp_sp);
SBWatchpoint (const lldb::WatchpointSP &wp_sp);
~SBWatchpoint();
~SBWatchpoint ();
const lldb::SBWatchpoint &operator=(const lldb::SBWatchpoint &rhs);
const lldb::SBWatchpoint &
operator = (const lldb::SBWatchpoint &rhs);
bool IsValid() const;
bool
IsValid() const;
SBError GetError();
SBError
GetError();
watch_id_t GetID();
watch_id_t
GetID ();
/// With -1 representing an invalid hardware index.
int32_t GetHardwareIndex();
/// With -1 representing an invalid hardware index.
int32_t
GetHardwareIndex ();
lldb::addr_t GetWatchAddress();
lldb::addr_t
GetWatchAddress ();
size_t GetWatchSize();
size_t
GetWatchSize();
void SetEnabled(bool enabled);
void
SetEnabled(bool enabled);
bool IsEnabled();
bool
IsEnabled ();
uint32_t GetHitCount();
uint32_t
GetHitCount ();
uint32_t GetIgnoreCount();
uint32_t
GetIgnoreCount ();
void SetIgnoreCount(uint32_t n);
void
SetIgnoreCount (uint32_t n);
const char *GetCondition();
const char *
GetCondition ();
void SetCondition(const char *condition);
void
SetCondition (const char *condition);
bool
GetDescription (lldb::SBStream &description, DescriptionLevel level);
bool GetDescription(lldb::SBStream &description, DescriptionLevel level);
void
Clear ();
void Clear();
lldb::WatchpointSP
GetSP () const;
lldb::WatchpointSP GetSP() const;
void
SetSP (const lldb::WatchpointSP &sp);
void SetSP(const lldb::WatchpointSP &sp);
static bool
EventIsWatchpointEvent (const lldb::SBEvent &event);
static lldb::WatchpointEventType
GetWatchpointEventTypeFromEvent (const lldb::SBEvent& event);
static bool EventIsWatchpointEvent(const lldb::SBEvent &event);
static lldb::SBWatchpoint
GetWatchpointFromEvent (const lldb::SBEvent& event);
static lldb::WatchpointEventType
GetWatchpointEventTypeFromEvent(const lldb::SBEvent &event);
static lldb::SBWatchpoint GetWatchpointFromEvent(const lldb::SBEvent &event);
private:
friend class SBTarget;
friend class SBValue;
lldb::WatchpointSP m_opaque_sp;
friend class SBTarget;
friend class SBValue;
lldb::WatchpointSP m_opaque_sp;
};
} // namespace lldb
#endif // LLDB_SBWatchpoint_h_
#endif // LLDB_SBWatchpoint_h_

View File

@ -12,8 +12,7 @@
#include "lldb/Initialization/SystemInitializerCommon.h"
namespace lldb_private
{
namespace lldb_private {
//------------------------------------------------------------------
/// Initializes lldb.
///
@ -22,17 +21,16 @@ namespace lldb_private
/// not intended to be used externally, but is instead used
/// internally by SBDebugger to initialize the system.
//------------------------------------------------------------------
class SystemInitializerFull : public SystemInitializerCommon
{
public:
SystemInitializerFull();
~SystemInitializerFull() override;
class SystemInitializerFull : public SystemInitializerCommon {
public:
SystemInitializerFull();
~SystemInitializerFull() override;
void Initialize() override;
void Terminate() override;
void Initialize() override;
void Terminate() override;
private:
void InitializeSWIG();
private:
void InitializeSWIG();
};
} // namespace lldb_private

File diff suppressed because it is too large Load Diff

View File

@ -17,116 +17,95 @@
#include "lldb/lldb-private.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/Optional.h"
#include "llvm/ADT/StringRef.h"
namespace lldb_private {
//----------------------------------------------------------------------
// class BreakpointID
//----------------------------------------------------------------------
class BreakpointID
{
class BreakpointID {
public:
BreakpointID(lldb::break_id_t bp_id = LLDB_INVALID_BREAK_ID,
lldb::break_id_t loc_id = LLDB_INVALID_BREAK_ID);
BreakpointID (lldb::break_id_t bp_id = LLDB_INVALID_BREAK_ID,
lldb::break_id_t loc_id = LLDB_INVALID_BREAK_ID);
virtual ~BreakpointID();
virtual
~BreakpointID ();
lldb::break_id_t GetBreakpointID() const { return m_break_id; }
lldb::break_id_t
GetBreakpointID ()
{
return m_break_id;
}
lldb::break_id_t GetLocationID() const { return m_location_id; }
lldb::break_id_t
GetLocationID ()
{
return m_location_id;
}
void SetID(lldb::break_id_t bp_id, lldb::break_id_t loc_id) {
m_break_id = bp_id;
m_location_id = loc_id;
}
void
SetID (lldb::break_id_t bp_id, lldb::break_id_t loc_id)
{
m_break_id = bp_id;
m_location_id = loc_id;
}
void SetBreakpointID(lldb::break_id_t bp_id) { m_break_id = bp_id; }
void
SetBreakpointID (lldb::break_id_t bp_id)
{
m_break_id = bp_id;
}
void SetBreakpointLocationID(lldb::break_id_t loc_id) {
m_location_id = loc_id;
}
void
SetBreakpointLocationID (lldb::break_id_t loc_id)
{
m_location_id = loc_id;
}
void GetDescription(Stream *s, lldb::DescriptionLevel level);
void
GetDescription (Stream *s, lldb::DescriptionLevel level);
static bool IsRangeIdentifier(llvm::StringRef str);
static bool IsValidIDExpression(llvm::StringRef str);
static llvm::ArrayRef<llvm::StringRef> GetRangeSpecifiers();
static bool
IsRangeIdentifier (const char *str);
//------------------------------------------------------------------
/// Takes an input string containing the description of a breakpoint or
/// breakpoint and location and returns the a BreakpointID filled out with
/// the proper id and location.
///
/// @param[in] input
/// A string containing JUST the breakpoint description.
/// @return
/// If \p input was not a valid breakpoint ID string, returns
/// \b llvm::None. Otherwise returns a BreakpointID with members filled
/// out accordingly.
//------------------------------------------------------------------
static llvm::Optional<BreakpointID>
ParseCanonicalReference(llvm::StringRef input);
static bool
IsValidIDExpression (const char *str);
//------------------------------------------------------------------
/// Takes an input string and checks to see whether it is a breakpoint name.
/// If it is a mal-formed breakpoint name, error will be set to an appropriate
/// error string.
///
/// @param[in] input
/// A string containing JUST the breakpoint description.
/// @param[out] error
/// If the name is a well-formed breakpoint name, set to success,
/// otherwise set to an error.
/// @return
/// \b true if the name is a breakpoint name (as opposed to an ID or
/// range) false otherwise.
//------------------------------------------------------------------
static bool StringIsBreakpointName(llvm::StringRef str, Error &error);
static const char *g_range_specifiers[];
//------------------------------------------------------------------
/// Takes an input string containing the description of a breakpoint or breakpoint and location
/// and returns the breakpoint ID and the breakpoint location id.
///
/// @param[in] input
/// A string containing JUST the breakpoint description.
/// @param[out] break_id
/// This is the break id.
/// @param[out] break_loc_id
/// This is breakpoint location id, or LLDB_INVALID_BREAK_ID is no location was specified.
/// @return
/// \b true if the call was able to extract a breakpoint location from the string. \b false otherwise.
//------------------------------------------------------------------
static bool
ParseCanonicalReference (const char *input, lldb::break_id_t *break_id, lldb::break_id_t *break_loc_id);
//------------------------------------------------------------------
/// Takes an input string and checks to see whether it is a breakpoint name.
/// If it is a mal-formed breakpoint name, error will be set to an appropriate
/// error string.
///
/// @param[in] input
/// A string containing JUST the breakpoint description.
/// @param[out] error
/// If the name is a well-formed breakpoint name, set to success, otherwise set to an error.
/// @return
/// \b true if the name is a breakpoint name (as opposed to an ID or range) false otherwise.
//------------------------------------------------------------------
static bool
StringIsBreakpointName (const char *name, Error &error);
//------------------------------------------------------------------
/// Takes a breakpoint ID and the breakpoint location id and returns
/// a string containing the canonical description for the breakpoint
/// or breakpoint location.
///
/// @param[out] break_id
/// This is the break id.
///
/// @param[out] break_loc_id
/// This is breakpoint location id, or LLDB_INVALID_BREAK_ID is no
/// location is to be specified.
//------------------------------------------------------------------
static void
GetCanonicalReference (Stream *s, lldb::break_id_t break_id, lldb::break_id_t break_loc_id);
//------------------------------------------------------------------
/// Takes a breakpoint ID and the breakpoint location id and returns
/// a string containing the canonical description for the breakpoint
/// or breakpoint location.
///
/// @param[out] break_id
/// This is the break id.
///
/// @param[out] break_loc_id
/// This is breakpoint location id, or LLDB_INVALID_BREAK_ID is no
/// location is to be specified.
//------------------------------------------------------------------
static void GetCanonicalReference(Stream *s, lldb::break_id_t break_id,
lldb::break_id_t break_loc_id);
protected:
lldb::break_id_t m_break_id;
lldb::break_id_t m_location_id;
lldb::break_id_t m_break_id;
lldb::break_id_t m_location_id;
};
} // namespace lldb_private
#endif // liblldb_BreakpointID_h_
#endif // liblldb_BreakpointID_h_

View File

@ -12,13 +12,14 @@
// C Includes
// C++ Includes
#include <utility>
#include <vector>
// Other libraries and framework includes
// Project includes
#include "lldb/lldb-private.h"
#include "lldb/Breakpoint/BreakpointID.h"
#include "lldb/lldb-private.h"
namespace lldb_private {
@ -26,57 +27,53 @@ namespace lldb_private {
// class BreakpointIDList
//----------------------------------------------------------------------
class BreakpointIDList
{
class BreakpointIDList {
public:
typedef std::vector<BreakpointID> BreakpointIDArray;
// TODO: Convert this class to StringRef.
typedef std::vector<BreakpointID> BreakpointIDArray;
BreakpointIDList ();
BreakpointIDList();
virtual
~BreakpointIDList ();
virtual ~BreakpointIDList();
size_t
GetSize();
size_t GetSize() const;
BreakpointID &
GetBreakpointIDAtIndex (size_t index);
const BreakpointID &GetBreakpointIDAtIndex(size_t index) const;
bool
RemoveBreakpointIDAtIndex (size_t index);
bool RemoveBreakpointIDAtIndex(size_t index);
void
Clear();
void Clear();
bool
AddBreakpointID (BreakpointID bp_id);
bool AddBreakpointID(BreakpointID bp_id);
bool
AddBreakpointID (const char *bp_id);
bool AddBreakpointID(const char *bp_id);
bool
FindBreakpointID (BreakpointID &bp_id, size_t *position);
// TODO: This should take a const BreakpointID.
bool FindBreakpointID(BreakpointID &bp_id, size_t *position) const;
bool
FindBreakpointID (const char *bp_id, size_t *position);
bool FindBreakpointID(const char *bp_id, size_t *position) const;
void
InsertStringArray (const char **string_array, size_t array_size, CommandReturnObject &result);
void InsertStringArray(const char **string_array, size_t array_size,
CommandReturnObject &result);
static bool
StringContainsIDRangeExpression (const char *in_string, size_t *range_start_len, size_t *range_end_pos);
// Returns a pair consisting of the beginning and end of a breakpoint
// ID range expression. If the input string is not a valid specification,
// returns an empty pair.
static std::pair<llvm::StringRef, llvm::StringRef>
SplitIDRangeExpression(llvm::StringRef in_string);
static void
FindAndReplaceIDRanges (Args &old_args, Target *target, bool allow_locations, CommandReturnObject &result, Args &new_args);
static void FindAndReplaceIDRanges(Args &old_args, Target *target,
bool allow_locations,
CommandReturnObject &result,
Args &new_args);
private:
BreakpointIDArray m_breakpoint_ids;
BreakpointID m_invalid_id;
BreakpointIDArray m_breakpoint_ids;
BreakpointID m_invalid_id;
DISALLOW_COPY_AND_ASSIGN(BreakpointIDList);
DISALLOW_COPY_AND_ASSIGN(BreakpointIDList);
};
} // namespace lldb_private
#endif // liblldb_BreakpointIDList_h_
#endif // liblldb_BreakpointIDList_h_

View File

@ -31,204 +31,192 @@ namespace lldb_private {
/// Allows adding and removing breakpoints and find by ID and index.
//----------------------------------------------------------------------
class BreakpointList
{
class BreakpointList {
public:
BreakpointList (bool is_internal);
BreakpointList(bool is_internal);
~BreakpointList();
~BreakpointList();
//------------------------------------------------------------------
/// Add the breakpoint \a bp_sp to the list.
///
/// @param[in] bp_sp
/// Shared pointer to the breakpoint that will get added to the list.
///
/// @result
/// Returns breakpoint id.
//------------------------------------------------------------------
lldb::break_id_t
Add (lldb::BreakpointSP& bp_sp, bool notify);
//------------------------------------------------------------------
/// Add the breakpoint \a bp_sp to the list.
///
/// @param[in] bp_sp
/// Shared pointer to the breakpoint that will get added to the list.
///
/// @result
/// Returns breakpoint id.
//------------------------------------------------------------------
lldb::break_id_t Add(lldb::BreakpointSP &bp_sp, bool notify);
//------------------------------------------------------------------
/// Standard "Dump" method. At present it does nothing.
//------------------------------------------------------------------
void
Dump (Stream *s) const;
//------------------------------------------------------------------
/// Standard "Dump" method. At present it does nothing.
//------------------------------------------------------------------
void Dump(Stream *s) const;
//------------------------------------------------------------------
/// Returns a shared pointer to the breakpoint with id \a breakID.
///
/// @param[in] breakID
/// The breakpoint ID to seek for.
///
/// @result
/// A shared pointer to the breakpoint. May contain a NULL pointer if the
/// breakpoint doesn't exist.
//------------------------------------------------------------------
lldb::BreakpointSP
FindBreakpointByID (lldb::break_id_t breakID);
//------------------------------------------------------------------
/// Returns a shared pointer to the breakpoint with id \a breakID.
///
/// @param[in] breakID
/// The breakpoint ID to seek for.
///
/// @result
/// A shared pointer to the breakpoint. May contain a NULL pointer if the
/// breakpoint doesn't exist.
//------------------------------------------------------------------
lldb::BreakpointSP FindBreakpointByID(lldb::break_id_t breakID);
//------------------------------------------------------------------
/// Returns a shared pointer to the breakpoint with id \a breakID. Const version.
///
/// @param[in] breakID
/// The breakpoint ID to seek for.
///
/// @result
/// A shared pointer to the breakpoint. May contain a NULL pointer if the
/// breakpoint doesn't exist.
//------------------------------------------------------------------
const lldb::BreakpointSP
FindBreakpointByID (lldb::break_id_t breakID) const;
//------------------------------------------------------------------
/// Returns a shared pointer to the breakpoint with id \a breakID. Const
/// version.
///
/// @param[in] breakID
/// The breakpoint ID to seek for.
///
/// @result
/// A shared pointer to the breakpoint. May contain a NULL pointer if the
/// breakpoint doesn't exist.
//------------------------------------------------------------------
const lldb::BreakpointSP FindBreakpointByID(lldb::break_id_t breakID) const;
//------------------------------------------------------------------
/// Returns a shared pointer to the breakpoint with index \a i.
///
/// @param[in] i
/// The breakpoint index to seek for.
///
/// @result
/// A shared pointer to the breakpoint. May contain a NULL pointer if the
/// breakpoint doesn't exist.
//------------------------------------------------------------------
lldb::BreakpointSP
GetBreakpointAtIndex (size_t i);
//------------------------------------------------------------------
/// Returns a shared pointer to the breakpoint with index \a i.
///
/// @param[in] i
/// The breakpoint index to seek for.
///
/// @result
/// A shared pointer to the breakpoint. May contain a NULL pointer if the
/// breakpoint doesn't exist.
//------------------------------------------------------------------
lldb::BreakpointSP GetBreakpointAtIndex(size_t i);
//------------------------------------------------------------------
/// Returns a shared pointer to the breakpoint with index \a i, const version
///
/// @param[in] i
/// The breakpoint index to seek for.
///
/// @result
/// A shared pointer to the breakpoint. May contain a NULL pointer if the
/// breakpoint doesn't exist.
//------------------------------------------------------------------
const lldb::BreakpointSP
GetBreakpointAtIndex (size_t i) const;
//------------------------------------------------------------------
/// Returns a shared pointer to the breakpoint with index \a i, const version
///
/// @param[in] i
/// The breakpoint index to seek for.
///
/// @result
/// A shared pointer to the breakpoint. May contain a NULL pointer if the
/// breakpoint doesn't exist.
//------------------------------------------------------------------
const lldb::BreakpointSP GetBreakpointAtIndex(size_t i) const;
//------------------------------------------------------------------
/// Returns the number of elements in this breakpoint list.
///
/// @result
/// The number of elements.
//------------------------------------------------------------------
size_t
GetSize() const
{
std::lock_guard<std::recursive_mutex> guard(m_mutex);
return m_breakpoints.size();
}
//------------------------------------------------------------------
/// Find all the breakpoints with a given name
///
/// @param[in] name
/// The breakpoint name for which to search.
///
/// @result
/// \bfalse if the input name was not a legal breakpoint name.
//------------------------------------------------------------------
bool FindBreakpointsByName(const char *name, BreakpointList &matching_bps);
//------------------------------------------------------------------
/// Removes the breakpoint given by \b breakID from this list.
///
/// @param[in] breakID
/// The breakpoint index to remove.
///
/// @result
/// \b true if the breakpoint \a breakID was in the list.
//------------------------------------------------------------------
bool
Remove (lldb::break_id_t breakID, bool notify);
//------------------------------------------------------------------
/// Returns the number of elements in this breakpoint list.
///
/// @result
/// The number of elements.
//------------------------------------------------------------------
size_t GetSize() const {
std::lock_guard<std::recursive_mutex> guard(m_mutex);
return m_breakpoints.size();
}
//------------------------------------------------------------------
/// Removes all invalid breakpoint locations.
///
/// Removes all breakpoint locations in the list with architectures
/// that aren't compatible with \a arch. Also remove any breakpoint
/// locations with whose locations have address where the section
/// has been deleted (module and object files no longer exist).
///
/// This is typically used after the process calls exec, or anytime
/// the architecture of the target changes.
///
/// @param[in] arch
/// If valid, check the module in each breakpoint to make sure
/// they are compatible, otherwise, ignore architecture.
//------------------------------------------------------------------
void
RemoveInvalidLocations (const ArchSpec &arch);
//------------------------------------------------------------------
/// Removes the breakpoint given by \b breakID from this list.
///
/// @param[in] breakID
/// The breakpoint index to remove.
///
/// @result
/// \b true if the breakpoint \a breakID was in the list.
//------------------------------------------------------------------
bool Remove(lldb::break_id_t breakID, bool notify);
void
SetEnabledAll (bool enabled);
//------------------------------------------------------------------
/// Removes all invalid breakpoint locations.
///
/// Removes all breakpoint locations in the list with architectures
/// that aren't compatible with \a arch. Also remove any breakpoint
/// locations with whose locations have address where the section
/// has been deleted (module and object files no longer exist).
///
/// This is typically used after the process calls exec, or anytime
/// the architecture of the target changes.
///
/// @param[in] arch
/// If valid, check the module in each breakpoint to make sure
/// they are compatible, otherwise, ignore architecture.
//------------------------------------------------------------------
void RemoveInvalidLocations(const ArchSpec &arch);
//------------------------------------------------------------------
/// Removes all the breakpoints from this list.
//------------------------------------------------------------------
void
RemoveAll (bool notify);
void SetEnabledAll(bool enabled);
//------------------------------------------------------------------
/// Tell all the breakpoints to update themselves due to a change in the
/// modules in \a module_list. \a added says whether the module was loaded
/// or unloaded.
///
/// @param[in] module_list
/// The module list that has changed.
///
/// @param[in] load
/// \b true if the modules are loaded, \b false if unloaded.
///
/// @param[in] delete_locations
/// If \a load is \b false, then delete breakpoint locations when
/// when updating breakpoints.
//------------------------------------------------------------------
void
UpdateBreakpoints (ModuleList &module_list,
bool load,
bool delete_locations);
void
UpdateBreakpointsWhenModuleIsReplaced (lldb::ModuleSP old_module_sp, lldb::ModuleSP new_module_sp);
//------------------------------------------------------------------
/// Removes all the breakpoints from this list.
//------------------------------------------------------------------
void RemoveAll(bool notify);
void
ClearAllBreakpointSites ();
//------------------------------------------------------------------
/// Sets the passed in Locker to hold the Breakpoint List mutex.
///
/// @param[in] locker
/// The locker object that is set.
//------------------------------------------------------------------
void
GetListMutex(std::unique_lock<std::recursive_mutex> &lock);
//------------------------------------------------------------------
/// Tell all the breakpoints to update themselves due to a change in the
/// modules in \a module_list. \a added says whether the module was loaded
/// or unloaded.
///
/// @param[in] module_list
/// The module list that has changed.
///
/// @param[in] load
/// \b true if the modules are loaded, \b false if unloaded.
///
/// @param[in] delete_locations
/// If \a load is \b false, then delete breakpoint locations when
/// when updating breakpoints.
//------------------------------------------------------------------
void UpdateBreakpoints(ModuleList &module_list, bool load,
bool delete_locations);
void UpdateBreakpointsWhenModuleIsReplaced(lldb::ModuleSP old_module_sp,
lldb::ModuleSP new_module_sp);
void ClearAllBreakpointSites();
//------------------------------------------------------------------
/// Sets the passed in Locker to hold the Breakpoint List mutex.
///
/// @param[in] locker
/// The locker object that is set.
//------------------------------------------------------------------
void GetListMutex(std::unique_lock<std::recursive_mutex> &lock);
protected:
typedef std::list<lldb::BreakpointSP> bp_collection;
typedef std::list<lldb::BreakpointSP> bp_collection;
bp_collection::iterator
GetBreakpointIDIterator(lldb::break_id_t breakID);
bp_collection::iterator GetBreakpointIDIterator(lldb::break_id_t breakID);
bp_collection::const_iterator
GetBreakpointIDConstIterator(lldb::break_id_t breakID) const;
bp_collection::const_iterator
GetBreakpointIDConstIterator(lldb::break_id_t breakID) const;
std::recursive_mutex &
GetMutex() const
{
return m_mutex;
}
std::recursive_mutex &GetMutex() const { return m_mutex; }
mutable std::recursive_mutex m_mutex;
bp_collection m_breakpoints; // The breakpoint list, currently a list.
lldb::break_id_t m_next_break_id;
bool m_is_internal;
mutable std::recursive_mutex m_mutex;
bp_collection m_breakpoints; // The breakpoint list, currently a list.
lldb::break_id_t m_next_break_id;
bool m_is_internal;
public:
typedef LockingAdaptedIterable<bp_collection, lldb::BreakpointSP, list_adapter, std::recursive_mutex>
BreakpointIterable;
BreakpointIterable
Breakpoints()
{
return BreakpointIterable(m_breakpoints, GetMutex());
}
typedef LockingAdaptedIterable<bp_collection, lldb::BreakpointSP,
list_adapter, std::recursive_mutex>
BreakpointIterable;
BreakpointIterable Breakpoints() {
return BreakpointIterable(m_breakpoints, GetMutex());
}
private:
DISALLOW_COPY_AND_ASSIGN (BreakpointList);
DISALLOW_COPY_AND_ASSIGN(BreakpointList);
};
} // namespace lldb_private
#endif // liblldb_BreakpointList_h_
#endif // liblldb_BreakpointList_h_

View File

@ -17,16 +17,18 @@
// Other libraries and framework includes
// Project includes
#include "lldb/lldb-private.h"
#include "lldb/Breakpoint/StoppointLocation.h"
#include "lldb/Core/Address.h"
#include "lldb/Core/UserID.h"
#include "lldb/lldb-private.h"
namespace lldb_private {
//----------------------------------------------------------------------
/// @class BreakpointLocation BreakpointLocation.h "lldb/Breakpoint/BreakpointLocation.h"
/// @brief Class that manages one unique (by address) instance of a logical breakpoint.
/// @class BreakpointLocation BreakpointLocation.h
/// "lldb/Breakpoint/BreakpointLocation.h"
/// @brief Class that manages one unique (by address) instance of a logical
/// breakpoint.
//----------------------------------------------------------------------
//----------------------------------------------------------------------
@ -42,438 +44,384 @@ namespace lldb_private {
/// would be useful if you've set options on the locations.
//----------------------------------------------------------------------
class BreakpointLocation :
public std::enable_shared_from_this<BreakpointLocation>,
public StoppointLocation
{
class BreakpointLocation
: public std::enable_shared_from_this<BreakpointLocation>,
public StoppointLocation {
public:
~BreakpointLocation() override;
~BreakpointLocation() override;
//------------------------------------------------------------------
/// Gets the load address for this breakpoint location
/// @return
/// Returns breakpoint location load address, \b
/// LLDB_INVALID_ADDRESS if not yet set.
//------------------------------------------------------------------
lldb::addr_t
GetLoadAddress() const override;
//------------------------------------------------------------------
/// Gets the load address for this breakpoint location
/// @return
/// Returns breakpoint location load address, \b
/// LLDB_INVALID_ADDRESS if not yet set.
//------------------------------------------------------------------
lldb::addr_t GetLoadAddress() const override;
//------------------------------------------------------------------
/// Gets the Address for this breakpoint location
/// @return
/// Returns breakpoint location Address.
//------------------------------------------------------------------
Address &
GetAddress ();
//------------------------------------------------------------------
/// Gets the Breakpoint that created this breakpoint location
/// @return
/// Returns the owning breakpoint.
//------------------------------------------------------------------
Breakpoint &
GetBreakpoint ();
Target &
GetTarget();
//------------------------------------------------------------------
/// Gets the Address for this breakpoint location
/// @return
/// Returns breakpoint location Address.
//------------------------------------------------------------------
Address &GetAddress();
//------------------------------------------------------------------
/// Gets the Breakpoint that created this breakpoint location
/// @return
/// Returns the owning breakpoint.
//------------------------------------------------------------------
Breakpoint &GetBreakpoint();
//------------------------------------------------------------------
/// Determines whether we should stop due to a hit at this
/// breakpoint location.
///
/// Side Effects: This may evaluate the breakpoint condition, and
/// run the callback. So this command may do a considerable amount
/// of work.
///
/// @return
/// \b true if this breakpoint location thinks we should stop,
/// \b false otherwise.
//------------------------------------------------------------------
bool
ShouldStop(StoppointCallbackContext *context) override;
Target &GetTarget();
//------------------------------------------------------------------
// The next section deals with various breakpoint options.
//------------------------------------------------------------------
//------------------------------------------------------------------
/// Determines whether we should stop due to a hit at this
/// breakpoint location.
///
/// Side Effects: This may evaluate the breakpoint condition, and
/// run the callback. So this command may do a considerable amount
/// of work.
///
/// @return
/// \b true if this breakpoint location thinks we should stop,
/// \b false otherwise.
//------------------------------------------------------------------
bool ShouldStop(StoppointCallbackContext *context) override;
//------------------------------------------------------------------
/// If \a enable is \b true, enable the breakpoint, if \b false
/// disable it.
//------------------------------------------------------------------
void
SetEnabled(bool enabled);
//------------------------------------------------------------------
// The next section deals with various breakpoint options.
//------------------------------------------------------------------
//------------------------------------------------------------------
/// Check the Enable/Disable state.
///
/// @return
/// \b true if the breakpoint is enabled, \b false if disabled.
//------------------------------------------------------------------
bool
IsEnabled () const;
//------------------------------------------------------------------
/// If \a enable is \b true, enable the breakpoint, if \b false
/// disable it.
//------------------------------------------------------------------
void SetEnabled(bool enabled);
//------------------------------------------------------------------
/// Return the current Ignore Count.
///
/// @return
/// The number of breakpoint hits to be ignored.
//------------------------------------------------------------------
uint32_t
GetIgnoreCount ();
//------------------------------------------------------------------
/// Check the Enable/Disable state.
///
/// @return
/// \b true if the breakpoint is enabled, \b false if disabled.
//------------------------------------------------------------------
bool IsEnabled() const;
//------------------------------------------------------------------
/// Set the breakpoint to ignore the next \a count breakpoint hits.
///
/// @param[in] count
/// The number of breakpoint hits to ignore.
//------------------------------------------------------------------
void
SetIgnoreCount (uint32_t n);
//------------------------------------------------------------------
/// Return the current Ignore Count.
///
/// @return
/// The number of breakpoint hits to be ignored.
//------------------------------------------------------------------
uint32_t GetIgnoreCount();
//------------------------------------------------------------------
/// Set the callback action invoked when the breakpoint is hit.
///
/// The callback will return a bool indicating whether the target
/// should stop at this breakpoint or not.
///
/// @param[in] callback
/// The method that will get called when the breakpoint is hit.
///
/// @param[in] callback_baton_sp
/// A shared pointer to a Baton that provides the void * needed
/// for the callback.
///
/// @see lldb_private::Baton
//------------------------------------------------------------------
void
SetCallback (BreakpointHitCallback callback,
const lldb::BatonSP &callback_baton_sp,
bool is_synchronous);
//------------------------------------------------------------------
/// Set the breakpoint to ignore the next \a count breakpoint hits.
///
/// @param[in] count
/// The number of breakpoint hits to ignore.
//------------------------------------------------------------------
void SetIgnoreCount(uint32_t n);
void
SetCallback (BreakpointHitCallback callback,
void *baton,
bool is_synchronous);
void
ClearCallback ();
//------------------------------------------------------------------
/// Set the callback action invoked when the breakpoint is hit.
///
/// The callback will return a bool indicating whether the target
/// should stop at this breakpoint or not.
///
/// @param[in] callback
/// The method that will get called when the breakpoint is hit.
///
/// @param[in] callback_baton_sp
/// A shared pointer to a Baton that provides the void * needed
/// for the callback.
///
/// @see lldb_private::Baton
//------------------------------------------------------------------
void SetCallback(BreakpointHitCallback callback,
const lldb::BatonSP &callback_baton_sp, bool is_synchronous);
//------------------------------------------------------------------
/// Set the breakpoint location's condition.
///
/// @param[in] condition
/// The condition expression to evaluate when the breakpoint is hit.
//------------------------------------------------------------------
void
SetCondition (const char *condition);
void SetCallback(BreakpointHitCallback callback, void *baton,
bool is_synchronous);
//------------------------------------------------------------------
/// Return a pointer to the text of the condition expression.
///
/// @return
/// A pointer to the condition expression text, or nullptr if no
// condition has been set.
//------------------------------------------------------------------
const char *
GetConditionText(size_t *hash = nullptr) const;
bool
ConditionSaysStop (ExecutionContext &exe_ctx, Error &error);
void ClearCallback();
//------------------------------------------------------------------
/// Set the valid thread to be checked when the breakpoint is hit.
///
/// @param[in] thread_id
/// If this thread hits the breakpoint, we stop, otherwise not.
//------------------------------------------------------------------
void
SetThreadID (lldb::tid_t thread_id);
lldb::tid_t
GetThreadID ();
//------------------------------------------------------------------
/// Set the breakpoint location's condition.
///
/// @param[in] condition
/// The condition expression to evaluate when the breakpoint is hit.
//------------------------------------------------------------------
void SetCondition(const char *condition);
void
SetThreadIndex (uint32_t index);
uint32_t
GetThreadIndex() const;
void
SetThreadName (const char *thread_name);
const char *
GetThreadName () const;
void
SetQueueName (const char *queue_name);
const char *
GetQueueName () const;
//------------------------------------------------------------------
/// Return a pointer to the text of the condition expression.
///
/// @return
/// A pointer to the condition expression text, or nullptr if no
// condition has been set.
//------------------------------------------------------------------
const char *GetConditionText(size_t *hash = nullptr) const;
//------------------------------------------------------------------
// The next section deals with this location's breakpoint sites.
//------------------------------------------------------------------
bool ConditionSaysStop(ExecutionContext &exe_ctx, Error &error);
//------------------------------------------------------------------
/// Try to resolve the breakpoint site for this location.
///
/// @return
/// \b true if we were successful at setting a breakpoint site,
/// \b false otherwise.
//------------------------------------------------------------------
bool
ResolveBreakpointSite ();
//------------------------------------------------------------------
/// Set the valid thread to be checked when the breakpoint is hit.
///
/// @param[in] thread_id
/// If this thread hits the breakpoint, we stop, otherwise not.
//------------------------------------------------------------------
void SetThreadID(lldb::tid_t thread_id);
//------------------------------------------------------------------
/// Clear this breakpoint location's breakpoint site - for instance
/// when disabling the breakpoint.
///
/// @return
/// \b true if there was a breakpoint site to be cleared, \b false
/// otherwise.
//------------------------------------------------------------------
bool
ClearBreakpointSite ();
lldb::tid_t GetThreadID();
//------------------------------------------------------------------
/// Return whether this breakpoint location has a breakpoint site.
/// @return
/// \b true if there was a breakpoint site for this breakpoint
/// location, \b false otherwise.
//------------------------------------------------------------------
bool
IsResolved () const;
lldb::BreakpointSiteSP
GetBreakpointSite() const;
void SetThreadIndex(uint32_t index);
//------------------------------------------------------------------
// The next section are generic report functions.
//------------------------------------------------------------------
uint32_t GetThreadIndex() const;
//------------------------------------------------------------------
/// Print a description of this breakpoint location to the stream
/// \a s.
///
/// @param[in] s
/// The stream to which to print the description.
///
/// @param[in] level
/// The description level that indicates the detail level to
/// provide.
///
/// @see lldb::DescriptionLevel
//------------------------------------------------------------------
void
GetDescription (Stream *s, lldb::DescriptionLevel level);
void SetThreadName(const char *thread_name);
//------------------------------------------------------------------
/// Standard "Dump" method. At present it does nothing.
//------------------------------------------------------------------
void
Dump(Stream *s) const override;
const char *GetThreadName() const;
//------------------------------------------------------------------
/// Use this to set location specific breakpoint options.
///
/// It will create a copy of the containing breakpoint's options if
/// that hasn't been done already
///
/// @return
/// A pointer to the breakpoint options.
//------------------------------------------------------------------
BreakpointOptions *
GetLocationOptions ();
void SetQueueName(const char *queue_name);
//------------------------------------------------------------------
/// Use this to access breakpoint options from this breakpoint location.
/// This will point to the owning breakpoint's options unless options have
/// been set specifically on this location.
///
/// @return
/// A pointer to the containing breakpoint's options if this
/// location doesn't have its own copy.
//------------------------------------------------------------------
const BreakpointOptions *
GetOptionsNoCreate () const;
bool
ValidForThisThread (Thread *thread);
const char *GetQueueName() const;
//------------------------------------------------------------------
/// Invoke the callback action when the breakpoint is hit.
///
/// Meant to be used by the BreakpointLocation class.
///
/// @param[in] context
/// Described the breakpoint event.
///
/// @param[in] bp_loc_id
/// Which breakpoint location hit this breakpoint.
///
/// @return
/// \b true if the target should stop at this breakpoint and \b
/// false not.
//------------------------------------------------------------------
bool
InvokeCallback (StoppointCallbackContext *context);
//------------------------------------------------------------------
/// Returns whether we should resolve Indirect functions in setting the breakpoint site
/// for this location.
///
/// @return
/// \b true if the breakpoint SITE for this location should be set on the
/// resolved location for Indirect functions.
//------------------------------------------------------------------
bool
ShouldResolveIndirectFunctions ()
{
return m_should_resolve_indirect_functions;
}
//------------------------------------------------------------------
// The next section deals with this location's breakpoint sites.
//------------------------------------------------------------------
//------------------------------------------------------------------
/// Try to resolve the breakpoint site for this location.
///
/// @return
/// \b true if we were successful at setting a breakpoint site,
/// \b false otherwise.
//------------------------------------------------------------------
bool ResolveBreakpointSite();
//------------------------------------------------------------------
/// Clear this breakpoint location's breakpoint site - for instance
/// when disabling the breakpoint.
///
/// @return
/// \b true if there was a breakpoint site to be cleared, \b false
/// otherwise.
//------------------------------------------------------------------
bool ClearBreakpointSite();
//------------------------------------------------------------------
/// Return whether this breakpoint location has a breakpoint site.
/// @return
/// \b true if there was a breakpoint site for this breakpoint
/// location, \b false otherwise.
//------------------------------------------------------------------
bool IsResolved() const;
lldb::BreakpointSiteSP GetBreakpointSite() const;
//------------------------------------------------------------------
// The next section are generic report functions.
//------------------------------------------------------------------
//------------------------------------------------------------------
/// Print a description of this breakpoint location to the stream
/// \a s.
///
/// @param[in] s
/// The stream to which to print the description.
///
/// @param[in] level
/// The description level that indicates the detail level to
/// provide.
///
/// @see lldb::DescriptionLevel
//------------------------------------------------------------------
void GetDescription(Stream *s, lldb::DescriptionLevel level);
//------------------------------------------------------------------
/// Standard "Dump" method. At present it does nothing.
//------------------------------------------------------------------
void Dump(Stream *s) const override;
//------------------------------------------------------------------
/// Use this to set location specific breakpoint options.
///
/// It will create a copy of the containing breakpoint's options if
/// that hasn't been done already
///
/// @return
/// A pointer to the breakpoint options.
//------------------------------------------------------------------
BreakpointOptions *GetLocationOptions();
//------------------------------------------------------------------
/// Use this to access breakpoint options from this breakpoint location.
/// This will point to the owning breakpoint's options unless options have
/// been set specifically on this location.
///
/// @return
/// A pointer to the containing breakpoint's options if this
/// location doesn't have its own copy.
//------------------------------------------------------------------
const BreakpointOptions *GetOptionsNoCreate() const;
bool ValidForThisThread(Thread *thread);
//------------------------------------------------------------------
/// Invoke the callback action when the breakpoint is hit.
///
/// Meant to be used by the BreakpointLocation class.
///
/// @param[in] context
/// Described the breakpoint event.
///
/// @param[in] bp_loc_id
/// Which breakpoint location hit this breakpoint.
///
/// @return
/// \b true if the target should stop at this breakpoint and \b
/// false not.
//------------------------------------------------------------------
bool InvokeCallback(StoppointCallbackContext *context);
//------------------------------------------------------------------
/// Returns whether we should resolve Indirect functions in setting the
/// breakpoint site
/// for this location.
///
/// @return
/// \b true if the breakpoint SITE for this location should be set on the
/// resolved location for Indirect functions.
//------------------------------------------------------------------
bool ShouldResolveIndirectFunctions() {
return m_should_resolve_indirect_functions;
}
//------------------------------------------------------------------
/// Returns whether the address set in the breakpoint site for this location
/// was found by resolving
/// an indirect symbol.
///
/// @return
/// \b true or \b false as given in the description above.
//------------------------------------------------------------------
bool IsIndirect() { return m_is_indirect; }
void SetIsIndirect(bool is_indirect) { m_is_indirect = is_indirect; }
//------------------------------------------------------------------
/// Returns whether the address set in the breakpoint location was re-routed
/// to the target of a
/// re-exported symbol.
///
/// @return
/// \b true or \b false as given in the description above.
//------------------------------------------------------------------
bool IsReExported() { return m_is_reexported; }
void SetIsReExported(bool is_reexported) { m_is_reexported = is_reexported; }
//------------------------------------------------------------------
/// Returns whether the two breakpoint locations might represent "equivalent
/// locations".
/// This is used when modules changed to determine if a Location in the old
/// module might
/// be the "same as" the input location.
///
/// @param[in] location
/// The location to compare against.
///
/// @return
/// \b true or \b false as given in the description above.
//------------------------------------------------------------------
bool EquivalentToLocation(BreakpointLocation &location);
//------------------------------------------------------------------
/// Returns whether the address set in the breakpoint site for this location was found by resolving
/// an indirect symbol.
///
/// @return
/// \b true or \b false as given in the description above.
//------------------------------------------------------------------
bool
IsIndirect ()
{
return m_is_indirect;
}
void
SetIsIndirect (bool is_indirect)
{
m_is_indirect = is_indirect;
}
//------------------------------------------------------------------
/// Returns whether the address set in the breakpoint location was re-routed to the target of a
/// re-exported symbol.
///
/// @return
/// \b true or \b false as given in the description above.
//------------------------------------------------------------------
bool
IsReExported ()
{
return m_is_reexported;
}
void
SetIsReExported (bool is_reexported)
{
m_is_reexported = is_reexported;
}
//------------------------------------------------------------------
/// Returns whether the two breakpoint locations might represent "equivalent locations".
/// This is used when modules changed to determine if a Location in the old module might
/// be the "same as" the input location.
///
/// @param[in] location
/// The location to compare against.
///
/// @return
/// \b true or \b false as given in the description above.
//------------------------------------------------------------------
bool EquivalentToLocation(BreakpointLocation &location);
protected:
friend class BreakpointSite;
friend class BreakpointLocationList;
friend class Process;
friend class StopInfoBreakpoint;
friend class BreakpointSite;
friend class BreakpointLocationList;
friend class Process;
friend class StopInfoBreakpoint;
//------------------------------------------------------------------
/// Set the breakpoint site for this location to \a bp_site_sp.
///
/// @param[in] bp_site_sp
/// The breakpoint site we are setting for this location.
///
/// @return
/// \b true if we were successful at setting the breakpoint site,
/// \b false otherwise.
//------------------------------------------------------------------
bool
SetBreakpointSite (lldb::BreakpointSiteSP& bp_site_sp);
//------------------------------------------------------------------
/// Set the breakpoint site for this location to \a bp_site_sp.
///
/// @param[in] bp_site_sp
/// The breakpoint site we are setting for this location.
///
/// @return
/// \b true if we were successful at setting the breakpoint site,
/// \b false otherwise.
//------------------------------------------------------------------
bool SetBreakpointSite(lldb::BreakpointSiteSP &bp_site_sp);
void
DecrementIgnoreCount();
void DecrementIgnoreCount();
bool IgnoreCountShouldStop();
bool
IgnoreCountShouldStop();
private:
void
SwapLocation (lldb::BreakpointLocationSP swap_from);
void SwapLocation(lldb::BreakpointLocationSP swap_from);
void
BumpHitCount();
void BumpHitCount();
void
UndoBumpHitCount();
void UndoBumpHitCount();
//------------------------------------------------------------------
// Constructors and Destructors
//
// Only the Breakpoint can make breakpoint locations, and it owns
// them.
//------------------------------------------------------------------
//------------------------------------------------------------------
// Constructors and Destructors
//
// Only the Breakpoint can make breakpoint locations, and it owns
// them.
//------------------------------------------------------------------
//------------------------------------------------------------------
/// Constructor.
///
/// @param[in] owner
/// A back pointer to the breakpoint that owns this location.
///
/// @param[in] addr
/// The Address defining this location.
///
/// @param[in] tid
/// The thread for which this breakpoint location is valid, or
/// LLDB_INVALID_THREAD_ID if it is valid for all threads.
///
/// @param[in] hardware
/// \b true if a hardware breakpoint is requested.
//------------------------------------------------------------------
//------------------------------------------------------------------
/// Constructor.
///
/// @param[in] owner
/// A back pointer to the breakpoint that owns this location.
///
/// @param[in] addr
/// The Address defining this location.
///
/// @param[in] tid
/// The thread for which this breakpoint location is valid, or
/// LLDB_INVALID_THREAD_ID if it is valid for all threads.
///
/// @param[in] hardware
/// \b true if a hardware breakpoint is requested.
//------------------------------------------------------------------
BreakpointLocation (lldb::break_id_t bid,
Breakpoint &owner,
const Address &addr,
lldb::tid_t tid,
bool hardware,
bool check_for_resolver = true);
//------------------------------------------------------------------
// Data members:
//------------------------------------------------------------------
bool m_being_created;
bool m_should_resolve_indirect_functions;
bool m_is_reexported;
bool m_is_indirect;
Address m_address; ///< The address defining this location.
Breakpoint &m_owner; ///< The breakpoint that produced this object.
std::unique_ptr<BreakpointOptions> m_options_ap; ///< Breakpoint options pointer, nullptr if we're using our breakpoint's options.
lldb::BreakpointSiteSP m_bp_site_sp; ///< Our breakpoint site (it may be shared by more than one location.)
lldb::UserExpressionSP m_user_expression_sp; ///< The compiled expression to use in testing our condition.
std::mutex m_condition_mutex; ///< Guards parsing and evaluation of the condition, which could be evaluated by
/// multiple processes.
size_t m_condition_hash; ///< For testing whether the condition source code changed.
BreakpointLocation(lldb::break_id_t bid, Breakpoint &owner,
const Address &addr, lldb::tid_t tid, bool hardware,
bool check_for_resolver = true);
void
SetShouldResolveIndirectFunctions (bool do_resolve)
{
m_should_resolve_indirect_functions = do_resolve;
}
void
SendBreakpointLocationChangedEvent (lldb::BreakpointEventType eventKind);
DISALLOW_COPY_AND_ASSIGN (BreakpointLocation);
//------------------------------------------------------------------
// Data members:
//------------------------------------------------------------------
bool m_being_created;
bool m_should_resolve_indirect_functions;
bool m_is_reexported;
bool m_is_indirect;
Address m_address; ///< The address defining this location.
Breakpoint &m_owner; ///< The breakpoint that produced this object.
std::unique_ptr<BreakpointOptions> m_options_ap; ///< Breakpoint options
///pointer, nullptr if we're
///using our breakpoint's
///options.
lldb::BreakpointSiteSP m_bp_site_sp; ///< Our breakpoint site (it may be
///shared by more than one location.)
lldb::UserExpressionSP m_user_expression_sp; ///< The compiled expression to
///use in testing our condition.
std::mutex m_condition_mutex; ///< Guards parsing and evaluation of the
///condition, which could be evaluated by
/// multiple processes.
size_t m_condition_hash; ///< For testing whether the condition source code
///changed.
void SetShouldResolveIndirectFunctions(bool do_resolve) {
m_should_resolve_indirect_functions = do_resolve;
}
void SendBreakpointLocationChangedEvent(lldb::BreakpointEventType eventKind);
DISALLOW_COPY_AND_ASSIGN(BreakpointLocation);
};
} // namespace lldb_private

View File

@ -12,210 +12,202 @@
// C Includes
// C++ Includes
#include <vector>
#include <mutex>
#include <vector>
// Other libraries and framework includes
// Project includes
#include "lldb/lldb-private.h"
#include "lldb/Utility/Iterable.h"
#include "lldb/lldb-private.h"
namespace lldb_private {
class BreakpointLocationCollection
{
class BreakpointLocationCollection {
public:
BreakpointLocationCollection();
BreakpointLocationCollection();
~BreakpointLocationCollection();
~BreakpointLocationCollection();
//------------------------------------------------------------------
/// Add the breakpoint \a bp_loc_sp to the list.
///
/// @param[in] bp_sp
/// Shared pointer to the breakpoint location that will get added
/// to the list.
///
/// @result
/// Returns breakpoint location id.
//------------------------------------------------------------------
void
Add (const lldb::BreakpointLocationSP& bp_loc_sp);
//------------------------------------------------------------------
/// Add the breakpoint \a bp_loc_sp to the list.
///
/// @param[in] bp_sp
/// Shared pointer to the breakpoint location that will get added
/// to the list.
///
/// @result
/// Returns breakpoint location id.
//------------------------------------------------------------------
void Add(const lldb::BreakpointLocationSP &bp_loc_sp);
//------------------------------------------------------------------
/// Removes the breakpoint location given by \b breakID from this
/// list.
///
/// @param[in] break_id
/// The breakpoint index to remove.
///
/// @param[in] break_loc_id
/// The breakpoint location index in break_id to remove.
///
/// @result
/// \b true if the breakpoint was in the list.
//------------------------------------------------------------------
bool
Remove (lldb::break_id_t break_id, lldb::break_id_t break_loc_id);
//------------------------------------------------------------------
/// Removes the breakpoint location given by \b breakID from this
/// list.
///
/// @param[in] break_id
/// The breakpoint index to remove.
///
/// @param[in] break_loc_id
/// The breakpoint location index in break_id to remove.
///
/// @result
/// \b true if the breakpoint was in the list.
//------------------------------------------------------------------
bool Remove(lldb::break_id_t break_id, lldb::break_id_t break_loc_id);
//------------------------------------------------------------------
/// Returns a shared pointer to the breakpoint location with id \a
/// breakID.
///
/// @param[in] break_id
/// The breakpoint ID to seek for.
///
/// @param[in] break_loc_id
/// The breakpoint location ID in \a break_id to seek for.
///
/// @result
/// A shared pointer to the breakpoint. May contain a NULL
/// pointer if the breakpoint doesn't exist.
//------------------------------------------------------------------
lldb::BreakpointLocationSP
FindByIDPair (lldb::break_id_t break_id, lldb::break_id_t break_loc_id);
//------------------------------------------------------------------
/// Returns a shared pointer to the breakpoint location with id \a
/// breakID.
///
/// @param[in] break_id
/// The breakpoint ID to seek for.
///
/// @param[in] break_loc_id
/// The breakpoint location ID in \a break_id to seek for.
///
/// @result
/// A shared pointer to the breakpoint. May contain a NULL
/// pointer if the breakpoint doesn't exist.
//------------------------------------------------------------------
lldb::BreakpointLocationSP FindByIDPair(lldb::break_id_t break_id,
lldb::break_id_t break_loc_id);
//------------------------------------------------------------------
/// Returns a shared pointer to the breakpoint location with id \a
/// breakID, const version.
///
/// @param[in] breakID
/// The breakpoint location ID to seek for.
///
/// @param[in] break_loc_id
/// The breakpoint location ID in \a break_id to seek for.
///
/// @result
/// A shared pointer to the breakpoint. May contain a NULL
/// pointer if the breakpoint doesn't exist.
//------------------------------------------------------------------
const lldb::BreakpointLocationSP
FindByIDPair (lldb::break_id_t break_id, lldb::break_id_t break_loc_id) const;
//------------------------------------------------------------------
/// Returns a shared pointer to the breakpoint location with id \a
/// breakID, const version.
///
/// @param[in] breakID
/// The breakpoint location ID to seek for.
///
/// @param[in] break_loc_id
/// The breakpoint location ID in \a break_id to seek for.
///
/// @result
/// A shared pointer to the breakpoint. May contain a NULL
/// pointer if the breakpoint doesn't exist.
//------------------------------------------------------------------
const lldb::BreakpointLocationSP
FindByIDPair(lldb::break_id_t break_id, lldb::break_id_t break_loc_id) const;
//------------------------------------------------------------------
/// Returns a shared pointer to the breakpoint location with index
/// \a i.
///
/// @param[in] i
/// The breakpoint location index to seek for.
///
/// @result
/// A shared pointer to the breakpoint. May contain a NULL
/// pointer if the breakpoint doesn't exist.
//------------------------------------------------------------------
lldb::BreakpointLocationSP
GetByIndex (size_t i);
//------------------------------------------------------------------
/// Returns a shared pointer to the breakpoint location with index
/// \a i.
///
/// @param[in] i
/// The breakpoint location index to seek for.
///
/// @result
/// A shared pointer to the breakpoint. May contain a NULL
/// pointer if the breakpoint doesn't exist.
//------------------------------------------------------------------
lldb::BreakpointLocationSP GetByIndex(size_t i);
//------------------------------------------------------------------
/// Returns a shared pointer to the breakpoint location with index
/// \a i, const version.
///
/// @param[in] i
/// The breakpoint location index to seek for.
///
/// @result
/// A shared pointer to the breakpoint. May contain a NULL
/// pointer if the breakpoint doesn't exist.
//------------------------------------------------------------------
const lldb::BreakpointLocationSP
GetByIndex (size_t i) const;
//------------------------------------------------------------------
/// Returns a shared pointer to the breakpoint location with index
/// \a i, const version.
///
/// @param[in] i
/// The breakpoint location index to seek for.
///
/// @result
/// A shared pointer to the breakpoint. May contain a NULL
/// pointer if the breakpoint doesn't exist.
//------------------------------------------------------------------
const lldb::BreakpointLocationSP GetByIndex(size_t i) const;
//------------------------------------------------------------------
/// Returns the number of elements in this breakpoint location list.
///
/// @result
/// The number of elements.
//------------------------------------------------------------------
size_t
GetSize() const { return m_break_loc_collection.size(); }
//------------------------------------------------------------------
/// Returns the number of elements in this breakpoint location list.
///
/// @result
/// The number of elements.
//------------------------------------------------------------------
size_t GetSize() const { return m_break_loc_collection.size(); }
//------------------------------------------------------------------
/// Enquires of all the breakpoint locations in this list whether
/// we should stop at a hit at \a breakID.
///
/// @param[in] context
/// This contains the information about this stop.
///
/// @param[in] breakID
/// This break ID that we hit.
///
/// @return
/// \b true if we should stop, \b false otherwise.
//------------------------------------------------------------------
bool
ShouldStop (StoppointCallbackContext *context);
//------------------------------------------------------------------
/// Enquires of all the breakpoint locations in this list whether
/// we should stop at a hit at \a breakID.
///
/// @param[in] context
/// This contains the information about this stop.
///
/// @param[in] breakID
/// This break ID that we hit.
///
/// @return
/// \b true if we should stop, \b false otherwise.
//------------------------------------------------------------------
bool ShouldStop(StoppointCallbackContext *context);
//------------------------------------------------------------------
/// Print a description of the breakpoint locations in this list
/// to the stream \a s.
///
/// @param[in] s
/// The stream to which to print the description.
///
/// @param[in] level
/// The description level that indicates the detail level to
/// provide.
///
/// @see lldb::DescriptionLevel
//------------------------------------------------------------------
void GetDescription (Stream *s, lldb::DescriptionLevel level);
//------------------------------------------------------------------
/// Check whether this collection of breakpoint locations have any
/// thread specifiers, and if yes, is \a thread_id contained in any
/// of these specifiers.
///
/// @param[in] thread
/// The thread against which to test.
///
/// return
/// \b true if the collection contains at least one location that
/// would be valid for this thread, false otherwise.
//------------------------------------------------------------------
bool ValidForThisThread (Thread *thread);
//------------------------------------------------------------------
/// Print a description of the breakpoint locations in this list
/// to the stream \a s.
///
/// @param[in] s
/// The stream to which to print the description.
///
/// @param[in] level
/// The description level that indicates the detail level to
/// provide.
///
/// @see lldb::DescriptionLevel
//------------------------------------------------------------------
void GetDescription(Stream *s, lldb::DescriptionLevel level);
//------------------------------------------------------------------
/// Tell whether ALL the breakpoints in the location collection are internal.
///
/// @result
/// \b true if all breakpoint locations are owned by internal breakpoints,
/// \b false otherwise.
//------------------------------------------------------------------
bool IsInternal() const;
//------------------------------------------------------------------
/// Check whether this collection of breakpoint locations have any
/// thread specifiers, and if yes, is \a thread_id contained in any
/// of these specifiers.
///
/// @param[in] thread
/// The thread against which to test.
///
/// return
/// \b true if the collection contains at least one location that
/// would be valid for this thread, false otherwise.
//------------------------------------------------------------------
bool ValidForThisThread(Thread *thread);
//------------------------------------------------------------------
/// Tell whether ALL the breakpoints in the location collection are internal.
///
/// @result
/// \b true if all breakpoint locations are owned by internal breakpoints,
/// \b false otherwise.
//------------------------------------------------------------------
bool IsInternal() const;
protected:
//------------------------------------------------------------------
// Classes that inherit from BreakpointLocationCollection can see
// and modify these
//------------------------------------------------------------------
//------------------------------------------------------------------
// Classes that inherit from BreakpointLocationCollection can see
// and modify these
//------------------------------------------------------------------
private:
//------------------------------------------------------------------
// For BreakpointLocationCollection only
//------------------------------------------------------------------
//------------------------------------------------------------------
// For BreakpointLocationCollection only
//------------------------------------------------------------------
typedef std::vector<lldb::BreakpointLocationSP> collection;
typedef std::vector<lldb::BreakpointLocationSP> collection;
collection::iterator
GetIDPairIterator(lldb::break_id_t break_id, lldb::break_id_t break_loc_id);
collection::iterator GetIDPairIterator(lldb::break_id_t break_id,
lldb::break_id_t break_loc_id);
collection::const_iterator
GetIDPairConstIterator(lldb::break_id_t break_id, lldb::break_id_t break_loc_id) const;
collection::const_iterator
GetIDPairConstIterator(lldb::break_id_t break_id,
lldb::break_id_t break_loc_id) const;
collection m_break_loc_collection;
mutable std::mutex m_collection_mutex;
collection m_break_loc_collection;
mutable std::mutex m_collection_mutex;
public:
typedef AdaptedIterable<collection, lldb::BreakpointLocationSP, vector_adapter> BreakpointLocationCollectionIterable;
BreakpointLocationCollectionIterable
BreakpointLocations()
{
return BreakpointLocationCollectionIterable(m_break_loc_collection);
}
typedef AdaptedIterable<collection, lldb::BreakpointLocationSP,
vector_adapter>
BreakpointLocationCollectionIterable;
BreakpointLocationCollectionIterable BreakpointLocations() {
return BreakpointLocationCollectionIterable(m_break_loc_collection);
}
};
} // namespace lldb_private
#endif // liblldb_BreakpointLocationCollection_h_
#endif // liblldb_BreakpointLocationCollection_h_

View File

@ -18,270 +18,248 @@
// Other libraries and framework includes
// Project includes
#include "lldb/lldb-private.h"
#include "lldb/Core/Address.h"
#include "lldb/Utility/Iterable.h"
#include "lldb/lldb-private.h"
namespace lldb_private {
//----------------------------------------------------------------------
/// @class BreakpointLocationList BreakpointLocationList.h "lldb/Breakpoint/BreakpointLocationList.h"
/// @brief This class is used by Breakpoint to manage a list of breakpoint locations,
/// @class BreakpointLocationList BreakpointLocationList.h
/// "lldb/Breakpoint/BreakpointLocationList.h"
/// @brief This class is used by Breakpoint to manage a list of breakpoint
/// locations,
// each breakpoint location in the list
/// has a unique ID, and is unique by Address as well.
//----------------------------------------------------------------------
class BreakpointLocationList
{
// Only Breakpoints can make the location list, or add elements to it.
// This is not just some random collection of locations. Rather, the act of adding the location
// to this list sets its ID, and implicitly all the locations have the same breakpoint ID as
// well. If you need a generic container for breakpoint locations, use BreakpointLocationCollection.
friend class Breakpoint;
class BreakpointLocationList {
// Only Breakpoints can make the location list, or add elements to it.
// This is not just some random collection of locations. Rather, the act of
// adding the location
// to this list sets its ID, and implicitly all the locations have the same
// breakpoint ID as
// well. If you need a generic container for breakpoint locations, use
// BreakpointLocationCollection.
friend class Breakpoint;
public:
virtual
~BreakpointLocationList();
virtual ~BreakpointLocationList();
//------------------------------------------------------------------
/// Standard "Dump" method. At present it does nothing.
//------------------------------------------------------------------
void
Dump (Stream *s) const;
//------------------------------------------------------------------
/// Standard "Dump" method. At present it does nothing.
//------------------------------------------------------------------
void Dump(Stream *s) const;
//------------------------------------------------------------------
/// Returns a shared pointer to the breakpoint location at address
/// \a addr - const version.
///
/// @param[in] addr
/// The address to look for.
///
/// @result
/// A shared pointer to the breakpoint. May contain a nullptr
/// pointer if the breakpoint doesn't exist.
//------------------------------------------------------------------
const lldb::BreakpointLocationSP
FindByAddress (const Address &addr) const;
//------------------------------------------------------------------
/// Returns a shared pointer to the breakpoint location at address
/// \a addr - const version.
///
/// @param[in] addr
/// The address to look for.
///
/// @result
/// A shared pointer to the breakpoint. May contain a nullptr
/// pointer if the breakpoint doesn't exist.
//------------------------------------------------------------------
const lldb::BreakpointLocationSP FindByAddress(const Address &addr) const;
//------------------------------------------------------------------
/// Returns a shared pointer to the breakpoint location with id
/// \a breakID, const version.
///
/// @param[in] breakID
/// The breakpoint location ID to seek for.
///
/// @result
/// A shared pointer to the breakpoint. May contain a nullptr
/// pointer if the breakpoint doesn't exist.
//------------------------------------------------------------------
lldb::BreakpointLocationSP
FindByID (lldb::break_id_t breakID) const;
//------------------------------------------------------------------
/// Returns a shared pointer to the breakpoint location with id
/// \a breakID, const version.
///
/// @param[in] breakID
/// The breakpoint location ID to seek for.
///
/// @result
/// A shared pointer to the breakpoint. May contain a nullptr
/// pointer if the breakpoint doesn't exist.
//------------------------------------------------------------------
lldb::BreakpointLocationSP FindByID(lldb::break_id_t breakID) const;
//------------------------------------------------------------------
/// Returns the breakpoint location id to the breakpoint location
/// at address \a addr.
///
/// @param[in] addr
/// The address to match.
///
/// @result
/// The ID of the breakpoint location, or LLDB_INVALID_BREAK_ID.
//------------------------------------------------------------------
lldb::break_id_t
FindIDByAddress (const Address &addr);
//------------------------------------------------------------------
/// Returns the breakpoint location id to the breakpoint location
/// at address \a addr.
///
/// @param[in] addr
/// The address to match.
///
/// @result
/// The ID of the breakpoint location, or LLDB_INVALID_BREAK_ID.
//------------------------------------------------------------------
lldb::break_id_t FindIDByAddress(const Address &addr);
//------------------------------------------------------------------
/// Returns a breakpoint location list of the breakpoint locations
/// in the module \a module. This list is allocated, and owned by
/// the caller.
///
/// @param[in] module
/// The module to seek in.
///
/// @param[in]
/// A breakpoint collection that gets any breakpoint locations
/// that match \a module appended to.
///
/// @result
/// The number of matches
//------------------------------------------------------------------
size_t
FindInModule (Module *module,
BreakpointLocationCollection& bp_loc_list);
//------------------------------------------------------------------
/// Returns a breakpoint location list of the breakpoint locations
/// in the module \a module. This list is allocated, and owned by
/// the caller.
///
/// @param[in] module
/// The module to seek in.
///
/// @param[in]
/// A breakpoint collection that gets any breakpoint locations
/// that match \a module appended to.
///
/// @result
/// The number of matches
//------------------------------------------------------------------
size_t FindInModule(Module *module,
BreakpointLocationCollection &bp_loc_list);
//------------------------------------------------------------------
/// Returns a shared pointer to the breakpoint location with
/// index \a i.
///
/// @param[in] i
/// The breakpoint location index to seek for.
///
/// @result
/// A shared pointer to the breakpoint. May contain a nullptr
/// pointer if the breakpoint doesn't exist.
//------------------------------------------------------------------
lldb::BreakpointLocationSP
GetByIndex (size_t i);
//------------------------------------------------------------------
/// Returns a shared pointer to the breakpoint location with
/// index \a i.
///
/// @param[in] i
/// The breakpoint location index to seek for.
///
/// @result
/// A shared pointer to the breakpoint. May contain a nullptr
/// pointer if the breakpoint doesn't exist.
//------------------------------------------------------------------
lldb::BreakpointLocationSP GetByIndex(size_t i);
//------------------------------------------------------------------
/// Returns a shared pointer to the breakpoint location with index
/// \a i, const version.
///
/// @param[in] i
/// The breakpoint location index to seek for.
///
/// @result
/// A shared pointer to the breakpoint. May contain a nullptr
/// pointer if the breakpoint doesn't exist.
//------------------------------------------------------------------
const lldb::BreakpointLocationSP
GetByIndex (size_t i) const;
//------------------------------------------------------------------
/// Returns a shared pointer to the breakpoint location with index
/// \a i, const version.
///
/// @param[in] i
/// The breakpoint location index to seek for.
///
/// @result
/// A shared pointer to the breakpoint. May contain a nullptr
/// pointer if the breakpoint doesn't exist.
//------------------------------------------------------------------
const lldb::BreakpointLocationSP GetByIndex(size_t i) const;
//------------------------------------------------------------------
/// Removes all the locations in this list from their breakpoint site
/// owners list.
//------------------------------------------------------------------
void
ClearAllBreakpointSites ();
//------------------------------------------------------------------
/// Removes all the locations in this list from their breakpoint site
/// owners list.
//------------------------------------------------------------------
void ClearAllBreakpointSites();
//------------------------------------------------------------------
/// Tells all the breakpoint locations in this list to attempt to
/// resolve any possible breakpoint sites.
//------------------------------------------------------------------
void
ResolveAllBreakpointSites ();
//------------------------------------------------------------------
/// Tells all the breakpoint locations in this list to attempt to
/// resolve any possible breakpoint sites.
//------------------------------------------------------------------
void ResolveAllBreakpointSites();
//------------------------------------------------------------------
/// Returns the number of breakpoint locations in this list with
/// resolved breakpoints.
///
/// @result
/// Number of qualifying breakpoint locations.
//------------------------------------------------------------------
size_t
GetNumResolvedLocations() const;
//------------------------------------------------------------------
/// Returns the number of breakpoint locations in this list with
/// resolved breakpoints.
///
/// @result
/// Number of qualifying breakpoint locations.
//------------------------------------------------------------------
size_t GetNumResolvedLocations() const;
//------------------------------------------------------------------
/// Returns the number hit count of all locations in this list.
///
/// @result
/// Hit count of all locations in this list.
//------------------------------------------------------------------
uint32_t
GetHitCount () const;
//------------------------------------------------------------------
/// Returns the number hit count of all locations in this list.
///
/// @result
/// Hit count of all locations in this list.
//------------------------------------------------------------------
uint32_t GetHitCount() const;
//------------------------------------------------------------------
/// Enquires of the breakpoint location in this list with ID \a
/// breakID whether we should stop.
///
/// @param[in] context
/// This contains the information about this stop.
///
/// @param[in] breakID
/// This break ID that we hit.
///
/// @return
/// \b true if we should stop, \b false otherwise.
//------------------------------------------------------------------
bool
ShouldStop (StoppointCallbackContext *context,
lldb::break_id_t breakID);
//------------------------------------------------------------------
/// Enquires of the breakpoint location in this list with ID \a
/// breakID whether we should stop.
///
/// @param[in] context
/// This contains the information about this stop.
///
/// @param[in] breakID
/// This break ID that we hit.
///
/// @return
/// \b true if we should stop, \b false otherwise.
//------------------------------------------------------------------
bool ShouldStop(StoppointCallbackContext *context, lldb::break_id_t breakID);
//------------------------------------------------------------------
/// Returns the number of elements in this breakpoint location list.
///
/// @result
/// The number of elements.
//------------------------------------------------------------------
size_t
GetSize() const
{
return m_locations.size();
}
//------------------------------------------------------------------
/// Returns the number of elements in this breakpoint location list.
///
/// @result
/// The number of elements.
//------------------------------------------------------------------
size_t GetSize() const { return m_locations.size(); }
//------------------------------------------------------------------
/// Print a description of the breakpoint locations in this list to
/// the stream \a s.
///
/// @param[in] s
/// The stream to which to print the description.
///
/// @param[in] level
/// The description level that indicates the detail level to
/// provide.
///
/// @see lldb::DescriptionLevel
//------------------------------------------------------------------
void
GetDescription (Stream *s,
lldb::DescriptionLevel level);
//------------------------------------------------------------------
/// Print a description of the breakpoint locations in this list to
/// the stream \a s.
///
/// @param[in] s
/// The stream to which to print the description.
///
/// @param[in] level
/// The description level that indicates the detail level to
/// provide.
///
/// @see lldb::DescriptionLevel
//------------------------------------------------------------------
void GetDescription(Stream *s, lldb::DescriptionLevel level);
protected:
//------------------------------------------------------------------
/// This is the standard constructor.
///
/// It creates an empty breakpoint location list. It is protected
/// here because only Breakpoints are allowed to create the
/// breakpoint location list.
//------------------------------------------------------------------
BreakpointLocationList(Breakpoint &owner);
//------------------------------------------------------------------
/// This is the standard constructor.
///
/// It creates an empty breakpoint location list. It is protected
/// here because only Breakpoints are allowed to create the
/// breakpoint location list.
//------------------------------------------------------------------
BreakpointLocationList(Breakpoint &owner);
//------------------------------------------------------------------
/// Add the breakpoint \a bp_loc_sp to the list.
///
/// @param[in] bp_sp
/// Shared pointer to the breakpoint location that will get
/// added to the list.
///
/// @result
/// Returns breakpoint location id.
//------------------------------------------------------------------
lldb::BreakpointLocationSP
Create (const Address &addr, bool resolve_indirect_symbols);
void
StartRecordingNewLocations(BreakpointLocationCollection &new_locations);
void
StopRecordingNewLocations();
lldb::BreakpointLocationSP
AddLocation(const Address &addr,
bool resolve_indirect_symbols,
bool *new_location = nullptr);
void
SwapLocation (lldb::BreakpointLocationSP to_location_sp, lldb::BreakpointLocationSP from_location_sp);
//------------------------------------------------------------------
/// Add the breakpoint \a bp_loc_sp to the list.
///
/// @param[in] bp_sp
/// Shared pointer to the breakpoint location that will get
/// added to the list.
///
/// @result
/// Returns breakpoint location id.
//------------------------------------------------------------------
lldb::BreakpointLocationSP Create(const Address &addr,
bool resolve_indirect_symbols);
bool
RemoveLocation (const lldb::BreakpointLocationSP &bp_loc_sp);
void
RemoveInvalidLocations (const ArchSpec &arch);
void
Compact();
void StartRecordingNewLocations(BreakpointLocationCollection &new_locations);
typedef std::vector<lldb::BreakpointLocationSP> collection;
typedef std::map<lldb_private::Address,
lldb::BreakpointLocationSP,
Address::ModulePointerAndOffsetLessThanFunctionObject> addr_map;
void StopRecordingNewLocations();
Breakpoint &m_owner;
collection m_locations; // Vector of locations, sorted by ID
addr_map m_address_to_location;
mutable std::recursive_mutex m_mutex;
lldb::break_id_t m_next_id;
BreakpointLocationCollection *m_new_location_recorder;
lldb::BreakpointLocationSP AddLocation(const Address &addr,
bool resolve_indirect_symbols,
bool *new_location = nullptr);
void SwapLocation(lldb::BreakpointLocationSP to_location_sp,
lldb::BreakpointLocationSP from_location_sp);
bool RemoveLocation(const lldb::BreakpointLocationSP &bp_loc_sp);
void RemoveInvalidLocations(const ArchSpec &arch);
void Compact();
typedef std::vector<lldb::BreakpointLocationSP> collection;
typedef std::map<lldb_private::Address, lldb::BreakpointLocationSP,
Address::ModulePointerAndOffsetLessThanFunctionObject>
addr_map;
Breakpoint &m_owner;
collection m_locations; // Vector of locations, sorted by ID
addr_map m_address_to_location;
mutable std::recursive_mutex m_mutex;
lldb::break_id_t m_next_id;
BreakpointLocationCollection *m_new_location_recorder;
public:
typedef AdaptedIterable<collection, lldb::BreakpointLocationSP, vector_adapter> BreakpointLocationIterable;
typedef AdaptedIterable<collection, lldb::BreakpointLocationSP,
vector_adapter>
BreakpointLocationIterable;
BreakpointLocationIterable
BreakpointLocations()
{
return BreakpointLocationIterable(m_locations);
}
BreakpointLocationIterable BreakpointLocations() {
return BreakpointLocationIterable(m_locations);
}
};
} // namespace lldb_private

View File

@ -17,341 +17,389 @@
// Other libraries and framework includes
// Project includes
#include "lldb/lldb-private.h"
#include "lldb/Core/Baton.h"
#include "lldb/Core/StringList.h"
#include "lldb/Core/StructuredData.h"
#include "lldb/lldb-private.h"
namespace lldb_private {
//----------------------------------------------------------------------
/// @class BreakpointOptions BreakpointOptions.h "lldb/Breakpoint/BreakpointOptions.h"
/// @brief Class that manages the options on a breakpoint or breakpoint location.
/// @class BreakpointOptions BreakpointOptions.h
/// "lldb/Breakpoint/BreakpointOptions.h"
/// @brief Class that manages the options on a breakpoint or breakpoint
/// location.
//----------------------------------------------------------------------
class BreakpointOptions
{
class BreakpointOptions {
public:
//------------------------------------------------------------------
// Constructors and Destructors
//------------------------------------------------------------------
//------------------------------------------------------------------
/// Default constructor. The breakpoint is enabled, and has no condition,
/// callback, ignore count, etc...
//------------------------------------------------------------------
BreakpointOptions();
BreakpointOptions(const BreakpointOptions& rhs);
struct CommandData {
CommandData()
: user_source(), script_source(),
interpreter(lldb::eScriptLanguageNone), stop_on_error(true) {}
static BreakpointOptions *
CopyOptionsNoCallback (BreakpointOptions &rhs);
//------------------------------------------------------------------
/// This constructor allows you to specify all the breakpoint options.
///
/// @param[in] condition
/// The expression which if it evaluates to \b true if we are to stop
///
/// @param[in] callback
/// This is the plugin for some code that gets run, returns \b true if we are to stop.
///
/// @param[in] baton
/// Client data that will get passed to the callback.
///
/// @param[in] enabled
/// Is this breakpoint enabled.
///
/// @param[in] ignore
/// How many breakpoint hits we should ignore before stopping.
///
/// @param[in] thread_id
/// Only stop if \a thread_id hits the breakpoint.
//------------------------------------------------------------------
BreakpointOptions(void *condition,
BreakpointHitCallback callback,
void *baton,
bool enabled = true,
int32_t ignore = 0,
lldb::tid_t thread_id = LLDB_INVALID_THREAD_ID,
bool one_shot = false);
CommandData(const StringList &user_source, lldb::ScriptLanguage interp)
: user_source(user_source), script_source(), interpreter(interp),
stop_on_error(true) {}
virtual ~BreakpointOptions();
~CommandData() = default;
//------------------------------------------------------------------
// Operators
//------------------------------------------------------------------
const BreakpointOptions&
operator=(const BreakpointOptions& rhs);
static const char *GetSerializationKey() { return "BKPTCMDData"; }
//------------------------------------------------------------------
// Callbacks
//
// Breakpoint callbacks come in two forms, synchronous and asynchronous. Synchronous callbacks will get
// run before any of the thread plans are consulted, and if they return false the target will continue
// "under the radar" of the thread plans. There are a couple of restrictions to synchronous callbacks:
// 1) They should NOT resume the target themselves. Just return false if you want the target to restart.
// 2) Breakpoints with synchronous callbacks can't have conditions (or rather, they can have them, but they
// won't do anything. Ditto with ignore counts, etc... You are supposed to control that all through the
// callback.
// Asynchronous callbacks get run as part of the "ShouldStop" logic in the thread plan. The logic there is:
// a) If the breakpoint is thread specific and not for this thread, continue w/o running the callback.
// NB. This is actually enforced underneath the breakpoint system, the Process plugin is expected to
// call BreakpointSite::IsValidForThread, and set the thread's StopInfo to "no reason". That way,
// thread displays won't show stops for breakpoints not for that thread...
// b) If the ignore count says we shouldn't stop, then ditto.
// c) If the condition says we shouldn't stop, then ditto.
// d) Otherwise, the callback will get run, and if it returns true we will stop, and if false we won't.
// The asynchronous callback can run the target itself, but at present that should be the last action the
// callback does. We will relax this condition at some point, but it will take a bit of plumbing to get
// that to work.
//
//------------------------------------------------------------------
//------------------------------------------------------------------
/// Adds a callback to the breakpoint option set.
///
/// @param[in] callback
/// The function to be called when the breakpoint gets hit.
///
/// @param[in] baton_sp
/// A baton which will get passed back to the callback when it is invoked.
///
/// @param[in] synchronous
/// Whether this is a synchronous or asynchronous callback. See discussion above.
//------------------------------------------------------------------
void SetCallback (BreakpointHitCallback callback, const lldb::BatonSP &baton_sp, bool synchronous = false);
//------------------------------------------------------------------
/// Remove the callback from this option set.
//------------------------------------------------------------------
void ClearCallback ();
StructuredData::ObjectSP SerializeToStructuredData();
// The rest of these functions are meant to be used only within the breakpoint handling mechanism.
//------------------------------------------------------------------
/// Use this function to invoke the callback for a specific stop.
///
/// @param[in] context
/// The 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 breakpoint on multiple threads) and
/// whether we are currently executing synchronous or asynchronous callbacks.
///
/// @param[in] break_id
/// The breakpoint ID that owns this option set.
///
/// @param[in] break_loc_id
/// The breakpoint location ID that owns this option set.
///
/// @return
/// The callback return value.
//------------------------------------------------------------------
bool InvokeCallback (StoppointCallbackContext *context, lldb::user_id_t break_id, lldb::user_id_t break_loc_id);
//------------------------------------------------------------------
/// Used in InvokeCallback to tell whether it is the right time to run this kind of callback.
///
/// @return
/// The synchronicity of our callback.
//------------------------------------------------------------------
bool IsCallbackSynchronous () const
{
return m_callback_is_synchronous;
}
//------------------------------------------------------------------
/// Fetch the baton from the callback.
///
/// @return
/// The baton.
//------------------------------------------------------------------
Baton *GetBaton ();
//------------------------------------------------------------------
/// Fetch a const version of the baton from the callback.
///
/// @return
/// The baton.
//------------------------------------------------------------------
const Baton *GetBaton () const;
//------------------------------------------------------------------
// Condition
//------------------------------------------------------------------
//------------------------------------------------------------------
/// Set the breakpoint option's condition.
///
/// @param[in] condition
/// The condition expression to evaluate when the breakpoint is hit.
//------------------------------------------------------------------
void SetCondition (const char *condition);
//------------------------------------------------------------------
/// Return a pointer to the text of the condition expression.
///
/// @return
/// A pointer to the condition expression text, or nullptr if no
// condition has been set.
//------------------------------------------------------------------
const char *GetConditionText(size_t *hash = nullptr) const;
//------------------------------------------------------------------
// Enabled/Ignore Count
//------------------------------------------------------------------
static std::unique_ptr<CommandData>
CreateFromStructuredData(const StructuredData::Dictionary &options_dict,
Error &error);
//------------------------------------------------------------------
/// Check the Enable/Disable state.
/// @return
/// \b true if the breakpoint is enabled, \b false if disabled.
//------------------------------------------------------------------
bool
IsEnabled () const
{
return m_enabled;
}
StringList user_source;
std::string script_source;
enum lldb::ScriptLanguage
interpreter; // eScriptLanguageNone means command interpreter.
bool stop_on_error;
//------------------------------------------------------------------
/// If \a enable is \b true, enable the breakpoint, if \b false disable it.
//------------------------------------------------------------------
void
SetEnabled (bool enabled)
{
m_enabled = enabled;
}
//------------------------------------------------------------------
/// Check the One-shot state.
/// @return
/// \b true if the breakpoint is one-shot, \b false otherwise.
//------------------------------------------------------------------
bool
IsOneShot () const
{
return m_one_shot;
}
//------------------------------------------------------------------
/// If \a enable is \b true, enable the breakpoint, if \b false disable it.
//------------------------------------------------------------------
void
SetOneShot (bool one_shot)
{
m_one_shot = one_shot;
}
//------------------------------------------------------------------
/// Set the breakpoint to ignore the next \a count breakpoint hits.
/// @param[in] count
/// The number of breakpoint hits to ignore.
//------------------------------------------------------------------
void
SetIgnoreCount (uint32_t n)
{
m_ignore_count = n;
}
//------------------------------------------------------------------
/// Return the current Ignore Count.
/// @return
/// The number of breakpoint hits to be ignored.
//------------------------------------------------------------------
uint32_t
GetIgnoreCount () const
{
return m_ignore_count;
}
//------------------------------------------------------------------
/// Return the current thread spec for this option. This will return nullptr if the no thread
/// specifications have been set for this Option yet.
/// @return
/// The thread specification pointer for this option, or nullptr if none has
/// been set yet.
//------------------------------------------------------------------
const ThreadSpec *
GetThreadSpecNoCreate () const;
//------------------------------------------------------------------
/// 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 option.
//------------------------------------------------------------------
ThreadSpec *
GetThreadSpec ();
void
SetThreadID(lldb::tid_t thread_id);
void
GetDescription (Stream *s, lldb::DescriptionLevel level) const;
//------------------------------------------------------------------
/// Returns true if the breakpoint option has a callback set.
//------------------------------------------------------------------
bool
HasCallback() const;
//------------------------------------------------------------------
/// This is the default empty callback.
/// @return
/// The thread id for which the breakpoint hit will stop,
/// LLDB_INVALID_THREAD_ID for all threads.
//------------------------------------------------------------------
static bool
NullCallback (void *baton,
StoppointCallbackContext *context,
lldb::user_id_t break_id,
lldb::user_id_t break_loc_id);
struct CommandData
{
CommandData () :
user_source(),
script_source(),
stop_on_error(true)
{
}
~CommandData() = default;
StringList user_source;
std::string script_source;
bool stop_on_error;
private:
enum class OptionNames : uint32_t {
UserSource = 0,
Interpreter,
StopOnError,
LastOptionName
};
class CommandBaton : public Baton
{
public:
CommandBaton (CommandData *data) :
Baton (data)
{
}
static const char
*g_option_names[static_cast<uint32_t>(OptionNames::LastOptionName)];
~CommandBaton() override
{
delete ((CommandData *)m_data);
m_data = nullptr;
}
void
GetDescription (Stream *s, lldb::DescriptionLevel level) const override;
};
static const char *GetKey(OptionNames enum_value) {
return g_option_names[static_cast<uint32_t>(enum_value)];
}
};
class CommandBaton : public TypedBaton<CommandData> {
public:
explicit CommandBaton(std::unique_ptr<CommandData> Data)
: TypedBaton(std::move(Data)) {}
void GetDescription(Stream *s, lldb::DescriptionLevel level) const override;
};
typedef std::shared_ptr<CommandBaton> CommandBatonSP;
//------------------------------------------------------------------
// Constructors and Destructors
//------------------------------------------------------------------
//------------------------------------------------------------------
/// Default constructor. The breakpoint is enabled, and has no condition,
/// callback, ignore count, etc...
//------------------------------------------------------------------
BreakpointOptions();
BreakpointOptions(const BreakpointOptions &rhs);
static BreakpointOptions *CopyOptionsNoCallback(BreakpointOptions &rhs);
//------------------------------------------------------------------
/// This constructor allows you to specify all the breakpoint options
/// except the callback. That one is more complicated, and better
/// to do by hand.
///
/// @param[in] condition
/// The expression which if it evaluates to \b true if we are to stop
///
/// @param[in] enabled
/// Is this breakpoint enabled.
///
/// @param[in] ignore
/// How many breakpoint hits we should ignore before stopping.
///
//------------------------------------------------------------------
BreakpointOptions(const char *condition, bool enabled = true,
int32_t ignore = 0, bool one_shot = false);
virtual ~BreakpointOptions();
static std::unique_ptr<BreakpointOptions>
CreateFromStructuredData(Target &target,
const StructuredData::Dictionary &data_dict,
Error &error);
virtual StructuredData::ObjectSP SerializeToStructuredData();
static const char *GetSerializationKey() { return "BKPTOptions"; }
//------------------------------------------------------------------
// Operators
//------------------------------------------------------------------
const BreakpointOptions &operator=(const BreakpointOptions &rhs);
//------------------------------------------------------------------
// Callbacks
//
// Breakpoint callbacks come in two forms, synchronous and asynchronous.
// Synchronous callbacks will get
// run before any of the thread plans are consulted, and if they return false
// the target will continue
// "under the radar" of the thread plans. There are a couple of restrictions
// to synchronous callbacks:
// 1) They should NOT resume the target themselves. Just return false if you
// want the target to restart.
// 2) Breakpoints with synchronous callbacks can't have conditions (or rather,
// they can have them, but they
// won't do anything. Ditto with ignore counts, etc... You are supposed
// to control that all through the
// callback.
// Asynchronous callbacks get run as part of the "ShouldStop" logic in the
// thread plan. The logic there is:
// a) If the breakpoint is thread specific and not for this thread, continue
// w/o running the callback.
// NB. This is actually enforced underneath the breakpoint system, the
// Process plugin is expected to
// call BreakpointSite::IsValidForThread, and set the thread's StopInfo
// to "no reason". That way,
// thread displays won't show stops for breakpoints not for that
// thread...
// b) If the ignore count says we shouldn't stop, then ditto.
// c) If the condition says we shouldn't stop, then ditto.
// d) Otherwise, the callback will get run, and if it returns true we will
// stop, and if false we won't.
// The asynchronous callback can run the target itself, but at present that
// should be the last action the
// callback does. We will relax this condition at some point, but it will
// take a bit of plumbing to get
// that to work.
//
//------------------------------------------------------------------
//------------------------------------------------------------------
/// Adds a callback to the breakpoint option set.
///
/// @param[in] callback
/// The function to be called when the breakpoint gets hit.
///
/// @param[in] baton_sp
/// A baton which will get passed back to the callback when it is invoked.
///
/// @param[in] synchronous
/// Whether this is a synchronous or asynchronous callback. See discussion
/// above.
//------------------------------------------------------------------
void SetCallback(BreakpointHitCallback callback,
const lldb::BatonSP &baton_sp, bool synchronous = false);
void SetCallback(BreakpointHitCallback callback,
const BreakpointOptions::CommandBatonSP &command_baton_sp,
bool synchronous = false);
//------------------------------------------------------------------
/// Returns the command line commands for the callback on this breakpoint.
///
/// @param[out] command_list
/// The commands will be appended to this list.
///
/// @return
/// \btrue if the command callback is a command-line callback,
/// \bfalse otherwise.
//------------------------------------------------------------------
bool GetCommandLineCallbacks(StringList &command_list);
//------------------------------------------------------------------
/// Remove the callback from this option set.
//------------------------------------------------------------------
void ClearCallback();
// The rest of these functions are meant to be used only within the breakpoint
// handling mechanism.
//------------------------------------------------------------------
/// Use this function to invoke the callback for a specific stop.
///
/// @param[in] context
/// The 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 breakpoint
/// on multiple threads) and
/// whether we are currently executing synchronous or asynchronous
/// callbacks.
///
/// @param[in] break_id
/// The breakpoint ID that owns this option set.
///
/// @param[in] break_loc_id
/// The breakpoint location ID that owns this option set.
///
/// @return
/// The callback return value.
//------------------------------------------------------------------
bool InvokeCallback(StoppointCallbackContext *context,
lldb::user_id_t break_id, lldb::user_id_t break_loc_id);
//------------------------------------------------------------------
/// Used in InvokeCallback to tell whether it is the right time to run this
/// kind of callback.
///
/// @return
/// The synchronicity of our callback.
//------------------------------------------------------------------
bool IsCallbackSynchronous() const { return m_callback_is_synchronous; }
//------------------------------------------------------------------
/// Fetch the baton from the callback.
///
/// @return
/// The baton.
//------------------------------------------------------------------
Baton *GetBaton();
//------------------------------------------------------------------
/// Fetch a const version of the baton from the callback.
///
/// @return
/// The baton.
//------------------------------------------------------------------
const Baton *GetBaton() const;
//------------------------------------------------------------------
// Condition
//------------------------------------------------------------------
//------------------------------------------------------------------
/// Set the breakpoint option's condition.
///
/// @param[in] condition
/// The condition expression to evaluate when the breakpoint is hit.
//------------------------------------------------------------------
void SetCondition(const char *condition);
//------------------------------------------------------------------
/// Return a pointer to the text of the condition expression.
///
/// @return
/// A pointer to the condition expression text, or nullptr if no
// condition has been set.
//------------------------------------------------------------------
const char *GetConditionText(size_t *hash = nullptr) const;
//------------------------------------------------------------------
// Enabled/Ignore Count
//------------------------------------------------------------------
//------------------------------------------------------------------
/// Check the Enable/Disable state.
/// @return
/// \b true if the breakpoint is enabled, \b false if disabled.
//------------------------------------------------------------------
bool IsEnabled() const { return m_enabled; }
//------------------------------------------------------------------
/// If \a enable is \b true, enable the breakpoint, if \b false disable it.
//------------------------------------------------------------------
void SetEnabled(bool enabled) { m_enabled = enabled; }
//------------------------------------------------------------------
/// Check the One-shot state.
/// @return
/// \b true if the breakpoint is one-shot, \b false otherwise.
//------------------------------------------------------------------
bool IsOneShot() const { return m_one_shot; }
//------------------------------------------------------------------
/// If \a enable is \b true, enable the breakpoint, if \b false disable it.
//------------------------------------------------------------------
void SetOneShot(bool one_shot) { m_one_shot = one_shot; }
//------------------------------------------------------------------
/// Set the breakpoint to ignore the next \a count breakpoint hits.
/// @param[in] count
/// The number of breakpoint hits to ignore.
//------------------------------------------------------------------
void SetIgnoreCount(uint32_t n) { m_ignore_count = n; }
//------------------------------------------------------------------
/// Return the current Ignore Count.
/// @return
/// The number of breakpoint hits to be ignored.
//------------------------------------------------------------------
uint32_t GetIgnoreCount() const { return m_ignore_count; }
//------------------------------------------------------------------
/// Return the current thread spec for this option. This will return nullptr
/// if the no thread
/// specifications have been set for this Option yet.
/// @return
/// The thread specification pointer for this option, or nullptr if none
/// has
/// been set yet.
//------------------------------------------------------------------
const ThreadSpec *GetThreadSpecNoCreate() const;
//------------------------------------------------------------------
/// 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 option.
//------------------------------------------------------------------
ThreadSpec *GetThreadSpec();
void SetThreadID(lldb::tid_t thread_id);
void GetDescription(Stream *s, lldb::DescriptionLevel level) const;
//------------------------------------------------------------------
/// Returns true if the breakpoint option has a callback set.
//------------------------------------------------------------------
bool HasCallback() const;
//------------------------------------------------------------------
/// This is the default empty callback.
//------------------------------------------------------------------
static bool NullCallback(void *baton, StoppointCallbackContext *context,
lldb::user_id_t break_id,
lldb::user_id_t break_loc_id);
//------------------------------------------------------------------
/// Set a callback based on BreakpointOptions::CommandData.
/// @param[in] cmd_data
/// A UP holding the new'ed CommandData object.
/// The breakpoint will take ownership of pointer held by this object.
//------------------------------------------------------------------
void SetCommandDataCallback(std::unique_ptr<CommandData> &cmd_data);
protected:
//------------------------------------------------------------------
// Classes that inherit from BreakpointOptions can see and modify these
//------------------------------------------------------------------
//------------------------------------------------------------------
// Classes that inherit from BreakpointOptions can see and modify these
//------------------------------------------------------------------
enum class OptionNames {
ConditionText = 0,
IgnoreCount,
EnabledState,
OneShotState,
LastOptionName
};
static const char *g_option_names[(size_t)OptionNames::LastOptionName];
static const char *GetKey(OptionNames enum_value) {
return g_option_names[(size_t)enum_value];
}
static bool BreakpointOptionsCallbackFunction(
void *baton, StoppointCallbackContext *context, lldb::user_id_t break_id,
lldb::user_id_t break_loc_id);
void SetThreadSpec(std::unique_ptr<ThreadSpec> &thread_spec_up);
private:
//------------------------------------------------------------------
// For BreakpointOptions only
//------------------------------------------------------------------
BreakpointHitCallback m_callback; // This is the callback function pointer
lldb::BatonSP m_callback_baton_sp; // This is the client data for the callback
bool m_callback_is_synchronous;
bool m_enabled;
bool m_one_shot;
uint32_t m_ignore_count; // Number of times to ignore this breakpoint
std::unique_ptr<ThreadSpec> m_thread_spec_ap; // Thread for which this breakpoint will take
std::string m_condition_text; // The condition to test.
size_t m_condition_text_hash; // Its hash, so that locations know when the condition is updated.
//------------------------------------------------------------------
// For BreakpointOptions only
//------------------------------------------------------------------
BreakpointHitCallback m_callback; // This is the callback function pointer
lldb::BatonSP m_callback_baton_sp; // This is the client data for the callback
bool m_baton_is_command_baton;
bool m_callback_is_synchronous;
bool m_enabled;
bool m_one_shot;
uint32_t m_ignore_count; // Number of times to ignore this breakpoint
std::unique_ptr<ThreadSpec>
m_thread_spec_ap; // Thread for which this breakpoint will take
std::string m_condition_text; // The condition to test.
size_t m_condition_text_hash; // Its hash, so that locations know when the
// condition is updated.
};
} // namespace lldb_private

View File

@ -14,20 +14,22 @@
// C++ Includes
// Other libraries and framework includes
// Project includes
#include "lldb/lldb-private.h"
#include "lldb/Core/Address.h"
#include "lldb/Breakpoint/Breakpoint.h"
#include "lldb/Breakpoint/BreakpointResolver.h"
#include "lldb/Host/FileSpec.h"
#include "lldb/Core/Address.h"
#include "lldb/Core/ConstString.h"
#include "lldb/Core/RegularExpression.h"
#include "lldb/Core/SearchFilter.h"
#include "lldb/Core/ConstString.h"
#include "lldb/Host/FileSpec.h"
#include "lldb/lldb-private.h"
namespace lldb_private {
//----------------------------------------------------------------------
/// @class BreakpointResolver BreakpointResolver.h "lldb/Breakpoint/BreakpointResolver.h"
/// @brief This class works with SearchFilter to resolve logical breakpoints to their
/// @class BreakpointResolver BreakpointResolver.h
/// "lldb/Breakpoint/BreakpointResolver.h"
/// @brief This class works with SearchFilter to resolve logical breakpoints to
/// their
/// of concrete breakpoint locations.
//----------------------------------------------------------------------
@ -35,150 +37,220 @@ namespace lldb_private {
/// General Outline:
/// The BreakpointResolver is a Searcher. In that protocol,
/// the SearchFilter asks the question "At what depth of the symbol context
/// descent do you want your callback to get called?" of the filter. The resolver
/// answers this question (in the GetDepth method) and provides the resolution callback.
/// Each Breakpoint has a BreakpointResolver, and it calls either ResolveBreakpoint
/// or ResolveBreakpointInModules to tell it to look for new breakpoint locations.
/// descent do you want your callback to get called?" of the filter. The
/// resolver
/// answers this question (in the GetDepth method) and provides the resolution
/// callback.
/// Each Breakpoint has a BreakpointResolver, and it calls either
/// ResolveBreakpoint
/// or ResolveBreakpointInModules to tell it to look for new breakpoint
/// locations.
//----------------------------------------------------------------------
class BreakpointResolver :
public Searcher
{
friend class Breakpoint;
class BreakpointResolver : public Searcher {
friend class Breakpoint;
public:
//------------------------------------------------------------------
/// The breakpoint resolver need to have a breakpoint for "ResolveBreakpoint
/// to make sense. It can be constructed without a breakpoint, but you have to
/// call SetBreakpoint before ResolveBreakpoint.
///
/// @param[in] bkpt
/// The breakpoint that owns this resolver.
/// @param[in] resolverType
/// The concrete breakpoint resolver type for this breakpoint.
///
/// @result
/// Returns breakpoint location id.
//------------------------------------------------------------------
BreakpointResolver (Breakpoint *bkpt, unsigned char resolverType, lldb::addr_t offset = 0);
//------------------------------------------------------------------
/// The breakpoint resolver need to have a breakpoint for "ResolveBreakpoint
/// to make sense. It can be constructed without a breakpoint, but you have
/// to
/// call SetBreakpoint before ResolveBreakpoint.
///
/// @param[in] bkpt
/// The breakpoint that owns this resolver.
/// @param[in] resolverType
/// The concrete breakpoint resolver type for this breakpoint.
///
/// @result
/// Returns breakpoint location id.
//------------------------------------------------------------------
BreakpointResolver(Breakpoint *bkpt, unsigned char resolverType,
lldb::addr_t offset = 0);
//------------------------------------------------------------------
/// The Destructor is virtual, all significant breakpoint resolvers derive
/// from this class.
//------------------------------------------------------------------
~BreakpointResolver() override;
//------------------------------------------------------------------
/// The Destructor is virtual, all significant breakpoint resolvers derive
/// from this class.
//------------------------------------------------------------------
~BreakpointResolver() override;
//------------------------------------------------------------------
/// This sets the breakpoint for this resolver.
///
/// @param[in] bkpt
/// The breakpoint that owns this resolver.
//------------------------------------------------------------------
void
SetBreakpoint (Breakpoint *bkpt);
//------------------------------------------------------------------
/// This sets the breakpoint for this resolver.
///
/// @param[in] bkpt
/// The breakpoint that owns this resolver.
//------------------------------------------------------------------
void SetBreakpoint(Breakpoint *bkpt);
//------------------------------------------------------------------
/// This updates the offset for this breakpoint. All the locations currently
/// set for this breakpoint will have their offset adjusted when this is called.
///
/// @param[in] offset
/// The offset to add to all locations.
//------------------------------------------------------------------
void
SetOffset (lldb::addr_t offset);
//------------------------------------------------------------------
/// This updates the offset for this breakpoint. All the locations currently
/// set for this breakpoint will have their offset adjusted when this is
/// called.
///
/// @param[in] offset
/// The offset to add to all locations.
//------------------------------------------------------------------
void SetOffset(lldb::addr_t offset);
//------------------------------------------------------------------
/// This updates the offset for this breakpoint. All the locations currently
/// set for this breakpoint will have their offset adjusted when this is called.
///
/// @param[in] offset
/// The offset to add to all locations.
//------------------------------------------------------------------
lldb::addr_t
GetOffset () const
{
return m_offset;
}
//------------------------------------------------------------------
/// This updates the offset for this breakpoint. All the locations currently
/// set for this breakpoint will have their offset adjusted when this is
/// called.
///
/// @param[in] offset
/// The offset to add to all locations.
//------------------------------------------------------------------
lldb::addr_t GetOffset() const { return m_offset; }
//------------------------------------------------------------------
/// In response to this method the resolver scans all the modules in the breakpoint's
/// target, and adds any new locations it finds.
///
/// @param[in] filter
/// The filter that will manage the search for this resolver.
//------------------------------------------------------------------
virtual void
ResolveBreakpoint (SearchFilter &filter);
//------------------------------------------------------------------
/// In response to this method the resolver scans all the modules in the
/// breakpoint's
/// target, and adds any new locations it finds.
///
/// @param[in] filter
/// The filter that will manage the search for this resolver.
//------------------------------------------------------------------
virtual void ResolveBreakpoint(SearchFilter &filter);
//------------------------------------------------------------------
/// In response to this method the resolver scans the modules in the module list
/// \a modules, and adds any new locations it finds.
///
/// @param[in] filter
/// The filter that will manage the search for this resolver.
//------------------------------------------------------------------
virtual void
ResolveBreakpointInModules (SearchFilter &filter,
ModuleList &modules);
//------------------------------------------------------------------
/// In response to this method the resolver scans the modules in the module
/// list
/// \a modules, and adds any new locations it finds.
///
/// @param[in] filter
/// The filter that will manage the search for this resolver.
//------------------------------------------------------------------
virtual void ResolveBreakpointInModules(SearchFilter &filter,
ModuleList &modules);
//------------------------------------------------------------------
/// Prints a canonical description for the breakpoint to the stream \a s.
///
/// @param[in] s
/// Stream to which the output is copied.
//------------------------------------------------------------------
void
GetDescription(Stream *s) override = 0;
//------------------------------------------------------------------
/// Prints a canonical description for the breakpoint to the stream \a s.
///
/// @param[in] s
/// Stream to which the output is copied.
//------------------------------------------------------------------
void GetDescription(Stream *s) override = 0;
//------------------------------------------------------------------
/// Standard "Dump" method. At present it does nothing.
//------------------------------------------------------------------
virtual void
Dump (Stream *s) const = 0;
//------------------------------------------------------------------
/// Standard "Dump" method. At present it does nothing.
//------------------------------------------------------------------
virtual void Dump(Stream *s) const = 0;
//------------------------------------------------------------------
/// An enumeration for keeping track of the concrete subclass that
/// is actually instantiated. Values of this enumeration are kept in the
/// BreakpointResolver's SubclassID field. They are used for concrete type
/// identification.
enum ResolverTy {
FileLineResolver, // This is an instance of BreakpointResolverFileLine
AddressResolver, // This is an instance of BreakpointResolverAddress
NameResolver, // This is an instance of BreakpointResolverName
FileRegexResolver,
ExceptionResolver,
LastKnownResolverType = ExceptionResolver
};
/// This section handles serializing and deserializing from StructuredData
/// objects.
//------------------------------------------------------------------
/// getResolverID - Return an ID for the concrete type of this object. This
/// is used to implement the LLVM classof checks. This should not be used
/// for any other purpose, as the values may change as LLDB evolves.
unsigned getResolverID() const {
return SubclassID;
}
static lldb::BreakpointResolverSP
CreateFromStructuredData(const StructuredData::Dictionary &resolver_dict,
Error &error);
virtual lldb::BreakpointResolverSP
CopyForBreakpoint (Breakpoint &breakpoint) = 0;
virtual StructuredData::ObjectSP SerializeToStructuredData() {
return StructuredData::ObjectSP();
}
static const char *GetSerializationKey() { return "BKPTResolver"; }
static const char *GetSerializationSubclassKey() { return "Type"; }
static const char *GetSerializationSubclassOptionsKey() { return "Options"; }
StructuredData::DictionarySP
WrapOptionsDict(StructuredData::DictionarySP options_dict_sp);
//------------------------------------------------------------------
//------------------------------------------------------------------
/// An enumeration for keeping track of the concrete subclass that
/// is actually instantiated. Values of this enumeration are kept in the
/// BreakpointResolver's SubclassID field. They are used for concrete type
/// identification.
enum ResolverTy {
FileLineResolver = 0, // This is an instance of BreakpointResolverFileLine
AddressResolver, // This is an instance of BreakpointResolverAddress
NameResolver, // This is an instance of BreakpointResolverName
FileRegexResolver,
ExceptionResolver,
LastKnownResolverType = ExceptionResolver,
UnknownResolver
};
// Translate the Ty to name for serialization,
// the "+2" is one for size vrs. index, and one for UnknownResolver.
static const char *g_ty_to_name[LastKnownResolverType + 2];
//------------------------------------------------------------------
/// getResolverID - Return an ID for the concrete type of this object. This
/// is used to implement the LLVM classof checks. This should not be used
/// for any other purpose, as the values may change as LLDB evolves.
unsigned getResolverID() const { return SubclassID; }
enum ResolverTy GetResolverTy() {
if (SubclassID > ResolverTy::LastKnownResolverType)
return ResolverTy::UnknownResolver;
else
return (enum ResolverTy)SubclassID;
}
const char *GetResolverName() { return ResolverTyToName(GetResolverTy()); }
static const char *ResolverTyToName(enum ResolverTy);
static ResolverTy NameToResolverTy(const char *name);
virtual lldb::BreakpointResolverSP
CopyForBreakpoint(Breakpoint &breakpoint) = 0;
protected:
//------------------------------------------------------------------
/// SetSCMatchesByLine - Takes a symbol context list of matches which supposedly represent the same file and
/// line number in a CU, and find the nearest actual line number that matches, and then filter down the
/// matching addresses to unique entries, and skip the prologue if asked to do so, and then set
/// breakpoint locations in this breakpoint for all the resultant addresses.
void SetSCMatchesByLine (SearchFilter &filter, SymbolContextList &sc_list, bool skip_prologue, const char *log_ident);
// Used for serializing resolver options:
// The options in this enum and the strings in the
// g_option_names must be kept in sync.
enum class OptionNames : uint32_t {
AddressOffset = 0,
ExactMatch,
FileName,
Inlines,
LanguageName,
LineNumber,
ModuleName,
NameMaskArray,
Offset,
RegexString,
SectionName,
SkipPrologue,
SymbolNameArray,
LastOptionName
};
static const char
*g_option_names[static_cast<uint32_t>(OptionNames::LastOptionName)];
lldb::BreakpointLocationSP
AddLocation(Address loc_addr, bool *new_location = NULL);
Breakpoint *m_breakpoint; // This is the breakpoint we add locations to.
lldb::addr_t m_offset; // A random offset the user asked us to add to any breakpoints we set.
public:
static const char *GetKey(OptionNames enum_value) {
return g_option_names[static_cast<uint32_t>(enum_value)];
}
protected:
//------------------------------------------------------------------
/// SetSCMatchesByLine - Takes a symbol context list of matches which
/// supposedly represent the same file and
/// line number in a CU, and find the nearest actual line number that matches,
/// and then filter down the
/// matching addresses to unique entries, and skip the prologue if asked to do
/// so, and then set
/// breakpoint locations in this breakpoint for all the resultant addresses.
void SetSCMatchesByLine(SearchFilter &filter, SymbolContextList &sc_list,
bool skip_prologue, llvm::StringRef log_ident);
void SetSCMatchesByLine(SearchFilter &, SymbolContextList &, bool,
const char *) = delete;
lldb::BreakpointLocationSP AddLocation(Address loc_addr,
bool *new_location = NULL);
Breakpoint *m_breakpoint; // This is the breakpoint we add locations to.
lldb::addr_t m_offset; // A random offset the user asked us to add to any
// breakpoints we set.
private:
// Subclass identifier (for llvm isa/dyn_cast)
const unsigned char SubclassID;
DISALLOW_COPY_AND_ASSIGN(BreakpointResolver);
// Subclass identifier (for llvm isa/dyn_cast)
const unsigned char SubclassID;
DISALLOW_COPY_AND_ASSIGN(BreakpointResolver);
};
} // namespace lldb_private

View File

@ -20,63 +20,64 @@
namespace lldb_private {
//----------------------------------------------------------------------
/// @class BreakpointResolverAddress BreakpointResolverAddress.h "lldb/Breakpoint/BreakpointResolverAddress.h"
/// @brief This class sets breakpoints on a given Address. This breakpoint only takes
/// @class BreakpointResolverAddress BreakpointResolverAddress.h
/// "lldb/Breakpoint/BreakpointResolverAddress.h"
/// @brief This class sets breakpoints on a given Address. This breakpoint only
/// takes
/// once, and then it won't attempt to reset itself.
//----------------------------------------------------------------------
class BreakpointResolverAddress:
public BreakpointResolver
{
class BreakpointResolverAddress : public BreakpointResolver {
public:
BreakpointResolverAddress (Breakpoint *bkpt,
const Address &addr);
BreakpointResolverAddress(Breakpoint *bkpt, const Address &addr);
BreakpointResolverAddress (Breakpoint *bkpt,
const Address &addr,
const FileSpec &module_spec);
BreakpointResolverAddress(Breakpoint *bkpt, const Address &addr,
const FileSpec &module_spec);
~BreakpointResolverAddress() override;
~BreakpointResolverAddress() override;
void
ResolveBreakpoint (SearchFilter &filter) override;
static BreakpointResolver *
CreateFromStructuredData(Breakpoint *bkpt,
const StructuredData::Dictionary &options_dict,
Error &error);
void
ResolveBreakpointInModules (SearchFilter &filter,
ModuleList &modules) override;
StructuredData::ObjectSP SerializeToStructuredData() override;
Searcher::CallbackReturn
SearchCallback (SearchFilter &filter,
SymbolContext &context,
Address *addr,
bool containing) override;
void ResolveBreakpoint(SearchFilter &filter) override;
Searcher::Depth
GetDepth () override;
void ResolveBreakpointInModules(SearchFilter &filter,
ModuleList &modules) override;
void
GetDescription (Stream *s) override;
Searcher::CallbackReturn SearchCallback(SearchFilter &filter,
SymbolContext &context, Address *addr,
bool containing) override;
void
Dump (Stream *s) const override;
Searcher::Depth GetDepth() override;
/// Methods for support type inquiry through isa, cast, and dyn_cast:
static inline bool classof(const BreakpointResolverAddress *) { return true; }
static inline bool classof(const BreakpointResolver *V) {
return V->getResolverID() == BreakpointResolver::AddressResolver;
}
void GetDescription(Stream *s) override;
lldb::BreakpointResolverSP
CopyForBreakpoint (Breakpoint &breakpoint) override;
void Dump(Stream *s) const override;
/// Methods for support type inquiry through isa, cast, and dyn_cast:
static inline bool classof(const BreakpointResolverAddress *) { return true; }
static inline bool classof(const BreakpointResolver *V) {
return V->getResolverID() == BreakpointResolver::AddressResolver;
}
lldb::BreakpointResolverSP CopyForBreakpoint(Breakpoint &breakpoint) override;
protected:
Address m_addr; // The address - may be Section Offset or may be just an offset
lldb::addr_t m_resolved_addr; // The current value of the resolved load address for this breakpoint,
FileSpec m_module_filespec; // If this filespec is Valid, and m_addr is an offset, then it will be converted
// to a Section+Offset address in this module, whenever that module gets around to
// being loaded.
Address
m_addr; // The address - may be Section Offset or may be just an offset
lldb::addr_t m_resolved_addr; // The current value of the resolved load
// address for this breakpoint,
FileSpec m_module_filespec; // If this filespec is Valid, and m_addr is an
// offset, then it will be converted
// to a Section+Offset address in this module, whenever that module gets
// around to
// being loaded.
private:
DISALLOW_COPY_AND_ASSIGN(BreakpointResolverAddress);
DISALLOW_COPY_AND_ASSIGN(BreakpointResolverAddress);
};
} // namespace lldb_private

View File

@ -19,59 +19,60 @@
namespace lldb_private {
//----------------------------------------------------------------------
/// @class BreakpointResolverFileLine BreakpointResolverFileLine.h "lldb/Breakpoint/BreakpointResolverFileLine.h"
/// @brief This class sets breakpoints by file and line. Optionally, it will look for inlined
/// @class BreakpointResolverFileLine BreakpointResolverFileLine.h
/// "lldb/Breakpoint/BreakpointResolverFileLine.h"
/// @brief This class sets breakpoints by file and line. Optionally, it will
/// look for inlined
/// instances of the file and line specification.
//----------------------------------------------------------------------
class BreakpointResolverFileLine :
public BreakpointResolver
{
class BreakpointResolverFileLine : public BreakpointResolver {
public:
BreakpointResolverFileLine (Breakpoint *bkpt,
const FileSpec &resolver,
uint32_t line_no,
lldb::addr_t m_offset,
bool check_inlines,
bool skip_prologue,
bool exact_match);
BreakpointResolverFileLine(Breakpoint *bkpt, const FileSpec &resolver,
uint32_t line_no, lldb::addr_t m_offset,
bool check_inlines, bool skip_prologue,
bool exact_match);
~BreakpointResolverFileLine() override;
static BreakpointResolver *
CreateFromStructuredData(Breakpoint *bkpt,
const StructuredData::Dictionary &data_dict,
Error &error);
Searcher::CallbackReturn
SearchCallback (SearchFilter &filter,
SymbolContext &context,
Address *addr,
bool containing) override;
StructuredData::ObjectSP SerializeToStructuredData() override;
Searcher::Depth
GetDepth () override;
~BreakpointResolverFileLine() override;
void
GetDescription (Stream *s) override;
Searcher::CallbackReturn SearchCallback(SearchFilter &filter,
SymbolContext &context, Address *addr,
bool containing) override;
void
Dump (Stream *s) const override;
Searcher::Depth GetDepth() override;
/// Methods for support type inquiry through isa, cast, and dyn_cast:
static inline bool classof(const BreakpointResolverFileLine *) { return true; }
static inline bool classof(const BreakpointResolver *V) {
return V->getResolverID() == BreakpointResolver::FileLineResolver;
}
void GetDescription(Stream *s) override;
lldb::BreakpointResolverSP
CopyForBreakpoint (Breakpoint &breakpoint) override;
void Dump(Stream *s) const override;
/// Methods for support type inquiry through isa, cast, and dyn_cast:
static inline bool classof(const BreakpointResolverFileLine *) {
return true;
}
static inline bool classof(const BreakpointResolver *V) {
return V->getResolverID() == BreakpointResolver::FileLineResolver;
}
lldb::BreakpointResolverSP CopyForBreakpoint(Breakpoint &breakpoint) override;
protected:
friend class Breakpoint;
FileSpec m_file_spec; // This is the file spec we are looking for.
uint32_t m_line_number; // This is the line number that we are looking for.
bool m_inlines; // This determines whether the resolver looks for inlined functions or not.
bool m_skip_prologue;
bool m_exact_match;
friend class Breakpoint;
FileSpec m_file_spec; // This is the file spec we are looking for.
uint32_t m_line_number; // This is the line number that we are looking for.
bool m_inlines; // This determines whether the resolver looks for inlined
// functions or not.
bool m_skip_prologue;
bool m_exact_match;
private:
DISALLOW_COPY_AND_ASSIGN(BreakpointResolverFileLine);
DISALLOW_COPY_AND_ASSIGN(BreakpointResolverFileLine);
};
} // namespace lldb_private

View File

@ -1,4 +1,5 @@
//===-- BreakpointResolverFileRegex.h ----------------------------*- C++ -*-===//
//===-- BreakpointResolverFileRegex.h ----------------------------*- C++
//-*-===//
//
// The LLVM Compiler Infrastructure
//
@ -21,57 +22,62 @@
namespace lldb_private {
//----------------------------------------------------------------------
/// @class BreakpointResolverFileRegex BreakpointResolverFileRegex.h "lldb/Breakpoint/BreakpointResolverFileRegex.h"
/// @brief This class sets breakpoints by file and line. Optionally, it will look for inlined
/// @class BreakpointResolverFileRegex BreakpointResolverFileRegex.h
/// "lldb/Breakpoint/BreakpointResolverFileRegex.h"
/// @brief This class sets breakpoints by file and line. Optionally, it will
/// look for inlined
/// instances of the file and line specification.
//----------------------------------------------------------------------
class BreakpointResolverFileRegex :
public BreakpointResolver
{
class BreakpointResolverFileRegex : public BreakpointResolver {
public:
BreakpointResolverFileRegex (Breakpoint *bkpt,
RegularExpression &regex,
const std::unordered_set<std::string> &func_name_set,
bool exact_match);
BreakpointResolverFileRegex(
Breakpoint *bkpt, RegularExpression &regex,
const std::unordered_set<std::string> &func_name_set, bool exact_match);
~BreakpointResolverFileRegex() override;
static BreakpointResolver *
CreateFromStructuredData(Breakpoint *bkpt,
const StructuredData::Dictionary &options_dict,
Error &error);
Searcher::CallbackReturn
SearchCallback (SearchFilter &filter,
SymbolContext &context,
Address *addr,
bool containing) override;
StructuredData::ObjectSP SerializeToStructuredData() override;
Searcher::Depth
GetDepth () override;
~BreakpointResolverFileRegex() override;
void
GetDescription (Stream *s) override;
Searcher::CallbackReturn SearchCallback(SearchFilter &filter,
SymbolContext &context, Address *addr,
bool containing) override;
void
Dump (Stream *s) const override;
void
AddFunctionName(const char *func_name);
Searcher::Depth GetDepth() override;
/// Methods for support type inquiry through isa, cast, and dyn_cast:
static inline bool classof(const BreakpointResolverFileRegex *) { return true; }
static inline bool classof(const BreakpointResolver *V) {
return V->getResolverID() == BreakpointResolver::FileRegexResolver;
}
void GetDescription(Stream *s) override;
lldb::BreakpointResolverSP
CopyForBreakpoint (Breakpoint &breakpoint) override;
void Dump(Stream *s) const override;
void AddFunctionName(const char *func_name);
/// Methods for support type inquiry through isa, cast, and dyn_cast:
static inline bool classof(const BreakpointResolverFileRegex *) {
return true;
}
static inline bool classof(const BreakpointResolver *V) {
return V->getResolverID() == BreakpointResolver::FileRegexResolver;
}
lldb::BreakpointResolverSP CopyForBreakpoint(Breakpoint &breakpoint) override;
protected:
friend class Breakpoint;
RegularExpression m_regex; // This is the line expression that we are looking for.
bool m_exact_match; // If true, then if the source we match is in a comment, we won't set a location there.
std::unordered_set<std::string> m_function_names; // Limit the search to functions in the comp_unit passed in.
friend class Breakpoint;
RegularExpression
m_regex; // This is the line expression that we are looking for.
bool m_exact_match; // If true, then if the source we match is in a comment,
// we won't set a location there.
std::unordered_set<std::string> m_function_names; // Limit the search to
// functions in the
// comp_unit passed in.
private:
DISALLOW_COPY_AND_ASSIGN(BreakpointResolverFileRegex);
DISALLOW_COPY_AND_ASSIGN(BreakpointResolverFileRegex);
};
} // namespace lldb_private

View File

@ -12,8 +12,8 @@
// C Includes
// C++ Includes
#include <vector>
#include <string>
#include <vector>
// Other libraries and framework includes
// Project includes
@ -23,93 +23,75 @@
namespace lldb_private {
//----------------------------------------------------------------------
/// @class BreakpointResolverName BreakpointResolverName.h "lldb/Breakpoint/BreakpointResolverName.h"
/// @brief This class sets breakpoints on a given function name, either by exact match
/// @class BreakpointResolverName BreakpointResolverName.h
/// "lldb/Breakpoint/BreakpointResolverName.h"
/// @brief This class sets breakpoints on a given function name, either by exact
/// match
/// or by regular expression.
//----------------------------------------------------------------------
class BreakpointResolverName:
public BreakpointResolver
{
class BreakpointResolverName : public BreakpointResolver {
public:
BreakpointResolverName(Breakpoint *bkpt, const char *name,
uint32_t name_type_mask, lldb::LanguageType language,
Breakpoint::MatchType type, lldb::addr_t offset,
bool skip_prologue);
BreakpointResolverName (Breakpoint *bkpt,
const char *name,
uint32_t name_type_mask,
lldb::LanguageType language,
Breakpoint::MatchType type,
lldb::addr_t offset,
bool skip_prologue);
// This one takes an array of names. It is always MatchType = Exact.
BreakpointResolverName(Breakpoint *bkpt, const char *names[],
size_t num_names, uint32_t name_type_mask,
lldb::LanguageType language, lldb::addr_t offset,
bool skip_prologue);
// This one takes an array of names. It is always MatchType = Exact.
BreakpointResolverName (Breakpoint *bkpt,
const char *names[],
size_t num_names,
uint32_t name_type_mask,
lldb::LanguageType language,
lldb::addr_t offset,
bool skip_prologue);
// This one takes a C++ array of names. It is always MatchType = Exact.
BreakpointResolverName(Breakpoint *bkpt, std::vector<std::string> names,
uint32_t name_type_mask, lldb::LanguageType language,
lldb::addr_t offset, bool skip_prologue);
// This one takes a C++ array of names. It is always MatchType = Exact.
BreakpointResolverName (Breakpoint *bkpt,
std::vector<std::string> names,
uint32_t name_type_mask,
lldb::LanguageType language,
lldb::addr_t offset,
bool skip_prologue);
// Creates a function breakpoint by regular expression. Takes over control of
// the lifespan of func_regex.
BreakpointResolverName(Breakpoint *bkpt, RegularExpression &func_regex,
lldb::LanguageType language, lldb::addr_t offset,
bool skip_prologue);
// Creates a function breakpoint by regular expression. Takes over control of the lifespan of func_regex.
BreakpointResolverName (Breakpoint *bkpt,
RegularExpression &func_regex,
lldb::LanguageType language,
lldb::addr_t offset,
bool skip_prologue);
static BreakpointResolver *
CreateFromStructuredData(Breakpoint *bkpt,
const StructuredData::Dictionary &data_dict,
Error &error);
BreakpointResolverName (Breakpoint *bkpt,
const char *class_name,
const char *method,
Breakpoint::MatchType type,
lldb::addr_t offset,
bool skip_prologue);
StructuredData::ObjectSP SerializeToStructuredData() override;
~BreakpointResolverName() override;
~BreakpointResolverName() override;
Searcher::CallbackReturn
SearchCallback (SearchFilter &filter,
SymbolContext &context,
Address *addr,
bool containing) override;
Searcher::CallbackReturn SearchCallback(SearchFilter &filter,
SymbolContext &context, Address *addr,
bool containing) override;
Searcher::Depth
GetDepth () override;
Searcher::Depth GetDepth() override;
void
GetDescription (Stream *s) override;
void GetDescription(Stream *s) override;
void
Dump (Stream *s) const override;
void Dump(Stream *s) const override;
/// Methods for support type inquiry through isa, cast, and dyn_cast:
static inline bool classof(const BreakpointResolverName *) { return true; }
static inline bool classof(const BreakpointResolver *V) {
return V->getResolverID() == BreakpointResolver::NameResolver;
}
/// Methods for support type inquiry through isa, cast, and dyn_cast:
static inline bool classof(const BreakpointResolverName *) { return true; }
static inline bool classof(const BreakpointResolver *V) {
return V->getResolverID() == BreakpointResolver::NameResolver;
}
lldb::BreakpointResolverSP
CopyForBreakpoint (Breakpoint &breakpoint) override;
lldb::BreakpointResolverSP CopyForBreakpoint(Breakpoint &breakpoint) override;
protected:
BreakpointResolverName(const BreakpointResolverName &rhs);
BreakpointResolverName(const BreakpointResolverName &rhs);
std::vector<Module::LookupInfo> m_lookups;
ConstString m_class_name;
RegularExpression m_regex;
Breakpoint::MatchType m_match_type;
lldb::LanguageType m_language;
bool m_skip_prologue;
std::vector<Module::LookupInfo> m_lookups;
ConstString m_class_name;
RegularExpression m_regex;
Breakpoint::MatchType m_match_type;
lldb::LanguageType m_language;
bool m_skip_prologue;
void
AddNameLookup (const ConstString &name, uint32_t name_type_mask);
void AddNameLookup(const ConstString &name, uint32_t name_type_mask);
};
} // namespace lldb_private

View File

@ -19,10 +19,10 @@
// Other libraries and framework includes
// Project includes
#include "lldb/lldb-forward.h"
#include "lldb/Core/UserID.h"
#include "lldb/Breakpoint/StoppointLocation.h"
#include "lldb/Breakpoint/BreakpointLocationCollection.h"
#include "lldb/Breakpoint/StoppointLocation.h"
#include "lldb/Core/UserID.h"
#include "lldb/lldb-forward.h"
namespace lldb_private {
@ -39,277 +39,247 @@ namespace lldb_private {
/// site. Breakpoint sites are owned by the process.
//----------------------------------------------------------------------
class BreakpointSite :
public std::enable_shared_from_this<BreakpointSite>,
public StoppointLocation
{
class BreakpointSite : public std::enable_shared_from_this<BreakpointSite>,
public StoppointLocation {
public:
enum Type {
eSoftware, // Breakpoint opcode has been written to memory and
// m_saved_opcode
// and m_trap_opcode contain the saved and written opcode.
eHardware, // Breakpoint site is set as a hardware breakpoint
eExternal // Breakpoint site is managed by an external debug nub or
// debug interface where memory reads transparently will not
// display any breakpoint opcodes.
};
enum Type
{
eSoftware, // Breakpoint opcode has been written to memory and m_saved_opcode
// and m_trap_opcode contain the saved and written opcode.
eHardware, // Breakpoint site is set as a hardware breakpoint
eExternal // Breakpoint site is managed by an external debug nub or
// debug interface where memory reads transparently will not
// display any breakpoint opcodes.
};
~BreakpointSite() override;
~BreakpointSite() override;
//----------------------------------------------------------------------
// This section manages the breakpoint traps
//----------------------------------------------------------------------
//----------------------------------------------------------------------
// This section manages the breakpoint traps
//----------------------------------------------------------------------
//------------------------------------------------------------------
/// Returns the Opcode Bytes for this breakpoint
//------------------------------------------------------------------
uint8_t *GetTrapOpcodeBytes();
//------------------------------------------------------------------
/// Returns the Opcode Bytes for this breakpoint
//------------------------------------------------------------------
uint8_t *
GetTrapOpcodeBytes ();
//------------------------------------------------------------------
/// Returns the Opcode Bytes for this breakpoint - const version
//------------------------------------------------------------------
const uint8_t *GetTrapOpcodeBytes() const;
//------------------------------------------------------------------
/// Returns the Opcode Bytes for this breakpoint - const version
//------------------------------------------------------------------
const uint8_t *
GetTrapOpcodeBytes () const;
//------------------------------------------------------------------
/// Get the size of the trap opcode for this address
//------------------------------------------------------------------
size_t GetTrapOpcodeMaxByteSize() const;
//------------------------------------------------------------------
/// Get the size of the trap opcode for this address
//------------------------------------------------------------------
size_t
GetTrapOpcodeMaxByteSize () const;
//------------------------------------------------------------------
/// Sets the trap opcode
//------------------------------------------------------------------
bool SetTrapOpcode(const uint8_t *trap_opcode, uint32_t trap_opcode_size);
//------------------------------------------------------------------
/// Sets the trap opcode
//------------------------------------------------------------------
bool
SetTrapOpcode (const uint8_t *trap_opcode,
uint32_t trap_opcode_size);
//------------------------------------------------------------------
/// Gets the original instruction bytes that were overwritten by the trap
//------------------------------------------------------------------
uint8_t *GetSavedOpcodeBytes();
//------------------------------------------------------------------
/// Gets the original instruction bytes that were overwritten by the trap
//------------------------------------------------------------------
uint8_t *
GetSavedOpcodeBytes ();
//------------------------------------------------------------------
/// Gets the original instruction bytes that were overwritten by the trap
/// const version
//------------------------------------------------------------------
const uint8_t *GetSavedOpcodeBytes() const;
//------------------------------------------------------------------
/// Gets the original instruction bytes that were overwritten by the trap const version
//------------------------------------------------------------------
const uint8_t *
GetSavedOpcodeBytes () const;
//------------------------------------------------------------------
/// Says whether \a addr and size \a size intersects with the address \a
/// intersect_addr
//------------------------------------------------------------------
bool IntersectsRange(lldb::addr_t addr, size_t size,
lldb::addr_t *intersect_addr, size_t *intersect_size,
size_t *opcode_offset) const;
//------------------------------------------------------------------
/// Says whether \a addr and size \a size intersects with the address \a intersect_addr
//------------------------------------------------------------------
bool
IntersectsRange (lldb::addr_t addr,
size_t size,
lldb::addr_t *intersect_addr,
size_t *intersect_size,
size_t *opcode_offset) const;
//------------------------------------------------------------------
/// Tells whether the current breakpoint site is enabled or not
///
/// This is a low-level enable bit for the breakpoint sites. If a
/// breakpoint site has no enabled owners, it should just get
/// removed. This enable/disable is for the low-level target code
/// to enable and disable breakpoint sites when single stepping,
/// etc.
//------------------------------------------------------------------
bool IsEnabled() const;
//------------------------------------------------------------------
/// Tells whether the current breakpoint site is enabled or not
///
/// This is a low-level enable bit for the breakpoint sites. If a
/// breakpoint site has no enabled owners, it should just get
/// removed. This enable/disable is for the low-level target code
/// to enable and disable breakpoint sites when single stepping,
/// etc.
//------------------------------------------------------------------
bool
IsEnabled () const;
//------------------------------------------------------------------
/// Sets whether the current breakpoint site is enabled or not
///
/// @param[in] enabled
/// \b true if the breakpoint is enabled, \b false otherwise.
//------------------------------------------------------------------
void SetEnabled(bool enabled);
//------------------------------------------------------------------
/// Sets whether the current breakpoint site is enabled or not
///
/// @param[in] enabled
/// \b true if the breakpoint is enabled, \b false otherwise.
//------------------------------------------------------------------
void
SetEnabled (bool enabled);
//------------------------------------------------------------------
/// Enquires of the breakpoint locations that produced this breakpoint site
/// whether
/// we should stop at this location.
///
/// @param[in] context
/// This contains the information about this stop.
///
/// @return
/// \b true if we should stop, \b false otherwise.
//------------------------------------------------------------------
bool ShouldStop(StoppointCallbackContext *context) override;
//------------------------------------------------------------------
/// Enquires of the breakpoint locations that produced this breakpoint site whether
/// we should stop at this location.
///
/// @param[in] context
/// This contains the information about this stop.
///
/// @return
/// \b true if we should stop, \b false otherwise.
//------------------------------------------------------------------
bool
ShouldStop(StoppointCallbackContext *context) override;
//------------------------------------------------------------------
/// Standard Dump method
///
/// @param[in] context
/// The stream to dump this output.
//------------------------------------------------------------------
void Dump(Stream *s) const override;
//------------------------------------------------------------------
/// Standard Dump method
///
/// @param[in] context
/// The stream to dump this output.
//------------------------------------------------------------------
void
Dump(Stream *s) const override;
//------------------------------------------------------------------
/// The "Owners" are the breakpoint locations that share this
/// breakpoint site. The method adds the \a owner to this breakpoint
/// site's owner list.
///
/// @param[in] context
/// \a owner is the Breakpoint Location to add.
//------------------------------------------------------------------
void AddOwner(const lldb::BreakpointLocationSP &owner);
//------------------------------------------------------------------
/// The "Owners" are the breakpoint locations that share this
/// breakpoint site. The method adds the \a owner to this breakpoint
/// site's owner list.
///
/// @param[in] context
/// \a owner is the Breakpoint Location to add.
//------------------------------------------------------------------
void
AddOwner (const lldb::BreakpointLocationSP &owner);
//------------------------------------------------------------------
/// This method returns the number of breakpoint locations currently
/// located at this breakpoint site.
///
/// @return
/// The number of owners.
//------------------------------------------------------------------
size_t GetNumberOfOwners();
//------------------------------------------------------------------
/// This method returns the number of breakpoint locations currently
/// located at this breakpoint site.
///
/// @return
/// The number of owners.
//------------------------------------------------------------------
size_t
GetNumberOfOwners ();
//------------------------------------------------------------------
/// This method returns the breakpoint location at index \a index
/// located at this breakpoint site. The owners are listed ordinally
/// from 0 to GetNumberOfOwners() - 1 so you can use this method to iterate
/// over the owners
///
/// @param[in] index
/// The index in the list of owners for which you wish the owner location.
/// @return
/// A shared pointer to the breakpoint location at that index.
//------------------------------------------------------------------
lldb::BreakpointLocationSP GetOwnerAtIndex(size_t idx);
//------------------------------------------------------------------
/// This method returns the breakpoint location at index \a index
/// located at this breakpoint site. The owners are listed ordinally
/// from 0 to GetNumberOfOwners() - 1 so you can use this method to iterate
/// over the owners
///
/// @param[in] index
/// The index in the list of owners for which you wish the owner location.
/// @return
/// A shared pointer to the breakpoint location at that index.
//------------------------------------------------------------------
lldb::BreakpointLocationSP
GetOwnerAtIndex (size_t idx);
//------------------------------------------------------------------
/// This method copies the breakpoint site's owners into a new collection.
/// It does this while the owners mutex is locked.
///
/// @param[out] out_collection
/// The BreakpointLocationCollection into which to put the owners
/// of this breakpoint site.
///
/// @return
/// The number of elements copied into out_collection.
//------------------------------------------------------------------
size_t
CopyOwnersList (BreakpointLocationCollection &out_collection);
//------------------------------------------------------------------
/// Check whether the owners of this breakpoint site have any
/// thread specifiers, and if yes, is \a thread contained in any
/// of these specifiers.
///
/// @param[in] thread
/// The thread against which to test.
///
/// return
/// \b true if the collection contains at least one location that
/// would be valid for this thread, false otherwise.
//------------------------------------------------------------------
bool
ValidForThisThread (Thread *thread);
//------------------------------------------------------------------
/// This method copies the breakpoint site's owners into a new collection.
/// It does this while the owners mutex is locked.
///
/// @param[out] out_collection
/// The BreakpointLocationCollection into which to put the owners
/// of this breakpoint site.
///
/// @return
/// The number of elements copied into out_collection.
//------------------------------------------------------------------
size_t CopyOwnersList(BreakpointLocationCollection &out_collection);
//------------------------------------------------------------------
/// Print a description of this breakpoint site to the stream \a s.
/// GetDescription tells you about the breakpoint site's owners.
/// Use BreakpointSite::Dump(Stream *) to get information about the
/// breakpoint site itself.
///
/// @param[in] s
/// The stream to which to print the description.
///
/// @param[in] level
/// The description level that indicates the detail level to
/// provide.
///
/// @see lldb::DescriptionLevel
//------------------------------------------------------------------
void
GetDescription (Stream *s,
lldb::DescriptionLevel level);
//------------------------------------------------------------------
/// Check whether the owners of this breakpoint site have any
/// thread specifiers, and if yes, is \a thread contained in any
/// of these specifiers.
///
/// @param[in] thread
/// The thread against which to test.
///
/// return
/// \b true if the collection contains at least one location that
/// would be valid for this thread, false otherwise.
//------------------------------------------------------------------
bool ValidForThisThread(Thread *thread);
//------------------------------------------------------------------
/// Tell whether a breakpoint has a location at this site.
///
/// @param[in] bp_id
/// The breakpoint id to query.
///
/// @result
/// \b true if bp_id has a location that is at this site,
/// \b false otherwise.
//------------------------------------------------------------------
bool
IsBreakpointAtThisSite (lldb::break_id_t bp_id);
//------------------------------------------------------------------
/// Print a description of this breakpoint site to the stream \a s.
/// GetDescription tells you about the breakpoint site's owners.
/// Use BreakpointSite::Dump(Stream *) to get information about the
/// breakpoint site itself.
///
/// @param[in] s
/// The stream to which to print the description.
///
/// @param[in] level
/// The description level that indicates the detail level to
/// provide.
///
/// @see lldb::DescriptionLevel
//------------------------------------------------------------------
void GetDescription(Stream *s, lldb::DescriptionLevel level);
//------------------------------------------------------------------
/// Tell whether ALL the breakpoints in the location collection are internal.
///
/// @result
/// \b true if all breakpoint locations are owned by internal breakpoints,
/// \b false otherwise.
//------------------------------------------------------------------
bool
IsInternal () const;
BreakpointSite::Type
GetType () const
{
return m_type;
}
//------------------------------------------------------------------
/// Tell whether a breakpoint has a location at this site.
///
/// @param[in] bp_id
/// The breakpoint id to query.
///
/// @result
/// \b true if bp_id has a location that is at this site,
/// \b false otherwise.
//------------------------------------------------------------------
bool IsBreakpointAtThisSite(lldb::break_id_t bp_id);
void
SetType (BreakpointSite::Type type)
{
m_type = type;
}
//------------------------------------------------------------------
/// Tell whether ALL the breakpoints in the location collection are internal.
///
/// @result
/// \b true if all breakpoint locations are owned by internal breakpoints,
/// \b false otherwise.
//------------------------------------------------------------------
bool IsInternal() const;
BreakpointSite::Type GetType() const { return m_type; }
void SetType(BreakpointSite::Type type) { m_type = type; }
private:
friend class Process;
friend class BreakpointLocation;
// The StopInfoBreakpoint knows when it is processing a hit for a thread for a site, so let it be the
// one to manage setting the location hit count once and only once.
friend class StopInfoBreakpoint;
friend class Process;
friend class BreakpointLocation;
// The StopInfoBreakpoint knows when it is processing a hit for a thread for a
// site, so let it be the
// one to manage setting the location hit count once and only once.
friend class StopInfoBreakpoint;
void
BumpHitCounts();
void BumpHitCounts();
//------------------------------------------------------------------
/// The method removes the owner at \a break_loc_id from this breakpoint list.
///
/// @param[in] context
/// \a break_loc_id is the Breakpoint Location to remove.
//------------------------------------------------------------------
size_t
RemoveOwner (lldb::break_id_t break_id,
lldb::break_id_t break_loc_id);
//------------------------------------------------------------------
/// The method removes the owner at \a break_loc_id from this breakpoint list.
///
/// @param[in] context
/// \a break_loc_id is the Breakpoint Location to remove.
//------------------------------------------------------------------
size_t RemoveOwner(lldb::break_id_t break_id, lldb::break_id_t break_loc_id);
BreakpointSite::Type m_type;///< The type of this breakpoint site.
uint8_t m_saved_opcode[8]; ///< The saved opcode bytes if this breakpoint site uses trap opcodes.
uint8_t m_trap_opcode[8]; ///< The opcode that was used to create the breakpoint if it is a software breakpoint site.
bool m_enabled; ///< Boolean indicating if this breakpoint site enabled or not.
BreakpointSite::Type m_type; ///< The type of this breakpoint site.
uint8_t m_saved_opcode[8]; ///< The saved opcode bytes if this breakpoint site
///uses trap opcodes.
uint8_t m_trap_opcode[8]; ///< The opcode that was used to create the
///breakpoint if it is a software breakpoint site.
bool
m_enabled; ///< Boolean indicating if this breakpoint site enabled or not.
// Consider adding an optimization where if there is only one
// owner, we don't store a list. The usual case will be only one owner...
BreakpointLocationCollection m_owners; ///< This has the BreakpointLocations that share this breakpoint site.
std::recursive_mutex m_owners_mutex; ///< This mutex protects the owners collection.
// Consider adding an optimization where if there is only one
// owner, we don't store a list. The usual case will be only one owner...
BreakpointLocationCollection m_owners; ///< This has the BreakpointLocations
///that share this breakpoint site.
std::recursive_mutex
m_owners_mutex; ///< This mutex protects the owners collection.
static lldb::break_id_t
GetNextID();
static lldb::break_id_t GetNextID();
// Only the Process can create breakpoint sites in
// Process::CreateBreakpointSite (lldb::BreakpointLocationSP &, bool).
BreakpointSite (BreakpointSiteList *list,
const lldb::BreakpointLocationSP& owner,
lldb::addr_t m_addr,
bool use_hardware);
// Only the Process can create breakpoint sites in
// Process::CreateBreakpointSite (lldb::BreakpointLocationSP &, bool).
BreakpointSite(BreakpointSiteList *list,
const lldb::BreakpointLocationSP &owner, lldb::addr_t m_addr,
bool use_hardware);
DISALLOW_COPY_AND_ASSIGN(BreakpointSite);
DISALLOW_COPY_AND_ASSIGN(BreakpointSite);
};
} // namespace lldb_private

View File

@ -23,197 +23,185 @@
namespace lldb_private {
//----------------------------------------------------------------------
/// @class BreakpointSiteList BreakpointSiteList.h "lldb/Breakpoint/BreakpointSiteList.h"
/// @class BreakpointSiteList BreakpointSiteList.h
/// "lldb/Breakpoint/BreakpointSiteList.h"
/// @brief Class that manages lists of BreakpointSite shared pointers.
//----------------------------------------------------------------------
class BreakpointSiteList
{
// At present Process directly accesses the map of BreakpointSites so it can
// do quick lookups into the map (using GetMap).
// FIXME: Find a better interface for this.
friend class Process;
class BreakpointSiteList {
// At present Process directly accesses the map of BreakpointSites so it can
// do quick lookups into the map (using GetMap).
// FIXME: Find a better interface for this.
friend class Process;
public:
//------------------------------------------------------------------
/// Default constructor makes an empty list.
//------------------------------------------------------------------
BreakpointSiteList();
//------------------------------------------------------------------
/// Default constructor makes an empty list.
//------------------------------------------------------------------
BreakpointSiteList();
//------------------------------------------------------------------
/// Destructor, currently does nothing.
//------------------------------------------------------------------
~BreakpointSiteList();
//------------------------------------------------------------------
/// Destructor, currently does nothing.
//------------------------------------------------------------------
~BreakpointSiteList();
//------------------------------------------------------------------
/// Add a BreakpointSite to the list.
///
/// @param[in] bp_site_sp
/// A shared pointer to a breakpoint site being added to the list.
///
/// @return
/// The ID of the BreakpointSite in the list.
//------------------------------------------------------------------
lldb::break_id_t
Add (const lldb::BreakpointSiteSP& bp_site_sp);
//------------------------------------------------------------------
/// Add a BreakpointSite to the list.
///
/// @param[in] bp_site_sp
/// A shared pointer to a breakpoint site being added to the list.
///
/// @return
/// The ID of the BreakpointSite in the list.
//------------------------------------------------------------------
lldb::break_id_t Add(const lldb::BreakpointSiteSP &bp_site_sp);
//------------------------------------------------------------------
/// Standard Dump routine, doesn't do anything at present.
/// @param[in] s
/// Stream into which to dump the description.
//------------------------------------------------------------------
void
Dump (Stream *s) const;
//------------------------------------------------------------------
/// Standard Dump routine, doesn't do anything at present.
/// @param[in] s
/// Stream into which to dump the description.
//------------------------------------------------------------------
void Dump(Stream *s) const;
//------------------------------------------------------------------
/// Returns a shared pointer to the breakpoint site at address
/// \a addr.
///
/// @param[in] addr
/// The address to look for.
///
/// @result
/// A shared pointer to the breakpoint site. May contain a NULL
/// pointer if no breakpoint site exists with a matching address.
//------------------------------------------------------------------
lldb::BreakpointSiteSP
FindByAddress (lldb::addr_t addr);
//------------------------------------------------------------------
/// Returns a shared pointer to the breakpoint site at address
/// \a addr.
///
/// @param[in] addr
/// The address to look for.
///
/// @result
/// A shared pointer to the breakpoint site. May contain a NULL
/// pointer if no breakpoint site exists with a matching address.
//------------------------------------------------------------------
lldb::BreakpointSiteSP FindByAddress(lldb::addr_t addr);
//------------------------------------------------------------------
/// Returns a shared pointer to the breakpoint site with id \a breakID.
///
/// @param[in] breakID
/// The breakpoint site ID to seek for.
///
/// @result
/// A shared pointer to the breakpoint site. May contain a NULL pointer if the
/// breakpoint doesn't exist.
//------------------------------------------------------------------
lldb::BreakpointSiteSP
FindByID (lldb::break_id_t breakID);
//------------------------------------------------------------------
/// Returns a shared pointer to the breakpoint site with id \a breakID.
///
/// @param[in] breakID
/// The breakpoint site ID to seek for.
///
/// @result
/// A shared pointer to the breakpoint site. May contain a NULL pointer if
/// the
/// breakpoint doesn't exist.
//------------------------------------------------------------------
lldb::BreakpointSiteSP FindByID(lldb::break_id_t breakID);
//------------------------------------------------------------------
/// Returns a shared pointer to the breakpoint site with id \a breakID - const version.
///
/// @param[in] breakID
/// The breakpoint site ID to seek for.
///
/// @result
/// A shared pointer to the breakpoint site. May contain a NULL pointer if the
/// breakpoint doesn't exist.
//------------------------------------------------------------------
const lldb::BreakpointSiteSP
FindByID (lldb::break_id_t breakID) const;
//------------------------------------------------------------------
/// Returns a shared pointer to the breakpoint site with id \a breakID - const
/// version.
///
/// @param[in] breakID
/// The breakpoint site ID to seek for.
///
/// @result
/// A shared pointer to the breakpoint site. May contain a NULL pointer if
/// the
/// breakpoint doesn't exist.
//------------------------------------------------------------------
const lldb::BreakpointSiteSP FindByID(lldb::break_id_t breakID) const;
//------------------------------------------------------------------
/// Returns the breakpoint site id to the breakpoint site at address \a addr.
///
/// @param[in] addr
/// The address to match.
///
/// @result
/// The ID of the breakpoint site, or LLDB_INVALID_BREAK_ID.
//------------------------------------------------------------------
lldb::break_id_t
FindIDByAddress (lldb::addr_t addr);
//------------------------------------------------------------------
/// Returns whether the breakpoint site \a bp_site_id has \a bp_id
// as one of its owners.
///
/// @param[in] bp_site_id
/// The breakpoint site id to query.
///
/// @param[in] bp_id
/// The breakpoint id to look for in \a bp_site_id.
///
/// @result
/// True if \a bp_site_id exists in the site list AND \a bp_id is one of the
/// owners of that site.
//------------------------------------------------------------------
bool
BreakpointSiteContainsBreakpoint (lldb::break_id_t bp_site_id, lldb::break_id_t bp_id);
//------------------------------------------------------------------
/// Returns the breakpoint site id to the breakpoint site at address \a addr.
///
/// @param[in] addr
/// The address to match.
///
/// @result
/// The ID of the breakpoint site, or LLDB_INVALID_BREAK_ID.
//------------------------------------------------------------------
lldb::break_id_t FindIDByAddress(lldb::addr_t addr);
void
ForEach (std::function <void(BreakpointSite *)> const &callback);
//------------------------------------------------------------------
/// Returns whether the breakpoint site \a bp_site_id has \a bp_id
// as one of its owners.
///
/// @param[in] bp_site_id
/// The breakpoint site id to query.
///
/// @param[in] bp_id
/// The breakpoint id to look for in \a bp_site_id.
///
/// @result
/// True if \a bp_site_id exists in the site list AND \a bp_id is one of the
/// owners of that site.
//------------------------------------------------------------------
bool BreakpointSiteContainsBreakpoint(lldb::break_id_t bp_site_id,
lldb::break_id_t bp_id);
//------------------------------------------------------------------
/// Removes the breakpoint site given by \b breakID from this list.
///
/// @param[in] breakID
/// The breakpoint site index to remove.
///
/// @result
/// \b true if the breakpoint site \a breakID was in the list.
//------------------------------------------------------------------
bool
Remove (lldb::break_id_t breakID);
void ForEach(std::function<void(BreakpointSite *)> const &callback);
//------------------------------------------------------------------
/// Removes the breakpoint site at address \a addr from this list.
///
/// @param[in] addr
/// The address from which to remove a breakpoint site.
///
/// @result
/// \b true if \a addr had a breakpoint site to remove from the list.
//------------------------------------------------------------------
bool
RemoveByAddress (lldb::addr_t addr);
bool
FindInRange (lldb::addr_t lower_bound, lldb::addr_t upper_bound, BreakpointSiteList &bp_site_list) const;
//------------------------------------------------------------------
/// Removes the breakpoint site given by \b breakID from this list.
///
/// @param[in] breakID
/// The breakpoint site index to remove.
///
/// @result
/// \b true if the breakpoint site \a breakID was in the list.
//------------------------------------------------------------------
bool Remove(lldb::break_id_t breakID);
typedef void (*BreakpointSiteSPMapFunc) (lldb::BreakpointSiteSP &bp, void *baton);
//------------------------------------------------------------------
/// Removes the breakpoint site at address \a addr from this list.
///
/// @param[in] addr
/// The address from which to remove a breakpoint site.
///
/// @result
/// \b true if \a addr had a breakpoint site to remove from the list.
//------------------------------------------------------------------
bool RemoveByAddress(lldb::addr_t addr);
//------------------------------------------------------------------
/// Enquires of the breakpoint site on in this list with ID \a breakID whether
/// we should stop for the breakpoint or not.
///
/// @param[in] context
/// This contains the information about this stop.
///
/// @param[in] breakID
/// This break ID that we hit.
///
/// @return
/// \b true if we should stop, \b false otherwise.
//------------------------------------------------------------------
bool
ShouldStop (StoppointCallbackContext *context, lldb::break_id_t breakID);
bool FindInRange(lldb::addr_t lower_bound, lldb::addr_t upper_bound,
BreakpointSiteList &bp_site_list) const;
//------------------------------------------------------------------
/// Returns the number of elements in the list.
///
/// @result
/// The number of elements.
//------------------------------------------------------------------
size_t
GetSize() const
{
std::lock_guard<std::recursive_mutex> guard(m_mutex);
return m_bp_site_list.size();
}
typedef void (*BreakpointSiteSPMapFunc)(lldb::BreakpointSiteSP &bp,
void *baton);
bool
IsEmpty() const
{
std::lock_guard<std::recursive_mutex> guard(m_mutex);
return m_bp_site_list.empty();
}
//------------------------------------------------------------------
/// Enquires of the breakpoint site on in this list with ID \a breakID whether
/// we should stop for the breakpoint or not.
///
/// @param[in] context
/// This contains the information about this stop.
///
/// @param[in] breakID
/// This break ID that we hit.
///
/// @return
/// \b true if we should stop, \b false otherwise.
//------------------------------------------------------------------
bool ShouldStop(StoppointCallbackContext *context, lldb::break_id_t breakID);
//------------------------------------------------------------------
/// Returns the number of elements in the list.
///
/// @result
/// The number of elements.
//------------------------------------------------------------------
size_t GetSize() const {
std::lock_guard<std::recursive_mutex> guard(m_mutex);
return m_bp_site_list.size();
}
bool IsEmpty() const {
std::lock_guard<std::recursive_mutex> guard(m_mutex);
return m_bp_site_list.empty();
}
protected:
typedef std::map<lldb::addr_t, lldb::BreakpointSiteSP> collection;
typedef std::map<lldb::addr_t, lldb::BreakpointSiteSP> collection;
collection::iterator
GetIDIterator(lldb::break_id_t breakID);
collection::iterator GetIDIterator(lldb::break_id_t breakID);
collection::const_iterator
GetIDConstIterator(lldb::break_id_t breakID) const;
collection::const_iterator GetIDConstIterator(lldb::break_id_t breakID) const;
mutable std::recursive_mutex m_mutex;
collection m_bp_site_list; // The breakpoint site list.
mutable std::recursive_mutex m_mutex;
collection m_bp_site_list; // The breakpoint site list.
};
} // namespace lldb_private
#endif // liblldb_BreakpointSiteList_h_
#endif // liblldb_BreakpointSiteList_h_

View File

@ -14,50 +14,43 @@
// C++ Includes
// Other libraries and framework includes
// Project includes
#include "lldb/lldb-private.h"
#include "lldb/Core/UserID.h"
#include "lldb/lldb-private.h"
namespace lldb_private {
class Stoppoint
{
class Stoppoint {
public:
//------------------------------------------------------------------
// Constructors and Destructors
//------------------------------------------------------------------
Stoppoint();
//------------------------------------------------------------------
// Constructors and Destructors
//------------------------------------------------------------------
Stoppoint();
virtual
~Stoppoint();
virtual ~Stoppoint();
//------------------------------------------------------------------
// Methods
//------------------------------------------------------------------
virtual void
Dump (Stream *) = 0;
//------------------------------------------------------------------
// Methods
//------------------------------------------------------------------
virtual void Dump(Stream *) = 0;
virtual bool
IsEnabled () = 0;
virtual bool IsEnabled() = 0;
virtual void
SetEnabled (bool enable) = 0;
virtual void SetEnabled(bool enable) = 0;
lldb::break_id_t
GetID () const;
lldb::break_id_t GetID() const;
void
SetID (lldb::break_id_t bid);
void SetID(lldb::break_id_t bid);
protected:
lldb::break_id_t m_bid;
lldb::break_id_t m_bid;
private:
//------------------------------------------------------------------
// For Stoppoint only
//------------------------------------------------------------------
DISALLOW_COPY_AND_ASSIGN (Stoppoint);
//------------------------------------------------------------------
// For Stoppoint only
//------------------------------------------------------------------
DISALLOW_COPY_AND_ASSIGN(Stoppoint);
};
} // namespace lldb_private
#endif // liblldb_Stoppoint_h_
#endif // liblldb_Stoppoint_h_

View File

@ -10,49 +10,54 @@
#ifndef liblldb_StoppointCallbackContext_h_
#define liblldb_StoppointCallbackContext_h_
#include "lldb/lldb-private.h"
#include "lldb/Target/ExecutionContext.h"
#include "lldb/lldb-private.h"
namespace lldb_private {
//----------------------------------------------------------------------
/// @class StoppointCallbackContext StoppointCallbackContext.h "lldb/Breakpoint/StoppointCallbackContext.h"
/// @brief Class holds the information that a breakpoint callback needs to evaluate this stop.
/// @class StoppointCallbackContext StoppointCallbackContext.h
/// "lldb/Breakpoint/StoppointCallbackContext.h"
/// @brief Class holds the information that a breakpoint callback needs to
/// evaluate this stop.
//----------------------------------------------------------------------
//----------------------------------------------------------------------
/// General Outline:
/// When we hit a breakpoint we need to package up whatever information is needed
/// to evaluate breakpoint commands and conditions. This class is the container of
/// When we hit a breakpoint we need to package up whatever information is
/// needed
/// to evaluate breakpoint commands and conditions. This class is the container
/// of
/// that information.
//----------------------------------------------------------------------
class StoppointCallbackContext
{
class StoppointCallbackContext {
public:
StoppointCallbackContext();
StoppointCallbackContext();
StoppointCallbackContext(Event *event, const ExecutionContext &exe_ctx, bool synchronously = false);
StoppointCallbackContext(Event *event, const ExecutionContext &exe_ctx,
bool synchronously = false);
//------------------------------------------------------------------
/// Clear the object's state.
///
/// Sets the event, process and thread to NULL, and the frame index to an
/// invalid value.
//------------------------------------------------------------------
void
Clear ();
//------------------------------------------------------------------
/// Clear the object's state.
///
/// Sets the event, process and thread to NULL, and the frame index to an
/// invalid value.
//------------------------------------------------------------------
void Clear();
//------------------------------------------------------------------
// Member variables
//------------------------------------------------------------------
Event *event; // This is the event, the callback can modify this to indicate
// the meaning of the breakpoint hit
ExecutionContextRef exe_ctx_ref; // This tells us where we have stopped, what thread.
bool is_synchronous; // Is the callback being executed synchronously with the breakpoint,
// or asynchronously as the event is retrieved?
//------------------------------------------------------------------
// Member variables
//------------------------------------------------------------------
Event *event; // This is the event, the callback can modify this to indicate
// the meaning of the breakpoint hit
ExecutionContextRef
exe_ctx_ref; // This tells us where we have stopped, what thread.
bool is_synchronous; // Is the callback being executed synchronously with the
// breakpoint,
// or asynchronously as the event is retrieved?
};
} // namespace lldb_private
#endif // liblldb_StoppointCallbackContext_h_
#endif // liblldb_StoppointCallbackContext_h_

View File

@ -14,137 +14,88 @@
// C++ Includes
// Other libraries and framework includes
// Project includes
#include "lldb/lldb-private.h"
#include "lldb/Core/UserID.h"
#include "lldb/lldb-private.h"
// #include "lldb/Breakpoint/BreakpointOptions.h"
namespace lldb_private {
class StoppointLocation
{
class StoppointLocation {
public:
//------------------------------------------------------------------
// Constructors and Destructors
//------------------------------------------------------------------
StoppointLocation (lldb::break_id_t bid,
lldb::addr_t m_addr,
bool hardware);
//------------------------------------------------------------------
// Constructors and Destructors
//------------------------------------------------------------------
StoppointLocation(lldb::break_id_t bid, lldb::addr_t m_addr, bool hardware);
StoppointLocation (lldb::break_id_t bid,
lldb::addr_t m_addr,
uint32_t byte_size,
bool hardware);
StoppointLocation(lldb::break_id_t bid, lldb::addr_t m_addr,
uint32_t byte_size, bool hardware);
virtual
~StoppointLocation ();
virtual ~StoppointLocation();
//------------------------------------------------------------------
// Operators
//------------------------------------------------------------------
//------------------------------------------------------------------
// Operators
//------------------------------------------------------------------
//------------------------------------------------------------------
// Methods
//------------------------------------------------------------------
virtual lldb::addr_t
GetLoadAddress() const
{
return m_addr;
}
//------------------------------------------------------------------
// Methods
//------------------------------------------------------------------
virtual lldb::addr_t GetLoadAddress() const { return m_addr; }
virtual void
SetLoadAddress (lldb::addr_t addr)
{
m_addr = addr;
}
virtual void SetLoadAddress(lldb::addr_t addr) { m_addr = addr; }
uint32_t
GetByteSize () const
{
return m_byte_size;
}
uint32_t GetByteSize() const { return m_byte_size; }
uint32_t
GetHitCount () const
{
return m_hit_count;
}
uint32_t GetHitCount() const { return m_hit_count; }
uint32_t
GetHardwareIndex () const
{
return m_hardware_index;
}
uint32_t GetHardwareIndex() const { return m_hardware_index; }
bool HardwareRequired() const { return m_hardware; }
bool
HardwareRequired () const
{
return m_hardware;
}
virtual bool IsHardware() const {
return m_hardware_index != LLDB_INVALID_INDEX32;
}
virtual bool
IsHardware () const
{
return m_hardware_index != LLDB_INVALID_INDEX32;
}
virtual bool ShouldStop(StoppointCallbackContext *context) { return true; }
virtual void Dump(Stream *stream) const {}
virtual bool
ShouldStop (StoppointCallbackContext *context)
{
return true;
}
void SetHardwareIndex(uint32_t index) { m_hardware_index = index; }
virtual void
Dump (Stream *stream) const
{
}
void
SetHardwareIndex (uint32_t index)
{
m_hardware_index = index;
}
lldb::break_id_t
GetID () const
{
return m_loc_id;
}
lldb::break_id_t GetID() const { return m_loc_id; }
protected:
//------------------------------------------------------------------
// Classes that inherit from StoppointLocation can see and modify these
//------------------------------------------------------------------
lldb::break_id_t m_loc_id; // Stoppoint location ID
lldb::addr_t m_addr; // The load address of this stop point. The base Stoppoint doesn't
// store a full Address since that's not needed for the breakpoint sites.
bool m_hardware; // True if this point has been is required to use hardware (which may fail due to lack of resources)
uint32_t m_hardware_index; // The hardware resource index for this breakpoint/watchpoint
uint32_t m_byte_size; // The size in bytes of stop location. e.g. the length of the trap opcode for
// software breakpoints, or the optional length in bytes for
// hardware breakpoints, or the length of the watchpoint.
uint32_t m_hit_count; // Number of times this breakpoint/watchpoint has been hit
//------------------------------------------------------------------
// Classes that inherit from StoppointLocation can see and modify these
//------------------------------------------------------------------
lldb::break_id_t m_loc_id; // Stoppoint location ID
lldb::addr_t
m_addr; // The load address of this stop point. The base Stoppoint doesn't
// store a full Address since that's not needed for the breakpoint sites.
bool m_hardware; // True if this point has been is required to use hardware
// (which may fail due to lack of resources)
uint32_t m_hardware_index; // The hardware resource index for this
// breakpoint/watchpoint
uint32_t m_byte_size; // The size in bytes of stop location. e.g. the length
// of the trap opcode for
// software breakpoints, or the optional length in bytes for
// hardware breakpoints, or the length of the watchpoint.
uint32_t
m_hit_count; // Number of times this breakpoint/watchpoint has been hit
// If you override this, be sure to call the base class to increment the internal counter.
void
IncrementHitCount ()
{
++m_hit_count;
}
// If you override this, be sure to call the base class to increment the
// internal counter.
void IncrementHitCount() { ++m_hit_count; }
void
DecrementHitCount ();
void DecrementHitCount();
private:
//------------------------------------------------------------------
// For StoppointLocation only
//------------------------------------------------------------------
DISALLOW_COPY_AND_ASSIGN(StoppointLocation);
StoppointLocation(); // Disallow default constructor
//------------------------------------------------------------------
// For StoppointLocation only
//------------------------------------------------------------------
DISALLOW_COPY_AND_ASSIGN(StoppointLocation);
StoppointLocation(); // Disallow default constructor
};
} // namespace lldb_private
#endif // liblldb_StoppointLocation_h_
#endif // liblldb_StoppointLocation_h_

View File

@ -17,240 +17,218 @@
// Other libraries and framework includes
// Project includes
#include "lldb/lldb-private.h"
#include "lldb/Breakpoint/WatchpointOptions.h"
#include "lldb/Breakpoint/StoppointLocation.h"
#include "lldb/Breakpoint/WatchpointOptions.h"
#include "lldb/Core/UserID.h"
#include "lldb/Symbol/CompilerType.h"
#include "lldb/Target/Target.h"
#include "lldb/lldb-private.h"
namespace lldb_private {
class Watchpoint :
public std::enable_shared_from_this<Watchpoint>,
public StoppointLocation
{
class Watchpoint : public std::enable_shared_from_this<Watchpoint>,
public StoppointLocation {
public:
class WatchpointEventData :
public EventData
{
public:
WatchpointEventData (lldb::WatchpointEventType sub_type,
const lldb::WatchpointSP &new_watchpoint_sp);
class WatchpointEventData : public EventData {
public:
WatchpointEventData(lldb::WatchpointEventType sub_type,
const lldb::WatchpointSP &new_watchpoint_sp);
~WatchpointEventData() override;
~WatchpointEventData() override;
static const ConstString &
GetFlavorString ();
static const ConstString &GetFlavorString();
const ConstString &
GetFlavor() const override;
const ConstString &GetFlavor() const override;
lldb::WatchpointEventType
GetWatchpointEventType () const;
lldb::WatchpointEventType GetWatchpointEventType() const;
lldb::WatchpointSP &
GetWatchpoint ();
void
Dump(Stream *s) const override;
lldb::WatchpointSP &GetWatchpoint();
static lldb::WatchpointEventType
GetWatchpointEventTypeFromEvent (const lldb::EventSP &event_sp);
void Dump(Stream *s) const override;
static lldb::WatchpointSP
GetWatchpointFromEvent (const lldb::EventSP &event_sp);
static lldb::WatchpointEventType
GetWatchpointEventTypeFromEvent(const lldb::EventSP &event_sp);
static const WatchpointEventData *
GetEventDataFromEvent (const Event *event_sp);
static lldb::WatchpointSP
GetWatchpointFromEvent(const lldb::EventSP &event_sp);
private:
lldb::WatchpointEventType m_watchpoint_event;
lldb::WatchpointSP m_new_watchpoint_sp;
static const WatchpointEventData *
GetEventDataFromEvent(const Event *event_sp);
DISALLOW_COPY_AND_ASSIGN (WatchpointEventData);
};
private:
lldb::WatchpointEventType m_watchpoint_event;
lldb::WatchpointSP m_new_watchpoint_sp;
Watchpoint (Target& target, lldb::addr_t addr, uint32_t size, const CompilerType *type, bool hardware = true);
DISALLOW_COPY_AND_ASSIGN(WatchpointEventData);
};
~Watchpoint() override;
Watchpoint(Target &target, lldb::addr_t addr, uint32_t size,
const CompilerType *type, bool hardware = true);
void
IncrementFalseAlarmsAndReviseHitCount();
~Watchpoint() override;
bool
IsEnabled () const;
void IncrementFalseAlarmsAndReviseHitCount();
void
SetEnabled (bool enabled, bool notify = true);
bool IsEnabled() const;
bool
IsHardware() const override;
// This doesn't really enable/disable the watchpoint.
// It is currently just for use in the Process plugin's
// {Enable,Disable}Watchpoint, which should be used instead.
void SetEnabled(bool enabled, bool notify = true);
bool
ShouldStop(StoppointCallbackContext *context) override;
bool IsHardware() const override;
bool WatchpointRead () const;
bool WatchpointWrite () const;
uint32_t GetIgnoreCount () const;
void SetIgnoreCount (uint32_t n);
void SetWatchpointType (uint32_t type, bool notify = true);
void SetDeclInfo (const std::string &str);
std::string GetWatchSpec();
void SetWatchSpec (const std::string &str);
bool ShouldStop(StoppointCallbackContext *context) override;
// Snapshot management interface.
bool IsWatchVariable() const;
void SetWatchVariable(bool val);
bool CaptureWatchedValue (const ExecutionContext &exe_ctx);
bool WatchpointRead() const;
bool WatchpointWrite() const;
uint32_t GetIgnoreCount() const;
void SetIgnoreCount(uint32_t n);
void SetWatchpointType(uint32_t type, bool notify = true);
void SetDeclInfo(const std::string &str);
std::string GetWatchSpec();
void SetWatchSpec(const std::string &str);
void GetDescription (Stream *s, lldb::DescriptionLevel level);
void Dump (Stream *s) const override;
void DumpSnapshots(Stream *s, const char *prefix = nullptr) const;
void DumpWithLevel (Stream *s, lldb::DescriptionLevel description_level) const;
Target &GetTarget() { return m_target; }
const Error &GetError() { return m_error; }
// Snapshot management interface.
bool IsWatchVariable() const;
void SetWatchVariable(bool val);
bool CaptureWatchedValue(const ExecutionContext &exe_ctx);
//------------------------------------------------------------------
/// Returns the WatchpointOptions structure set for this watchpoint.
///
/// @return
/// A pointer to this watchpoint's WatchpointOptions.
//------------------------------------------------------------------
WatchpointOptions *
GetOptions () { return &m_options; }
void GetDescription(Stream *s, lldb::DescriptionLevel level);
void Dump(Stream *s) const override;
void DumpSnapshots(Stream *s, const char *prefix = nullptr) const;
void DumpWithLevel(Stream *s, lldb::DescriptionLevel description_level) const;
Target &GetTarget() { return m_target; }
const Error &GetError() { return m_error; }
//------------------------------------------------------------------
/// Set the callback action invoked when the watchpoint is hit.
///
/// @param[in] callback
/// The method that will get called when the watchpoint is hit.
/// @param[in] callback_baton
/// A void * pointer that will get passed back to the callback function.
/// @param[in] is_synchronous
/// If \b true the callback will be run on the private event thread
/// before the stop event gets reported. If false, the callback will get
/// handled on the public event thread after the stop has been posted.
///
/// @return
/// \b true if the process should stop when you hit the watchpoint.
/// \b false if it should continue.
//------------------------------------------------------------------
void
SetCallback (WatchpointHitCallback callback,
void *callback_baton,
bool is_synchronous = false);
//------------------------------------------------------------------
/// Returns the WatchpointOptions structure set for this watchpoint.
///
/// @return
/// A pointer to this watchpoint's WatchpointOptions.
//------------------------------------------------------------------
WatchpointOptions *GetOptions() { return &m_options; }
void
SetCallback (WatchpointHitCallback callback,
const lldb::BatonSP &callback_baton_sp,
bool is_synchronous = false);
//------------------------------------------------------------------
/// Set the callback action invoked when the watchpoint is hit.
///
/// @param[in] callback
/// The method that will get called when the watchpoint is hit.
/// @param[in] callback_baton
/// A void * pointer that will get passed back to the callback function.
/// @param[in] is_synchronous
/// If \b true the callback will be run on the private event thread
/// before the stop event gets reported. If false, the callback will get
/// handled on the public event thread after the stop has been posted.
///
/// @return
/// \b true if the process should stop when you hit the watchpoint.
/// \b false if it should continue.
//------------------------------------------------------------------
void SetCallback(WatchpointHitCallback callback, void *callback_baton,
bool is_synchronous = false);
void ClearCallback();
void SetCallback(WatchpointHitCallback callback,
const lldb::BatonSP &callback_baton_sp,
bool is_synchronous = false);
//------------------------------------------------------------------
/// Invoke the callback action when the watchpoint is hit.
///
/// @param[in] context
/// Described the watchpoint event.
///
/// @return
/// \b true if the target should stop at this watchpoint and \b false not.
//------------------------------------------------------------------
bool
InvokeCallback (StoppointCallbackContext *context);
void ClearCallback();
//------------------------------------------------------------------
// Condition
//------------------------------------------------------------------
//------------------------------------------------------------------
/// Set the watchpoint's condition.
///
/// @param[in] condition
/// The condition expression to evaluate when the watchpoint is hit.
/// Pass in nullptr to clear the condition.
//------------------------------------------------------------------
void SetCondition (const char *condition);
//------------------------------------------------------------------
/// Return a pointer to the text of the condition expression.
///
/// @return
/// A pointer to the condition expression text, or nullptr if no
// condition has been set.
//------------------------------------------------------------------
const char *GetConditionText () const;
//------------------------------------------------------------------
/// Invoke the callback action when the watchpoint is hit.
///
/// @param[in] context
/// Described the watchpoint event.
///
/// @return
/// \b true if the target should stop at this watchpoint and \b false not.
//------------------------------------------------------------------
bool InvokeCallback(StoppointCallbackContext *context);
void
TurnOnEphemeralMode();
//------------------------------------------------------------------
// Condition
//------------------------------------------------------------------
//------------------------------------------------------------------
/// Set the watchpoint's condition.
///
/// @param[in] condition
/// The condition expression to evaluate when the watchpoint is hit.
/// Pass in nullptr to clear the condition.
//------------------------------------------------------------------
void SetCondition(const char *condition);
void
TurnOffEphemeralMode();
//------------------------------------------------------------------
/// Return a pointer to the text of the condition expression.
///
/// @return
/// A pointer to the condition expression text, or nullptr if no
// condition has been set.
//------------------------------------------------------------------
const char *GetConditionText() const;
bool
IsDisabledDuringEphemeralMode();
const CompilerType &
GetCompilerType()
{
return m_type;
}
void TurnOnEphemeralMode();
void TurnOffEphemeralMode();
bool IsDisabledDuringEphemeralMode();
const CompilerType &GetCompilerType() { return m_type; }
private:
friend class Target;
friend class WatchpointList;
friend class Target;
friend class WatchpointList;
void
ResetHitCount ()
{
m_hit_count = 0;
}
void
ResetHistoricValues ()
{
m_old_value_sp.reset(nullptr);
m_new_value_sp.reset(nullptr);
}
void ResetHitCount() { m_hit_count = 0; }
Target &m_target;
bool m_enabled; // Is this watchpoint enabled
bool m_is_hardware; // Is this a hardware watchpoint
bool m_is_watch_variable; // True if set via 'watchpoint set variable'.
bool m_is_ephemeral; // True if the watchpoint is in the ephemeral mode, meaning that it is
// undergoing a pair of temporary disable/enable actions to avoid recursively
// triggering further watchpoint events.
uint32_t m_disabled_count; // Keep track of the count that the watchpoint is disabled while in ephemeral mode.
// At the end of the ephemeral mode when the watchpoint is to be enabled again,
// we check the count, if it is more than 1, it means the user-supplied actions
// actually want the watchpoint to be disabled!
uint32_t m_watch_read:1, // 1 if we stop when the watched data is read from
m_watch_write:1, // 1 if we stop when the watched data is written to
m_watch_was_read:1, // Set to 1 when watchpoint is hit for a read access
m_watch_was_written:1; // Set to 1 when watchpoint is hit for a write access
uint32_t m_ignore_count; // Number of times to ignore this watchpoint
uint32_t m_false_alarms; // Number of false alarms.
std::string m_decl_str; // Declaration information, if any.
std::string m_watch_spec_str; // Spec for the watchpoint.
lldb::ValueObjectSP m_old_value_sp;
lldb::ValueObjectSP m_new_value_sp;
CompilerType m_type;
Error m_error; // An error object describing errors associated with this watchpoint.
WatchpointOptions m_options; // Settable watchpoint options, which is a delegate to handle
// the callback machinery.
bool m_being_created;
void ResetHistoricValues() {
m_old_value_sp.reset(nullptr);
m_new_value_sp.reset(nullptr);
}
std::unique_ptr<UserExpression> m_condition_ap; // The condition to test.
Target &m_target;
bool m_enabled; // Is this watchpoint enabled
bool m_is_hardware; // Is this a hardware watchpoint
bool m_is_watch_variable; // True if set via 'watchpoint set variable'.
bool m_is_ephemeral; // True if the watchpoint is in the ephemeral mode,
// meaning that it is
// undergoing a pair of temporary disable/enable actions to avoid recursively
// triggering further watchpoint events.
uint32_t m_disabled_count; // Keep track of the count that the watchpoint is
// disabled while in ephemeral mode.
// At the end of the ephemeral mode when the watchpoint is to be enabled
// again,
// we check the count, if it is more than 1, it means the user-supplied
// actions
// actually want the watchpoint to be disabled!
uint32_t m_watch_read : 1, // 1 if we stop when the watched data is read from
m_watch_write : 1, // 1 if we stop when the watched data is written to
m_watch_was_read : 1, // Set to 1 when watchpoint is hit for a read access
m_watch_was_written : 1; // Set to 1 when watchpoint is hit for a write
// access
uint32_t m_ignore_count; // Number of times to ignore this watchpoint
uint32_t m_false_alarms; // Number of false alarms.
std::string m_decl_str; // Declaration information, if any.
std::string m_watch_spec_str; // Spec for the watchpoint.
lldb::ValueObjectSP m_old_value_sp;
lldb::ValueObjectSP m_new_value_sp;
CompilerType m_type;
Error m_error; // An error object describing errors associated with this
// watchpoint.
WatchpointOptions
m_options; // Settable watchpoint options, which is a delegate to handle
// the callback machinery.
bool m_being_created;
void SetID(lldb::watch_id_t id) { m_loc_id = id; }
void
SendWatchpointChangedEvent (lldb::WatchpointEventType eventKind);
std::unique_ptr<UserExpression> m_condition_ap; // The condition to test.
void
SendWatchpointChangedEvent (WatchpointEventData *data);
void SetID(lldb::watch_id_t id) { m_loc_id = id; }
DISALLOW_COPY_AND_ASSIGN (Watchpoint);
void SendWatchpointChangedEvent(lldb::WatchpointEventType eventKind);
void SendWatchpointChangedEvent(WatchpointEventData *data);
DISALLOW_COPY_AND_ASSIGN(Watchpoint);
};
} // namespace lldb_private

View File

@ -18,8 +18,8 @@
// Other libraries and framework includes
// Project includes
#include "lldb/lldb-private.h"
#include "lldb/Core/Address.h"
#include "lldb/lldb-private.h"
namespace lldb_private {
@ -30,248 +30,224 @@ namespace lldb_private {
// well.
//----------------------------------------------------------------------
class WatchpointList
{
// Only Target can make the watchpoint list, or add elements to it.
// This is not just some random collection of watchpoints. Rather, the act of
// adding the watchpoint to this list sets its ID.
friend class Watchpoint;
friend class Target;
class WatchpointList {
// Only Target can make the watchpoint list, or add elements to it.
// This is not just some random collection of watchpoints. Rather, the act of
// adding the watchpoint to this list sets its ID.
friend class Watchpoint;
friend class Target;
public:
//------------------------------------------------------------------
/// Default constructor makes an empty list.
//------------------------------------------------------------------
WatchpointList();
//------------------------------------------------------------------
/// Default constructor makes an empty list.
//------------------------------------------------------------------
WatchpointList();
//------------------------------------------------------------------
/// Destructor, currently does nothing.
//------------------------------------------------------------------
~WatchpointList();
//------------------------------------------------------------------
/// Destructor, currently does nothing.
//------------------------------------------------------------------
~WatchpointList();
//------------------------------------------------------------------
/// Add a Watchpoint to the list.
///
/// @param[in] wp_sp
/// A shared pointer to a watchpoint being added to the list.
///
/// @return
/// The ID of the Watchpoint in the list.
//------------------------------------------------------------------
lldb::watch_id_t
Add (const lldb::WatchpointSP& wp_sp, bool notify);
//------------------------------------------------------------------
/// Add a Watchpoint to the list.
///
/// @param[in] wp_sp
/// A shared pointer to a watchpoint being added to the list.
///
/// @return
/// The ID of the Watchpoint in the list.
//------------------------------------------------------------------
lldb::watch_id_t Add(const lldb::WatchpointSP &wp_sp, bool notify);
//------------------------------------------------------------------
/// Standard "Dump" method.
//------------------------------------------------------------------
void
Dump (Stream *s) const;
//------------------------------------------------------------------
/// Standard "Dump" method.
//------------------------------------------------------------------
void Dump(Stream *s) const;
//------------------------------------------------------------------
/// Dump with lldb::DescriptionLevel.
//------------------------------------------------------------------
void
DumpWithLevel (Stream *s, lldb::DescriptionLevel description_level) const;
//------------------------------------------------------------------
/// Dump with lldb::DescriptionLevel.
//------------------------------------------------------------------
void DumpWithLevel(Stream *s, lldb::DescriptionLevel description_level) const;
//------------------------------------------------------------------
/// Returns a shared pointer to the watchpoint at address
/// \a addr -
/// const version.
///
/// @param[in] addr
/// The address to look for.
///
/// @result
/// A shared pointer to the watchpoint. May contain a NULL
/// pointer if the watchpoint doesn't exist.
//------------------------------------------------------------------
const lldb::WatchpointSP
FindByAddress (lldb::addr_t addr) const;
//------------------------------------------------------------------
/// Returns a shared pointer to the watchpoint at address
/// \a addr -
/// const version.
///
/// @param[in] addr
/// The address to look for.
///
/// @result
/// A shared pointer to the watchpoint. May contain a NULL
/// pointer if the watchpoint doesn't exist.
//------------------------------------------------------------------
const lldb::WatchpointSP FindByAddress(lldb::addr_t addr) const;
//------------------------------------------------------------------
/// Returns a shared pointer to the watchpoint with watchpoint spec
/// \a spec -
/// const version.
///
/// @param[in] spec
/// The watchpoint spec to look for.
///
/// @result
/// A shared pointer to the watchpoint. May contain a NULL
/// pointer if the watchpoint doesn't exist.
//------------------------------------------------------------------
const lldb::WatchpointSP
FindBySpec (std::string spec) const;
//------------------------------------------------------------------
/// Returns a shared pointer to the watchpoint with watchpoint spec
/// \a spec -
/// const version.
///
/// @param[in] spec
/// The watchpoint spec to look for.
///
/// @result
/// A shared pointer to the watchpoint. May contain a NULL
/// pointer if the watchpoint doesn't exist.
//------------------------------------------------------------------
const lldb::WatchpointSP FindBySpec(std::string spec) const;
//------------------------------------------------------------------
/// Returns a shared pointer to the watchpoint with id
/// \a watchID, const
/// version.
///
/// @param[in] watchID
/// The watchpoint location ID to seek for.
///
/// @result
/// A shared pointer to the watchpoint. May contain a NULL
/// pointer if the watchpoint doesn't exist.
//------------------------------------------------------------------
lldb::WatchpointSP
FindByID (lldb::watch_id_t watchID) const;
//------------------------------------------------------------------
/// Returns a shared pointer to the watchpoint with id
/// \a watchID, const
/// version.
///
/// @param[in] watchID
/// The watchpoint location ID to seek for.
///
/// @result
/// A shared pointer to the watchpoint. May contain a NULL
/// pointer if the watchpoint doesn't exist.
//------------------------------------------------------------------
lldb::WatchpointSP FindByID(lldb::watch_id_t watchID) const;
//------------------------------------------------------------------
/// Returns the watchpoint id to the watchpoint
/// at address \a addr.
///
/// @param[in] addr
/// The address to match.
///
/// @result
/// The ID of the watchpoint, or LLDB_INVALID_WATCH_ID.
//------------------------------------------------------------------
lldb::watch_id_t
FindIDByAddress (lldb::addr_t addr);
//------------------------------------------------------------------
/// Returns the watchpoint id to the watchpoint
/// at address \a addr.
///
/// @param[in] addr
/// The address to match.
///
/// @result
/// The ID of the watchpoint, or LLDB_INVALID_WATCH_ID.
//------------------------------------------------------------------
lldb::watch_id_t FindIDByAddress(lldb::addr_t addr);
//------------------------------------------------------------------
/// Returns the watchpoint id to the watchpoint
/// with watchpoint spec \a spec.
///
/// @param[in] spec
/// The watchpoint spec to match.
///
/// @result
/// The ID of the watchpoint, or LLDB_INVALID_WATCH_ID.
//------------------------------------------------------------------
lldb::watch_id_t
FindIDBySpec (std::string spec);
//------------------------------------------------------------------
/// Returns the watchpoint id to the watchpoint
/// with watchpoint spec \a spec.
///
/// @param[in] spec
/// The watchpoint spec to match.
///
/// @result
/// The ID of the watchpoint, or LLDB_INVALID_WATCH_ID.
//------------------------------------------------------------------
lldb::watch_id_t FindIDBySpec(std::string spec);
//------------------------------------------------------------------
/// Returns a shared pointer to the watchpoint with index \a i.
///
/// @param[in] i
/// The watchpoint index to seek for.
///
/// @result
/// A shared pointer to the watchpoint. May contain a NULL pointer if
/// the watchpoint doesn't exist.
//------------------------------------------------------------------
lldb::WatchpointSP
GetByIndex (uint32_t i);
//------------------------------------------------------------------
/// Returns a shared pointer to the watchpoint with index \a i.
///
/// @param[in] i
/// The watchpoint index to seek for.
///
/// @result
/// A shared pointer to the watchpoint. May contain a NULL pointer if
/// the watchpoint doesn't exist.
//------------------------------------------------------------------
lldb::WatchpointSP GetByIndex(uint32_t i);
//------------------------------------------------------------------
/// Returns a shared pointer to the watchpoint with index \a i, const
/// version.
///
/// @param[in] i
/// The watchpoint index to seek for.
///
/// @result
/// A shared pointer to the watchpoint. May contain a NULL pointer if
/// the watchpoint location doesn't exist.
//------------------------------------------------------------------
const lldb::WatchpointSP
GetByIndex (uint32_t i) const;
//------------------------------------------------------------------
/// Returns a shared pointer to the watchpoint with index \a i, const
/// version.
///
/// @param[in] i
/// The watchpoint index to seek for.
///
/// @result
/// A shared pointer to the watchpoint. May contain a NULL pointer if
/// the watchpoint location doesn't exist.
//------------------------------------------------------------------
const lldb::WatchpointSP GetByIndex(uint32_t i) const;
//------------------------------------------------------------------
/// Removes the watchpoint given by \b watchID from this list.
///
/// @param[in] watchID
/// The watchpoint ID to remove.
///
/// @result
/// \b true if the watchpoint \a watchID was in the list.
//------------------------------------------------------------------
bool
Remove (lldb::watch_id_t watchID, bool notify);
//------------------------------------------------------------------
/// Removes the watchpoint given by \b watchID from this list.
///
/// @param[in] watchID
/// The watchpoint ID to remove.
///
/// @result
/// \b true if the watchpoint \a watchID was in the list.
//------------------------------------------------------------------
bool Remove(lldb::watch_id_t watchID, bool notify);
//------------------------------------------------------------------
/// Returns the number hit count of all watchpoints in this list.
///
/// @result
/// Hit count of all watchpoints in this list.
//------------------------------------------------------------------
uint32_t
GetHitCount () const;
//------------------------------------------------------------------
/// Returns the number hit count of all watchpoints in this list.
///
/// @result
/// Hit count of all watchpoints in this list.
//------------------------------------------------------------------
uint32_t GetHitCount() const;
//------------------------------------------------------------------
/// Enquires of the watchpoint in this list with ID \a watchID whether we
/// should stop.
///
/// @param[in] context
/// This contains the information about this stop.
///
/// @param[in] watchID
/// This watch ID that we hit.
///
/// @return
/// \b true if we should stop, \b false otherwise.
//------------------------------------------------------------------
bool
ShouldStop (StoppointCallbackContext *context,
lldb::watch_id_t watchID);
//------------------------------------------------------------------
/// Enquires of the watchpoint in this list with ID \a watchID whether we
/// should stop.
///
/// @param[in] context
/// This contains the information about this stop.
///
/// @param[in] watchID
/// This watch ID that we hit.
///
/// @return
/// \b true if we should stop, \b false otherwise.
//------------------------------------------------------------------
bool ShouldStop(StoppointCallbackContext *context, lldb::watch_id_t watchID);
//------------------------------------------------------------------
/// Returns the number of elements in this watchpoint list.
///
/// @result
/// The number of elements.
//------------------------------------------------------------------
size_t
GetSize() const
{
std::lock_guard<std::recursive_mutex> guard(m_mutex);
return m_watchpoints.size();
}
//------------------------------------------------------------------
/// Returns the number of elements in this watchpoint list.
///
/// @result
/// The number of elements.
//------------------------------------------------------------------
size_t GetSize() const {
std::lock_guard<std::recursive_mutex> guard(m_mutex);
return m_watchpoints.size();
}
//------------------------------------------------------------------
/// Print a description of the watchpoints in this list to the stream \a s.
///
/// @param[in] s
/// The stream to which to print the description.
///
/// @param[in] level
/// The description level that indicates the detail level to
/// provide.
///
/// @see lldb::DescriptionLevel
//------------------------------------------------------------------
void
GetDescription (Stream *s,
lldb::DescriptionLevel level);
//------------------------------------------------------------------
/// Print a description of the watchpoints in this list to the stream \a s.
///
/// @param[in] s
/// The stream to which to print the description.
///
/// @param[in] level
/// The description level that indicates the detail level to
/// provide.
///
/// @see lldb::DescriptionLevel
//------------------------------------------------------------------
void GetDescription(Stream *s, lldb::DescriptionLevel level);
void
SetEnabledAll (bool enabled);
void SetEnabledAll(bool enabled);
void
RemoveAll (bool notify);
//------------------------------------------------------------------
/// Sets the passed in Locker to hold the Watchpoint List mutex.
///
/// @param[in] locker
/// The locker object that is set.
//------------------------------------------------------------------
void
GetListMutex(std::unique_lock<std::recursive_mutex> &lock);
void RemoveAll(bool notify);
//------------------------------------------------------------------
/// Sets the passed in Locker to hold the Watchpoint List mutex.
///
/// @param[in] locker
/// The locker object that is set.
//------------------------------------------------------------------
void GetListMutex(std::unique_lock<std::recursive_mutex> &lock);
protected:
typedef std::list<lldb::WatchpointSP> wp_collection;
typedef std::vector<lldb::watch_id_t> id_vector;
typedef std::list<lldb::WatchpointSP> wp_collection;
typedef std::vector<lldb::watch_id_t> id_vector;
id_vector
GetWatchpointIDs() const;
id_vector GetWatchpointIDs() const;
wp_collection::iterator
GetIDIterator(lldb::watch_id_t watchID);
wp_collection::iterator GetIDIterator(lldb::watch_id_t watchID);
wp_collection::const_iterator
GetIDConstIterator(lldb::watch_id_t watchID) const;
wp_collection::const_iterator
GetIDConstIterator(lldb::watch_id_t watchID) const;
wp_collection m_watchpoints;
mutable std::recursive_mutex m_mutex;
wp_collection m_watchpoints;
mutable std::recursive_mutex m_mutex;
lldb::watch_id_t m_next_wp_id;
lldb::watch_id_t m_next_wp_id;
};
} // namespace lldb_private
#endif // liblldb_WatchpointList_h_
#endif // liblldb_WatchpointList_h_

View File

@ -17,234 +17,228 @@
// Other libraries and framework includes
// Project includes
#include "lldb/lldb-private.h"
#include "lldb/Core/Baton.h"
#include "lldb/Core/StringList.h"
#include "lldb/lldb-private.h"
namespace lldb_private {
//----------------------------------------------------------------------
/// @class WatchpointOptions WatchpointOptions.h "lldb/Breakpoint/WatchpointOptions.h"
/// @class WatchpointOptions WatchpointOptions.h
/// "lldb/Breakpoint/WatchpointOptions.h"
/// @brief Class that manages the options on a watchpoint.
//----------------------------------------------------------------------
class WatchpointOptions
{
class WatchpointOptions {
public:
//------------------------------------------------------------------
// Constructors and Destructors
//------------------------------------------------------------------
//------------------------------------------------------------------
/// Default constructor. The watchpoint is enabled, and has no condition,
/// callback, ignore count, etc...
//------------------------------------------------------------------
WatchpointOptions();
WatchpointOptions(const WatchpointOptions& rhs);
//------------------------------------------------------------------
// Constructors and Destructors
//------------------------------------------------------------------
//------------------------------------------------------------------
/// Default constructor. The watchpoint is enabled, and has no condition,
/// callback, ignore count, etc...
//------------------------------------------------------------------
WatchpointOptions();
WatchpointOptions(const WatchpointOptions &rhs);
static WatchpointOptions *
CopyOptionsNoCallback (WatchpointOptions &rhs);
//------------------------------------------------------------------
/// This constructor allows you to specify all the watchpoint options.
///
/// @param[in] callback
/// This is the plugin for some code that gets run, returns \b true if we are to stop.
///
/// @param[in] baton
/// Client data that will get passed to the callback.
///
/// @param[in] thread_id
/// Only stop if \a thread_id hits the watchpoint.
//------------------------------------------------------------------
WatchpointOptions(WatchpointHitCallback callback,
void *baton,
lldb::tid_t thread_id = LLDB_INVALID_THREAD_ID);
static WatchpointOptions *CopyOptionsNoCallback(WatchpointOptions &rhs);
//------------------------------------------------------------------
/// This constructor allows you to specify all the watchpoint options.
///
/// @param[in] callback
/// This is the plugin for some code that gets run, returns \b true if we
/// are to stop.
///
/// @param[in] baton
/// Client data that will get passed to the callback.
///
/// @param[in] thread_id
/// Only stop if \a thread_id hits the watchpoint.
//------------------------------------------------------------------
WatchpointOptions(WatchpointHitCallback callback, void *baton,
lldb::tid_t thread_id = LLDB_INVALID_THREAD_ID);
virtual ~WatchpointOptions();
virtual ~WatchpointOptions();
//------------------------------------------------------------------
// Operators
//------------------------------------------------------------------
const WatchpointOptions&
operator=(const WatchpointOptions& rhs);
//------------------------------------------------------------------
// Operators
//------------------------------------------------------------------
const WatchpointOptions &operator=(const WatchpointOptions &rhs);
//------------------------------------------------------------------
// Callbacks
//
// Watchpoint callbacks come in two forms, synchronous and asynchronous. Synchronous callbacks will get
// run before any of the thread plans are consulted, and if they return false the target will continue
// "under the radar" of the thread plans. There are a couple of restrictions to synchronous callbacks:
// 1) They should NOT resume the target themselves. Just return false if you want the target to restart.
// 2) Watchpoints with synchronous callbacks can't have conditions (or rather, they can have them, but they
// won't do anything. Ditto with ignore counts, etc... You are supposed to control that all through the
// callback.
// Asynchronous callbacks get run as part of the "ShouldStop" logic in the thread plan. The logic there is:
// a) If the watchpoint is thread specific and not for this thread, continue w/o running the callback.
// b) If the ignore count says we shouldn't stop, then ditto.
// c) If the condition says we shouldn't stop, then ditto.
// d) Otherwise, the callback will get run, and if it returns true we will stop, and if false we won't.
// The asynchronous callback can run the target itself, but at present that should be the last action the
// callback does. We will relax this condition at some point, but it will take a bit of plumbing to get
// that to work.
//
//------------------------------------------------------------------
//------------------------------------------------------------------
/// Adds a callback to the watchpoint option set.
///
/// @param[in] callback
/// The function to be called when the watchpoint gets hit.
///
/// @param[in] baton_sp
/// A baton which will get passed back to the callback when it is invoked.
///
/// @param[in] synchronous
/// Whether this is a synchronous or asynchronous callback. See discussion above.
//------------------------------------------------------------------
void SetCallback (WatchpointHitCallback callback, const lldb::BatonSP &baton_sp, bool synchronous = false);
//------------------------------------------------------------------
/// Remove the callback from this option set.
//------------------------------------------------------------------
void ClearCallback ();
//------------------------------------------------------------------
// Callbacks
//
// Watchpoint callbacks come in two forms, synchronous and asynchronous.
// Synchronous callbacks will get
// run before any of the thread plans are consulted, and if they return false
// the target will continue
// "under the radar" of the thread plans. There are a couple of restrictions
// to synchronous callbacks:
// 1) They should NOT resume the target themselves. Just return false if you
// want the target to restart.
// 2) Watchpoints with synchronous callbacks can't have conditions (or rather,
// they can have them, but they
// won't do anything. Ditto with ignore counts, etc... You are supposed
// to control that all through the
// callback.
// Asynchronous callbacks get run as part of the "ShouldStop" logic in the
// thread plan. The logic there is:
// a) If the watchpoint is thread specific and not for this thread, continue
// w/o running the callback.
// b) If the ignore count says we shouldn't stop, then ditto.
// c) If the condition says we shouldn't stop, then ditto.
// d) Otherwise, the callback will get run, and if it returns true we will
// stop, and if false we won't.
// The asynchronous callback can run the target itself, but at present that
// should be the last action the
// callback does. We will relax this condition at some point, but it will
// take a bit of plumbing to get
// that to work.
//
//------------------------------------------------------------------
// The rest of these functions are meant to be used only within the watchpoint handling mechanism.
//------------------------------------------------------------------
/// Use this function to invoke the callback for a specific stop.
///
/// @param[in] context
/// The 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.
///
/// @param[in] watch_id
/// The watchpoint ID that owns this option set.
///
/// @return
/// The callback return value.
//------------------------------------------------------------------
bool InvokeCallback (StoppointCallbackContext *context, lldb::user_id_t watch_id);
//------------------------------------------------------------------
/// Used in InvokeCallback to tell whether it is the right time to run this kind of callback.
///
/// @return
/// The synchronicity of our callback.
//------------------------------------------------------------------
bool IsCallbackSynchronous () {
return m_callback_is_synchronous;
}
//------------------------------------------------------------------
/// Fetch the baton from the callback.
///
/// @return
/// The baton.
//------------------------------------------------------------------
Baton *GetBaton ();
//------------------------------------------------------------------
/// Fetch a const version of the baton from the callback.
///
/// @return
/// The baton.
//------------------------------------------------------------------
const Baton *GetBaton () const;
//------------------------------------------------------------------
/// Return the current thread spec for this option. This will return nullptr if the no thread
/// specifications have been set for this Option yet.
/// @return
/// The thread specification pointer for this option, or nullptr if none has
/// been set yet.
//------------------------------------------------------------------
const ThreadSpec *
GetThreadSpecNoCreate () const;
//------------------------------------------------------------------
/// Adds a callback to the watchpoint option set.
///
/// @param[in] callback
/// The function to be called when the watchpoint gets hit.
///
/// @param[in] baton_sp
/// A baton which will get passed back to the callback when it is invoked.
///
/// @param[in] synchronous
/// Whether this is a synchronous or asynchronous callback. See discussion
/// above.
//------------------------------------------------------------------
void SetCallback(WatchpointHitCallback callback,
const lldb::BatonSP &baton_sp, bool synchronous = false);
//------------------------------------------------------------------
/// 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 option.
//------------------------------------------------------------------
ThreadSpec *
GetThreadSpec ();
void
SetThreadID(lldb::tid_t thread_id);
void
GetDescription (Stream *s, lldb::DescriptionLevel level) const;
//------------------------------------------------------------------
/// Get description for callback only.
//------------------------------------------------------------------
void
GetCallbackDescription (Stream *s, lldb::DescriptionLevel level) const;
//------------------------------------------------------------------
/// Returns true if the watchpoint option has a callback set.
//------------------------------------------------------------------
bool
HasCallback();
//------------------------------------------------------------------
/// Remove the callback from this option set.
//------------------------------------------------------------------
void ClearCallback();
//------------------------------------------------------------------
/// This is the default empty callback.
/// @return
/// The thread id for which the watchpoint hit will stop,
/// LLDB_INVALID_THREAD_ID for all threads.
//------------------------------------------------------------------
static bool
NullCallback (void *baton,
StoppointCallbackContext *context,
lldb::user_id_t watch_id);
struct CommandData
{
CommandData () :
user_source(),
script_source(),
stop_on_error(true)
{
}
// The rest of these functions are meant to be used only within the watchpoint
// handling mechanism.
~CommandData() = default;
//------------------------------------------------------------------
/// Use this function to invoke the callback for a specific stop.
///
/// @param[in] context
/// The 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.
///
/// @param[in] watch_id
/// The watchpoint ID that owns this option set.
///
/// @return
/// The callback return value.
//------------------------------------------------------------------
bool InvokeCallback(StoppointCallbackContext *context,
lldb::user_id_t watch_id);
StringList user_source;
std::string script_source;
bool stop_on_error;
};
//------------------------------------------------------------------
/// Used in InvokeCallback to tell whether it is the right time to run this
/// kind of callback.
///
/// @return
/// The synchronicity of our callback.
//------------------------------------------------------------------
bool IsCallbackSynchronous() { return m_callback_is_synchronous; }
class CommandBaton : public Baton
{
public:
CommandBaton (CommandData *data) :
Baton (data)
{
}
//------------------------------------------------------------------
/// Fetch the baton from the callback.
///
/// @return
/// The baton.
//------------------------------------------------------------------
Baton *GetBaton();
~CommandBaton() override
{
delete ((CommandData *)m_data);
m_data = nullptr;
}
void
GetDescription(Stream *s, lldb::DescriptionLevel level) const override;
};
//------------------------------------------------------------------
/// Fetch a const version of the baton from the callback.
///
/// @return
/// The baton.
//------------------------------------------------------------------
const Baton *GetBaton() const;
//------------------------------------------------------------------
/// Return the current thread spec for this option. This will return nullptr
/// if the no thread
/// specifications have been set for this Option yet.
/// @return
/// The thread specification pointer for this option, or nullptr if none
/// has
/// been set yet.
//------------------------------------------------------------------
const ThreadSpec *GetThreadSpecNoCreate() const;
//------------------------------------------------------------------
/// 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 option.
//------------------------------------------------------------------
ThreadSpec *GetThreadSpec();
void SetThreadID(lldb::tid_t thread_id);
void GetDescription(Stream *s, lldb::DescriptionLevel level) const;
//------------------------------------------------------------------
/// Get description for callback only.
//------------------------------------------------------------------
void GetCallbackDescription(Stream *s, lldb::DescriptionLevel level) const;
//------------------------------------------------------------------
/// Returns true if the watchpoint option has a callback set.
//------------------------------------------------------------------
bool HasCallback();
//------------------------------------------------------------------
/// This is the default empty callback.
/// @return
/// The thread id for which the watchpoint hit will stop,
/// LLDB_INVALID_THREAD_ID for all threads.
//------------------------------------------------------------------
static bool NullCallback(void *baton, StoppointCallbackContext *context,
lldb::user_id_t watch_id);
struct CommandData {
CommandData() : user_source(), script_source(), stop_on_error(true) {}
~CommandData() = default;
StringList user_source;
std::string script_source;
bool stop_on_error;
};
class CommandBaton : public TypedBaton<CommandData> {
public:
CommandBaton(std::unique_ptr<CommandData> Data)
: TypedBaton(std::move(Data)) {}
void GetDescription(Stream *s, lldb::DescriptionLevel level) const override;
};
protected:
//------------------------------------------------------------------
// Classes that inherit from WatchpointOptions can see and modify these
//------------------------------------------------------------------
//------------------------------------------------------------------
// Classes that inherit from WatchpointOptions can see and modify these
//------------------------------------------------------------------
private:
//------------------------------------------------------------------
// For WatchpointOptions only
//------------------------------------------------------------------
WatchpointHitCallback m_callback; // This is the callback function pointer
lldb::BatonSP m_callback_baton_sp; // This is the client data for the callback
bool m_callback_is_synchronous;
std::unique_ptr<ThreadSpec> m_thread_spec_ap; // Thread for which this watchpoint will take
//------------------------------------------------------------------
// For WatchpointOptions only
//------------------------------------------------------------------
WatchpointHitCallback m_callback; // This is the callback function pointer
lldb::BatonSP m_callback_baton_sp; // This is the client data for the callback
bool m_callback_is_synchronous;
std::unique_ptr<ThreadSpec>
m_thread_spec_ap; // Thread for which this watchpoint will take
};
} // namespace lldb_private

View File

@ -12,12 +12,11 @@
// C Includes
// C++ Includes
#include <atomic>
// Other libraries and framework includes
// Project includes
#include "lldb/lldb-private.h"
#include "lldb/Symbol/SymbolContextScope.h"
#include "lldb/lldb-private.h"
namespace lldb_private {
@ -53,541 +52,492 @@ namespace lldb_private {
/// this happens, breakpoints that are in one of these sections can be
/// set/cleared.
//----------------------------------------------------------------------
class Address
{
class Address {
public:
//------------------------------------------------------------------
/// Dump styles allow the Address::Dump(Stream *,DumpStyle) const
/// function to display Address contents in a variety of ways.
//------------------------------------------------------------------
typedef enum {
DumpStyleInvalid, ///< Invalid dump style
DumpStyleSectionNameOffset, ///< Display as the section name + offset.
///< \code
/// // address for printf in libSystem.B.dylib as a section name + offset
/// libSystem.B.dylib.__TEXT.__text + 0x0005cfdf
/// \endcode
DumpStyleSectionPointerOffset, ///< Display as the section pointer + offset (debug output).
///< \code
/// // address for printf in libSystem.B.dylib as a section pointer + offset
/// (lldb::Section *)0x35cc50 + 0x000000000005cfdf \endcode
DumpStyleFileAddress, ///< Display as the file address (if any).
///< \code
/// // address for printf in libSystem.B.dylib as a file address
/// 0x000000000005dcff \endcode
DumpStyleModuleWithFileAddress, ///< Display as the file address with the module name prepended (if any).
///< \code
/// // address for printf in libSystem.B.dylib as a file address
/// libSystem.B.dylib[0x000000000005dcff] \endcode
DumpStyleLoadAddress, ///< Display as the load address (if resolved).
///< \code
/// // address for printf in libSystem.B.dylib as a load address
/// 0x00007fff8306bcff \endcode
DumpStyleResolvedDescription, ///< Display the details about what an address resolves to. This can
///< be anything from a symbol context summary (module, function/symbol,
///< and file and line), to information about what the pointer points to
///< if the address is in a section (section of pointers, c strings, etc).
DumpStyleResolvedDescriptionNoModule,
DumpStyleResolvedDescriptionNoFunctionArguments,
DumpStyleNoFunctionName, ///< Elide the function name; display an offset into the current function.
///< Used primarily in disassembly symbolication
DumpStyleDetailedSymbolContext, ///< Detailed symbol context information for an address for all symbol
///< context members.
DumpStyleResolvedPointerDescription ///< Dereference a pointer at the current address and then lookup the
///< dereferenced address using DumpStyleResolvedDescription
} DumpStyle;
//------------------------------------------------------------------
/// Dump styles allow the Address::Dump(Stream *,DumpStyle) const
/// function to display Address contents in a variety of ways.
//------------------------------------------------------------------
typedef enum {
DumpStyleInvalid, ///< Invalid dump style
DumpStyleSectionNameOffset, ///< Display as the section name + offset.
///< \code
/// // address for printf in libSystem.B.dylib as a section name + offset
/// libSystem.B.dylib.__TEXT.__text + 0x0005cfdf
/// \endcode
DumpStyleSectionPointerOffset, ///< Display as the section pointer + offset
///(debug output).
///< \code
/// // address for printf in libSystem.B.dylib as a section pointer + offset
/// (lldb::Section *)0x35cc50 + 0x000000000005cfdf \endcode
DumpStyleFileAddress, ///< Display as the file address (if any).
///< \code
/// // address for printf in libSystem.B.dylib as a file address
/// 0x000000000005dcff \endcode
DumpStyleModuleWithFileAddress, ///< Display as the file address with the
///module name prepended (if any).
///< \code
/// // address for printf in libSystem.B.dylib as a file address
/// libSystem.B.dylib[0x000000000005dcff] \endcode
DumpStyleLoadAddress, ///< Display as the load address (if resolved).
///< \code
/// // address for printf in libSystem.B.dylib as a load address
/// 0x00007fff8306bcff \endcode
DumpStyleResolvedDescription, ///< Display the details about what an address
///resolves to. This can
///< be anything from a symbol context summary (module, function/symbol,
///< and file and line), to information about what the pointer points to
///< if the address is in a section (section of pointers, c strings, etc).
DumpStyleResolvedDescriptionNoModule,
DumpStyleResolvedDescriptionNoFunctionArguments,
DumpStyleNoFunctionName, ///< Elide the function name; display an offset
///into the current function.
///< Used primarily in disassembly symbolication
DumpStyleDetailedSymbolContext, ///< Detailed symbol context information for
///an address for all symbol
///< context members.
DumpStyleResolvedPointerDescription ///< Dereference a pointer at the
///current address and then lookup the
///< dereferenced address using DumpStyleResolvedDescription
} DumpStyle;
//------------------------------------------------------------------
/// Default constructor.
///
/// Initialize with a invalid section (NULL) and an invalid
/// offset (LLDB_INVALID_ADDRESS).
//------------------------------------------------------------------
Address () :
m_section_wp (),
m_offset (LLDB_INVALID_ADDRESS)
{
}
//------------------------------------------------------------------
/// Default constructor.
///
/// Initialize with a invalid section (NULL) and an invalid
/// offset (LLDB_INVALID_ADDRESS).
//------------------------------------------------------------------
Address() : m_section_wp(), m_offset(LLDB_INVALID_ADDRESS) {}
//------------------------------------------------------------------
/// Copy constructor
///
/// Makes a copy of the another Address object \a rhs.
///
/// @param[in] rhs
/// A const Address object reference to copy.
//------------------------------------------------------------------
Address (const Address& rhs) :
m_section_wp (rhs.m_section_wp),
m_offset(rhs.m_offset.load())
{
}
//------------------------------------------------------------------
/// Copy constructor
///
/// Makes a copy of the another Address object \a rhs.
///
/// @param[in] rhs
/// A const Address object reference to copy.
//------------------------------------------------------------------
Address(const Address &rhs)
: m_section_wp(rhs.m_section_wp), m_offset(rhs.m_offset) {}
//------------------------------------------------------------------
/// Construct with a section pointer and offset.
///
/// Initialize the address with the supplied \a section and \a
/// offset.
///
/// @param[in] section
/// A section pointer to a valid lldb::Section, or NULL if the
/// address doesn't have a section or will get resolved later.
///
/// @param[in] offset
/// The offset in bytes into \a section.
//------------------------------------------------------------------
Address (const lldb::SectionSP &section_sp, lldb::addr_t offset) :
m_section_wp (), // Don't init with section_sp in case section_sp is invalid (the weak_ptr will throw)
m_offset (offset)
{
if (section_sp)
m_section_wp = section_sp;
}
//------------------------------------------------------------------
/// Construct with a section pointer and offset.
///
/// Initialize the address with the supplied \a section and \a
/// offset.
///
/// @param[in] section
/// A section pointer to a valid lldb::Section, or NULL if the
/// address doesn't have a section or will get resolved later.
///
/// @param[in] offset
/// The offset in bytes into \a section.
//------------------------------------------------------------------
Address(const lldb::SectionSP &section_sp, lldb::addr_t offset)
: m_section_wp(), // Don't init with section_sp in case section_sp is
// invalid (the weak_ptr will throw)
m_offset(offset) {
if (section_sp)
m_section_wp = section_sp;
}
//------------------------------------------------------------------
/// Construct with a virtual address and section list.
///
/// Initialize and resolve the address with the supplied virtual
/// address \a file_addr.
///
/// @param[in] file_addr
/// A virtual file address.
///
/// @param[in] section_list
/// A list of sections, one of which may contain the \a file_addr.
//------------------------------------------------------------------
Address (lldb::addr_t file_addr, const SectionList * section_list);
//------------------------------------------------------------------
/// Construct with a virtual address and section list.
///
/// Initialize and resolve the address with the supplied virtual
/// address \a file_addr.
///
/// @param[in] file_addr
/// A virtual file address.
///
/// @param[in] section_list
/// A list of sections, one of which may contain the \a file_addr.
//------------------------------------------------------------------
Address(lldb::addr_t file_addr, const SectionList *section_list);
Address (lldb::addr_t abs_addr);
Address(lldb::addr_t abs_addr);
//------------------------------------------------------------------
/// Assignment operator.
///
/// Copies the address value from another Address object \a rhs
/// into \a this object.
///
/// @param[in] rhs
/// A const Address object reference to copy.
///
/// @return
/// A const Address object reference to \a this.
//------------------------------------------------------------------
//------------------------------------------------------------------
/// Assignment operator.
///
/// Copies the address value from another Address object \a rhs
/// into \a this object.
///
/// @param[in] rhs
/// A const Address object reference to copy.
///
/// @return
/// A const Address object reference to \a this.
//------------------------------------------------------------------
#ifndef SWIG
const Address&
operator= (const Address& rhs);
const Address &operator=(const Address &rhs);
#endif
//------------------------------------------------------------------
/// Clear the object's state.
///
/// Sets the section to an invalid value (NULL) and an invalid
/// offset (LLDB_INVALID_ADDRESS).
//------------------------------------------------------------------
void
Clear ()
{
m_section_wp.reset();
m_offset = LLDB_INVALID_ADDRESS;
//------------------------------------------------------------------
/// Clear the object's state.
///
/// Sets the section to an invalid value (NULL) and an invalid
/// offset (LLDB_INVALID_ADDRESS).
//------------------------------------------------------------------
void Clear() {
m_section_wp.reset();
m_offset = LLDB_INVALID_ADDRESS;
}
//------------------------------------------------------------------
/// Compare two Address objects.
///
/// @param[in] lhs
/// The Left Hand Side const Address object reference.
///
/// @param[in] rhs
/// The Right Hand Side const Address object reference.
///
/// @return
/// @li -1 if lhs < rhs
/// @li 0 if lhs == rhs
/// @li 1 if lhs > rhs
//------------------------------------------------------------------
static int CompareFileAddress(const Address &lhs, const Address &rhs);
static int CompareLoadAddress(const Address &lhs, const Address &rhs,
Target *target);
static int CompareModulePointerAndOffset(const Address &lhs,
const Address &rhs);
// For use with std::map, std::multi_map
class ModulePointerAndOffsetLessThanFunctionObject {
public:
ModulePointerAndOffsetLessThanFunctionObject() = default;
bool operator()(const Address &a, const Address &b) const {
return Address::CompareModulePointerAndOffset(a, b) < 0;
}
};
//------------------------------------------------------------------
/// Compare two Address objects.
///
/// @param[in] lhs
/// The Left Hand Side const Address object reference.
///
/// @param[in] rhs
/// The Right Hand Side const Address object reference.
///
/// @return
/// @li -1 if lhs < rhs
/// @li 0 if lhs == rhs
/// @li 1 if lhs > rhs
//------------------------------------------------------------------
static int
CompareFileAddress (const Address& lhs, const Address& rhs);
//------------------------------------------------------------------
/// Dump a description of this object to a Stream.
///
/// Dump a description of the contents of this object to the
/// supplied stream \a s. There are many ways to display a section
/// offset based address, and \a style lets the user choose.
///
/// @param[in] s
/// The stream to which to dump the object description.
///
/// @param[in] style
/// The display style for the address.
///
/// @param[in] fallback_style
/// The display style for the address.
///
/// @return
/// Returns \b true if the address was able to be displayed.
/// File and load addresses may be unresolved and it may not be
/// possible to display a valid value, \b false will be returned
/// in such cases.
///
/// @see Address::DumpStyle
//------------------------------------------------------------------
bool Dump(Stream *s, ExecutionContextScope *exe_scope, DumpStyle style,
DumpStyle fallback_style = DumpStyleInvalid,
uint32_t addr_byte_size = UINT32_MAX) const;
static int
CompareLoadAddress (const Address& lhs, const Address& rhs, Target *target);
lldb::AddressClass GetAddressClass() const;
static int
CompareModulePointerAndOffset (const Address& lhs, const Address& rhs);
//------------------------------------------------------------------
/// Get the file address.
///
/// If an address comes from a file on disk that has section
/// relative addresses, then it has a virtual address that is
/// relative to unique section in the object file.
///
/// @return
/// The valid file virtual address, or LLDB_INVALID_ADDRESS if
/// the address doesn't have a file virtual address (image is
/// from memory only with no representation on disk).
//------------------------------------------------------------------
lldb::addr_t GetFileAddress() const;
// For use with std::map, std::multi_map
class ModulePointerAndOffsetLessThanFunctionObject
{
public:
ModulePointerAndOffsetLessThanFunctionObject() = default;
//------------------------------------------------------------------
/// Get the load address.
///
/// If an address comes from a file on disk that has section
/// relative addresses, then it has a virtual address that is
/// relative to unique section in the object file. Sections get
/// resolved at runtime by DynamicLoader plug-ins as images
/// (executables and shared libraries) get loaded/unloaded. If a
/// section is loaded, then the load address can be resolved.
///
/// @return
/// The valid load virtual address, or LLDB_INVALID_ADDRESS if
/// the address is currently not loaded.
//------------------------------------------------------------------
lldb::addr_t GetLoadAddress(Target *target) const;
bool
operator() (const Address& a, const Address& b) const
{
return Address::CompareModulePointerAndOffset(a, b) < 0;
}
};
//------------------------------------------------------------------
/// Get the load address as a callable code load address.
///
/// This function will first resolve its address to a load address.
/// Then, if the address turns out to be in code address, return the
/// load address that would be required to call or return to. The
/// address might have extra bits set (bit zero will be set to Thumb
/// functions for an ARM target) that are required when changing the
/// program counter to setting a return address.
///
/// @return
/// The valid load virtual address, or LLDB_INVALID_ADDRESS if
/// the address is currently not loaded.
//------------------------------------------------------------------
lldb::addr_t GetCallableLoadAddress(Target *target,
bool is_indirect = false) const;
//------------------------------------------------------------------
/// Dump a description of this object to a Stream.
///
/// Dump a description of the contents of this object to the
/// supplied stream \a s. There are many ways to display a section
/// offset based address, and \a style lets the user choose.
///
/// @param[in] s
/// The stream to which to dump the object description.
///
/// @param[in] style
/// The display style for the address.
///
/// @param[in] fallback_style
/// The display style for the address.
///
/// @return
/// Returns \b true if the address was able to be displayed.
/// File and load addresses may be unresolved and it may not be
/// possible to display a valid value, \b false will be returned
/// in such cases.
///
/// @see Address::DumpStyle
//------------------------------------------------------------------
bool
Dump (Stream *s,
ExecutionContextScope *exe_scope,
DumpStyle style,
DumpStyle fallback_style = DumpStyleInvalid,
uint32_t addr_byte_size = UINT32_MAX) const;
//------------------------------------------------------------------
/// Get the load address as an opcode load address.
///
/// This function will first resolve its address to a load address.
/// Then, if the address turns out to be in code address, return the
/// load address for an opcode. This address object might have
/// extra bits set (bit zero will be set to Thumb functions for an
/// ARM target) that are required for changing the program counter
/// and this function will remove any bits that are intended for
/// these special purposes. The result of this function can be used
/// to safely write a software breakpoint trap to memory.
///
/// @return
/// The valid load virtual address with extra callable bits
/// removed, or LLDB_INVALID_ADDRESS if the address is currently
/// not loaded.
//------------------------------------------------------------------
lldb::addr_t GetOpcodeLoadAddress(
Target *target,
lldb::AddressClass addr_class = lldb::eAddressClassInvalid) const;
lldb::AddressClass
GetAddressClass () const;
//------------------------------------------------------------------
/// Get the file address.
///
/// If an address comes from a file on disk that has section
/// relative addresses, then it has a virtual address that is
/// relative to unique section in the object file.
///
/// @return
/// The valid file virtual address, or LLDB_INVALID_ADDRESS if
/// the address doesn't have a file virtual address (image is
/// from memory only with no representation on disk).
//------------------------------------------------------------------
lldb::addr_t
GetFileAddress () const;
//------------------------------------------------------------------
/// Get the section relative offset value.
///
/// @return
/// The current offset, or LLDB_INVALID_ADDRESS if this address
/// doesn't contain a valid offset.
//------------------------------------------------------------------
lldb::addr_t GetOffset() const { return m_offset; }
//------------------------------------------------------------------
/// Get the load address.
///
/// If an address comes from a file on disk that has section
/// relative addresses, then it has a virtual address that is
/// relative to unique section in the object file. Sections get
/// resolved at runtime by DynamicLoader plug-ins as images
/// (executables and shared libraries) get loaded/unloaded. If a
/// section is loaded, then the load address can be resolved.
///
/// @return
/// The valid load virtual address, or LLDB_INVALID_ADDRESS if
/// the address is currently not loaded.
//------------------------------------------------------------------
lldb::addr_t
GetLoadAddress (Target *target) const;
//------------------------------------------------------------------
/// Get the load address as a callable code load address.
///
/// This function will first resolve its address to a load address.
/// Then, if the address turns out to be in code address, return the
/// load address that would be required to call or return to. The
/// address might have extra bits set (bit zero will be set to Thumb
/// functions for an ARM target) that are required when changing the
/// program counter to setting a return address.
///
/// @return
/// The valid load virtual address, or LLDB_INVALID_ADDRESS if
/// the address is currently not loaded.
//------------------------------------------------------------------
lldb::addr_t
GetCallableLoadAddress (Target *target, bool is_indirect = false) const;
//------------------------------------------------------------------
/// Check if an address is section offset.
///
/// When converting a virtual file or load address into a section
/// offset based address, we often need to know if, given a section
/// list, if the address was able to be converted to section offset.
/// This function returns true if the current value contained in
/// this object is section offset based.
///
/// @return
/// Returns \b true if the address has a valid section and
/// offset, \b false otherwise.
//------------------------------------------------------------------
bool IsSectionOffset() const {
return IsValid() && (GetSection().get() != nullptr);
}
//------------------------------------------------------------------
/// Get the load address as an opcode load address.
///
/// This function will first resolve its address to a load address.
/// Then, if the address turns out to be in code address, return the
/// load address for an opcode. This address object might have
/// extra bits set (bit zero will be set to Thumb functions for an
/// ARM target) that are required for changing the program counter
/// and this function will remove any bits that are intended for
/// these special purposes. The result of this function can be used
/// to safely write a software breakpoint trap to memory.
///
/// @return
/// The valid load virtual address with extra callable bits
/// removed, or LLDB_INVALID_ADDRESS if the address is currently
/// not loaded.
//------------------------------------------------------------------
lldb::addr_t
GetOpcodeLoadAddress (Target *target,
lldb::AddressClass addr_class = lldb::eAddressClassInvalid) const;
//------------------------------------------------------------------
/// Check if the object state is valid.
///
/// A valid Address object contains either a section pointer and
/// and offset (for section offset based addresses), or just a valid
/// offset (for absolute addresses that have no section).
///
/// @return
/// Returns \b true if the offset is valid, \b false
/// otherwise.
//------------------------------------------------------------------
bool IsValid() const { return m_offset != LLDB_INVALID_ADDRESS; }
//------------------------------------------------------------------
/// Get the section relative offset value.
///
/// @return
/// The current offset, or LLDB_INVALID_ADDRESS if this address
/// doesn't contain a valid offset.
//------------------------------------------------------------------
lldb::addr_t
GetOffset () const { return m_offset; }
//------------------------------------------------------------------
/// Get the memory cost of this object.
///
/// @return
/// The number of bytes that this object occupies in memory.
//------------------------------------------------------------------
size_t MemorySize() const;
//------------------------------------------------------------------
/// Check if an address is section offset.
///
/// When converting a virtual file or load address into a section
/// offset based address, we often need to know if, given a section
/// list, if the address was able to be converted to section offset.
/// This function returns true if the current value contained in
/// this object is section offset based.
///
/// @return
/// Returns \b true if the address has a valid section and
/// offset, \b false otherwise.
//------------------------------------------------------------------
bool
IsSectionOffset() const
{
return IsValid() && (GetSection().get() != nullptr);
//------------------------------------------------------------------
/// Resolve a file virtual address using a section list.
///
/// Given a list of sections, attempt to resolve \a addr as a
/// an offset into one of the file sections.
///
/// @return
/// Returns \b true if \a addr was able to be resolved, \b false
/// otherwise.
//------------------------------------------------------------------
bool ResolveAddressUsingFileSections(lldb::addr_t addr,
const SectionList *sections);
//------------------------------------------------------------------
/// Set the address to represent \a load_addr.
///
/// The address will attempt to find a loaded section within
/// \a target that contains \a load_addr. If successful, this
/// address object will have a valid section and offset. Else this
/// address object will have no section (NULL) and the offset will
/// be \a load_addr.
///
/// @param[in] load_addr
/// A load address from a current process.
///
/// @param[in] target
/// The target to use when trying resolve the address into
/// a section + offset. The Target's SectionLoadList object
/// is used to resolve the address.
///
/// @return
/// Returns \b true if the load address was resolved to be
/// section/offset, \b false otherwise. It is often ok for an
/// address no not resolve to a section in a module, this often
/// happens for JIT'ed code, or any load addresses on the stack
/// or heap.
//------------------------------------------------------------------
bool SetLoadAddress(lldb::addr_t load_addr, Target *target);
bool SetOpcodeLoadAddress(
lldb::addr_t load_addr, Target *target,
lldb::AddressClass addr_class = lldb::eAddressClassInvalid);
bool SetCallableLoadAddress(lldb::addr_t load_addr, Target *target);
//------------------------------------------------------------------
/// Get accessor for the module for this address.
///
/// @return
/// Returns the Module pointer that this address is an offset
/// in, or NULL if this address doesn't belong in a module, or
/// isn't resolved yet.
//------------------------------------------------------------------
lldb::ModuleSP GetModule() const;
//------------------------------------------------------------------
/// Get const accessor for the section.
///
/// @return
/// Returns the const lldb::Section pointer that this address is an
/// offset in, or NULL if this address is absolute.
//------------------------------------------------------------------
lldb::SectionSP GetSection() const { return m_section_wp.lock(); }
//------------------------------------------------------------------
/// Set accessor for the offset.
///
/// @param[in] offset
/// A new offset value for this object.
///
/// @return
/// Returns \b true if the offset changed, \b false otherwise.
//------------------------------------------------------------------
bool SetOffset(lldb::addr_t offset) {
bool changed = m_offset != offset;
m_offset = offset;
return changed;
}
void SetRawAddress(lldb::addr_t addr) {
m_section_wp.reset();
m_offset = addr;
}
bool Slide(int64_t offset) {
if (m_offset != LLDB_INVALID_ADDRESS) {
m_offset += offset;
return true;
}
return false;
}
//------------------------------------------------------------------
/// Check if the object state is valid.
///
/// A valid Address object contains either a section pointer and
/// and offset (for section offset based addresses), or just a valid
/// offset (for absolute addresses that have no section).
///
/// @return
/// Returns \b true if the offset is valid, \b false
/// otherwise.
//------------------------------------------------------------------
bool
IsValid() const
{
return m_offset != LLDB_INVALID_ADDRESS;
}
//------------------------------------------------------------------
/// Set accessor for the section.
///
/// @param[in] section
/// A new lldb::Section pointer to use as the section base. Can
/// be NULL for absolute addresses that are not relative to
/// any section.
//------------------------------------------------------------------
void SetSection(const lldb::SectionSP &section_sp) {
m_section_wp = section_sp;
}
//------------------------------------------------------------------
/// Get the memory cost of this object.
///
/// @return
/// The number of bytes that this object occupies in memory.
//------------------------------------------------------------------
size_t
MemorySize () const;
void ClearSection() { m_section_wp.reset(); }
//------------------------------------------------------------------
/// Resolve a file virtual address using a section list.
///
/// Given a list of sections, attempt to resolve \a addr as a
/// an offset into one of the file sections.
///
/// @return
/// Returns \b true if \a addr was able to be resolved, \b false
/// otherwise.
//------------------------------------------------------------------
bool
ResolveAddressUsingFileSections (lldb::addr_t addr, const SectionList *sections);
//------------------------------------------------------------------
/// Reconstruct a symbol context from an address.
///
/// This class doesn't inherit from SymbolContextScope because many
/// address objects have short lifespans. Address objects that are
/// section offset can reconstruct their symbol context by looking
/// up the address in the module found in the section.
///
/// @see SymbolContextScope::CalculateSymbolContext(SymbolContext*)
//------------------------------------------------------------------
uint32_t CalculateSymbolContext(
SymbolContext *sc,
uint32_t resolve_scope = lldb::eSymbolContextEverything) const;
//------------------------------------------------------------------
/// Set the address to represent \a load_addr.
///
/// The address will attempt to find a loaded section within
/// \a target that contains \a load_addr. If successful, this
/// address object will have a valid section and offset. Else this
/// address object will have no section (NULL) and the offset will
/// be \a load_addr.
///
/// @param[in] load_addr
/// A load address from a current process.
///
/// @param[in] target
/// The target to use when trying resolve the address into
/// a section + offset. The Target's SectionLoadList object
/// is used to resolve the address.
///
/// @return
/// Returns \b true if the load address was resolved to be
/// section/offset, \b false otherwise. It is often ok for an
/// address no not resolve to a section in a module, this often
/// happens for JIT'ed code, or any load addresses on the stack
/// or heap.
//------------------------------------------------------------------
bool
SetLoadAddress (lldb::addr_t load_addr, Target *target);
bool
SetOpcodeLoadAddress (lldb::addr_t load_addr,
Target *target,
lldb::AddressClass addr_class = lldb::eAddressClassInvalid);
lldb::ModuleSP CalculateSymbolContextModule() const;
bool
SetCallableLoadAddress (lldb::addr_t load_addr, Target *target);
CompileUnit *CalculateSymbolContextCompileUnit() const;
//------------------------------------------------------------------
/// Get accessor for the module for this address.
///
/// @return
/// Returns the Module pointer that this address is an offset
/// in, or NULL if this address doesn't belong in a module, or
/// isn't resolved yet.
//------------------------------------------------------------------
lldb::ModuleSP
GetModule () const;
Function *CalculateSymbolContextFunction() const;
//------------------------------------------------------------------
/// Get const accessor for the section.
///
/// @return
/// Returns the const lldb::Section pointer that this address is an
/// offset in, or NULL if this address is absolute.
//------------------------------------------------------------------
lldb::SectionSP
GetSection () const { return m_section_wp.lock(); }
Block *CalculateSymbolContextBlock() const;
//------------------------------------------------------------------
/// Set accessor for the offset.
///
/// @param[in] offset
/// A new offset value for this object.
///
/// @return
/// Returns \b true if the offset changed, \b false otherwise.
//------------------------------------------------------------------
bool
SetOffset (lldb::addr_t offset)
{
bool changed = m_offset != offset;
m_offset = offset;
return changed;
}
void
SetRawAddress (lldb::addr_t addr)
{
m_section_wp.reset();
m_offset = addr;
}
Symbol *CalculateSymbolContextSymbol() const;
bool
Slide (int64_t offset)
{
if (m_offset != LLDB_INVALID_ADDRESS)
{
m_offset += offset;
return true;
}
return false;
}
bool CalculateSymbolContextLineEntry(LineEntry &line_entry) const;
//------------------------------------------------------------------
/// Set accessor for the section.
///
/// @param[in] section
/// A new lldb::Section pointer to use as the section base. Can
/// be NULL for absolute addresses that are not relative to
/// any section.
//------------------------------------------------------------------
void
SetSection (const lldb::SectionSP &section_sp)
{
m_section_wp = section_sp;
}
void
ClearSection ()
{
m_section_wp.reset();
}
//------------------------------------------------------------------
/// Reconstruct a symbol context from an address.
///
/// This class doesn't inherit from SymbolContextScope because many
/// address objects have short lifespans. Address objects that are
/// section offset can reconstruct their symbol context by looking
/// up the address in the module found in the section.
///
/// @see SymbolContextScope::CalculateSymbolContext(SymbolContext*)
//------------------------------------------------------------------
uint32_t
CalculateSymbolContext (SymbolContext *sc,
uint32_t resolve_scope = lldb::eSymbolContextEverything) const;
lldb::ModuleSP
CalculateSymbolContextModule () const;
CompileUnit *
CalculateSymbolContextCompileUnit () const;
Function *
CalculateSymbolContextFunction () const;
Block *
CalculateSymbolContextBlock () const;
Symbol *
CalculateSymbolContextSymbol () const;
bool
CalculateSymbolContextLineEntry (LineEntry &line_entry) const;
//------------------------------------------------------------------
// Returns true if the section should be valid, but isn't because
// the shared pointer to the section can't be reconstructed from
// a weak pointer that contains a valid weak reference to a section.
// Returns false if the section weak pointer has no reference to
// a section, or if the section is still valid
//------------------------------------------------------------------
bool
SectionWasDeleted() const;
//------------------------------------------------------------------
// Returns true if the section should be valid, but isn't because
// the shared pointer to the section can't be reconstructed from
// a weak pointer that contains a valid weak reference to a section.
// Returns false if the section weak pointer has no reference to
// a section, or if the section is still valid
//------------------------------------------------------------------
bool SectionWasDeleted() const;
protected:
//------------------------------------------------------------------
// Member variables.
//------------------------------------------------------------------
lldb::SectionWP m_section_wp; ///< The section for the address, can be NULL.
std::atomic<lldb::addr_t> m_offset; ///< Offset into section if \a m_section_wp is valid...
//------------------------------------------------------------------
// Returns true if the m_section_wp once had a reference to a valid
// section shared pointer, but no longer does. This can happen if
// we have an address from a module that gets unloaded and deleted.
// This function should only be called if GetSection() returns an
// empty shared pointer and you want to know if this address used to
// have a valid section.
//------------------------------------------------------------------
bool
SectionWasDeletedPrivate() const;
//------------------------------------------------------------------
// Member variables.
//------------------------------------------------------------------
lldb::SectionWP m_section_wp; ///< The section for the address, can be NULL.
lldb::addr_t m_offset; ///< Offset into section if \a m_section_wp is valid...
//------------------------------------------------------------------
// Returns true if the m_section_wp once had a reference to a valid
// section shared pointer, but no longer does. This can happen if
// we have an address from a module that gets unloaded and deleted.
// This function should only be called if GetSection() returns an
// empty shared pointer and you want to know if this address used to
// have a valid section.
//------------------------------------------------------------------
bool SectionWasDeletedPrivate() const;
};
//----------------------------------------------------------------------
// NOTE: Be careful using this operator. It can correctly compare two
// addresses from the same Module correctly. It can't compare two
// NOTE: Be careful using this operator. It can correctly compare two
// addresses from the same Module correctly. It can't compare two
// addresses from different modules in any meaningful way, but it will
// compare the module pointers.
//
//
// To sum things up:
// - works great for addresses within the same module
// - it works for addresses across multiple modules, but don't expect the
// address results to make much sense
//
// This basically lets Address objects be used in ordered collection
// This basically lets Address objects be used in ordered collection
// classes.
//----------------------------------------------------------------------
bool operator< (const Address& lhs, const Address& rhs);
bool operator> (const Address& lhs, const Address& rhs);
bool operator== (const Address& lhs, const Address& rhs);
bool operator!= (const Address& lhs, const Address& rhs);
bool operator<(const Address &lhs, const Address &rhs);
bool operator>(const Address &lhs, const Address &rhs);
bool operator==(const Address &lhs, const Address &rhs);
bool operator!=(const Address &lhs, const Address &rhs);
} // namespace lldb_private

View File

@ -22,266 +22,257 @@ namespace lldb_private {
/// @class AddressRange AddressRange.h "lldb/Core/AddressRange.h"
/// @brief A section + offset based address range class.
//----------------------------------------------------------------------
class AddressRange
{
class AddressRange {
public:
//------------------------------------------------------------------
/// Default constructor.
///
/// Initialize with a invalid section (NULL), an invalid
/// offset (LLDB_INVALID_ADDRESS), and zero byte size.
//------------------------------------------------------------------
AddressRange ();
//------------------------------------------------------------------
/// Default constructor.
///
/// Initialize with a invalid section (NULL), an invalid
/// offset (LLDB_INVALID_ADDRESS), and zero byte size.
//------------------------------------------------------------------
AddressRange();
//------------------------------------------------------------------
/// Construct with a section pointer, offset, and byte_size.
///
/// Initialize the address with the supplied \a section, \a
/// offset and \a byte_size.
///
/// @param[in] section
/// A section pointer to a valid lldb::Section, or NULL if the
/// address doesn't have a section or will get resolved later.
///
/// @param[in] offset
/// The offset in bytes into \a section.
///
/// @param[in] byte_size
/// The size in bytes of the address range.
//------------------------------------------------------------------
AddressRange (const lldb::SectionSP &section, lldb::addr_t offset, lldb::addr_t byte_size);
//------------------------------------------------------------------
/// Construct with a section pointer, offset, and byte_size.
///
/// Initialize the address with the supplied \a section, \a
/// offset and \a byte_size.
///
/// @param[in] section
/// A section pointer to a valid lldb::Section, or NULL if the
/// address doesn't have a section or will get resolved later.
///
/// @param[in] offset
/// The offset in bytes into \a section.
///
/// @param[in] byte_size
/// The size in bytes of the address range.
//------------------------------------------------------------------
AddressRange(const lldb::SectionSP &section, lldb::addr_t offset,
lldb::addr_t byte_size);
//------------------------------------------------------------------
/// Construct with a virtual address, section list and byte size.
///
/// Initialize and resolve the address with the supplied virtual
/// address \a file_addr, and byte size \a byte_size.
///
/// @param[in] file_addr
/// A virtual address.
///
/// @param[in] byte_size
/// The size in bytes of the address range.
///
/// @param[in] section_list
/// A list of sections, one of which may contain the \a vaddr.
//------------------------------------------------------------------
AddressRange(lldb::addr_t file_addr, lldb::addr_t byte_size, const SectionList *section_list = nullptr);
//------------------------------------------------------------------
/// Construct with a virtual address, section list and byte size.
///
/// Initialize and resolve the address with the supplied virtual
/// address \a file_addr, and byte size \a byte_size.
///
/// @param[in] file_addr
/// A virtual address.
///
/// @param[in] byte_size
/// The size in bytes of the address range.
///
/// @param[in] section_list
/// A list of sections, one of which may contain the \a vaddr.
//------------------------------------------------------------------
AddressRange(lldb::addr_t file_addr, lldb::addr_t byte_size,
const SectionList *section_list = nullptr);
//------------------------------------------------------------------
/// Construct with a Address object address and byte size.
///
/// Initialize by copying the section offset address in \a so_addr,
/// and setting the byte size to \a byte_size.
///
/// @param[in] so_addr
/// A section offset address object.
///
/// @param[in] byte_size
/// The size in bytes of the address range.
//------------------------------------------------------------------
AddressRange (const Address& so_addr, lldb::addr_t byte_size);
//------------------------------------------------------------------
/// Construct with a Address object address and byte size.
///
/// Initialize by copying the section offset address in \a so_addr,
/// and setting the byte size to \a byte_size.
///
/// @param[in] so_addr
/// A section offset address object.
///
/// @param[in] byte_size
/// The size in bytes of the address range.
//------------------------------------------------------------------
AddressRange(const Address &so_addr, lldb::addr_t byte_size);
//------------------------------------------------------------------
/// Destructor.
///
/// The destructor is virtual in case this class is subclassed.
//------------------------------------------------------------------
~AddressRange ();
//------------------------------------------------------------------
/// Destructor.
///
/// The destructor is virtual in case this class is subclassed.
//------------------------------------------------------------------
~AddressRange();
//------------------------------------------------------------------
/// Clear the object's state.
///
/// Sets the section to an invalid value (NULL), an invalid offset
/// (LLDB_INVALID_ADDRESS) and a zero byte size.
//------------------------------------------------------------------
void
Clear ();
//------------------------------------------------------------------
/// Clear the object's state.
///
/// Sets the section to an invalid value (NULL), an invalid offset
/// (LLDB_INVALID_ADDRESS) and a zero byte size.
//------------------------------------------------------------------
void Clear();
//------------------------------------------------------------------
/// Check if a section offset address is contained in this range.
///
/// @param[in] so_addr
/// A section offset address object reference.
///
/// @return
/// Returns \b true if \a so_addr is contained in this range,
/// \b false otherwise.
//------------------------------------------------------------------
// bool
// Contains (const Address &so_addr) const;
//------------------------------------------------------------------
/// Check if a section offset address is contained in this range.
///
/// @param[in] so_addr
/// A section offset address object reference.
///
/// @return
/// Returns \b true if \a so_addr is contained in this range,
/// \b false otherwise.
//------------------------------------------------------------------
// bool
// Contains (const Address &so_addr) const;
//------------------------------------------------------------------
/// Check if a section offset address is contained in this range.
///
/// @param[in] so_addr_ptr
/// A section offset address object pointer.
///
/// @return
/// Returns \b true if \a so_addr is contained in this range,
/// \b false otherwise.
//------------------------------------------------------------------
// bool
// Contains (const Address *so_addr_ptr) const;
//------------------------------------------------------------------
/// Check if a section offset address is contained in this range.
///
/// @param[in] so_addr_ptr
/// A section offset address object pointer.
///
/// @return
/// Returns \b true if \a so_addr is contained in this range,
/// \b false otherwise.
//------------------------------------------------------------------
// bool
// Contains (const Address *so_addr_ptr) const;
//------------------------------------------------------------------
/// Check if a section offset \a so_addr when represented as a file
/// address is contained within this object's file address range.
///
/// @param[in] so_addr
/// A section offset address object reference.
///
/// @return
/// Returns \b true if both \a this and \a so_addr have
/// resolvable file address values and \a so_addr is contained
/// in the address range, \b false otherwise.
//------------------------------------------------------------------
bool
ContainsFileAddress (const Address &so_addr) const;
//------------------------------------------------------------------
/// Check if a section offset \a so_addr when represented as a file
/// address is contained within this object's file address range.
///
/// @param[in] so_addr
/// A section offset address object reference.
///
/// @return
/// Returns \b true if both \a this and \a so_addr have
/// resolvable file address values and \a so_addr is contained
/// in the address range, \b false otherwise.
//------------------------------------------------------------------
bool ContainsFileAddress(const Address &so_addr) const;
//------------------------------------------------------------------
/// Check if the resolved file address \a file_addr is contained
/// within this object's file address range.
///
/// @param[in] so_addr
/// A section offset address object reference.
///
/// @return
/// Returns \b true if both \a this has a resolvable file
/// address value and \a so_addr is contained in the address
/// range, \b false otherwise.
//------------------------------------------------------------------
bool
ContainsFileAddress (lldb::addr_t file_addr) const;
//------------------------------------------------------------------
/// Check if the resolved file address \a file_addr is contained
/// within this object's file address range.
///
/// @param[in] so_addr
/// A section offset address object reference.
///
/// @return
/// Returns \b true if both \a this has a resolvable file
/// address value and \a so_addr is contained in the address
/// range, \b false otherwise.
//------------------------------------------------------------------
bool ContainsFileAddress(lldb::addr_t file_addr) const;
//------------------------------------------------------------------
/// Check if a section offset \a so_addr when represented as a load
/// address is contained within this object's load address range.
///
/// @param[in] so_addr
/// A section offset address object reference.
///
/// @return
/// Returns \b true if both \a this and \a so_addr have
/// resolvable load address values and \a so_addr is contained
/// in the address range, \b false otherwise.
//------------------------------------------------------------------
bool
ContainsLoadAddress (const Address &so_addr, Target *target) const;
//------------------------------------------------------------------
/// Check if a section offset \a so_addr when represented as a load
/// address is contained within this object's load address range.
///
/// @param[in] so_addr
/// A section offset address object reference.
///
/// @return
/// Returns \b true if both \a this and \a so_addr have
/// resolvable load address values and \a so_addr is contained
/// in the address range, \b false otherwise.
//------------------------------------------------------------------
bool ContainsLoadAddress(const Address &so_addr, Target *target) const;
//------------------------------------------------------------------
/// Check if the resolved load address \a load_addr is contained
/// within this object's load address range.
///
/// @param[in] so_addr
/// A section offset address object reference.
///
/// @return
/// Returns \b true if both \a this has a resolvable load
/// address value and \a so_addr is contained in the address
/// range, \b false otherwise.
//------------------------------------------------------------------
bool
ContainsLoadAddress (lldb::addr_t load_addr, Target *target) const;
//------------------------------------------------------------------
/// Check if the resolved load address \a load_addr is contained
/// within this object's load address range.
///
/// @param[in] so_addr
/// A section offset address object reference.
///
/// @return
/// Returns \b true if both \a this has a resolvable load
/// address value and \a so_addr is contained in the address
/// range, \b false otherwise.
//------------------------------------------------------------------
bool ContainsLoadAddress(lldb::addr_t load_addr, Target *target) const;
//------------------------------------------------------------------
/// Dump a description of this object to a Stream.
///
/// Dump a description of the contents of this object to the
/// supplied stream \a s. There are many ways to display a section
/// offset based address range, and \a style lets the user choose
/// how the base address gets displayed.
///
/// @param[in] s
/// The stream to which to dump the object description.
///
/// @param[in] style
/// The display style for the address.
///
/// @return
/// Returns \b true if the address was able to be displayed.
/// File and load addresses may be unresolved and it may not be
/// possible to display a valid value, \b false will be returned
/// in such cases.
///
/// @see Address::DumpStyle
//------------------------------------------------------------------
bool
Dump (Stream *s, Target *target, Address::DumpStyle style, Address::DumpStyle fallback_style = Address::DumpStyleInvalid) const;
//------------------------------------------------------------------
/// Dump a description of this object to a Stream.
///
/// Dump a description of the contents of this object to the
/// supplied stream \a s. There are many ways to display a section
/// offset based address range, and \a style lets the user choose
/// how the base address gets displayed.
///
/// @param[in] s
/// The stream to which to dump the object description.
///
/// @param[in] style
/// The display style for the address.
///
/// @return
/// Returns \b true if the address was able to be displayed.
/// File and load addresses may be unresolved and it may not be
/// possible to display a valid value, \b false will be returned
/// in such cases.
///
/// @see Address::DumpStyle
//------------------------------------------------------------------
bool
Dump(Stream *s, Target *target, Address::DumpStyle style,
Address::DumpStyle fallback_style = Address::DumpStyleInvalid) const;
//------------------------------------------------------------------
/// Dump a debug description of this object to a Stream.
///
/// Dump a debug description of the contents of this object to the
/// supplied stream \a s.
///
/// The debug description contains verbose internal state such
/// and pointer values, reference counts, etc.
///
/// @param[in] s
/// The stream to which to dump the object description.
//------------------------------------------------------------------
void
DumpDebug (Stream *s) const;
//------------------------------------------------------------------
/// Dump a debug description of this object to a Stream.
///
/// Dump a debug description of the contents of this object to the
/// supplied stream \a s.
///
/// The debug description contains verbose internal state such
/// and pointer values, reference counts, etc.
///
/// @param[in] s
/// The stream to which to dump the object description.
//------------------------------------------------------------------
void DumpDebug(Stream *s) const;
//------------------------------------------------------------------
/// Get accessor for the base address of the range.
///
/// @return
/// A reference to the base address object.
//------------------------------------------------------------------
Address &
GetBaseAddress() { return m_base_addr; }
//------------------------------------------------------------------
/// Get accessor for the base address of the range.
///
/// @return
/// A reference to the base address object.
//------------------------------------------------------------------
Address &GetBaseAddress() { return m_base_addr; }
//------------------------------------------------------------------
/// Get const accessor for the base address of the range.
///
/// @return
/// A const reference to the base address object.
//------------------------------------------------------------------
const Address &
GetBaseAddress() const { return m_base_addr; }
//------------------------------------------------------------------
/// Get const accessor for the base address of the range.
///
/// @return
/// A const reference to the base address object.
//------------------------------------------------------------------
const Address &GetBaseAddress() const { return m_base_addr; }
//------------------------------------------------------------------
/// Get accessor for the byte size of this range.
///
/// @return
/// The size in bytes of this address range.
//------------------------------------------------------------------
lldb::addr_t
GetByteSize () const { return m_byte_size; }
//------------------------------------------------------------------
/// Get accessor for the byte size of this range.
///
/// @return
/// The size in bytes of this address range.
//------------------------------------------------------------------
lldb::addr_t GetByteSize() const { return m_byte_size; }
//------------------------------------------------------------------
/// Get the memory cost of this object.
///
/// @return
/// The number of bytes that this object occupies in memory.
//------------------------------------------------------------------
size_t
MemorySize () const {
// Noting special for the memory size of a single AddressRange object,
// it is just the size of itself.
return sizeof(AddressRange);
}
//------------------------------------------------------------------
/// Get the memory cost of this object.
///
/// @return
/// The number of bytes that this object occupies in memory.
//------------------------------------------------------------------
size_t MemorySize() const {
// Noting special for the memory size of a single AddressRange object,
// it is just the size of itself.
return sizeof(AddressRange);
}
//------------------------------------------------------------------
/// Set accessor for the byte size of this range.
///
/// @param[in] byte_size
/// The new size in bytes of this address range.
//------------------------------------------------------------------
void
SetByteSize (lldb::addr_t byte_size) { m_byte_size = byte_size; }
//------------------------------------------------------------------
/// Set accessor for the byte size of this range.
///
/// @param[in] byte_size
/// The new size in bytes of this address range.
//------------------------------------------------------------------
void SetByteSize(lldb::addr_t byte_size) { m_byte_size = byte_size; }
protected:
//------------------------------------------------------------------
// Member variables
//------------------------------------------------------------------
Address m_base_addr; ///< The section offset base address of this range.
lldb::addr_t m_byte_size; ///< The size in bytes of this address range.
//------------------------------------------------------------------
// Member variables
//------------------------------------------------------------------
Address m_base_addr; ///< The section offset base address of this range.
lldb::addr_t m_byte_size; ///< The size in bytes of this address range.
};
//bool operator== (const AddressRange& lhs, const AddressRange& rhs);
// bool operator== (const AddressRange& lhs, const AddressRange& rhs);
} // namespace lldb_private

View File

@ -16,12 +16,12 @@
// C++ Includes
// Other libraries and framework includes
// Project includes
#include "lldb/lldb-private.h"
#include "lldb/Core/Address.h"
#include "lldb/Core/AddressRange.h"
#include "lldb/Host/FileSpec.h"
#include "lldb/Core/SearchFilter.h"
#include "lldb/Core/ConstString.h"
#include "lldb/Core/SearchFilter.h"
#include "lldb/Host/FileSpec.h"
#include "lldb/lldb-private.h"
namespace lldb_private {
@ -35,52 +35,38 @@ namespace lldb_private {
/// General Outline:
/// The AddressResolver is a Searcher. In that protocol,
/// the SearchFilter asks the question "At what depth of the symbol context
/// descent do you want your callback to get called?" of the filter. The resolver
/// answers this question (in the GetDepth method) and provides the resolution callback.
/// descent do you want your callback to get called?" of the filter. The
/// resolver
/// answers this question (in the GetDepth method) and provides the resolution
/// callback.
//----------------------------------------------------------------------
class AddressResolver :
public Searcher
{
class AddressResolver : public Searcher {
public:
typedef enum { Exact, Regexp, Glob } MatchType;
typedef enum
{
Exact,
Regexp,
Glob
} MatchType;
AddressResolver();
~AddressResolver() override;
AddressResolver ();
virtual void ResolveAddress(SearchFilter &filter);
~AddressResolver () override;
virtual void ResolveAddressInModules(SearchFilter &filter,
ModuleList &modules);
virtual void
ResolveAddress (SearchFilter &filter);
void GetDescription(Stream *s) override = 0;
virtual void
ResolveAddressInModules (SearchFilter &filter,
ModuleList &modules);
std::vector<AddressRange> &GetAddressRanges();
void
GetDescription (Stream *s) override = 0;
size_t GetNumberOfAddresses();
std::vector<AddressRange> &
GetAddressRanges ();
size_t
GetNumberOfAddresses ();
AddressRange &
GetAddressRangeAtIndex (size_t idx);
AddressRange &GetAddressRangeAtIndex(size_t idx);
protected:
std::vector<AddressRange> m_address_ranges;
std::vector<AddressRange> m_address_ranges;
private:
DISALLOW_COPY_AND_ASSIGN(AddressResolver);
DISALLOW_COPY_AND_ASSIGN(AddressResolver);
};
} // namespace lldb_private

View File

@ -16,41 +16,36 @@
namespace lldb_private {
//----------------------------------------------------------------------
/// @class AddressResolverFileLine AddressResolverFileLine.h "lldb/Core/AddressResolverFileLine.h"
/// @brief This class finds address for source file and line. Optionally, it will look for inlined
/// @class AddressResolverFileLine AddressResolverFileLine.h
/// "lldb/Core/AddressResolverFileLine.h"
/// @brief This class finds address for source file and line. Optionally, it
/// will look for inlined
/// instances of the file and line specification.
//----------------------------------------------------------------------
class AddressResolverFileLine :
public AddressResolver
{
class AddressResolverFileLine : public AddressResolver {
public:
AddressResolverFileLine(const FileSpec &resolver, uint32_t line_no,
bool check_inlines);
AddressResolverFileLine (const FileSpec &resolver,
uint32_t line_no,
bool check_inlines);
~AddressResolverFileLine() override;
~AddressResolverFileLine () override;
Searcher::CallbackReturn SearchCallback(SearchFilter &filter,
SymbolContext &context, Address *addr,
bool containing) override;
Searcher::CallbackReturn
SearchCallback (SearchFilter &filter,
SymbolContext &context,
Address *addr,
bool containing) override;
Searcher::Depth GetDepth() override;
Searcher::Depth
GetDepth () override;
void
GetDescription (Stream *s) override;
void GetDescription(Stream *s) override;
protected:
FileSpec m_file_spec; // This is the file spec we are looking for.
uint32_t m_line_number; // This is the line number that we are looking for.
bool m_inlines; // This determines whether the resolver looks for inlined functions or not.
FileSpec m_file_spec; // This is the file spec we are looking for.
uint32_t m_line_number; // This is the line number that we are looking for.
bool m_inlines; // This determines whether the resolver looks for inlined
// functions or not.
private:
DISALLOW_COPY_AND_ASSIGN(AddressResolverFileLine);
DISALLOW_COPY_AND_ASSIGN(AddressResolverFileLine);
};
} // namespace lldb_private

View File

@ -18,48 +18,44 @@
namespace lldb_private {
//----------------------------------------------------------------------
/// @class AddressResolverName AddressResolverName.h "lldb/Core/AddressResolverName.h"
/// @brief This class finds addresses for a given function name, either by exact match
/// @class AddressResolverName AddressResolverName.h
/// "lldb/Core/AddressResolverName.h"
/// @brief This class finds addresses for a given function name, either by exact
/// match
/// or by regular expression.
//----------------------------------------------------------------------
class AddressResolverName:
public AddressResolver
{
class AddressResolverName : public AddressResolver {
public:
AddressResolverName(const char *func_name,
AddressResolver::MatchType type = Exact);
AddressResolverName (const char *func_name,
AddressResolver::MatchType type = Exact);
// Creates a function breakpoint by regular expression. Takes over control of
// the lifespan of func_regex.
AddressResolverName(RegularExpression &func_regex);
// Creates a function breakpoint by regular expression. Takes over control of the lifespan of func_regex.
AddressResolverName (RegularExpression &func_regex);
AddressResolverName(const char *class_name, const char *method,
AddressResolver::MatchType type);
AddressResolverName (const char *class_name,
const char *method,
AddressResolver::MatchType type);
~AddressResolverName() override;
~AddressResolverName () override;
Searcher::CallbackReturn SearchCallback(SearchFilter &filter,
SymbolContext &context, Address *addr,
bool containing) override;
Searcher::CallbackReturn
SearchCallback (SearchFilter &filter,
SymbolContext &context,
Address *addr,
bool containing) override;
Searcher::Depth GetDepth() override;
Searcher::Depth
GetDepth () override;
void
GetDescription (Stream *s) override;
void GetDescription(Stream *s) override;
protected:
ConstString m_func_name;
ConstString m_class_name; // FIXME: Not used yet. The idea would be to stop on methods of this class.
RegularExpression m_regex;
AddressResolver::MatchType m_match_type;
ConstString m_func_name;
ConstString m_class_name; // FIXME: Not used yet. The idea would be to stop
// on methods of this class.
RegularExpression m_regex;
AddressResolver::MatchType m_match_type;
private:
DISALLOW_COPY_AND_ASSIGN(AddressResolverName);
DISALLOW_COPY_AND_ASSIGN(AddressResolverName);
};
} // namespace lldb_private

File diff suppressed because it is too large Load Diff

View File

@ -23,40 +23,53 @@ namespace lldb_private {
/// @brief A class designed to wrap callback batons so they can cleanup
/// any acquired resources
///
/// This class is designed to be used by any objects that have a
/// This class is designed to be used by any objects that have a
/// callback function that takes a baton where the baton might need to
/// free/delete/close itself.
///
/// The default behavior is to not free anything. Subclasses can
/// The default behavior is to not free anything. Subclasses can
/// free any needed resources in their destructors.
//----------------------------------------------------------------------
class Baton
{
class Baton {
public:
explicit Baton(void *p) :
m_data (p)
{
}
Baton() {}
virtual ~Baton() {}
virtual
~Baton()
{
// The default destructor for a baton does NOT attempt to clean up
// anything in m_baton
}
virtual void
GetDescription (Stream *s, lldb::DescriptionLevel level) const;
virtual void *data() = 0;
void *m_data; // Leave baton public for easy access
virtual void GetDescription(Stream *s,
lldb::DescriptionLevel level) const = 0;
};
private:
//------------------------------------------------------------------
// For Baton only
//------------------------------------------------------------------
DISALLOW_COPY_AND_ASSIGN (Baton);
class UntypedBaton : public Baton {
public:
UntypedBaton(void *Data) : m_data(Data) {}
virtual ~UntypedBaton() {
// The default destructor for an untyped baton does NOT attempt to clean up
// anything in m_data.
}
void *data() override { return m_data; }
void GetDescription(Stream *s, lldb::DescriptionLevel level) const override;
void *m_data; // Leave baton public for easy access
};
template <typename T> class TypedBaton : public Baton {
public:
explicit TypedBaton(std::unique_ptr<T> Item) : Item(std::move(Item)) {}
T *getItem() { return Item.get(); }
const T *getItem() const { return Item.get(); }
void *data() override { return Item.get(); }
virtual void GetDescription(Stream *s,
lldb::DescriptionLevel level) const override {}
protected:
std::unique_ptr<T> Item;
};
} // namespace lldb_private
#endif // lldb_Baton_h_
#endif // lldb_Baton_h_

File diff suppressed because it is too large Load Diff

View File

@ -17,126 +17,123 @@
#if defined(__cplusplus)
namespace clang
{
namespace Builtin
{
class Context;
}
class Action;
class ASTConsumer;
class ASTContext;
class ASTRecordLayout;
class AddrLabelExpr;
class AnalyzerOptions;
class BinaryOperator;
class ClassTemplateDecl;
class ClassTemplateSpecializationDecl;
class CodeGenOptions;
class CodeGenerator;
class CompilerInstance;
class CompoundStmt;
class CXXBaseSpecifier;
class CXXBoolLiteralExpr;
class CXXFunctionalCastExpr;
class CXXMethodDecl;
class CXXNamedCastExpr;
class CXXRecordDecl;
class CXXThisExpr;
class CharacterLiteral;
class CompoundAssignOperator;
class Decl;
class DeclarationName;
class DeclaratorDecl;
class DeclContext;
class DeclRefExpr;
class DeclStmt;
class DependencyOutputOptions;
class Diagnostic;
class DiagnosticConsumer;
class DiagnosticsEngine;
class DiagnosticOptions;
class EnumDecl;
class EnumConstantDecl;
class Expr;
class ExternalASTSource;
class ExtVectorElementExpr;
class FieldDecl;
class FileManager;
class FileSystemOptions;
class FloatingLiteral;
class FrontendOptions;
class FunctionDecl;
class FunctionTemplateDecl;
class FunctionTemplateSpecializationInfo;
class GotoStmt;
class HeaderSearchOptions;
class IdentifierInfo;
class IdentifierTable;
class IntegerLiteral;
class LabelStmt;
class LangOptions;
class MacroDirective;
class MemberExpr;
class Module;
class NamedDecl;
class NamespaceDecl;
class NonTypeTemplateParmDecl;
class ObjCEncodeExpr;
class ObjCImplicitSetterGetterRefExpr;
class ObjCInterfaceDecl;
class ObjCIvarDecl;
class ObjCIvarRefExpr;
class ObjCMessageExpr;
class ObjCMethodDecl;
class ObjCPropertyRefExpr;
class ObjCProtocolDecl;
class ObjCProtocolExpr;
class ObjCSelectorExpr;
class ObjCSuperExpr;
class ParenExpr;
class ParmVarDecl;
class PredefinedExpr;
class PreprocessorOptions;
class PreprocessorOutputOptions;
class QualType;
class QualifiedNameType;
class RecordDecl;
class SelectorTable;
class SizeOfAlignOfExpr;
class SourceLocation;
class SourceManager;
class Stmt;
class StmtIteratorBase;
class StringLiteral;
class TagDecl;
class TargetInfo;
class TargetOptions;
class TemplateArgument;
class TemplateDecl;
class TemplateParameterList;
class TemplateTemplateParmDecl;
class TemplateTypeParmDecl;
class TextDiagnosticBuffer;
class TranslationUnitDecl;
class Type;
class TypeDecl;
class TypedefDecl;
class TypesCompatibleExpr;
class UnaryOperator;
class ValueDecl;
class VarDecl;
struct PrintingPolicy;
namespace clang {
namespace Builtin {
class Context;
}
namespace llvm
{
class APInt;
class APSInt;
class LLVMContext;
class ExecutionEngine;
class Action;
class ASTConsumer;
class ASTContext;
class ASTRecordLayout;
class AddrLabelExpr;
class AnalyzerOptions;
class BinaryOperator;
class ClassTemplateDecl;
class ClassTemplateSpecializationDecl;
class CodeGenOptions;
class CodeGenerator;
class CompilerInstance;
class CompoundStmt;
class CXXBaseSpecifier;
class CXXBoolLiteralExpr;
class CXXFunctionalCastExpr;
class CXXMethodDecl;
class CXXNamedCastExpr;
class CXXRecordDecl;
class CXXThisExpr;
class CharacterLiteral;
class CompoundAssignOperator;
class Decl;
class DeclarationName;
class DeclaratorDecl;
class DeclContext;
class DeclRefExpr;
class DeclStmt;
class DependencyOutputOptions;
class Diagnostic;
class DiagnosticConsumer;
class DiagnosticsEngine;
class DiagnosticOptions;
class EnumDecl;
class EnumConstantDecl;
class Expr;
class ExternalASTSource;
class ExtVectorElementExpr;
class FieldDecl;
class FileManager;
class FileSystemOptions;
class FloatingLiteral;
class FrontendOptions;
class FunctionDecl;
class FunctionTemplateDecl;
class FunctionTemplateSpecializationInfo;
class GotoStmt;
class HeaderSearchOptions;
class IdentifierInfo;
class IdentifierTable;
class IntegerLiteral;
class LabelStmt;
class LangOptions;
class MacroDirective;
class MemberExpr;
class Module;
class NamedDecl;
class NamespaceDecl;
class NonTypeTemplateParmDecl;
class ObjCEncodeExpr;
class ObjCImplicitSetterGetterRefExpr;
class ObjCInterfaceDecl;
class ObjCIvarDecl;
class ObjCIvarRefExpr;
class ObjCMessageExpr;
class ObjCMethodDecl;
class ObjCPropertyRefExpr;
class ObjCProtocolDecl;
class ObjCProtocolExpr;
class ObjCSelectorExpr;
class ObjCSuperExpr;
class ParenExpr;
class ParmVarDecl;
class PredefinedExpr;
class PreprocessorOptions;
class PreprocessorOutputOptions;
class QualType;
class QualifiedNameType;
class RecordDecl;
class SelectorTable;
class SizeOfAlignOfExpr;
class SourceLocation;
class SourceManager;
class Stmt;
class StmtIteratorBase;
class StringLiteral;
class TagDecl;
class TargetInfo;
class TargetOptions;
class TemplateArgument;
class TemplateDecl;
class TemplateParameterList;
class TemplateTemplateParmDecl;
class TemplateTypeParmDecl;
class TextDiagnosticBuffer;
class TranslationUnitDecl;
class Type;
class TypeDecl;
class TypedefDecl;
class TypesCompatibleExpr;
class UnaryOperator;
class ValueDecl;
class VarDecl;
struct PrintingPolicy;
}
#endif // #if defined(__cplusplus)
#endif // liblldb_ClangForward_h_
namespace llvm {
class APInt;
class APSInt;
class LLVMContext;
class ExecutionEngine;
}
#endif // #if defined(__cplusplus)
#endif // liblldb_ClangForward_h_

View File

@ -18,10 +18,10 @@
// Other libraries and framework includes
// Project includes
#include "lldb/lldb-private.h"
#include "lldb/Core/Broadcaster.h"
#include "lldb/Core/Error.h"
#include "lldb/Host/HostThread.h"
#include "lldb/Utility/Timeout.h"
#include "lldb/lldb-private.h"
namespace lldb_private {
@ -82,343 +82,321 @@ namespace lldb_private {
/// can also post a \b eBroadcastBitReadThreadShouldExit event to this
/// object which will cause the read thread to exit.
//----------------------------------------------------------------------
class Communication : public Broadcaster
{
class Communication : public Broadcaster {
public:
FLAGS_ANONYMOUS_ENUM()
{
eBroadcastBitDisconnected = (1u << 0), ///< Sent when the communications connection is lost.
eBroadcastBitReadThreadGotBytes = (1u << 1), ///< Sent by the read thread when bytes become available.
eBroadcastBitReadThreadDidExit = (1u << 2), ///< Sent by the read thread when it exits to inform clients.
eBroadcastBitReadThreadShouldExit = (1u << 3), ///< Sent by clients that need to cancel the read thread.
eBroadcastBitPacketAvailable = (1u << 4), ///< Sent when data received makes a complete packet.
eBroadcastBitNoMorePendingInput = (1u << 5), ///< Sent by the read thread to indicate all pending input has been processed.
kLoUserBroadcastBit = (1u << 16),///< Subclasses can used bits 31:16 for any needed events.
kHiUserBroadcastBit = (1u << 31),
eAllEventBits = 0xffffffff
};
FLAGS_ANONYMOUS_ENUM(){
eBroadcastBitDisconnected =
(1u << 0), ///< Sent when the communications connection is lost.
eBroadcastBitReadThreadGotBytes =
(1u << 1), ///< Sent by the read thread when bytes become available.
eBroadcastBitReadThreadDidExit =
(1u
<< 2), ///< Sent by the read thread when it exits to inform clients.
eBroadcastBitReadThreadShouldExit =
(1u << 3), ///< Sent by clients that need to cancel the read thread.
eBroadcastBitPacketAvailable =
(1u << 4), ///< Sent when data received makes a complete packet.
eBroadcastBitNoMorePendingInput = (1u << 5), ///< Sent by the read thread
///to indicate all pending
///input has been processed.
kLoUserBroadcastBit =
(1u << 16), ///< Subclasses can used bits 31:16 for any needed events.
kHiUserBroadcastBit = (1u << 31),
eAllEventBits = 0xffffffff};
typedef void (*ReadThreadBytesReceived) (void *baton, const void *src, size_t src_len);
typedef void (*ReadThreadBytesReceived)(void *baton, const void *src,
size_t src_len);
//------------------------------------------------------------------
/// Construct the Communication object with the specified name for
/// the Broadcaster that this object inherits from.
///
/// @param[in] broadcaster_name
/// The name of the broadcaster object. This name should be as
/// complete as possible to uniquely identify this object. The
/// broadcaster name can be updated after the connect function
/// is called.
//------------------------------------------------------------------
Communication(const char * broadcaster_name);
//------------------------------------------------------------------
/// Construct the Communication object with the specified name for
/// the Broadcaster that this object inherits from.
///
/// @param[in] broadcaster_name
/// The name of the broadcaster object. This name should be as
/// complete as possible to uniquely identify this object. The
/// broadcaster name can be updated after the connect function
/// is called.
//------------------------------------------------------------------
Communication(const char *broadcaster_name);
//------------------------------------------------------------------
/// Destructor.
///
/// The destructor is virtual since this class gets subclassed.
//------------------------------------------------------------------
~Communication() override;
//------------------------------------------------------------------
/// Destructor.
///
/// The destructor is virtual since this class gets subclassed.
//------------------------------------------------------------------
~Communication() override;
void
Clear ();
void Clear();
//------------------------------------------------------------------
/// Connect using the current connection by passing \a url to its
/// connect function.
/// string.
///
/// @param[in] url
/// A string that contains all information needed by the
/// subclass to connect to another client.
///
/// @return
/// \b True if the connect succeeded, \b false otherwise. The
/// internal error object should be filled in with an
/// appropriate value based on the result of this function.
///
/// @see Error& Communication::GetError ();
/// @see bool Connection::Connect (const char *url);
//------------------------------------------------------------------
lldb::ConnectionStatus
Connect (const char *url, Error *error_ptr);
//------------------------------------------------------------------
/// Connect using the current connection by passing \a url to its
/// connect function.
/// string.
///
/// @param[in] url
/// A string that contains all information needed by the
/// subclass to connect to another client.
///
/// @return
/// \b True if the connect succeeded, \b false otherwise. The
/// internal error object should be filled in with an
/// appropriate value based on the result of this function.
///
/// @see Error& Communication::GetError ();
/// @see bool Connection::Connect (const char *url);
//------------------------------------------------------------------
lldb::ConnectionStatus Connect(const char *url, Error *error_ptr);
//------------------------------------------------------------------
/// Disconnect the communications connection if one is currently
/// connected.
///
/// @return
/// \b True if the disconnect succeeded, \b false otherwise. The
/// internal error object should be filled in with an
/// appropriate value based on the result of this function.
///
/// @see Error& Communication::GetError ();
/// @see bool Connection::Disconnect ();
//------------------------------------------------------------------
lldb::ConnectionStatus
Disconnect(Error *error_ptr = nullptr);
//------------------------------------------------------------------
/// Disconnect the communications connection if one is currently
/// connected.
///
/// @return
/// \b True if the disconnect succeeded, \b false otherwise. The
/// internal error object should be filled in with an
/// appropriate value based on the result of this function.
///
/// @see Error& Communication::GetError ();
/// @see bool Connection::Disconnect ();
//------------------------------------------------------------------
lldb::ConnectionStatus Disconnect(Error *error_ptr = nullptr);
//------------------------------------------------------------------
/// Check if the connection is valid.
///
/// @return
/// \b True if this object is currently connected, \b false
/// otherwise.
//------------------------------------------------------------------
bool
IsConnected () const;
//------------------------------------------------------------------
/// Check if the connection is valid.
///
/// @return
/// \b True if this object is currently connected, \b false
/// otherwise.
//------------------------------------------------------------------
bool IsConnected() const;
bool
HasConnection () const;
lldb_private::Connection *
GetConnection ()
{
return m_connection_sp.get();
}
bool HasConnection() const;
//------------------------------------------------------------------
/// Read bytes from the current connection.
///
/// If no read thread is running, this function call the
/// connection's Connection::Read(...) function to get any available.
///
/// If a read thread has been started, this function will check for
/// any cached bytes that have already been read and return any
/// currently available bytes. If no bytes are cached, it will wait
/// for the bytes to become available by listening for the \a
/// eBroadcastBitReadThreadGotBytes event. If this function consumes
/// all of the bytes in the cache, it will reset the
/// \a eBroadcastBitReadThreadGotBytes event bit.
///
/// @param[in] dst
/// A destination buffer that must be at least \a dst_len bytes
/// long.
///
/// @param[in] dst_len
/// The number of bytes to attempt to read, and also the max
/// number of bytes that can be placed into \a dst.
///
/// @param[in] timeout_usec
/// A timeout value in micro-seconds.
///
/// @return
/// The number of bytes actually read.
///
/// @see size_t Connection::Read (void *, size_t);
//------------------------------------------------------------------
size_t
Read (void *dst,
size_t dst_len,
uint32_t timeout_usec,
lldb::ConnectionStatus &status,
Error *error_ptr);
//------------------------------------------------------------------
/// The actual write function that attempts to write to the
/// communications protocol.
///
/// Subclasses must override this function.
///
/// @param[in] src
/// A source buffer that must be at least \a src_len bytes
/// long.
///
/// @param[in] src_len
/// The number of bytes to attempt to write, and also the
/// number of bytes are currently available in \a src.
///
/// @return
/// The number of bytes actually Written.
//------------------------------------------------------------------
size_t
Write (const void *src,
size_t src_len,
lldb::ConnectionStatus &status,
Error *error_ptr);
//------------------------------------------------------------------
/// Sets the connection that it to be used by this class.
///
/// By making a communication class that uses different connections
/// it allows a single communication interface to negotiate and
/// change its connection without any interruption to the client.
/// It also allows the Communication class to be subclassed for
/// packet based communication.
///
/// @param[in] connection
/// A connection that this class will own and destroy.
///
/// @see
/// class Connection
//------------------------------------------------------------------
void
SetConnection (Connection *connection);
lldb_private::Connection *GetConnection() { return m_connection_sp.get(); }
//------------------------------------------------------------------
/// Starts a read thread whose sole purpose it to read bytes from
/// the current connection. This function will call connection's
/// read function:
///
/// size_t Connection::Read (void *, size_t);
///
/// When bytes are read and cached, this function will call:
///
/// Communication::AppendBytesToCache (const uint8_t * bytes, size_t len, bool broadcast);
///
/// Subclasses should override this function if they wish to override
/// the default action of caching the bytes and broadcasting a \b
/// eBroadcastBitReadThreadGotBytes event.
///
/// @return
/// \b True if the read thread was successfully started, \b
/// false otherwise.
///
/// @see size_t Connection::Read (void *, size_t);
/// @see void Communication::AppendBytesToCache (const uint8_t * bytes, size_t len, bool broadcast);
//------------------------------------------------------------------
virtual bool
StartReadThread(Error *error_ptr = nullptr);
//------------------------------------------------------------------
/// Read bytes from the current connection.
///
/// If no read thread is running, this function call the
/// connection's Connection::Read(...) function to get any available.
///
/// If a read thread has been started, this function will check for
/// any cached bytes that have already been read and return any
/// currently available bytes. If no bytes are cached, it will wait
/// for the bytes to become available by listening for the \a
/// eBroadcastBitReadThreadGotBytes event. If this function consumes
/// all of the bytes in the cache, it will reset the
/// \a eBroadcastBitReadThreadGotBytes event bit.
///
/// @param[in] dst
/// A destination buffer that must be at least \a dst_len bytes
/// long.
///
/// @param[in] dst_len
/// The number of bytes to attempt to read, and also the max
/// number of bytes that can be placed into \a dst.
///
/// @param[in] timeout
/// A timeout value or llvm::None for no timeout.
///
/// @return
/// The number of bytes actually read.
///
/// @see size_t Connection::Read (void *, size_t);
//------------------------------------------------------------------
size_t Read(void *dst, size_t dst_len, const Timeout<std::micro> &timeout,
lldb::ConnectionStatus &status, Error *error_ptr);
//------------------------------------------------------------------
/// Stops the read thread by cancelling it.
///
/// @return
/// \b True if the read thread was successfully canceled, \b
/// false otherwise.
//------------------------------------------------------------------
virtual bool
StopReadThread(Error *error_ptr = nullptr);
//------------------------------------------------------------------
/// The actual write function that attempts to write to the
/// communications protocol.
///
/// Subclasses must override this function.
///
/// @param[in] src
/// A source buffer that must be at least \a src_len bytes
/// long.
///
/// @param[in] src_len
/// The number of bytes to attempt to write, and also the
/// number of bytes are currently available in \a src.
///
/// @return
/// The number of bytes actually Written.
//------------------------------------------------------------------
size_t Write(const void *src, size_t src_len, lldb::ConnectionStatus &status,
Error *error_ptr);
virtual bool
JoinReadThread(Error *error_ptr = nullptr);
//------------------------------------------------------------------
/// Checks if there is a currently running read thread.
///
/// @return
/// \b True if the read thread is running, \b false otherwise.
//------------------------------------------------------------------
bool
ReadThreadIsRunning ();
//------------------------------------------------------------------
/// Sets the connection that it to be used by this class.
///
/// By making a communication class that uses different connections
/// it allows a single communication interface to negotiate and
/// change its connection without any interruption to the client.
/// It also allows the Communication class to be subclassed for
/// packet based communication.
///
/// @param[in] connection
/// A connection that this class will own and destroy.
///
/// @see
/// class Connection
//------------------------------------------------------------------
void SetConnection(Connection *connection);
//------------------------------------------------------------------
/// The static read thread function. This function will call
/// the "DoRead" function continuously and wait for data to become
/// available. When data is received it will append the available
/// data to the internal cache and broadcast a
/// \b eBroadcastBitReadThreadGotBytes event.
///
/// @param[in] comm_ptr
/// A pointer to an instance of this class.
///
/// @return
/// \b NULL.
///
/// @see void Communication::ReadThreadGotBytes (const uint8_t *, size_t);
//------------------------------------------------------------------
static lldb::thread_result_t
ReadThread (lldb::thread_arg_t comm_ptr);
//------------------------------------------------------------------
/// Starts a read thread whose sole purpose it to read bytes from
/// the current connection. This function will call connection's
/// read function:
///
/// size_t Connection::Read (void *, size_t);
///
/// When bytes are read and cached, this function will call:
///
/// Communication::AppendBytesToCache (const uint8_t * bytes, size_t len, bool
/// broadcast);
///
/// Subclasses should override this function if they wish to override
/// the default action of caching the bytes and broadcasting a \b
/// eBroadcastBitReadThreadGotBytes event.
///
/// @return
/// \b True if the read thread was successfully started, \b
/// false otherwise.
///
/// @see size_t Connection::Read (void *, size_t);
/// @see void Communication::AppendBytesToCache (const uint8_t * bytes, size_t
/// len, bool broadcast);
//------------------------------------------------------------------
virtual bool StartReadThread(Error *error_ptr = nullptr);
void
SetReadThreadBytesReceivedCallback (ReadThreadBytesReceived callback,
void *callback_baton);
//------------------------------------------------------------------
/// Stops the read thread by cancelling it.
///
/// @return
/// \b True if the read thread was successfully canceled, \b
/// false otherwise.
//------------------------------------------------------------------
virtual bool StopReadThread(Error *error_ptr = nullptr);
//------------------------------------------------------------------
/// Wait for the read thread to process all outstanding data.
///
/// After this function returns, the read thread has processed all data that
/// has been waiting in the Connection queue.
///
//------------------------------------------------------------------
void SynchronizeWithReadThread ();
virtual bool JoinReadThread(Error *error_ptr = nullptr);
//------------------------------------------------------------------
/// Checks if there is a currently running read thread.
///
/// @return
/// \b True if the read thread is running, \b false otherwise.
//------------------------------------------------------------------
bool ReadThreadIsRunning();
static const char *
ConnectionStatusAsCString (lldb::ConnectionStatus status);
//------------------------------------------------------------------
/// The static read thread function. This function will call
/// the "DoRead" function continuously and wait for data to become
/// available. When data is received it will append the available
/// data to the internal cache and broadcast a
/// \b eBroadcastBitReadThreadGotBytes event.
///
/// @param[in] comm_ptr
/// A pointer to an instance of this class.
///
/// @return
/// \b NULL.
///
/// @see void Communication::ReadThreadGotBytes (const uint8_t *, size_t);
//------------------------------------------------------------------
static lldb::thread_result_t ReadThread(lldb::thread_arg_t comm_ptr);
bool
GetCloseOnEOF () const
{
return m_close_on_eof;
}
void SetReadThreadBytesReceivedCallback(ReadThreadBytesReceived callback,
void *callback_baton);
void
SetCloseOnEOF (bool b)
{
m_close_on_eof = b;
}
//------------------------------------------------------------------
/// Wait for the read thread to process all outstanding data.
///
/// After this function returns, the read thread has processed all data that
/// has been waiting in the Connection queue.
///
//------------------------------------------------------------------
void SynchronizeWithReadThread();
static ConstString &GetStaticBroadcasterClass ();
static const char *ConnectionStatusAsCString(lldb::ConnectionStatus status);
ConstString &GetBroadcasterClass() const override
{
return GetStaticBroadcasterClass();
}
bool GetCloseOnEOF() const { return m_close_on_eof; }
void SetCloseOnEOF(bool b) { m_close_on_eof = b; }
static ConstString &GetStaticBroadcasterClass();
ConstString &GetBroadcasterClass() const override {
return GetStaticBroadcasterClass();
}
protected:
lldb::ConnectionSP m_connection_sp; ///< The connection that is current in use by this communications class.
HostThread m_read_thread; ///< The read thread handle in case we need to cancel the thread.
std::atomic<bool> m_read_thread_enabled;
std::atomic<bool> m_read_thread_did_exit;
std::string m_bytes; ///< A buffer to cache bytes read in the ReadThread function.
std::recursive_mutex m_bytes_mutex; ///< A mutex to protect multi-threaded access to the cached bytes.
std::mutex m_write_mutex; ///< Don't let multiple threads write at the same time...
std::mutex m_synchronize_mutex;
ReadThreadBytesReceived m_callback;
void *m_callback_baton;
bool m_close_on_eof;
lldb::ConnectionSP m_connection_sp; ///< The connection that is current in use
///by this communications class.
HostThread m_read_thread; ///< The read thread handle in case we need to
///cancel the thread.
std::atomic<bool> m_read_thread_enabled;
std::atomic<bool> m_read_thread_did_exit;
std::string
m_bytes; ///< A buffer to cache bytes read in the ReadThread function.
std::recursive_mutex m_bytes_mutex; ///< A mutex to protect multi-threaded
///access to the cached bytes.
std::mutex
m_write_mutex; ///< Don't let multiple threads write at the same time...
std::mutex m_synchronize_mutex;
ReadThreadBytesReceived m_callback;
void *m_callback_baton;
bool m_close_on_eof;
size_t
ReadFromConnection (void *dst,
size_t dst_len,
uint32_t timeout_usec,
lldb::ConnectionStatus &status,
Error *error_ptr);
size_t ReadFromConnection(void *dst, size_t dst_len,
const Timeout<std::micro> &timeout,
lldb::ConnectionStatus &status, Error *error_ptr);
//------------------------------------------------------------------
/// Append new bytes that get read from the read thread into the
/// internal object byte cache. This will cause a \b
/// eBroadcastBitReadThreadGotBytes event to be broadcast if \a
/// broadcast is true.
///
/// Subclasses can override this function in order to inspect the
/// received data and check if a packet is available.
///
/// Subclasses can also still call this function from the
/// overridden method to allow the caching to correctly happen and
/// suppress the broadcasting of the \a eBroadcastBitReadThreadGotBytes
/// event by setting \a broadcast to false.
///
/// @param[in] src
/// A source buffer that must be at least \a src_len bytes
/// long.
///
/// @param[in] src_len
/// The number of bytes to append to the cache.
//------------------------------------------------------------------
virtual void
AppendBytesToCache (const uint8_t *src, size_t src_len, bool broadcast, lldb::ConnectionStatus status);
//------------------------------------------------------------------
/// Append new bytes that get read from the read thread into the
/// internal object byte cache. This will cause a \b
/// eBroadcastBitReadThreadGotBytes event to be broadcast if \a
/// broadcast is true.
///
/// Subclasses can override this function in order to inspect the
/// received data and check if a packet is available.
///
/// Subclasses can also still call this function from the
/// overridden method to allow the caching to correctly happen and
/// suppress the broadcasting of the \a eBroadcastBitReadThreadGotBytes
/// event by setting \a broadcast to false.
///
/// @param[in] src
/// A source buffer that must be at least \a src_len bytes
/// long.
///
/// @param[in] src_len
/// The number of bytes to append to the cache.
//------------------------------------------------------------------
virtual void AppendBytesToCache(const uint8_t *src, size_t src_len,
bool broadcast,
lldb::ConnectionStatus status);
//------------------------------------------------------------------
/// Get any available bytes from our data cache. If this call
/// empties the data cache, the \b eBroadcastBitReadThreadGotBytes event
/// will be reset to signify no more bytes are available.
///
/// @param[in] dst
/// A destination buffer that must be at least \a dst_len bytes
/// long.
///
/// @param[in] dst_len
/// The number of bytes to attempt to read from the cache,
/// and also the max number of bytes that can be placed into
/// \a dst.
///
/// @return
/// The number of bytes extracted from the data cache.
//------------------------------------------------------------------
size_t
GetCachedBytes (void *dst, size_t dst_len);
//------------------------------------------------------------------
/// Get any available bytes from our data cache. If this call
/// empties the data cache, the \b eBroadcastBitReadThreadGotBytes event
/// will be reset to signify no more bytes are available.
///
/// @param[in] dst
/// A destination buffer that must be at least \a dst_len bytes
/// long.
///
/// @param[in] dst_len
/// The number of bytes to attempt to read from the cache,
/// and also the max number of bytes that can be placed into
/// \a dst.
///
/// @return
/// The number of bytes extracted from the data cache.
//------------------------------------------------------------------
size_t GetCachedBytes(void *dst, size_t dst_len);
private:
DISALLOW_COPY_AND_ASSIGN (Communication);
DISALLOW_COPY_AND_ASSIGN(Communication);
};
} // namespace lldb_private

View File

@ -10,12 +10,14 @@
#ifndef liblldb_Connection_h_
#define liblldb_Connection_h_
// Other libraries and framework includes
// Project includes
#include "lldb/Utility/Timeout.h"
#include "lldb/lldb-private.h"
// C Includes
// C++ Includes
#include <string>
// Other libraries and framework includes
// Project includes
#include "lldb/lldb-private.h"
namespace lldb_private {
@ -32,182 +34,172 @@ namespace lldb_private {
/// Communication class to perform communications where clients can
/// listen for broadcasts, and perform other higher level communications.
//----------------------------------------------------------------------
class Connection
{
class Connection {
public:
//------------------------------------------------------------------
/// Default constructor
//------------------------------------------------------------------
Connection ();
//------------------------------------------------------------------
/// Default constructor
//------------------------------------------------------------------
Connection();
//------------------------------------------------------------------
/// Virtual destructor since this class gets subclassed and handed
/// to a Communication object.
//------------------------------------------------------------------
virtual
~Connection ();
//------------------------------------------------------------------
/// Virtual destructor since this class gets subclassed and handed
/// to a Communication object.
//------------------------------------------------------------------
virtual ~Connection();
static Connection *CreateDefaultConnection(const char *url);
static Connection *CreateDefaultConnection(const char *url);
//------------------------------------------------------------------
/// Connect using the connect string \a url.
///
/// @param[in] url
/// A string that contains all information needed by the
/// subclass to connect to another client.
///
/// @param[out] error_ptr
/// A pointer to an error object that should be given an
/// appropriate error value if this method returns false. This
/// value can be NULL if the error value should be ignored.
///
/// @return
/// \b True if the connect succeeded, \b false otherwise. The
/// internal error object should be filled in with an
/// appropriate value based on the result of this function.
///
/// @see Error& Communication::GetError ();
//------------------------------------------------------------------
virtual lldb::ConnectionStatus
Connect (const char *url, Error *error_ptr) = 0;
//------------------------------------------------------------------
/// Connect using the connect string \a url.
///
/// @param[in] url
/// A string that contains all information needed by the
/// subclass to connect to another client.
///
/// @param[out] error_ptr
/// A pointer to an error object that should be given an
/// appropriate error value if this method returns false. This
/// value can be NULL if the error value should be ignored.
///
/// @return
/// \b True if the connect succeeded, \b false otherwise. The
/// internal error object should be filled in with an
/// appropriate value based on the result of this function.
///
/// @see Error& Communication::GetError ();
//------------------------------------------------------------------
virtual lldb::ConnectionStatus Connect(llvm::StringRef url,
Error *error_ptr) = 0;
//------------------------------------------------------------------
/// Disconnect the communications connection if one is currently
/// connected.
///
/// @param[out] error_ptr
/// A pointer to an error object that should be given an
/// appropriate error value if this method returns false. This
/// value can be NULL if the error value should be ignored.
///
/// @return
/// \b True if the disconnect succeeded, \b false otherwise. The
/// internal error object should be filled in with an
/// appropriate value based on the result of this function.
///
/// @see Error& Communication::GetError ();
//------------------------------------------------------------------
virtual lldb::ConnectionStatus
Disconnect (Error *error_ptr) = 0;
//------------------------------------------------------------------
/// Disconnect the communications connection if one is currently
/// connected.
///
/// @param[out] error_ptr
/// A pointer to an error object that should be given an
/// appropriate error value if this method returns false. This
/// value can be NULL if the error value should be ignored.
///
/// @return
/// \b True if the disconnect succeeded, \b false otherwise. The
/// internal error object should be filled in with an
/// appropriate value based on the result of this function.
///
/// @see Error& Communication::GetError ();
//------------------------------------------------------------------
virtual lldb::ConnectionStatus Disconnect(Error *error_ptr) = 0;
//------------------------------------------------------------------
/// Check if the connection is valid.
///
/// @return
/// \b True if this object is currently connected, \b false
/// otherwise.
//------------------------------------------------------------------
virtual bool
IsConnected () const = 0;
//------------------------------------------------------------------
/// Check if the connection is valid.
///
/// @return
/// \b True if this object is currently connected, \b false
/// otherwise.
//------------------------------------------------------------------
virtual bool IsConnected() const = 0;
//------------------------------------------------------------------
/// The read function that attempts to read from the connection.
///
/// @param[in] dst
/// A destination buffer that must be at least \a dst_len bytes
/// long.
///
/// @param[in] dst_len
/// The number of bytes to attempt to read, and also the max
/// number of bytes that can be placed into \a dst.
///
/// @param[in] timeout_usec
/// The number of microseconds to wait for the data.
///
/// @param[out] status
/// On return, indicates whether the call was successful or terminated
/// due to some error condition.
///
/// @param[out] error_ptr
/// A pointer to an error object that should be given an
/// appropriate error value if this method returns zero. This
/// value can be NULL if the error value should be ignored.
///
/// @return
/// The number of bytes actually read.
///
/// @see size_t Communication::Read (void *, size_t, uint32_t);
//------------------------------------------------------------------
virtual size_t
Read (void *dst,
size_t dst_len,
uint32_t timeout_usec,
lldb::ConnectionStatus &status,
Error *error_ptr) = 0;
//------------------------------------------------------------------
/// The read function that attempts to read from the connection.
///
/// @param[in] dst
/// A destination buffer that must be at least \a dst_len bytes
/// long.
///
/// @param[in] dst_len
/// The number of bytes to attempt to read, and also the max
/// number of bytes that can be placed into \a dst.
///
/// @param[in] timeout
/// The number of microseconds to wait for the data.
///
/// @param[out] status
/// On return, indicates whether the call was successful or terminated
/// due to some error condition.
///
/// @param[out] error_ptr
/// A pointer to an error object that should be given an
/// appropriate error value if this method returns zero. This
/// value can be NULL if the error value should be ignored.
///
/// @return
/// The number of bytes actually read.
///
/// @see size_t Communication::Read (void *, size_t, uint32_t);
//------------------------------------------------------------------
virtual size_t Read(void *dst, size_t dst_len,
const Timeout<std::micro> &timeout,
lldb::ConnectionStatus &status, Error *error_ptr) = 0;
//------------------------------------------------------------------
/// The actual write function that attempts to write to the
/// communications protocol.
///
/// Subclasses must override this function.
///
/// @param[in] dst
/// A desination buffer that must be at least \a dst_len bytes
/// long.
///
/// @param[in] dst_len
/// The number of bytes to attempt to write, and also the
/// number of bytes are currently available in \a dst.
///
/// @param[out] error_ptr
/// A pointer to an error object that should be given an
/// appropriate error value if this method returns zero. This
/// value can be NULL if the error value should be ignored.
///
/// @return
/// The number of bytes actually Written.
//------------------------------------------------------------------
virtual size_t
Write (const void *dst, size_t dst_len, lldb::ConnectionStatus &status, Error *error_ptr) = 0;
//------------------------------------------------------------------
/// The actual write function that attempts to write to the
/// communications protocol.
///
/// Subclasses must override this function.
///
/// @param[in] dst
/// A desination buffer that must be at least \a dst_len bytes
/// long.
///
/// @param[in] dst_len
/// The number of bytes to attempt to write, and also the
/// number of bytes are currently available in \a dst.
///
/// @param[out] error_ptr
/// A pointer to an error object that should be given an
/// appropriate error value if this method returns zero. This
/// value can be NULL if the error value should be ignored.
///
/// @return
/// The number of bytes actually Written.
//------------------------------------------------------------------
virtual size_t Write(const void *dst, size_t dst_len,
lldb::ConnectionStatus &status, Error *error_ptr) = 0;
//------------------------------------------------------------------
/// Returns a URI that describes this connection object
///
/// Subclasses may override this function.
///
/// @return
/// Returns URI or an empty string if disconnecteds
//------------------------------------------------------------------
virtual std::string
GetURI() = 0;
//------------------------------------------------------------------
/// Returns a URI that describes this connection object
///
/// Subclasses may override this function.
///
/// @return
/// Returns URI or an empty string if disconnecteds
//------------------------------------------------------------------
virtual std::string GetURI() = 0;
//------------------------------------------------------------------
/// Interrupts an ongoing Read() operation.
///
/// If there is an ongoing read operation in another thread, this operation
/// return with status == eConnectionStatusInterrupted. Note that if there
/// data waiting to be read and an interrupt request is issued, the Read()
/// function will return the data immediately without processing the
/// interrupt request (which will remain queued for the next Read()
/// operation).
///
/// @return
/// Returns true is the interrupt request was successful.
//------------------------------------------------------------------
virtual bool
InterruptRead() = 0;
//------------------------------------------------------------------
/// Interrupts an ongoing Read() operation.
///
/// If there is an ongoing read operation in another thread, this operation
/// return with status == eConnectionStatusInterrupted. Note that if there
/// data waiting to be read and an interrupt request is issued, the Read()
/// function will return the data immediately without processing the
/// interrupt request (which will remain queued for the next Read()
/// operation).
///
/// @return
/// Returns true is the interrupt request was successful.
//------------------------------------------------------------------
virtual bool InterruptRead() = 0;
//------------------------------------------------------------------
/// Returns the underlying IOObject used by the Connection.
///
/// The IOObject can be used to wait for data to become available
/// on the connection. If the Connection does not use IOObjects (and
/// hence does not support waiting) this function should return a
/// null pointer.
///
/// @return
/// The underlying IOObject used for reading.
//------------------------------------------------------------------
virtual lldb::IOObjectSP
GetReadObject() { return lldb::IOObjectSP(); }
//------------------------------------------------------------------
/// Returns the underlying IOObject used by the Connection.
///
/// The IOObject can be used to wait for data to become available
/// on the connection. If the Connection does not use IOObjects (and
/// hence does not support waiting) this function should return a
/// null pointer.
///
/// @return
/// The underlying IOObject used for reading.
//------------------------------------------------------------------
virtual lldb::IOObjectSP GetReadObject() { return lldb::IOObjectSP(); }
private:
//------------------------------------------------------------------
// For Connection only
//------------------------------------------------------------------
DISALLOW_COPY_AND_ASSIGN (Connection);
//------------------------------------------------------------------
// For Connection only
//------------------------------------------------------------------
DISALLOW_COPY_AND_ASSIGN(Connection);
};
} // namespace lldb_private
#endif // liblldb_Connection_h_
#endif // liblldb_Connection_h_

View File

@ -1,97 +0,0 @@
//===-- ConnectionMachPort.h --------------------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#if defined(__APPLE__)
#ifndef liblldb_ConnectionMachPort_h_
#define liblldb_ConnectionMachPort_h_
// C Includes
#include <mach/port.h>
#include <mach/kern_return.h>
// C++ Includes
#include <string>
// Other libraries and framework includes
// Project includes
#include "lldb/Core/Connection.h"
class ConnectionMachPort :
public lldb_private::Connection
{
public:
ConnectionMachPort ();
virtual
~ConnectionMachPort ();
virtual bool
IsConnected () const;
virtual lldb::ConnectionStatus
BytesAvailable (uint32_t timeout_usec, lldb_private::Error *error_ptr);
virtual lldb::ConnectionStatus
Connect (const char *s, lldb_private::Error *error_ptr);
virtual lldb::ConnectionStatus
Disconnect (lldb_private::Error *error_ptr);
virtual size_t
Read (void *dst,
size_t dst_len,
uint32_t timeout_usec,
lldb::ConnectionStatus &status,
lldb_private::Error *error_ptr);
virtual size_t
Write (const void *src,
size_t src_len,
lldb::ConnectionStatus &status,
lldb_private::Error *error_ptr);
virtual std::string
GetURI();
lldb::ConnectionStatus
BootstrapCheckIn (const char *port_name,
lldb_private::Error *error_ptr);
lldb::ConnectionStatus
BootstrapLookup (const char *port_name,
lldb_private::Error *error_ptr);
struct PayloadType
{
uint32_t command;
uint32_t data_length;
uint8_t data[32];
};
kern_return_t
Send (const PayloadType &payload);
kern_return_t
Receive (PayloadType &payload);
protected:
mach_port_t m_task;
mach_port_t m_port;
private:
std::string m_uri;
DISALLOW_COPY_AND_ASSIGN (ConnectionMachPort);
};
#endif // liblldb_ConnectionMachPort_h_
#endif // #if defined(__APPLE__)

View File

@ -1,74 +0,0 @@
//===-- ConnectionSharedMemory.h --------------------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#ifndef liblldb_ConnectionSharedMemory_h_
#define liblldb_ConnectionSharedMemory_h_
// C Includes
// C++ Includes
#include <string>
// Other libraries and framework includes
// Project includes
#include "lldb/Core/Connection.h"
#include "lldb/Core/DataBufferMemoryMap.h"
namespace lldb_private {
class ConnectionSharedMemory :
public Connection
{
public:
ConnectionSharedMemory ();
~ConnectionSharedMemory () override;
bool
IsConnected () const override;
virtual lldb::ConnectionStatus
BytesAvailable (uint32_t timeout_usec, Error *error_ptr);
lldb::ConnectionStatus
Connect (const char *s, Error *error_ptr) override;
lldb::ConnectionStatus
Disconnect (Error *error_ptr) override;
size_t
Read (void *dst,
size_t dst_len,
uint32_t timeout_usec,
lldb::ConnectionStatus &status,
Error *error_ptr) override;
size_t
Write (const void *src, size_t src_len, lldb::ConnectionStatus &status, Error *error_ptr) override;
std::string
GetURI() override;
lldb::ConnectionStatus
Open (bool create, const char *name, size_t size, Error *error_ptr);
protected:
std::string m_name;
int m_fd; // One buffer that contains all we need
DataBufferMemoryMap m_mmap;
private:
DISALLOW_COPY_AND_ASSIGN (ConnectionSharedMemory);
};
} // namespace lldb_private
#endif // liblldb_ConnectionSharedMemory_h_

View File

@ -25,503 +25,454 @@ namespace lldb_private {
/// @brief A uniqued constant string class.
///
/// Provides an efficient way to store strings as uniqued strings. After
/// the strings are uniqued, finding strings that are equal to one
/// another is very fast as just the pointers need to be compared. It
/// the strings are uniqued, finding strings that are equal to one
/// another is very fast as just the pointers need to be compared. It
/// also allows for many common strings from many different sources to
/// be shared to keep the memory footprint low.
///
/// No reference counting is done on strings that are added to the
/// No reference counting is done on strings that are added to the
/// string pool, once strings are added they are in the string pool for
/// the life of the program.
//----------------------------------------------------------------------
class ConstString
{
class ConstString {
public:
//------------------------------------------------------------------
/// Default constructor
//------------------------------------------------------------------
/// Default constructor
///
/// Initializes the string to an empty string.
//------------------------------------------------------------------
ConstString() : m_string(nullptr) {}
//------------------------------------------------------------------
/// Copy constructor
///
/// Copies the string value in \a rhs into this object.
///
/// @param[in] rhs
/// Another string object to copy.
//------------------------------------------------------------------
ConstString(const ConstString &rhs) : m_string(rhs.m_string) {}
explicit ConstString(const llvm::StringRef &s);
//------------------------------------------------------------------
/// Construct with C String value
///
/// Constructs this object with a C string by looking to see if the
/// C string already exists in the global string pool. If it doesn't
/// exist, it is added to the string pool.
///
/// @param[in] cstr
/// A NULL terminated C string to add to the string pool.
//------------------------------------------------------------------
explicit ConstString(const char *cstr);
//------------------------------------------------------------------
/// Construct with C String value with max length
///
/// Constructs this object with a C string with a length. If
/// \a max_cstr_len is greater than the actual length of the string,
/// the string length will be truncated. This allows substrings to
/// be created without the need to NULL terminate the string as it
/// is passed into this function.
///
/// @param[in] cstr
/// A pointer to the first character in the C string. The C
/// string can be NULL terminated in a buffer that contains
/// more characters than the length of the string, or the
/// string can be part of another string and a new substring
/// can be created.
///
/// @param[in] max_cstr_len
/// The max length of \a cstr. If the string length of \a cstr
/// is less than \a max_cstr_len, then the string will be
/// truncated. If the string length of \a cstr is greater than
/// \a max_cstr_len, then only max_cstr_len bytes will be used
/// from \a cstr.
//------------------------------------------------------------------
explicit ConstString(const char *cstr, size_t max_cstr_len);
//------------------------------------------------------------------
/// Destructor
///
/// Since constant string values are currently not reference counted,
/// there isn't much to do here.
//------------------------------------------------------------------
~ConstString() = default;
//----------------------------------------------------------------------
/// C string equality binary predicate function object for ConstString
/// objects.
//----------------------------------------------------------------------
struct StringIsEqual {
//--------------------------------------------------------------
/// C equality test.
///
/// Initializes the string to an empty string.
//------------------------------------------------------------------
ConstString():
m_string(nullptr)
{
/// Two C strings are equal when they are contained in ConstString
/// objects when their pointer values are equal to each other.
///
/// @return
/// Returns \b true if the C string in \a lhs is equal to
/// the C string value in \a rhs, \b false otherwise.
//--------------------------------------------------------------
bool operator()(const char *lhs, const char *rhs) const {
return lhs == rhs;
}
};
//------------------------------------------------------------------
/// Copy constructor
///
/// Copies the string value in \a rhs into this object.
///
/// @param[in] rhs
/// Another string object to copy.
//------------------------------------------------------------------
ConstString (const ConstString& rhs) :
m_string (rhs.m_string)
{
}
//------------------------------------------------------------------
/// Convert to bool operator.
///
/// This allows code to check a ConstString object to see if it
/// contains a valid string using code such as:
///
/// @code
/// ConstString str(...);
/// if (str)
/// { ...
/// @endcode
///
/// @return
/// /b True this object contains a valid non-empty C string, \b
/// false otherwise.
//------------------------------------------------------------------
explicit operator bool() const { return m_string && m_string[0]; }
explicit ConstString (const llvm::StringRef &s);
//------------------------------------------------------------------
/// Assignment operator
///
/// Assigns the string in this object with the value from \a rhs.
///
/// @param[in] rhs
/// Another string object to copy into this object.
///
/// @return
/// A const reference to this object.
//------------------------------------------------------------------
const ConstString &operator=(const ConstString &rhs) {
m_string = rhs.m_string;
return *this;
}
//------------------------------------------------------------------
/// Construct with C String value
///
/// Constructs this object with a C string by looking to see if the
/// C string already exists in the global string pool. If it doesn't
/// exist, it is added to the string pool.
///
/// @param[in] cstr
/// A NULL terminated C string to add to the string pool.
//------------------------------------------------------------------
explicit ConstString (const char *cstr);
//------------------------------------------------------------------
/// Equal to operator
///
/// Returns true if this string is equal to the string in \a rhs.
/// This operation is very fast as it results in a pointer
/// comparison since all strings are in a uniqued in a global string
/// pool.
///
/// @param[in] rhs
/// Another string object to compare this object to.
///
/// @return
/// @li \b true if this object is equal to \a rhs.
/// @li \b false if this object is not equal to \a rhs.
//------------------------------------------------------------------
bool operator==(const ConstString &rhs) const {
// We can do a pointer compare to compare these strings since they
// must come from the same pool in order to be equal.
return m_string == rhs.m_string;
}
//------------------------------------------------------------------
/// Construct with C String value with max length
///
/// Constructs this object with a C string with a length. If
/// \a max_cstr_len is greater than the actual length of the string,
/// the string length will be truncated. This allows substrings to
/// be created without the need to NULL terminate the string as it
/// is passed into this function.
///
/// @param[in] cstr
/// A pointer to the first character in the C string. The C
/// string can be NULL terminated in a buffer that contains
/// more characters than the length of the string, or the
/// string can be part of another string and a new substring
/// can be created.
///
/// @param[in] max_cstr_len
/// The max length of \a cstr. If the string length of \a cstr
/// is less than \a max_cstr_len, then the string will be
/// truncated. If the string length of \a cstr is greater than
/// \a max_cstr_len, then only max_cstr_len bytes will be used
/// from \a cstr.
//------------------------------------------------------------------
explicit ConstString (const char *cstr, size_t max_cstr_len);
//------------------------------------------------------------------
/// Not equal to operator
///
/// Returns true if this string is not equal to the string in \a rhs.
/// This operation is very fast as it results in a pointer
/// comparison since all strings are in a uniqued in a global string
/// pool.
///
/// @param[in] rhs
/// Another string object to compare this object to.
///
/// @return
/// @li \b true if this object is not equal to \a rhs.
/// @li \b false if this object is equal to \a rhs.
//------------------------------------------------------------------
bool operator!=(const ConstString &rhs) const {
return m_string != rhs.m_string;
}
//------------------------------------------------------------------
/// Destructor
///
/// Since constant string values are currently not reference counted,
/// there isn't much to do here.
//------------------------------------------------------------------
~ConstString() = default;
bool operator<(const ConstString &rhs) const;
//----------------------------------------------------------------------
/// C string equality binary predicate function object for ConstString
/// objects.
//----------------------------------------------------------------------
struct StringIsEqual
{
//--------------------------------------------------------------
/// C equality test.
///
/// Two C strings are equal when they are contained in ConstString
/// objects when their pointer values are equal to each other.
///
/// @return
/// Returns \b true if the C string in \a lhs is equal to
/// the C string value in \a rhs, \b false otherwise.
//--------------------------------------------------------------
bool operator()(const char* lhs, const char* rhs) const
{
return lhs == rhs;
}
};
//------------------------------------------------------------------
/// Get the string value as a C string.
///
/// Get the value of the contained string as a NULL terminated C
/// string value.
///
/// If \a value_if_empty is nullptr, then nullptr will be returned.
///
/// @return
/// Returns \a value_if_empty if the string is empty, otherwise
/// the C string value contained in this object.
//------------------------------------------------------------------
const char *AsCString(const char *value_if_empty = nullptr) const {
return (IsEmpty() ? value_if_empty : m_string);
}
//------------------------------------------------------------------
/// Convert to bool operator.
///
/// This allows code to check a ConstString object to see if it
/// contains a valid string using code such as:
///
/// @code
/// ConstString str(...);
/// if (str)
/// { ...
/// @endcode
///
/// @return
/// /b True this object contains a valid non-empty C string, \b
/// false otherwise.
//------------------------------------------------------------------
explicit operator bool() const
{
return m_string && m_string[0];
}
//------------------------------------------------------------------
/// Assignment operator
///
/// Assigns the string in this object with the value from \a rhs.
///
/// @param[in] rhs
/// Another string object to copy into this object.
///
/// @return
/// A const reference to this object.
//------------------------------------------------------------------
const ConstString&
operator = (const ConstString& rhs)
{
m_string = rhs.m_string;
return *this;
}
//------------------------------------------------------------------
/// Get the string value as a llvm::StringRef
///
/// @return
/// Returns a new llvm::StringRef object filled in with the
/// needed data.
//------------------------------------------------------------------
llvm::StringRef GetStringRef() const {
return llvm::StringRef(m_string, GetLength());
}
//------------------------------------------------------------------
/// Equal to operator
///
/// Returns true if this string is equal to the string in \a rhs.
/// This operation is very fast as it results in a pointer
/// comparison since all strings are in a uniqued in a global string
/// pool.
///
/// @param[in] rhs
/// Another string object to compare this object to.
///
/// @return
/// @li \b true if this object is equal to \a rhs.
/// @li \b false if this object is not equal to \a rhs.
//------------------------------------------------------------------
bool
operator == (const ConstString& rhs) const
{
// We can do a pointer compare to compare these strings since they
// must come from the same pool in order to be equal.
return m_string == rhs.m_string;
}
//------------------------------------------------------------------
/// Get the string value as a C string.
///
/// Get the value of the contained string as a NULL terminated C
/// string value. Similar to the ConstString::AsCString() function,
/// yet this function will always return nullptr if the string is not
/// valid. So this function is a direct accessor to the string
/// pointer value.
///
/// @return
/// Returns nullptr the string is invalid, otherwise the C string
/// value contained in this object.
//------------------------------------------------------------------
const char *GetCString() const { return m_string; }
//------------------------------------------------------------------
/// Not equal to operator
///
/// Returns true if this string is not equal to the string in \a rhs.
/// This operation is very fast as it results in a pointer
/// comparison since all strings are in a uniqued in a global string
/// pool.
///
/// @param[in] rhs
/// Another string object to compare this object to.
///
/// @return
/// @li \b true if this object is not equal to \a rhs.
/// @li \b false if this object is equal to \a rhs.
//------------------------------------------------------------------
bool
operator != (const ConstString& rhs) const
{
return m_string != rhs.m_string;
}
//------------------------------------------------------------------
/// Get the length in bytes of string value.
///
/// The string pool stores the length of the string, so we can avoid
/// calling strlen() on the pointer value with this function.
///
/// @return
/// Returns the number of bytes that this string occupies in
/// memory, not including the NULL termination byte.
//------------------------------------------------------------------
size_t GetLength() const;
bool
operator < (const ConstString& rhs) const;
//------------------------------------------------------------------
/// Clear this object's state.
///
/// Clear any contained string and reset the value to the an empty
/// string value.
//------------------------------------------------------------------
void Clear() { m_string = nullptr; }
//------------------------------------------------------------------
/// Get the string value as a C string.
///
/// Get the value of the contained string as a NULL terminated C
/// string value.
///
/// If \a value_if_empty is nullptr, then nullptr will be returned.
///
/// @return
/// Returns \a value_if_empty if the string is empty, otherwise
/// the C string value contained in this object.
//------------------------------------------------------------------
const char *
AsCString(const char *value_if_empty = nullptr) const
{
return (IsEmpty() ? value_if_empty : m_string);
}
//------------------------------------------------------------------
/// Equal to operator
///
/// Returns true if this string is equal to the string in \a rhs.
/// If case sensitive equality is tested, this operation is very
/// fast as it results in a pointer comparison since all strings
/// are in a uniqued in a global string pool.
///
/// @param[in] rhs
/// The Left Hand Side const ConstString object reference.
///
/// @param[in] rhs
/// The Right Hand Side const ConstString object reference.
///
/// @param[in] case_sensitive
/// Case sensitivity. If true, case sensitive equality
/// will be tested, otherwise character case will be ignored
///
/// @return
/// @li \b true if this object is equal to \a rhs.
/// @li \b false if this object is not equal to \a rhs.
//------------------------------------------------------------------
static bool Equals(const ConstString &lhs, const ConstString &rhs,
const bool case_sensitive = true);
//------------------------------------------------------------------
/// Get the string value as a llvm::StringRef
///
/// @return
/// Returns a new llvm::StringRef object filled in with the
/// needed data.
//------------------------------------------------------------------
llvm::StringRef
GetStringRef () const
{
return llvm::StringRef (m_string, GetLength());
}
//------------------------------------------------------------------
/// Get the string value as a C string.
///
/// Get the value of the contained string as a NULL terminated C
/// string value. Similar to the ConstString::AsCString() function,
/// yet this function will always return nullptr if the string is not
/// valid. So this function is a direct accessor to the string
/// pointer value.
///
/// @return
/// Returns nullptr the string is invalid, otherwise the C string
/// value contained in this object.
//------------------------------------------------------------------
const char *
GetCString () const
{
return m_string;
}
//------------------------------------------------------------------
/// Compare two string objects.
///
/// Compares the C string values contained in \a lhs and \a rhs and
/// returns an integer result.
///
/// NOTE: only call this function when you want a true string
/// comparison. If you want string equality use the, use the ==
/// operator as it is much more efficient. Also if you want string
/// inequality, use the != operator for the same reasons.
///
/// @param[in] lhs
/// The Left Hand Side const ConstString object reference.
///
/// @param[in] rhs
/// The Right Hand Side const ConstString object reference.
///
/// @param[in] case_sensitive
/// Case sensitivity of compare. If true, case sensitive compare
/// will be performed, otherwise character case will be ignored
///
/// @return
/// @li -1 if lhs < rhs
/// @li 0 if lhs == rhs
/// @li 1 if lhs > rhs
//------------------------------------------------------------------
static int Compare(const ConstString &lhs, const ConstString &rhs,
const bool case_sensitive = true);
//------------------------------------------------------------------
/// Get the length in bytes of string value.
///
/// The string pool stores the length of the string, so we can avoid
/// calling strlen() on the pointer value with this function.
///
/// @return
/// Returns the number of bytes that this string occupies in
/// memory, not including the NULL termination byte.
//------------------------------------------------------------------
size_t
GetLength () const;
//------------------------------------------------------------------
/// Dump the object description to a stream.
///
/// Dump the string value to the stream \a s. If the contained string
/// is empty, print \a value_if_empty to the stream instead. If
/// \a value_if_empty is nullptr, then nothing will be dumped to the
/// stream.
///
/// @param[in] s
/// The stream that will be used to dump the object description.
///
/// @param[in] value_if_empty
/// The value to dump if the string is empty. If nullptr, nothing
/// will be output to the stream.
//------------------------------------------------------------------
void Dump(Stream *s, const char *value_if_empty = nullptr) const;
//------------------------------------------------------------------
/// Clear this object's state.
///
/// Clear any contained string and reset the value to the an empty
/// string value.
//------------------------------------------------------------------
void
Clear ()
{
m_string = nullptr;
}
//------------------------------------------------------------------
/// Dump the object debug description to a stream.
///
/// @param[in] s
/// The stream that will be used to dump the object description.
//------------------------------------------------------------------
void DumpDebug(Stream *s) const;
//------------------------------------------------------------------
/// Equal to operator
///
/// Returns true if this string is equal to the string in \a rhs.
/// If case sensitive equality is tested, this operation is very
/// fast as it results in a pointer comparison since all strings
/// are in a uniqued in a global string pool.
///
/// @param[in] rhs
/// The Left Hand Side const ConstString object reference.
///
/// @param[in] rhs
/// The Right Hand Side const ConstString object reference.
///
/// @param[in] case_sensitive
/// Case sensitivity. If true, case sensitive equality
/// will be tested, otherwise character case will be ignored
///
/// @return
/// @li \b true if this object is equal to \a rhs.
/// @li \b false if this object is not equal to \a rhs.
//------------------------------------------------------------------
static bool
Equals(const ConstString &lhs, const ConstString &rhs, const bool case_sensitive = true);
//------------------------------------------------------------------
/// Test for empty string.
///
/// @return
/// @li \b true if the contained string is empty.
/// @li \b false if the contained string is not empty.
//------------------------------------------------------------------
bool IsEmpty() const { return m_string == nullptr || m_string[0] == '\0'; }
//------------------------------------------------------------------
/// Compare two string objects.
///
/// Compares the C string values contained in \a lhs and \a rhs and
/// returns an integer result.
///
/// NOTE: only call this function when you want a true string
/// comparison. If you want string equality use the, use the ==
/// operator as it is much more efficient. Also if you want string
/// inequality, use the != operator for the same reasons.
///
/// @param[in] lhs
/// The Left Hand Side const ConstString object reference.
///
/// @param[in] rhs
/// The Right Hand Side const ConstString object reference.
///
/// @param[in] case_sensitive
/// Case sensitivity of compare. If true, case sensitive compare
/// will be performed, otherwise character case will be ignored
///
/// @return
/// @li -1 if lhs < rhs
/// @li 0 if lhs == rhs
/// @li 1 if lhs > rhs
//------------------------------------------------------------------
static int
Compare(const ConstString &lhs, const ConstString &rhs, const bool case_sensitive = true);
//------------------------------------------------------------------
/// Set the C string value.
///
/// Set the string value in the object by uniquing the \a cstr
/// string value in our global string pool.
///
/// If the C string already exists in the global string pool, it
/// finds the current entry and returns the existing value. If it
/// doesn't exist, it is added to the string pool.
///
/// @param[in] cstr
/// A NULL terminated C string to add to the string pool.
//------------------------------------------------------------------
void SetCString(const char *cstr);
//------------------------------------------------------------------
/// Dump the object description to a stream.
///
/// Dump the string value to the stream \a s. If the contained string
/// is empty, print \a value_if_empty to the stream instead. If
/// \a value_if_empty is nullptr, then nothing will be dumped to the
/// stream.
///
/// @param[in] s
/// The stream that will be used to dump the object description.
///
/// @param[in] value_if_empty
/// The value to dump if the string is empty. If nullptr, nothing
/// will be output to the stream.
//------------------------------------------------------------------
void
Dump(Stream *s, const char *value_if_empty = nullptr) const;
void SetString(const llvm::StringRef &s);
//------------------------------------------------------------------
/// Dump the object debug description to a stream.
///
/// @param[in] s
/// The stream that will be used to dump the object description.
//------------------------------------------------------------------
void
DumpDebug (Stream *s) const;
//------------------------------------------------------------------
/// Set the C string value and its mangled counterpart.
///
/// Object files and debug symbols often use mangled string to
/// represent the linkage name for a symbol, function or global.
/// The string pool can efficiently store these values and their
/// counterparts so when we run into another instance of a mangled
/// name, we can avoid calling the name demangler over and over on
/// the same strings and then trying to unique them.
///
/// @param[in] demangled
/// The demangled C string to correlate with the \a mangled
/// name.
///
/// @param[in] mangled
/// The already uniqued mangled ConstString to correlate the
/// soon to be uniqued version of \a demangled.
//------------------------------------------------------------------
void SetCStringWithMangledCounterpart(const char *demangled,
const ConstString &mangled);
//------------------------------------------------------------------
/// Test for empty string.
///
/// @return
/// @li \b true if the contained string is empty.
/// @li \b false if the contained string is not empty.
//------------------------------------------------------------------
bool
IsEmpty () const
{
return m_string == nullptr || m_string[0] == '\0';
}
//------------------------------------------------------------------
/// Retrieve the mangled or demangled counterpart for a mangled
/// or demangled ConstString.
///
/// Object files and debug symbols often use mangled string to
/// represent the linkage name for a symbol, function or global.
/// The string pool can efficiently store these values and their
/// counterparts so when we run into another instance of a mangled
/// name, we can avoid calling the name demangler over and over on
/// the same strings and then trying to unique them.
///
/// @param[in] counterpart
/// A reference to a ConstString object that might get filled in
/// with the demangled/mangled counterpart.
///
/// @return
/// /b True if \a counterpart was filled in with the counterpart
/// /b false otherwise.
//------------------------------------------------------------------
bool GetMangledCounterpart(ConstString &counterpart) const;
//------------------------------------------------------------------
/// Set the C string value.
///
/// Set the string value in the object by uniquing the \a cstr
/// string value in our global string pool.
///
/// If the C string already exists in the global string pool, it
/// finds the current entry and returns the existing value. If it
/// doesn't exist, it is added to the string pool.
///
/// @param[in] cstr
/// A NULL terminated C string to add to the string pool.
//------------------------------------------------------------------
void
SetCString (const char *cstr);
//------------------------------------------------------------------
/// Set the C string value with length.
///
/// Set the string value in the object by uniquing \a cstr_len bytes
/// starting at the \a cstr string value in our global string pool.
/// If trim is true, then \a cstr_len indicates a maximum length of
/// the CString and if the actual length of the string is less, then
/// it will be trimmed.
///
/// If the C string already exists in the global string pool, it
/// finds the current entry and returns the existing value. If it
/// doesn't exist, it is added to the string pool.
///
/// @param[in] cstr
/// A NULL terminated C string to add to the string pool.
///
/// @param[in] cstr_len
/// The maximum length of the C string.
//------------------------------------------------------------------
void SetCStringWithLength(const char *cstr, size_t cstr_len);
void
SetString (const llvm::StringRef &s);
//------------------------------------------------------------------
/// Set the C string value with the minimum length between
/// \a fixed_cstr_len and the actual length of the C string. This
/// can be used for data structures that have a fixed length to
/// store a C string where the string might not be NULL terminated
/// if the string takes the entire buffer.
//------------------------------------------------------------------
void SetTrimmedCStringWithLength(const char *cstr, size_t fixed_cstr_len);
//------------------------------------------------------------------
/// Set the C string value and its mangled counterpart.
///
/// Object files and debug symbols often use mangled string to
/// represent the linkage name for a symbol, function or global.
/// The string pool can efficiently store these values and their
/// counterparts so when we run into another instance of a mangled
/// name, we can avoid calling the name demangler over and over on
/// the same strings and then trying to unique them.
///
/// @param[in] demangled
/// The demangled C string to correlate with the \a mangled
/// name.
///
/// @param[in] mangled
/// The already uniqued mangled ConstString to correlate the
/// soon to be uniqued version of \a demangled.
//------------------------------------------------------------------
void
SetCStringWithMangledCounterpart (const char *demangled,
const ConstString &mangled);
//------------------------------------------------------------------
/// Get the memory cost of this object.
///
/// Return the size in bytes that this object takes in memory. This
/// returns the size in bytes of this object, which does not include
/// any the shared string values it may refer to.
///
/// @return
/// The number of bytes that this object occupies in memory.
///
/// @see ConstString::StaticMemorySize ()
//------------------------------------------------------------------
size_t MemorySize() const { return sizeof(ConstString); }
//------------------------------------------------------------------
/// Retrieve the mangled or demangled counterpart for a mangled
/// or demangled ConstString.
///
/// Object files and debug symbols often use mangled string to
/// represent the linkage name for a symbol, function or global.
/// The string pool can efficiently store these values and their
/// counterparts so when we run into another instance of a mangled
/// name, we can avoid calling the name demangler over and over on
/// the same strings and then trying to unique them.
///
/// @param[in] counterpart
/// A reference to a ConstString object that might get filled in
/// with the demangled/mangled counterpart.
///
/// @return
/// /b True if \a counterpart was filled in with the counterpart
/// /b false otherwise.
//------------------------------------------------------------------
bool
GetMangledCounterpart (ConstString &counterpart) const;
//------------------------------------------------------------------
/// Set the C string value with length.
///
/// Set the string value in the object by uniquing \a cstr_len bytes
/// starting at the \a cstr string value in our global string pool.
/// If trim is true, then \a cstr_len indicates a maximum length of
/// the CString and if the actual length of the string is less, then
/// it will be trimmed.
///
/// If the C string already exists in the global string pool, it
/// finds the current entry and returns the existing value. If it
/// doesn't exist, it is added to the string pool.
///
/// @param[in] cstr
/// A NULL terminated C string to add to the string pool.
///
/// @param[in] cstr_len
/// The maximum length of the C string.
//------------------------------------------------------------------
void
SetCStringWithLength (const char *cstr, size_t cstr_len);
//------------------------------------------------------------------
/// Set the C string value with the minimum length between
/// \a fixed_cstr_len and the actual length of the C string. This
/// can be used for data structures that have a fixed length to
/// store a C string where the string might not be NULL terminated
/// if the string takes the entire buffer.
//------------------------------------------------------------------
void
SetTrimmedCStringWithLength (const char *cstr, size_t fixed_cstr_len);
//------------------------------------------------------------------
/// Get the memory cost of this object.
///
/// Return the size in bytes that this object takes in memory. This
/// returns the size in bytes of this object, which does not include
/// any the shared string values it may refer to.
///
/// @return
/// The number of bytes that this object occupies in memory.
///
/// @see ConstString::StaticMemorySize ()
//------------------------------------------------------------------
size_t
MemorySize () const
{
return sizeof(ConstString);
}
//------------------------------------------------------------------
/// Get the size in bytes of the current global string pool.
///
/// Reports the size in bytes of all shared C string values,
/// containers and any other values as a byte size for the
/// entire string pool.
///
/// @return
/// The number of bytes that the global string pool occupies
/// in memory.
//------------------------------------------------------------------
static size_t
StaticMemorySize ();
//------------------------------------------------------------------
/// Get the size in bytes of the current global string pool.
///
/// Reports the size in bytes of all shared C string values,
/// containers and any other values as a byte size for the
/// entire string pool.
///
/// @return
/// The number of bytes that the global string pool occupies
/// in memory.
//------------------------------------------------------------------
static size_t StaticMemorySize();
protected:
//------------------------------------------------------------------
// Member variables
//------------------------------------------------------------------
const char *m_string;
//------------------------------------------------------------------
// Member variables
//------------------------------------------------------------------
const char *m_string;
};
//------------------------------------------------------------------
/// Stream the string value \a str to the stream \a s
//------------------------------------------------------------------
Stream& operator << (Stream& s, const ConstString& str);
Stream &operator<<(Stream &s, const ConstString &str);
} // namespace lldb_private

View File

@ -1,21 +0,0 @@
//===-- CxaDemangle.h -------------------------------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#ifndef liblldb_CxaDemangle_h_
#define liblldb_CxaDemangle_h_
namespace lldb_private
{
char*
__cxa_demangle(const char* mangled_name, char* buf, size_t* n, int* status);
}
#endif

Some files were not shown because too many files have changed in this diff Show More