Merge once more from ^/vendor/llvm-project/release-10.x, to get the
lldb/bindings directory, which will be used to provide lua bindings for lldb. Requested by: emaste MFC after: 6 weeks X-MFC-With: 358851
This commit is contained in:
commit
130d950caf
76
contrib/llvm-project/lldb/bindings/headers.swig
Normal file
76
contrib/llvm-project/lldb/bindings/headers.swig
Normal file
@ -0,0 +1,76 @@
|
||||
/* C++ headers to be included. */
|
||||
%{
|
||||
#include <algorithm>
|
||||
#include <string>
|
||||
%}
|
||||
|
||||
/* The liblldb header files to be included. */
|
||||
%{
|
||||
#include "lldb/lldb-public.h"
|
||||
#include "lldb/API/SBAddress.h"
|
||||
#include "lldb/API/SBAttachInfo.h"
|
||||
#include "lldb/API/SBBlock.h"
|
||||
#include "lldb/API/SBBreakpoint.h"
|
||||
#include "lldb/API/SBBreakpointLocation.h"
|
||||
#include "lldb/API/SBBreakpointName.h"
|
||||
#include "lldb/API/SBBroadcaster.h"
|
||||
#include "lldb/API/SBCommandInterpreter.h"
|
||||
#include "lldb/API/SBCommandReturnObject.h"
|
||||
#include "lldb/API/SBCommunication.h"
|
||||
#include "lldb/API/SBCompileUnit.h"
|
||||
#include "lldb/API/SBData.h"
|
||||
#include "lldb/API/SBDebugger.h"
|
||||
#include "lldb/API/SBDeclaration.h"
|
||||
#include "lldb/API/SBError.h"
|
||||
#include "lldb/API/SBEvent.h"
|
||||
#include "lldb/API/SBExecutionContext.h"
|
||||
#include "lldb/API/SBExpressionOptions.h"
|
||||
#include "lldb/API/SBFileSpec.h"
|
||||
#include "lldb/API/SBFile.h"
|
||||
#include "lldb/API/SBFileSpecList.h"
|
||||
#include "lldb/API/SBFrame.h"
|
||||
#include "lldb/API/SBFunction.h"
|
||||
#include "lldb/API/SBHostOS.h"
|
||||
#include "lldb/API/SBInstruction.h"
|
||||
#include "lldb/API/SBInstructionList.h"
|
||||
#include "lldb/API/SBLanguageRuntime.h"
|
||||
#include "lldb/API/SBLaunchInfo.h"
|
||||
#include "lldb/API/SBLineEntry.h"
|
||||
#include "lldb/API/SBListener.h"
|
||||
#include "lldb/API/SBMemoryRegionInfo.h"
|
||||
#include "lldb/API/SBMemoryRegionInfoList.h"
|
||||
#include "lldb/API/SBModule.h"
|
||||
#include "lldb/API/SBModuleSpec.h"
|
||||
#include "lldb/API/SBPlatform.h"
|
||||
#include "lldb/API/SBProcess.h"
|
||||
#include "lldb/API/SBProcessInfo.h"
|
||||
#include "lldb/API/SBQueue.h"
|
||||
#include "lldb/API/SBQueueItem.h"
|
||||
#include "lldb/API/SBSection.h"
|
||||
#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"
|
||||
#include "lldb/API/SBTarget.h"
|
||||
#include "lldb/API/SBThread.h"
|
||||
#include "lldb/API/SBThreadCollection.h"
|
||||
#include "lldb/API/SBThreadPlan.h"
|
||||
#include "lldb/API/SBTrace.h"
|
||||
#include "lldb/API/SBTraceOptions.h"
|
||||
#include "lldb/API/SBType.h"
|
||||
#include "lldb/API/SBTypeCategory.h"
|
||||
#include "lldb/API/SBTypeEnumMember.h"
|
||||
#include "lldb/API/SBTypeFilter.h"
|
||||
#include "lldb/API/SBTypeFormat.h"
|
||||
#include "lldb/API/SBTypeNameSpecifier.h"
|
||||
#include "lldb/API/SBTypeSummary.h"
|
||||
#include "lldb/API/SBTypeSynthetic.h"
|
||||
#include "lldb/API/SBValue.h"
|
||||
#include "lldb/API/SBValueList.h"
|
||||
#include "lldb/API/SBVariablesOptions.h"
|
||||
#include "lldb/API/SBWatchpoint.h"
|
||||
#include "lldb/API/SBUnixSignals.h"
|
||||
%}
|
185
contrib/llvm-project/lldb/bindings/interface/SBAddress.i
Normal file
185
contrib/llvm-project/lldb/bindings/interface/SBAddress.i
Normal file
@ -0,0 +1,185 @@
|
||||
//===-- SWIG Interface for SBAddress ----------------------------*- C++ -*-===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
namespace lldb {
|
||||
|
||||
%feature("docstring",
|
||||
"A section + offset based address class.
|
||||
|
||||
The SBAddress class allows addresses to be relative to a section
|
||||
that can move during runtime due to images (executables, shared
|
||||
libraries, bundles, frameworks) being loaded at different
|
||||
addresses than the addresses found in the object file that
|
||||
represents them on disk. There are currently two types of addresses
|
||||
for a section:
|
||||
o file addresses
|
||||
o load addresses
|
||||
|
||||
File addresses represents the virtual addresses that are in the 'on
|
||||
disk' object files. These virtual addresses are converted to be
|
||||
relative to unique sections scoped to the object file so that
|
||||
when/if the addresses slide when the images are loaded/unloaded
|
||||
in memory, we can easily track these changes without having to
|
||||
update every object (compile unit ranges, line tables, function
|
||||
address ranges, lexical block and inlined subroutine address
|
||||
ranges, global and static variables) each time an image is loaded or
|
||||
unloaded.
|
||||
|
||||
Load addresses represents the virtual addresses where each section
|
||||
ends up getting loaded at runtime. Before executing a program, it
|
||||
is common for all of the load addresses to be unresolved. When a
|
||||
DynamicLoader plug-in receives notification that shared libraries
|
||||
have been loaded/unloaded, the load addresses of the main executable
|
||||
and any images (shared libraries) will be resolved/unresolved. When
|
||||
this happens, breakpoints that are in one of these sections can be
|
||||
set/cleared.
|
||||
|
||||
See docstring of SBFunction for example usage of SBAddress."
|
||||
) SBAddress;
|
||||
class SBAddress
|
||||
{
|
||||
public:
|
||||
|
||||
SBAddress ();
|
||||
|
||||
SBAddress (const lldb::SBAddress &rhs);
|
||||
|
||||
SBAddress (lldb::SBSection section,
|
||||
lldb::addr_t offset);
|
||||
|
||||
%feature("docstring", "
|
||||
Create an address by resolving a load address using the supplied target.") SBAddress;
|
||||
SBAddress (lldb::addr_t load_addr, lldb::SBTarget &target);
|
||||
|
||||
~SBAddress ();
|
||||
|
||||
bool
|
||||
IsValid () const;
|
||||
|
||||
explicit operator bool() const;
|
||||
|
||||
#ifdef SWIGPYTHON
|
||||
// operator== is a free function, which swig does not handle, so we inject
|
||||
// our own equality operator here
|
||||
%pythoncode%{
|
||||
def __eq__(self, other):
|
||||
return not self.__ne__(other)
|
||||
%}
|
||||
#endif
|
||||
|
||||
bool operator!=(const SBAddress &rhs) const;
|
||||
|
||||
void
|
||||
Clear ();
|
||||
|
||||
addr_t
|
||||
GetFileAddress () const;
|
||||
|
||||
addr_t
|
||||
GetLoadAddress (const lldb::SBTarget &target) const;
|
||||
|
||||
void
|
||||
SetLoadAddress (lldb::addr_t load_addr,
|
||||
lldb::SBTarget &target);
|
||||
|
||||
bool
|
||||
OffsetAddress (addr_t offset);
|
||||
|
||||
bool
|
||||
GetDescription (lldb::SBStream &description);
|
||||
|
||||
lldb::SBSection
|
||||
GetSection ();
|
||||
|
||||
lldb::addr_t
|
||||
SBAddress::GetOffset ();
|
||||
|
||||
void
|
||||
SetAddress (lldb::SBSection section,
|
||||
lldb::addr_t offset);
|
||||
|
||||
%feature("docstring", "
|
||||
GetSymbolContext() and the following 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 (...)'.") GetSymbolContext;
|
||||
lldb::SBSymbolContext
|
||||
GetSymbolContext (uint32_t resolve_scope);
|
||||
|
||||
%feature("docstring", "
|
||||
GetModule() and the following 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.") GetModule;
|
||||
lldb::SBModule
|
||||
GetModule ();
|
||||
|
||||
lldb::SBCompileUnit
|
||||
GetCompileUnit ();
|
||||
|
||||
lldb::SBFunction
|
||||
GetFunction ();
|
||||
|
||||
lldb::SBBlock
|
||||
GetBlock ();
|
||||
|
||||
lldb::SBSymbol
|
||||
GetSymbol ();
|
||||
|
||||
lldb::SBLineEntry
|
||||
GetLineEntry ();
|
||||
|
||||
STRING_EXTENSION(SBAddress)
|
||||
|
||||
#ifdef SWIGPYTHON
|
||||
%pythoncode %{
|
||||
def __get_load_addr_property__ (self):
|
||||
'''Get the load address for a lldb.SBAddress using the current target.'''
|
||||
return self.GetLoadAddress (target)
|
||||
|
||||
def __set_load_addr_property__ (self, load_addr):
|
||||
'''Set the load address for a lldb.SBAddress using the current target.'''
|
||||
return self.SetLoadAddress (load_addr, target)
|
||||
|
||||
def __int__(self):
|
||||
'''Convert an address to a load address if there is a process and that process is alive, or to a file address otherwise.'''
|
||||
if process.is_alive:
|
||||
return self.GetLoadAddress (target)
|
||||
else:
|
||||
return self.GetFileAddress ()
|
||||
|
||||
def __oct__(self):
|
||||
'''Convert the address to an octal string'''
|
||||
return '%o' % int(self)
|
||||
|
||||
def __hex__(self):
|
||||
'''Convert the address to an hex string'''
|
||||
return '0x%x' % int(self)
|
||||
|
||||
module = property(GetModule, None, doc='''A read only property that returns an lldb object that represents the module (lldb.SBModule) that this address resides within.''')
|
||||
compile_unit = property(GetCompileUnit, None, doc='''A read only property that returns an lldb object that represents the compile unit (lldb.SBCompileUnit) that this address resides within.''')
|
||||
line_entry = property(GetLineEntry, None, doc='''A read only property that returns an lldb object that represents the line entry (lldb.SBLineEntry) that this address resides within.''')
|
||||
function = property(GetFunction, None, doc='''A read only property that returns an lldb object that represents the function (lldb.SBFunction) that this address resides within.''')
|
||||
block = property(GetBlock, None, doc='''A read only property that returns an lldb object that represents the block (lldb.SBBlock) that this address resides within.''')
|
||||
symbol = property(GetSymbol, None, doc='''A read only property that returns an lldb object that represents the symbol (lldb.SBSymbol) that this address resides within.''')
|
||||
offset = property(GetOffset, None, doc='''A read only property that returns the section offset in bytes as an integer.''')
|
||||
section = property(GetSection, None, doc='''A read only property that returns an lldb object that represents the section (lldb.SBSection) that this address resides within.''')
|
||||
file_addr = property(GetFileAddress, None, doc='''A read only property that returns file address for the section as an integer. This is the address that represents the address as it is found in the object file that defines it.''')
|
||||
load_addr = property(__get_load_addr_property__, __set_load_addr_property__, doc='''A read/write property that gets/sets the SBAddress using load address. The setter resolves SBAddress using the SBTarget from lldb.target so this property can ONLY be used in the interactive script interpreter (i.e. under the lldb script command) and not in Python based commands, or breakpoint commands.''')
|
||||
%}
|
||||
#endif
|
||||
|
||||
};
|
||||
|
||||
} // namespace lldb
|
115
contrib/llvm-project/lldb/bindings/interface/SBAttachInfo.i
Normal file
115
contrib/llvm-project/lldb/bindings/interface/SBAttachInfo.i
Normal file
@ -0,0 +1,115 @@
|
||||
//===-- SWIG Interface for SBAttachInfo--------------------------*- C++ -*-===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
namespace lldb {
|
||||
|
||||
class SBAttachInfo
|
||||
{
|
||||
public:
|
||||
SBAttachInfo ();
|
||||
|
||||
SBAttachInfo (lldb::pid_t pid);
|
||||
|
||||
SBAttachInfo (const char *path, bool wait_for);
|
||||
|
||||
SBAttachInfo (const char *path, bool wait_for, bool async);
|
||||
|
||||
SBAttachInfo (const lldb::SBAttachInfo &rhs);
|
||||
|
||||
lldb::pid_t
|
||||
GetProcessID ();
|
||||
|
||||
void
|
||||
SetProcessID (lldb::pid_t pid);
|
||||
|
||||
void
|
||||
SetExecutable (const char *path);
|
||||
|
||||
void
|
||||
SetExecutable (lldb::SBFileSpec exe_file);
|
||||
|
||||
bool
|
||||
GetWaitForLaunch ();
|
||||
|
||||
void
|
||||
SetWaitForLaunch (bool b);
|
||||
|
||||
void
|
||||
SetWaitForLaunch (bool b, bool async);
|
||||
|
||||
bool
|
||||
GetIgnoreExisting ();
|
||||
|
||||
void
|
||||
SetIgnoreExisting (bool b);
|
||||
|
||||
uint32_t
|
||||
GetResumeCount ();
|
||||
|
||||
void
|
||||
SetResumeCount (uint32_t c);
|
||||
|
||||
const char *
|
||||
GetProcessPluginName ();
|
||||
|
||||
void
|
||||
SetProcessPluginName (const char *plugin_name);
|
||||
|
||||
uint32_t
|
||||
GetUserID();
|
||||
|
||||
uint32_t
|
||||
GetGroupID();
|
||||
|
||||
bool
|
||||
UserIDIsValid ();
|
||||
|
||||
bool
|
||||
GroupIDIsValid ();
|
||||
|
||||
void
|
||||
SetUserID (uint32_t uid);
|
||||
|
||||
void
|
||||
SetGroupID (uint32_t gid);
|
||||
|
||||
uint32_t
|
||||
GetEffectiveUserID();
|
||||
|
||||
uint32_t
|
||||
GetEffectiveGroupID();
|
||||
|
||||
bool
|
||||
EffectiveUserIDIsValid ();
|
||||
|
||||
bool
|
||||
EffectiveGroupIDIsValid ();
|
||||
|
||||
void
|
||||
SetEffectiveUserID (uint32_t uid);
|
||||
|
||||
void
|
||||
SetEffectiveGroupID (uint32_t gid);
|
||||
|
||||
lldb::pid_t
|
||||
GetParentProcessID ();
|
||||
|
||||
void
|
||||
SetParentProcessID (lldb::pid_t pid);
|
||||
|
||||
bool
|
||||
ParentProcessIDIsValid();
|
||||
|
||||
lldb::SBListener
|
||||
GetListener ();
|
||||
|
||||
void
|
||||
SetListener (lldb::SBListener &listener);
|
||||
};
|
||||
|
||||
} // namespace lldb
|
163
contrib/llvm-project/lldb/bindings/interface/SBBlock.i
Normal file
163
contrib/llvm-project/lldb/bindings/interface/SBBlock.i
Normal file
@ -0,0 +1,163 @@
|
||||
//===-- SWIG Interface for SBBlock ------------------------------*- C++ -*-===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
namespace lldb {
|
||||
|
||||
%feature("docstring",
|
||||
"Represents a lexical block. SBFunction contains SBBlock(s)."
|
||||
) SBBlock;
|
||||
class SBBlock
|
||||
{
|
||||
public:
|
||||
|
||||
SBBlock ();
|
||||
|
||||
SBBlock (const lldb::SBBlock &rhs);
|
||||
|
||||
~SBBlock ();
|
||||
|
||||
%feature("docstring",
|
||||
"Does this block represent an inlined function?"
|
||||
) IsInlined;
|
||||
bool
|
||||
IsInlined () const;
|
||||
|
||||
bool
|
||||
IsValid () const;
|
||||
|
||||
explicit operator bool() const;
|
||||
|
||||
%feature("docstring", "
|
||||
Get the function name if this block represents an inlined function;
|
||||
otherwise, return None.") GetInlinedName;
|
||||
const char *
|
||||
GetInlinedName () const;
|
||||
|
||||
%feature("docstring", "
|
||||
Get the call site file if this block represents an inlined function;
|
||||
otherwise, return an invalid file spec.") GetInlinedCallSiteFile;
|
||||
lldb::SBFileSpec
|
||||
GetInlinedCallSiteFile () const;
|
||||
|
||||
%feature("docstring", "
|
||||
Get the call site line if this block represents an inlined function;
|
||||
otherwise, return 0.") GetInlinedCallSiteLine;
|
||||
uint32_t
|
||||
GetInlinedCallSiteLine () const;
|
||||
|
||||
%feature("docstring", "
|
||||
Get the call site column if this block represents an inlined function;
|
||||
otherwise, return 0.") GetInlinedCallSiteColumn;
|
||||
uint32_t
|
||||
GetInlinedCallSiteColumn () const;
|
||||
|
||||
%feature("docstring", "Get the parent block.") GetParent;
|
||||
lldb::SBBlock
|
||||
GetParent ();
|
||||
|
||||
%feature("docstring", "Get the inlined block that is or contains this block.") GetContainingInlinedBlock;
|
||||
lldb::SBBlock
|
||||
GetContainingInlinedBlock ();
|
||||
|
||||
%feature("docstring", "Get the sibling block for this block.") GetSibling;
|
||||
lldb::SBBlock
|
||||
GetSibling ();
|
||||
|
||||
%feature("docstring", "Get the first child block.") GetFirstChild;
|
||||
lldb::SBBlock
|
||||
GetFirstChild ();
|
||||
|
||||
uint32_t
|
||||
GetNumRanges ();
|
||||
|
||||
lldb::SBAddress
|
||||
GetRangeStartAddress (uint32_t idx);
|
||||
|
||||
lldb::SBAddress
|
||||
GetRangeEndAddress (uint32_t idx);
|
||||
|
||||
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);
|
||||
|
||||
STRING_EXTENSION(SBBlock)
|
||||
|
||||
#ifdef SWIGPYTHON
|
||||
%pythoncode %{
|
||||
def get_range_at_index(self, idx):
|
||||
if idx < self.GetNumRanges():
|
||||
return [self.GetRangeStartAddress(idx), self.GetRangeEndAddress(idx)]
|
||||
return []
|
||||
|
||||
class ranges_access(object):
|
||||
'''A helper object that will lazily hand out an array of lldb.SBAddress that represent address ranges for a block.'''
|
||||
def __init__(self, sbblock):
|
||||
self.sbblock = sbblock
|
||||
|
||||
def __len__(self):
|
||||
if self.sbblock:
|
||||
return int(self.sbblock.GetNumRanges())
|
||||
return 0
|
||||
|
||||
def __getitem__(self, key):
|
||||
count = len(self)
|
||||
if type(key) is int:
|
||||
return self.sbblock.get_range_at_index (key);
|
||||
if isinstance(key, SBAddress):
|
||||
range_idx = self.sbblock.GetRangeIndexForBlockAddress(key);
|
||||
if range_idx < len(self):
|
||||
return [self.sbblock.GetRangeStartAddress(range_idx), self.sbblock.GetRangeEndAddress(range_idx)]
|
||||
else:
|
||||
print("error: unsupported item type: %s" % type(key))
|
||||
return None
|
||||
|
||||
def get_ranges_access_object(self):
|
||||
'''An accessor function that returns a ranges_access() object which allows lazy block address ranges access.'''
|
||||
return self.ranges_access (self)
|
||||
|
||||
def get_ranges_array(self):
|
||||
'''An accessor function that returns an array object that contains all ranges in this block object.'''
|
||||
if not hasattr(self, 'ranges_array'):
|
||||
self.ranges_array = []
|
||||
for idx in range(self.num_ranges):
|
||||
self.ranges_array.append ([self.GetRangeStartAddress(idx), self.GetRangeEndAddress(idx)])
|
||||
return self.ranges_array
|
||||
|
||||
def get_call_site(self):
|
||||
return declaration(self.GetInlinedCallSiteFile(), self.GetInlinedCallSiteLine(), self.GetInlinedCallSiteColumn())
|
||||
|
||||
parent = property(GetParent, None, doc='''A read only property that returns the same result as GetParent().''')
|
||||
first_child = property(GetFirstChild, None, doc='''A read only property that returns the same result as GetFirstChild().''')
|
||||
call_site = property(get_call_site, None, doc='''A read only property that returns a lldb.declaration object that contains the inlined call site file, line and column.''')
|
||||
sibling = property(GetSibling, None, doc='''A read only property that returns the same result as GetSibling().''')
|
||||
name = property(GetInlinedName, None, doc='''A read only property that returns the same result as GetInlinedName().''')
|
||||
inlined_block = property(GetContainingInlinedBlock, None, doc='''A read only property that returns the same result as GetContainingInlinedBlock().''')
|
||||
range = property(get_ranges_access_object, None, doc='''A read only property that allows item access to the address ranges for a block by integer (range = block.range[0]) and by lldb.SBAdddress (find the range that contains the specified lldb.SBAddress like "pc_range = lldb.frame.block.range[frame.addr]").''')
|
||||
ranges = property(get_ranges_array, None, doc='''A read only property that returns a list() object that contains all of the address ranges for the block.''')
|
||||
num_ranges = property(GetNumRanges, None, doc='''A read only property that returns the same result as GetNumRanges().''')
|
||||
%}
|
||||
#endif
|
||||
|
||||
};
|
||||
|
||||
} // namespace lldb
|
334
contrib/llvm-project/lldb/bindings/interface/SBBreakpoint.i
Normal file
334
contrib/llvm-project/lldb/bindings/interface/SBBreakpoint.i
Normal file
@ -0,0 +1,334 @@
|
||||
//===-- SWIG Interface for SBBreakpoint -------------------------*- C++ -*-===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
namespace lldb {
|
||||
|
||||
%feature("docstring",
|
||||
"Represents a logical breakpoint and its associated settings.
|
||||
|
||||
For example (from test/functionalities/breakpoint/breakpoint_ignore_count/
|
||||
TestBreakpointIgnoreCount.py),
|
||||
|
||||
def breakpoint_ignore_count_python(self):
|
||||
'''Use Python APIs to set breakpoint ignore count.'''
|
||||
exe = os.path.join(os.getcwd(), 'a.out')
|
||||
|
||||
# Create a target by the debugger.
|
||||
target = self.dbg.CreateTarget(exe)
|
||||
self.assertTrue(target, VALID_TARGET)
|
||||
|
||||
# Now create a breakpoint on main.c by name 'c'.
|
||||
breakpoint = target.BreakpointCreateByName('c', 'a.out')
|
||||
self.assertTrue(breakpoint and
|
||||
breakpoint.GetNumLocations() == 1,
|
||||
VALID_BREAKPOINT)
|
||||
|
||||
# Get the breakpoint location from breakpoint after we verified that,
|
||||
# indeed, it has one location.
|
||||
location = breakpoint.GetLocationAtIndex(0)
|
||||
self.assertTrue(location and
|
||||
location.IsEnabled(),
|
||||
VALID_BREAKPOINT_LOCATION)
|
||||
|
||||
# Set the ignore count on the breakpoint location.
|
||||
location.SetIgnoreCount(2)
|
||||
self.assertTrue(location.GetIgnoreCount() == 2,
|
||||
'SetIgnoreCount() works correctly')
|
||||
|
||||
# Now launch the process, and do not stop at entry point.
|
||||
process = target.LaunchSimple(None, None, os.getcwd())
|
||||
self.assertTrue(process, PROCESS_IS_VALID)
|
||||
|
||||
# Frame#0 should be on main.c:37, frame#1 should be on main.c:25, and
|
||||
# frame#2 should be on main.c:48.
|
||||
#lldbutil.print_stacktraces(process)
|
||||
from lldbutil import get_stopped_thread
|
||||
thread = get_stopped_thread(process, lldb.eStopReasonBreakpoint)
|
||||
self.assertTrue(thread != None, 'There should be a thread stopped due to breakpoint')
|
||||
frame0 = thread.GetFrameAtIndex(0)
|
||||
frame1 = thread.GetFrameAtIndex(1)
|
||||
frame2 = thread.GetFrameAtIndex(2)
|
||||
self.assertTrue(frame0.GetLineEntry().GetLine() == self.line1 and
|
||||
frame1.GetLineEntry().GetLine() == self.line3 and
|
||||
frame2.GetLineEntry().GetLine() == self.line4,
|
||||
STOPPED_DUE_TO_BREAKPOINT_IGNORE_COUNT)
|
||||
|
||||
# The hit count for the breakpoint should be 3.
|
||||
self.assertTrue(breakpoint.GetHitCount() == 3)
|
||||
|
||||
process.Continue()
|
||||
|
||||
SBBreakpoint supports breakpoint location iteration, for example,
|
||||
|
||||
for bl in breakpoint:
|
||||
print('breakpoint location load addr: %s' % hex(bl.GetLoadAddress()))
|
||||
print('breakpoint location condition: %s' % hex(bl.GetCondition()))
|
||||
|
||||
and rich comparison methods which allow the API program to use,
|
||||
|
||||
if aBreakpoint == bBreakpoint:
|
||||
...
|
||||
|
||||
to compare two breakpoints for equality."
|
||||
) SBBreakpoint;
|
||||
class SBBreakpoint
|
||||
{
|
||||
public:
|
||||
|
||||
SBBreakpoint ();
|
||||
|
||||
SBBreakpoint (const lldb::SBBreakpoint& rhs);
|
||||
|
||||
~SBBreakpoint();
|
||||
|
||||
bool operator==(const lldb::SBBreakpoint &rhs);
|
||||
|
||||
bool operator!=(const lldb::SBBreakpoint &rhs);
|
||||
|
||||
break_id_t
|
||||
GetID () const;
|
||||
|
||||
bool
|
||||
IsValid() const;
|
||||
|
||||
explicit operator bool() const;
|
||||
|
||||
void
|
||||
ClearAllBreakpointSites ();
|
||||
|
||||
lldb::SBBreakpointLocation
|
||||
FindLocationByAddress (lldb::addr_t vm_addr);
|
||||
|
||||
lldb::break_id_t
|
||||
FindLocationIDByAddress (lldb::addr_t vm_addr);
|
||||
|
||||
lldb::SBBreakpointLocation
|
||||
FindLocationByID (lldb::break_id_t bp_loc_id);
|
||||
|
||||
lldb::SBBreakpointLocation
|
||||
GetLocationAtIndex (uint32_t index);
|
||||
|
||||
void
|
||||
SetEnabled (bool enable);
|
||||
|
||||
bool
|
||||
IsEnabled ();
|
||||
|
||||
void
|
||||
SetOneShot (bool one_shot);
|
||||
|
||||
bool
|
||||
IsOneShot ();
|
||||
|
||||
bool
|
||||
IsInternal ();
|
||||
|
||||
uint32_t
|
||||
GetHitCount () const;
|
||||
|
||||
void
|
||||
SetIgnoreCount (uint32_t count);
|
||||
|
||||
uint32_t
|
||||
GetIgnoreCount () const;
|
||||
|
||||
%feature("docstring", "
|
||||
The breakpoint stops only if the condition expression evaluates to true.") SetCondition;
|
||||
void
|
||||
SetCondition (const char *condition);
|
||||
|
||||
%feature("docstring", "
|
||||
Get the condition expression for the breakpoint.") GetCondition;
|
||||
const char *
|
||||
GetCondition ();
|
||||
|
||||
void SetAutoContinue(bool auto_continue);
|
||||
|
||||
bool GetAutoContinue();
|
||||
|
||||
void
|
||||
SetThreadID (lldb::tid_t sb_thread_id);
|
||||
|
||||
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;
|
||||
|
||||
%feature("docstring", "
|
||||
Set the name of the script function to be called when the breakpoint is hit.") SetScriptCallbackFunction;
|
||||
void
|
||||
SetScriptCallbackFunction (const char *callback_function_name);
|
||||
|
||||
%feature("docstring", "
|
||||
Set the name of the script function to be called when the breakpoint is hit.
|
||||
To use this variant, the function should take (frame, bp_loc, extra_args, dict) and
|
||||
when the breakpoint is hit the extra_args will be passed to the callback function.") SetScriptCallbackFunction;
|
||||
SBError
|
||||
SetScriptCallbackFunction (const char *callback_function_name,
|
||||
SBStructuredData &extra_args);
|
||||
|
||||
%feature("docstring", "
|
||||
Provide the body for the script function to be called when the breakpoint is hit.
|
||||
The body will be wrapped in a function, which be passed two arguments:
|
||||
'frame' - which holds the bottom-most SBFrame of the thread that hit the breakpoint
|
||||
'bpno' - which is the SBBreakpointLocation to which the callback was attached.
|
||||
|
||||
The error parameter is currently ignored, but will at some point hold the Python
|
||||
compilation diagnostics.
|
||||
Returns true if the body compiles successfully, false if not.") SetScriptCallbackBody;
|
||||
SBError
|
||||
SetScriptCallbackBody (const char *script_body_text);
|
||||
|
||||
void SetCommandLineCommands(SBStringList &commands);
|
||||
|
||||
bool GetCommandLineCommands(SBStringList &commands);
|
||||
|
||||
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);
|
||||
|
||||
// Can only be called from a ScriptedBreakpointResolver...
|
||||
SBError
|
||||
AddLocation(SBAddress &address);
|
||||
|
||||
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);
|
||||
|
||||
bool
|
||||
IsHardware ();
|
||||
|
||||
STRING_EXTENSION(SBBreakpoint)
|
||||
|
||||
#ifdef SWIGPYTHON
|
||||
%pythoncode %{
|
||||
|
||||
class locations_access(object):
|
||||
'''A helper object that will lazily hand out locations for a breakpoint when supplied an index.'''
|
||||
def __init__(self, sbbreakpoint):
|
||||
self.sbbreakpoint = sbbreakpoint
|
||||
|
||||
def __len__(self):
|
||||
if self.sbbreakpoint:
|
||||
return int(self.sbbreakpoint.GetNumLocations())
|
||||
return 0
|
||||
|
||||
def __getitem__(self, key):
|
||||
if type(key) is int and key < len(self):
|
||||
return self.sbbreakpoint.GetLocationAtIndex(key)
|
||||
return None
|
||||
|
||||
def get_locations_access_object(self):
|
||||
'''An accessor function that returns a locations_access() object which allows lazy location access from a lldb.SBBreakpoint object.'''
|
||||
return self.locations_access (self)
|
||||
|
||||
def get_breakpoint_location_list(self):
|
||||
'''An accessor function that returns a list() that contains all locations in a lldb.SBBreakpoint object.'''
|
||||
locations = []
|
||||
accessor = self.get_locations_access_object()
|
||||
for idx in range(len(accessor)):
|
||||
locations.append(accessor[idx])
|
||||
return locations
|
||||
|
||||
def __iter__(self):
|
||||
'''Iterate over all breakpoint locations in a lldb.SBBreakpoint
|
||||
object.'''
|
||||
return lldb_iter(self, 'GetNumLocations', 'GetLocationAtIndex')
|
||||
|
||||
def __len__(self):
|
||||
'''Return the number of breakpoint locations in a lldb.SBBreakpoint
|
||||
object.'''
|
||||
return self.GetNumLocations()
|
||||
|
||||
locations = property(get_breakpoint_location_list, None, doc='''A read only property that returns a list() of lldb.SBBreakpointLocation objects for this breakpoint.''')
|
||||
location = property(get_locations_access_object, None, doc='''A read only property that returns an object that can access locations by index (not location ID) (location = bkpt.location[12]).''')
|
||||
id = property(GetID, None, doc='''A read only property that returns the ID of this breakpoint.''')
|
||||
enabled = property(IsEnabled, SetEnabled, doc='''A read/write property that configures whether this breakpoint is enabled or not.''')
|
||||
one_shot = property(IsOneShot, SetOneShot, doc='''A read/write property that configures whether this breakpoint is one-shot (deleted when hit) or not.''')
|
||||
num_locations = property(GetNumLocations, None, doc='''A read only property that returns the count of locations of this breakpoint.''')
|
||||
%}
|
||||
#endif
|
||||
|
||||
|
||||
};
|
||||
|
||||
class SBBreakpointListImpl;
|
||||
|
||||
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_bkpt);
|
||||
|
||||
bool AppendIfUnique(const SBBreakpoint &sb_bkpt);
|
||||
|
||||
void AppendByID (lldb::break_id_t id);
|
||||
|
||||
void Clear();
|
||||
private:
|
||||
std::shared_ptr<SBBreakpointListImpl> m_opaque_sp;
|
||||
};
|
||||
|
||||
} // namespace lldb
|
@ -0,0 +1,141 @@
|
||||
//===-- SWIG Interface for SBBreakpointLocation -----------------*- C++ -*-===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
namespace lldb {
|
||||
|
||||
%feature("docstring",
|
||||
"Represents one unique instance (by address) of a logical breakpoint.
|
||||
|
||||
A breakpoint location is defined by the breakpoint that produces it,
|
||||
and the address that resulted in this particular instantiation.
|
||||
Each breakpoint location has its settable options.
|
||||
|
||||
SBBreakpoint contains SBBreakpointLocation(s). See docstring of SBBreakpoint
|
||||
for retrieval of an SBBreakpointLocation from an SBBreakpoint."
|
||||
) SBBreakpointLocation;
|
||||
class SBBreakpointLocation
|
||||
{
|
||||
public:
|
||||
|
||||
SBBreakpointLocation ();
|
||||
|
||||
SBBreakpointLocation (const lldb::SBBreakpointLocation &rhs);
|
||||
|
||||
~SBBreakpointLocation ();
|
||||
|
||||
break_id_t
|
||||
GetID ();
|
||||
|
||||
bool
|
||||
IsValid() const;
|
||||
|
||||
explicit operator bool() const;
|
||||
|
||||
lldb::SBAddress
|
||||
GetAddress();
|
||||
|
||||
lldb::addr_t
|
||||
GetLoadAddress ();
|
||||
|
||||
void
|
||||
SetEnabled(bool enabled);
|
||||
|
||||
bool
|
||||
IsEnabled ();
|
||||
|
||||
uint32_t
|
||||
GetHitCount ();
|
||||
|
||||
uint32_t
|
||||
GetIgnoreCount ();
|
||||
|
||||
void
|
||||
SetIgnoreCount (uint32_t n);
|
||||
|
||||
%feature("docstring", "
|
||||
The breakpoint location stops only if the condition expression evaluates
|
||||
to true.") SetCondition;
|
||||
void
|
||||
SetCondition (const char *condition);
|
||||
|
||||
%feature("docstring", "
|
||||
Get the condition expression for the breakpoint location.") GetCondition;
|
||||
const char *
|
||||
GetCondition ();
|
||||
|
||||
bool GetAutoContinue();
|
||||
|
||||
void SetAutoContinue(bool auto_continue);
|
||||
|
||||
%feature("docstring", "
|
||||
Set the callback to the given Python function name.
|
||||
The function takes three arguments (frame, bp_loc, dict).") SetScriptCallbackFunction;
|
||||
void
|
||||
SetScriptCallbackFunction (const char *callback_function_name);
|
||||
|
||||
%feature("docstring", "
|
||||
Set the name of the script function to be called when the breakpoint is hit.
|
||||
To use this variant, the function should take (frame, bp_loc, extra_args, dict) and
|
||||
when the breakpoint is hit the extra_args will be passed to the callback function.") SetScriptCallbackFunction;
|
||||
SBError
|
||||
SetScriptCallbackFunction (const char *callback_function_name,
|
||||
SBStructuredData &extra_args);
|
||||
|
||||
%feature("docstring", "
|
||||
Provide the body for the script function to be called when the breakpoint location is hit.
|
||||
The body will be wrapped in a function, which be passed two arguments:
|
||||
'frame' - which holds the bottom-most SBFrame of the thread that hit the breakpoint
|
||||
'bpno' - which is the SBBreakpointLocation to which the callback was attached.
|
||||
|
||||
The error parameter is currently ignored, but will at some point hold the Python
|
||||
compilation diagnostics.
|
||||
Returns true if the body compiles successfully, false if not.") SetScriptCallbackBody;
|
||||
SBError
|
||||
SetScriptCallbackBody (const char *script_body_text);
|
||||
|
||||
void SetCommandLineCommands(SBStringList &commands);
|
||||
|
||||
bool GetCommandLineCommands(SBStringList &commands);
|
||||
|
||||
void
|
||||
SetThreadID (lldb::tid_t sb_thread_id);
|
||||
|
||||
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;
|
||||
|
||||
bool
|
||||
IsResolved ();
|
||||
|
||||
bool
|
||||
GetDescription (lldb::SBStream &description, DescriptionLevel level);
|
||||
|
||||
SBBreakpoint
|
||||
GetBreakpoint ();
|
||||
|
||||
STRING_EXTENSION_LEVEL(SBBreakpointLocation, lldb::eDescriptionLevelFull)
|
||||
};
|
||||
|
||||
} // namespace lldb
|
115
contrib/llvm-project/lldb/bindings/interface/SBBreakpointName.i
Normal file
115
contrib/llvm-project/lldb/bindings/interface/SBBreakpointName.i
Normal file
@ -0,0 +1,115 @@
|
||||
//===-- SWIG interface for SBBreakpointName.h -------------------*- C++ -*-===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
namespace lldb {
|
||||
%feature("docstring",
|
||||
"Represents a breakpoint name registered in a given SBTarget.
|
||||
|
||||
Breakpoint names provide a way to act on groups of breakpoints. When you add a
|
||||
name to a group of breakpoints, you can then use the name in all the command
|
||||
line lldb commands for that name. You can also configure the SBBreakpointName
|
||||
options and those options will be propagated to any SBBreakpoints currently
|
||||
using that name. Adding a name to a breakpoint will also apply any of the
|
||||
set options to that breakpoint.
|
||||
|
||||
You can also set permissions on a breakpoint name to disable listing, deleting
|
||||
and disabling breakpoints. That will disallow the given operation for breakpoints
|
||||
except when the breakpoint is mentioned by ID. So for instance deleting all the
|
||||
breakpoints won't delete breakpoints so marked."
|
||||
) SBBreakpointName;
|
||||
class LLDB_API SBBreakpointName {
|
||||
public:
|
||||
SBBreakpointName();
|
||||
|
||||
SBBreakpointName(SBTarget &target, const char *name);
|
||||
|
||||
SBBreakpointName(SBBreakpoint &bkpt, const char *name);
|
||||
|
||||
SBBreakpointName(const lldb::SBBreakpointName &rhs);
|
||||
|
||||
~SBBreakpointName();
|
||||
|
||||
// Tests to see if the opaque breakpoint object in this object matches the
|
||||
// opaque breakpoint object in "rhs".
|
||||
bool operator==(const lldb::SBBreakpointName &rhs);
|
||||
|
||||
bool operator!=(const lldb::SBBreakpointName &rhs);
|
||||
|
||||
explicit operator bool() const;
|
||||
|
||||
bool IsValid() const;
|
||||
|
||||
const char *GetName() const;
|
||||
|
||||
void SetEnabled(bool enable);
|
||||
|
||||
bool IsEnabled();
|
||||
|
||||
void SetOneShot(bool one_shot);
|
||||
|
||||
bool IsOneShot() const;
|
||||
|
||||
void SetIgnoreCount(uint32_t count);
|
||||
|
||||
uint32_t GetIgnoreCount() const;
|
||||
|
||||
void SetCondition(const char *condition);
|
||||
|
||||
const char *GetCondition();
|
||||
|
||||
void SetAutoContinue(bool auto_continue);
|
||||
|
||||
bool GetAutoContinue();
|
||||
|
||||
void SetThreadID(lldb::tid_t sb_thread_id);
|
||||
|
||||
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);
|
||||
|
||||
SBError
|
||||
SetScriptCallbackFunction (const char *callback_function_name,
|
||||
SBStructuredData &extra_args);
|
||||
|
||||
void SetCommandLineCommands(SBStringList &commands);
|
||||
|
||||
bool GetCommandLineCommands(SBStringList &commands);
|
||||
|
||||
SBError SetScriptCallbackBody(const char *script_body_text);
|
||||
|
||||
const char *GetHelpString() const;
|
||||
void SetHelpString(const char *help_string);
|
||||
|
||||
bool GetAllowList() const;
|
||||
void SetAllowList(bool value);
|
||||
|
||||
bool GetAllowDelete();
|
||||
void SetAllowDelete(bool value);
|
||||
|
||||
bool GetAllowDisable();
|
||||
void SetAllowDisable(bool value);
|
||||
|
||||
bool GetDescription(lldb::SBStream &description);
|
||||
|
||||
STRING_EXTENSION(SBBreakpointName)
|
||||
};
|
||||
|
||||
} // namespace lldb
|
||||
|
69
contrib/llvm-project/lldb/bindings/interface/SBBroadcaster.i
Normal file
69
contrib/llvm-project/lldb/bindings/interface/SBBroadcaster.i
Normal file
@ -0,0 +1,69 @@
|
||||
//===-- SWIG Interface for SBBroadcaster ------------------------*- C++ -*-===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
namespace lldb {
|
||||
|
||||
%feature("docstring",
|
||||
"Represents an entity which can broadcast events. A default broadcaster is
|
||||
associated with an SBCommandInterpreter, SBProcess, and SBTarget. For
|
||||
example, use
|
||||
|
||||
broadcaster = process.GetBroadcaster()
|
||||
|
||||
to retrieve the process's broadcaster.
|
||||
|
||||
See also SBEvent for example usage of interacting with a broadcaster."
|
||||
) SBBroadcaster;
|
||||
class SBBroadcaster
|
||||
{
|
||||
public:
|
||||
SBBroadcaster ();
|
||||
|
||||
SBBroadcaster (const char *name);
|
||||
|
||||
SBBroadcaster (const SBBroadcaster &rhs);
|
||||
|
||||
~SBBroadcaster();
|
||||
|
||||
bool
|
||||
IsValid () const;
|
||||
|
||||
explicit operator bool() const;
|
||||
|
||||
void
|
||||
Clear ();
|
||||
|
||||
void
|
||||
BroadcastEventByType (uint32_t event_type, bool unique = false);
|
||||
|
||||
void
|
||||
BroadcastEvent (const lldb::SBEvent &event, bool unique = false);
|
||||
|
||||
void
|
||||
AddInitialEventsToListener (const lldb::SBListener &listener, uint32_t requested_events);
|
||||
|
||||
uint32_t
|
||||
AddListener (const lldb::SBListener &listener, uint32_t event_mask);
|
||||
|
||||
const char *
|
||||
GetName () const;
|
||||
|
||||
bool
|
||||
EventTypeHasListeners (uint32_t event_type);
|
||||
|
||||
bool
|
||||
RemoveListener (const lldb::SBListener &listener, uint32_t event_mask = UINT32_MAX);
|
||||
|
||||
bool
|
||||
operator == (const lldb::SBBroadcaster &rhs) const;
|
||||
|
||||
bool
|
||||
operator != (const lldb::SBBroadcaster &rhs) const;
|
||||
};
|
||||
|
||||
} // namespace lldb
|
@ -0,0 +1,235 @@
|
||||
//===-- SWIG Interface for SBCommandInterpreter -----------------*- C++ -*-===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
namespace lldb {
|
||||
|
||||
%feature("docstring",
|
||||
"SBCommandInterpreterRunOptions controls how the RunCommandInterpreter runs the code it is fed.
|
||||
A default SBCommandInterpreterRunOptions object has:
|
||||
StopOnContinue: false
|
||||
StopOnError: false
|
||||
StopOnCrash: false
|
||||
EchoCommands: true
|
||||
PrintResults: true
|
||||
AddToHistory: true
|
||||
|
||||
") SBCommandInterpreterRunOptions;
|
||||
class SBCommandInterpreterRunOptions
|
||||
{
|
||||
friend class SBDebugger;
|
||||
public:
|
||||
SBCommandInterpreterRunOptions();
|
||||
~SBCommandInterpreterRunOptions();
|
||||
|
||||
bool
|
||||
GetStopOnContinue () const;
|
||||
|
||||
void
|
||||
SetStopOnContinue (bool);
|
||||
|
||||
bool
|
||||
GetStopOnError () const;
|
||||
|
||||
void
|
||||
SetStopOnError (bool);
|
||||
|
||||
bool
|
||||
GetStopOnCrash () const;
|
||||
|
||||
void
|
||||
SetStopOnCrash (bool);
|
||||
|
||||
bool
|
||||
GetEchoCommands () const;
|
||||
|
||||
void
|
||||
SetEchoCommands (bool);
|
||||
|
||||
bool
|
||||
GetPrintResults () const;
|
||||
|
||||
void
|
||||
SetPrintResults (bool);
|
||||
|
||||
bool
|
||||
GetAddToHistory () const;
|
||||
|
||||
void
|
||||
SetAddToHistory (bool);
|
||||
private:
|
||||
lldb_private::CommandInterpreterRunOptions *
|
||||
get () 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;
|
||||
};
|
||||
|
||||
%feature("docstring",
|
||||
"SBCommandInterpreter handles/interprets commands for lldb. You get the
|
||||
command interpreter from the SBDebugger instance. For example (from test/
|
||||
python_api/interpreter/TestCommandInterpreterAPI.py),
|
||||
|
||||
def command_interpreter_api(self):
|
||||
'''Test the SBCommandInterpreter APIs.'''
|
||||
exe = os.path.join(os.getcwd(), 'a.out')
|
||||
|
||||
# Create a target by the debugger.
|
||||
target = self.dbg.CreateTarget(exe)
|
||||
self.assertTrue(target, VALID_TARGET)
|
||||
|
||||
# Retrieve the associated command interpreter from our debugger.
|
||||
ci = self.dbg.GetCommandInterpreter()
|
||||
self.assertTrue(ci, VALID_COMMAND_INTERPRETER)
|
||||
|
||||
# Exercise some APIs....
|
||||
|
||||
self.assertTrue(ci.HasCommands())
|
||||
self.assertTrue(ci.HasAliases())
|
||||
self.assertTrue(ci.HasAliasOptions())
|
||||
self.assertTrue(ci.CommandExists('breakpoint'))
|
||||
self.assertTrue(ci.CommandExists('target'))
|
||||
self.assertTrue(ci.CommandExists('platform'))
|
||||
self.assertTrue(ci.AliasExists('file'))
|
||||
self.assertTrue(ci.AliasExists('run'))
|
||||
self.assertTrue(ci.AliasExists('bt'))
|
||||
|
||||
res = lldb.SBCommandReturnObject()
|
||||
ci.HandleCommand('breakpoint set -f main.c -l %d' % self.line, res)
|
||||
self.assertTrue(res.Succeeded())
|
||||
ci.HandleCommand('process launch', res)
|
||||
self.assertTrue(res.Succeeded())
|
||||
|
||||
process = ci.GetProcess()
|
||||
self.assertTrue(process)
|
||||
|
||||
...
|
||||
|
||||
The HandleCommand() instance method takes two args: the command string and
|
||||
an SBCommandReturnObject instance which encapsulates the result of command
|
||||
execution.") SBCommandInterpreter;
|
||||
class SBCommandInterpreter
|
||||
{
|
||||
public:
|
||||
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 ();
|
||||
|
||||
static const char *
|
||||
GetArgumentTypeAsCString (const lldb::CommandArgumentType arg_type);
|
||||
|
||||
static const char *
|
||||
GetArgumentDescriptionAsCString (const lldb::CommandArgumentType arg_type);
|
||||
|
||||
static bool
|
||||
EventIsCommandInterpreterEvent (const lldb::SBEvent &event);
|
||||
|
||||
bool
|
||||
IsValid() const;
|
||||
|
||||
explicit operator bool() const;
|
||||
|
||||
const char *
|
||||
GetIOHandlerControlSequence(char ch);
|
||||
|
||||
bool
|
||||
GetPromptOnQuit();
|
||||
|
||||
void
|
||||
SetPromptOnQuit(bool b);
|
||||
|
||||
void
|
||||
AllowExitCodeOnQuit(bool b);
|
||||
|
||||
bool
|
||||
HasCustomQuitExitCode();
|
||||
|
||||
int
|
||||
GetQuitStatus();
|
||||
|
||||
void
|
||||
ResolveCommand(const char *command_line, SBCommandReturnObject &result);
|
||||
|
||||
bool
|
||||
CommandExists (const char *cmd);
|
||||
|
||||
bool
|
||||
AliasExists (const char *cmd);
|
||||
|
||||
lldb::SBBroadcaster
|
||||
GetBroadcaster ();
|
||||
|
||||
static const char *
|
||||
GetBroadcasterClass ();
|
||||
|
||||
bool
|
||||
HasCommands ();
|
||||
|
||||
bool
|
||||
HasAliases ();
|
||||
|
||||
bool
|
||||
HasAliasOptions ();
|
||||
|
||||
lldb::SBProcess
|
||||
GetProcess ();
|
||||
|
||||
lldb::SBDebugger
|
||||
GetDebugger ();
|
||||
|
||||
void
|
||||
SourceInitFileInHomeDirectory (lldb::SBCommandReturnObject &result);
|
||||
|
||||
void
|
||||
SourceInitFileInCurrentWorkingDirectory (lldb::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);
|
||||
|
||||
int
|
||||
HandleCompletion (const char *current_line,
|
||||
uint32_t cursor_pos,
|
||||
int match_start_point,
|
||||
int max_return_elements,
|
||||
lldb::SBStringList &matches);
|
||||
|
||||
int
|
||||
HandleCompletionWithDescriptions (const char *current_line,
|
||||
uint32_t cursor_pos,
|
||||
int match_start_point,
|
||||
int max_return_elements,
|
||||
lldb::SBStringList &matches,
|
||||
lldb::SBStringList &descriptions);
|
||||
bool
|
||||
IsActive ();
|
||||
|
||||
bool
|
||||
WasInterrupted () const;
|
||||
};
|
||||
|
||||
} // namespace lldb
|
@ -0,0 +1,127 @@
|
||||
//===-- SWIG Interface for SBCommandReturnObject ----------------*- C++ -*-===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
namespace lldb {
|
||||
|
||||
%feature("docstring",
|
||||
"Represents a container which holds the result from command execution.
|
||||
It works with SBCommandInterpreter.HandleCommand() to encapsulate the result
|
||||
of command execution.
|
||||
|
||||
See SBCommandInterpreter for example usage of SBCommandReturnObject."
|
||||
) SBCommandReturnObject;
|
||||
class SBCommandReturnObject
|
||||
{
|
||||
public:
|
||||
|
||||
SBCommandReturnObject ();
|
||||
|
||||
SBCommandReturnObject (const lldb::SBCommandReturnObject &rhs);
|
||||
|
||||
~SBCommandReturnObject ();
|
||||
|
||||
bool
|
||||
IsValid() const;
|
||||
|
||||
explicit operator bool() const;
|
||||
|
||||
const char *
|
||||
GetOutput ();
|
||||
|
||||
const char *
|
||||
GetError ();
|
||||
|
||||
size_t
|
||||
GetOutputSize ();
|
||||
|
||||
size_t
|
||||
GetErrorSize ();
|
||||
|
||||
const char *
|
||||
GetOutput (bool only_if_no_immediate);
|
||||
|
||||
const char *
|
||||
GetError (bool if_no_immediate);
|
||||
|
||||
size_t
|
||||
PutOutput (lldb::SBFile file);
|
||||
|
||||
size_t
|
||||
PutError (lldb::SBFile file);
|
||||
|
||||
size_t
|
||||
PutOutput (lldb::FileSP BORROWED);
|
||||
|
||||
size_t
|
||||
PutError (lldb::FileSP BORROWED);
|
||||
|
||||
void
|
||||
Clear();
|
||||
|
||||
void
|
||||
SetStatus (lldb::ReturnStatus status);
|
||||
|
||||
void
|
||||
SetError (lldb::SBError &error,
|
||||
const char *fallback_error_cstr = NULL);
|
||||
|
||||
void
|
||||
SetError (const char *error_cstr);
|
||||
|
||||
lldb::ReturnStatus
|
||||
GetStatus();
|
||||
|
||||
bool
|
||||
Succeeded ();
|
||||
|
||||
bool
|
||||
HasResult ();
|
||||
|
||||
void
|
||||
AppendMessage (const char *message);
|
||||
|
||||
void
|
||||
AppendWarning (const char *message);
|
||||
|
||||
bool
|
||||
GetDescription (lldb::SBStream &description);
|
||||
|
||||
void SetImmediateOutputFile(lldb::SBFile file);
|
||||
void SetImmediateErrorFile(lldb::SBFile file);
|
||||
void SetImmediateOutputFile(lldb::FileSP BORROWED);
|
||||
void SetImmediateErrorFile(lldb::FileSP BORROWED);
|
||||
|
||||
STRING_EXTENSION(SBCommandReturnObject)
|
||||
|
||||
%extend {
|
||||
// transfer_ownership does nothing, and is here for compatibility with
|
||||
// old scripts. Ownership is tracked by reference count in the ordinary way.
|
||||
|
||||
void SetImmediateOutputFile(lldb::FileSP BORROWED, bool transfer_ownership) {
|
||||
self->SetImmediateOutputFile(BORROWED);
|
||||
}
|
||||
void SetImmediateErrorFile(lldb::FileSP BORROWED, bool transfer_ownership) {
|
||||
self->SetImmediateErrorFile(BORROWED);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
PutCString(const char* string, int len);
|
||||
|
||||
// wrapping the variadic Printf() with a plain Print()
|
||||
// because it is hard to support varargs in SWIG bridgings
|
||||
%extend {
|
||||
void Print (const char* str)
|
||||
{
|
||||
self->Printf("%s", str);
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
} // namespace lldb
|
@ -0,0 +1,83 @@
|
||||
//===-- SWIG Interface for SBCommunication ----------------------*- C++ -*-===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
namespace lldb {
|
||||
|
||||
class SBCommunication
|
||||
{
|
||||
public:
|
||||
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);
|
||||
|
||||
SBCommunication ();
|
||||
SBCommunication (const char * broadcaster_name);
|
||||
~SBCommunication ();
|
||||
|
||||
|
||||
bool
|
||||
IsValid () const;
|
||||
|
||||
explicit operator bool() const;
|
||||
|
||||
lldb::SBBroadcaster
|
||||
GetBroadcaster ();
|
||||
|
||||
static const char *GetBroadcasterClass();
|
||||
|
||||
lldb::ConnectionStatus
|
||||
AdoptFileDesriptor (int fd, bool owns_fd);
|
||||
|
||||
lldb::ConnectionStatus
|
||||
Connect (const char *url);
|
||||
|
||||
lldb::ConnectionStatus
|
||||
Disconnect ();
|
||||
|
||||
bool
|
||||
IsConnected () const;
|
||||
|
||||
bool
|
||||
GetCloseOnEOF ();
|
||||
|
||||
void
|
||||
SetCloseOnEOF (bool b);
|
||||
|
||||
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);
|
||||
|
||||
bool
|
||||
ReadThreadStart ();
|
||||
|
||||
bool
|
||||
ReadThreadStop ();
|
||||
|
||||
bool
|
||||
ReadThreadIsRunning ();
|
||||
|
||||
bool
|
||||
SetReadThreadBytesReceivedCallback (ReadThreadBytesReceived callback,
|
||||
void *callback_baton);
|
||||
};
|
||||
|
||||
} // namespace lldb
|
138
contrib/llvm-project/lldb/bindings/interface/SBCompileUnit.i
Normal file
138
contrib/llvm-project/lldb/bindings/interface/SBCompileUnit.i
Normal file
@ -0,0 +1,138 @@
|
||||
//===-- SWIG Interface for SBCompileUnit ------------------------*- C++ -*-===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
namespace lldb {
|
||||
|
||||
%feature("docstring",
|
||||
"Represents a compilation unit, or compiled source file.
|
||||
|
||||
SBCompileUnit supports line entry iteration. For example,
|
||||
|
||||
# Now get the SBSymbolContext from this frame. We want everything. :-)
|
||||
context = frame0.GetSymbolContext(lldb.eSymbolContextEverything)
|
||||
...
|
||||
|
||||
compileUnit = context.GetCompileUnit()
|
||||
|
||||
for lineEntry in compileUnit:
|
||||
print('line entry: %s:%d' % (str(lineEntry.GetFileSpec()),
|
||||
lineEntry.GetLine()))
|
||||
print('start addr: %s' % str(lineEntry.GetStartAddress()))
|
||||
print('end addr: %s' % str(lineEntry.GetEndAddress()))
|
||||
|
||||
produces:
|
||||
|
||||
line entry: /Volumes/data/lldb/svn/trunk/test/python_api/symbol-context/main.c:20
|
||||
start addr: a.out[0x100000d98]
|
||||
end addr: a.out[0x100000da3]
|
||||
line entry: /Volumes/data/lldb/svn/trunk/test/python_api/symbol-context/main.c:21
|
||||
start addr: a.out[0x100000da3]
|
||||
end addr: a.out[0x100000da9]
|
||||
line entry: /Volumes/data/lldb/svn/trunk/test/python_api/symbol-context/main.c:22
|
||||
start addr: a.out[0x100000da9]
|
||||
end addr: a.out[0x100000db6]
|
||||
line entry: /Volumes/data/lldb/svn/trunk/test/python_api/symbol-context/main.c:23
|
||||
start addr: a.out[0x100000db6]
|
||||
end addr: a.out[0x100000dbc]
|
||||
...
|
||||
|
||||
See also SBSymbolContext and SBLineEntry"
|
||||
) SBCompileUnit;
|
||||
class SBCompileUnit
|
||||
{
|
||||
public:
|
||||
|
||||
SBCompileUnit ();
|
||||
|
||||
SBCompileUnit (const lldb::SBCompileUnit &rhs);
|
||||
|
||||
~SBCompileUnit ();
|
||||
|
||||
bool
|
||||
IsValid () const;
|
||||
|
||||
explicit operator bool() const;
|
||||
|
||||
lldb::SBFileSpec
|
||||
GetFileSpec () const;
|
||||
|
||||
uint32_t
|
||||
GetNumLineEntries () 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,
|
||||
bool exact) const;
|
||||
|
||||
SBFileSpec
|
||||
GetSupportFileAtIndex (uint32_t idx) const;
|
||||
|
||||
uint32_t
|
||||
GetNumSupportFiles () const;
|
||||
|
||||
uint32_t
|
||||
FindSupportFileIndex (uint32_t start_idx, const SBFileSpec &sb_file, bool full);
|
||||
|
||||
%feature("docstring", "
|
||||
Get all types matching 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 type_mask") GetTypes;
|
||||
lldb::SBTypeList
|
||||
GetTypes (uint32_t type_mask = lldb::eTypeClassAny);
|
||||
|
||||
lldb::LanguageType
|
||||
GetLanguage ();
|
||||
|
||||
bool
|
||||
GetDescription (lldb::SBStream &description);
|
||||
|
||||
bool
|
||||
operator == (const lldb::SBCompileUnit &rhs) const;
|
||||
|
||||
bool
|
||||
operator != (const lldb::SBCompileUnit &rhs) const;
|
||||
|
||||
STRING_EXTENSION(SBCompileUnit)
|
||||
|
||||
#ifdef SWIGPYTHON
|
||||
%pythoncode %{
|
||||
def __iter__(self):
|
||||
'''Iterate over all line entries in a lldb.SBCompileUnit object.'''
|
||||
return lldb_iter(self, 'GetNumLineEntries', 'GetLineEntryAtIndex')
|
||||
|
||||
def __len__(self):
|
||||
'''Return the number of line entries in a lldb.SBCompileUnit
|
||||
object.'''
|
||||
return self.GetNumLineEntries()
|
||||
|
||||
file = property(GetFileSpec, None, doc='''A read only property that returns the same result an lldb object that represents the source file (lldb.SBFileSpec) for the compile unit.''')
|
||||
num_line_entries = property(GetNumLineEntries, None, doc='''A read only property that returns the number of line entries in a compile unit as an integer.''')
|
||||
%}
|
||||
#endif
|
||||
};
|
||||
|
||||
} // namespace lldb
|
297
contrib/llvm-project/lldb/bindings/interface/SBData.i
Normal file
297
contrib/llvm-project/lldb/bindings/interface/SBData.i
Normal file
@ -0,0 +1,297 @@
|
||||
//===-- SWIG Interface for SBData -------------------------------*- C++ -*-===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
|
||||
namespace lldb {
|
||||
|
||||
class SBData
|
||||
{
|
||||
public:
|
||||
|
||||
SBData ();
|
||||
|
||||
SBData (const SBData &rhs);
|
||||
|
||||
~SBData ();
|
||||
|
||||
uint8_t
|
||||
GetAddressByteSize ();
|
||||
|
||||
void
|
||||
SetAddressByteSize (uint8_t addr_byte_size);
|
||||
|
||||
void
|
||||
Clear ();
|
||||
|
||||
bool
|
||||
IsValid();
|
||||
|
||||
explicit operator bool() const;
|
||||
|
||||
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);
|
||||
|
||||
bool
|
||||
GetDescription (lldb::SBStream &description, lldb::addr_t base_addr);
|
||||
|
||||
size_t
|
||||
ReadRawData (lldb::SBError& error,
|
||||
lldb::offset_t offset,
|
||||
void *buf,
|
||||
size_t size);
|
||||
|
||||
void
|
||||
SetData (lldb::SBError& error, const void *buf, size_t size, lldb::ByteOrder endian, uint8_t addr_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);
|
||||
|
||||
STRING_EXTENSION(SBData)
|
||||
|
||||
#ifdef SWIGPYTHON
|
||||
%pythoncode %{
|
||||
|
||||
class read_data_helper:
|
||||
def __init__(self, sbdata, readerfunc, item_size):
|
||||
self.sbdata = sbdata
|
||||
self.readerfunc = readerfunc
|
||||
self.item_size = item_size
|
||||
def __getitem__(self,key):
|
||||
if isinstance(key,slice):
|
||||
list = []
|
||||
for x in range(*key.indices(self.__len__())):
|
||||
list.append(self.__getitem__(x))
|
||||
return list
|
||||
if not (isinstance(key,six.integer_types)):
|
||||
raise TypeError('must be int')
|
||||
key = key * self.item_size # SBData uses byte-based indexes, but we want to use itemsize-based indexes here
|
||||
error = SBError()
|
||||
my_data = self.readerfunc(self.sbdata,error,key)
|
||||
if error.Fail():
|
||||
raise IndexError(error.GetCString())
|
||||
else:
|
||||
return my_data
|
||||
def __len__(self):
|
||||
return int(self.sbdata.GetByteSize()/self.item_size)
|
||||
def all(self):
|
||||
return self[0:len(self)]
|
||||
|
||||
@classmethod
|
||||
def CreateDataFromInt (cls, value, size = None, target = None, ptr_size = None, endian = None):
|
||||
import sys
|
||||
lldbmodule = sys.modules[cls.__module__]
|
||||
lldbdict = lldbmodule.__dict__
|
||||
if 'target' in lldbdict:
|
||||
lldbtarget = lldbdict['target']
|
||||
else:
|
||||
lldbtarget = None
|
||||
if target == None and lldbtarget != None and lldbtarget.IsValid():
|
||||
target = lldbtarget
|
||||
if ptr_size == None:
|
||||
if target and target.IsValid():
|
||||
ptr_size = target.addr_size
|
||||
else:
|
||||
ptr_size = 8
|
||||
if endian == None:
|
||||
if target and target.IsValid():
|
||||
endian = target.byte_order
|
||||
else:
|
||||
endian = lldbdict['eByteOrderLittle']
|
||||
if size == None:
|
||||
if value > 2147483647:
|
||||
size = 8
|
||||
elif value < -2147483648:
|
||||
size = 8
|
||||
elif value > 4294967295:
|
||||
size = 8
|
||||
else:
|
||||
size = 4
|
||||
if size == 4:
|
||||
if value < 0:
|
||||
return SBData().CreateDataFromSInt32Array(endian, ptr_size, [value])
|
||||
return SBData().CreateDataFromUInt32Array(endian, ptr_size, [value])
|
||||
if size == 8:
|
||||
if value < 0:
|
||||
return SBData().CreateDataFromSInt64Array(endian, ptr_size, [value])
|
||||
return SBData().CreateDataFromUInt64Array(endian, ptr_size, [value])
|
||||
return None
|
||||
|
||||
def _make_helper(self, sbdata, getfunc, itemsize):
|
||||
return self.read_data_helper(sbdata, getfunc, itemsize)
|
||||
|
||||
def _make_helper_uint8(self):
|
||||
return self._make_helper(self, SBData.GetUnsignedInt8, 1)
|
||||
|
||||
def _make_helper_uint16(self):
|
||||
return self._make_helper(self, SBData.GetUnsignedInt16, 2)
|
||||
|
||||
def _make_helper_uint32(self):
|
||||
return self._make_helper(self, SBData.GetUnsignedInt32, 4)
|
||||
|
||||
def _make_helper_uint64(self):
|
||||
return self._make_helper(self, SBData.GetUnsignedInt64, 8)
|
||||
|
||||
def _make_helper_sint8(self):
|
||||
return self._make_helper(self, SBData.GetSignedInt8, 1)
|
||||
|
||||
def _make_helper_sint16(self):
|
||||
return self._make_helper(self, SBData.GetSignedInt16, 2)
|
||||
|
||||
def _make_helper_sint32(self):
|
||||
return self._make_helper(self, SBData.GetSignedInt32, 4)
|
||||
|
||||
def _make_helper_sint64(self):
|
||||
return self._make_helper(self, SBData.GetSignedInt64, 8)
|
||||
|
||||
def _make_helper_float(self):
|
||||
return self._make_helper(self, SBData.GetFloat, 4)
|
||||
|
||||
def _make_helper_double(self):
|
||||
return self._make_helper(self, SBData.GetDouble, 8)
|
||||
|
||||
def _read_all_uint8(self):
|
||||
return self._make_helper_uint8().all()
|
||||
|
||||
def _read_all_uint16(self):
|
||||
return self._make_helper_uint16().all()
|
||||
|
||||
def _read_all_uint32(self):
|
||||
return self._make_helper_uint32().all()
|
||||
|
||||
def _read_all_uint64(self):
|
||||
return self._make_helper_uint64().all()
|
||||
|
||||
def _read_all_sint8(self):
|
||||
return self._make_helper_sint8().all()
|
||||
|
||||
def _read_all_sint16(self):
|
||||
return self._make_helper_sint16().all()
|
||||
|
||||
def _read_all_sint32(self):
|
||||
return self._make_helper_sint32().all()
|
||||
|
||||
def _read_all_sint64(self):
|
||||
return self._make_helper_sint64().all()
|
||||
|
||||
def _read_all_float(self):
|
||||
return self._make_helper_float().all()
|
||||
|
||||
def _read_all_double(self):
|
||||
return self._make_helper_double().all()
|
||||
|
||||
uint8 = property(_make_helper_uint8, None, doc='''A read only property that returns an array-like object out of which you can read uint8 values.''')
|
||||
uint16 = property(_make_helper_uint16, None, doc='''A read only property that returns an array-like object out of which you can read uint16 values.''')
|
||||
uint32 = property(_make_helper_uint32, None, doc='''A read only property that returns an array-like object out of which you can read uint32 values.''')
|
||||
uint64 = property(_make_helper_uint64, None, doc='''A read only property that returns an array-like object out of which you can read uint64 values.''')
|
||||
sint8 = property(_make_helper_sint8, None, doc='''A read only property that returns an array-like object out of which you can read sint8 values.''')
|
||||
sint16 = property(_make_helper_sint16, None, doc='''A read only property that returns an array-like object out of which you can read sint16 values.''')
|
||||
sint32 = property(_make_helper_sint32, None, doc='''A read only property that returns an array-like object out of which you can read sint32 values.''')
|
||||
sint64 = property(_make_helper_sint64, None, doc='''A read only property that returns an array-like object out of which you can read sint64 values.''')
|
||||
float = property(_make_helper_float, None, doc='''A read only property that returns an array-like object out of which you can read float values.''')
|
||||
double = property(_make_helper_double, None, doc='''A read only property that returns an array-like object out of which you can read double values.''')
|
||||
uint8s = property(_read_all_uint8, None, doc='''A read only property that returns an array with all the contents of this SBData represented as uint8 values.''')
|
||||
uint16s = property(_read_all_uint16, None, doc='''A read only property that returns an array with all the contents of this SBData represented as uint16 values.''')
|
||||
uint32s = property(_read_all_uint32, None, doc='''A read only property that returns an array with all the contents of this SBData represented as uint32 values.''')
|
||||
uint64s = property(_read_all_uint64, None, doc='''A read only property that returns an array with all the contents of this SBData represented as uint64 values.''')
|
||||
sint8s = property(_read_all_sint8, None, doc='''A read only property that returns an array with all the contents of this SBData represented as sint8 values.''')
|
||||
sint16s = property(_read_all_sint16, None, doc='''A read only property that returns an array with all the contents of this SBData represented as sint16 values.''')
|
||||
sint32s = property(_read_all_sint32, None, doc='''A read only property that returns an array with all the contents of this SBData represented as sint32 values.''')
|
||||
sint64s = property(_read_all_sint64, None, doc='''A read only property that returns an array with all the contents of this SBData represented as sint64 values.''')
|
||||
floats = property(_read_all_float, None, doc='''A read only property that returns an array with all the contents of this SBData represented as float values.''')
|
||||
doubles = property(_read_all_double, None, doc='''A read only property that returns an array with all the contents of this SBData represented as double values.''')
|
||||
byte_order = property(GetByteOrder, SetByteOrder, doc='''A read/write property getting and setting the endianness of this SBData (data.byte_order = lldb.eByteOrderLittle).''')
|
||||
size = property(GetByteSize, None, doc='''A read only property that returns the size the same result as GetByteSize().''')
|
||||
%}
|
||||
#endif
|
||||
|
||||
};
|
||||
|
||||
} // namespace lldb
|
535
contrib/llvm-project/lldb/bindings/interface/SBDebugger.i
Normal file
535
contrib/llvm-project/lldb/bindings/interface/SBDebugger.i
Normal file
@ -0,0 +1,535 @@
|
||||
//===-- SWIG Interface for SBDebugger ---------------------------*- C++ -*-===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
namespace lldb {
|
||||
|
||||
%feature("docstring",
|
||||
"SBDebugger is the primordial object that creates SBTargets and provides
|
||||
access to them. It also manages the overall debugging experiences.
|
||||
|
||||
For example (from example/disasm.py),
|
||||
|
||||
import lldb
|
||||
import os
|
||||
import sys
|
||||
|
||||
def disassemble_instructions (insts):
|
||||
for i in insts:
|
||||
print i
|
||||
|
||||
...
|
||||
|
||||
# Create a new debugger instance
|
||||
debugger = lldb.SBDebugger.Create()
|
||||
|
||||
# When we step or continue, don't return from the function until the process
|
||||
# stops. We do this by setting the async mode to false.
|
||||
debugger.SetAsync (False)
|
||||
|
||||
# Create a target from a file and arch
|
||||
print('Creating a target for \'%s\'' % exe)
|
||||
|
||||
target = debugger.CreateTargetWithFileAndArch (exe, lldb.LLDB_ARCH_DEFAULT)
|
||||
|
||||
if target:
|
||||
# If the target is valid set a breakpoint at main
|
||||
main_bp = target.BreakpointCreateByName (fname, target.GetExecutable().GetFilename());
|
||||
|
||||
print main_bp
|
||||
|
||||
# Launch the process. Since we specified synchronous mode, we won't return
|
||||
# from this function until we hit the breakpoint at main
|
||||
process = target.LaunchSimple (None, None, os.getcwd())
|
||||
|
||||
# Make sure the launch went ok
|
||||
if process:
|
||||
# Print some simple process info
|
||||
state = process.GetState ()
|
||||
print process
|
||||
if state == lldb.eStateStopped:
|
||||
# Get the first thread
|
||||
thread = process.GetThreadAtIndex (0)
|
||||
if thread:
|
||||
# Print some simple thread info
|
||||
print thread
|
||||
# Get the first frame
|
||||
frame = thread.GetFrameAtIndex (0)
|
||||
if frame:
|
||||
# Print some simple frame info
|
||||
print frame
|
||||
function = frame.GetFunction()
|
||||
# See if we have debug info (a function)
|
||||
if function:
|
||||
# We do have a function, print some info for the function
|
||||
print function
|
||||
# Now get all instructions for this function and print them
|
||||
insts = function.GetInstructions(target)
|
||||
disassemble_instructions (insts)
|
||||
else:
|
||||
# See if we have a symbol in the symbol table for where we stopped
|
||||
symbol = frame.GetSymbol();
|
||||
if symbol:
|
||||
# We do have a symbol, print some info for the symbol
|
||||
print symbol
|
||||
# Now get all instructions for this symbol and print them
|
||||
insts = symbol.GetInstructions(target)
|
||||
disassemble_instructions (insts)
|
||||
|
||||
registerList = frame.GetRegisters()
|
||||
print('Frame registers (size of register set = %d):' % registerList.GetSize())
|
||||
for value in registerList:
|
||||
#print value
|
||||
print('%s (number of children = %d):' % (value.GetName(), value.GetNumChildren()))
|
||||
for child in value:
|
||||
print('Name: ', child.GetName(), ' Value: ', child.GetValue())
|
||||
|
||||
print('Hit the breakpoint at main, enter to continue and wait for program to exit or \'Ctrl-D\'/\'quit\' to terminate the program')
|
||||
next = sys.stdin.readline()
|
||||
if not next or next.rstrip('\n') == 'quit':
|
||||
print('Terminating the inferior process...')
|
||||
process.Kill()
|
||||
else:
|
||||
# Now continue to the program exit
|
||||
process.Continue()
|
||||
# When we return from the above function we will hopefully be at the
|
||||
# program exit. Print out some process info
|
||||
print process
|
||||
elif state == lldb.eStateExited:
|
||||
print('Didn\'t hit the breakpoint at main, program has exited...')
|
||||
else:
|
||||
print('Unexpected process state: %s, killing process...' % debugger.StateAsCString (state))
|
||||
process.Kill()
|
||||
|
||||
Sometimes you need to create an empty target that will get filled in later. The most common use for this
|
||||
is to attach to a process by name or pid where you don't know the executable up front. The most convenient way
|
||||
to do this is:
|
||||
|
||||
target = debugger.CreateTarget('')
|
||||
error = lldb.SBError()
|
||||
process = target.AttachToProcessWithName(debugger.GetListener(), 'PROCESS_NAME', False, error)
|
||||
|
||||
or the equivalent arguments for AttachToProcessWithID.") SBDebugger;
|
||||
class SBDebugger
|
||||
{
|
||||
public:
|
||||
|
||||
static void
|
||||
Initialize();
|
||||
|
||||
static SBError
|
||||
InitializeWithErrorHandling();
|
||||
|
||||
static void
|
||||
Terminate();
|
||||
|
||||
static lldb::SBDebugger
|
||||
Create();
|
||||
|
||||
static lldb::SBDebugger
|
||||
Create(bool source_init_files);
|
||||
|
||||
static lldb::SBDebugger
|
||||
Create(bool source_init_files, lldb::LogOutputCallback log_callback, void *baton);
|
||||
|
||||
static void
|
||||
Destroy (lldb::SBDebugger &debugger);
|
||||
|
||||
static void
|
||||
MemoryPressureDetected();
|
||||
|
||||
SBDebugger();
|
||||
|
||||
SBDebugger(const lldb::SBDebugger &rhs);
|
||||
|
||||
~SBDebugger();
|
||||
|
||||
bool
|
||||
IsValid() const;
|
||||
|
||||
explicit operator bool() const;
|
||||
|
||||
void
|
||||
Clear ();
|
||||
|
||||
void
|
||||
SetAsync (bool b);
|
||||
|
||||
bool
|
||||
GetAsync ();
|
||||
|
||||
void
|
||||
SkipLLDBInitFiles (bool b);
|
||||
|
||||
#ifdef SWIGPYTHON
|
||||
%pythoncode %{
|
||||
def SetOutputFileHandle(self, file, transfer_ownership):
|
||||
"DEPRECATED, use SetOutputFile"
|
||||
if file is None:
|
||||
import sys
|
||||
file = sys.stdout
|
||||
self.SetOutputFile(SBFile.Create(file, borrow=True))
|
||||
|
||||
def SetInputFileHandle(self, file, transfer_ownership):
|
||||
"DEPRECATED, use SetInputFile"
|
||||
if file is None:
|
||||
import sys
|
||||
file = sys.stdin
|
||||
self.SetInputFile(SBFile.Create(file, borrow=True))
|
||||
|
||||
def SetErrorFileHandle(self, file, transfer_ownership):
|
||||
"DEPRECATED, use SetErrorFile"
|
||||
if file is None:
|
||||
import sys
|
||||
file = sys.stderr
|
||||
self.SetErrorFile(SBFile.Create(file, borrow=True))
|
||||
%}
|
||||
#endif
|
||||
|
||||
|
||||
%extend {
|
||||
|
||||
lldb::FileSP GetInputFileHandle() {
|
||||
return self->GetInputFile().GetFile();
|
||||
}
|
||||
|
||||
lldb::FileSP GetOutputFileHandle() {
|
||||
return self->GetOutputFile().GetFile();
|
||||
}
|
||||
|
||||
lldb::FileSP GetErrorFileHandle() {
|
||||
return self->GetErrorFile().GetFile();
|
||||
}
|
||||
}
|
||||
|
||||
SBError
|
||||
SetInputFile (SBFile file);
|
||||
|
||||
SBError
|
||||
SetOutputFile (SBFile file);
|
||||
|
||||
SBError
|
||||
SetErrorFile (SBFile file);
|
||||
|
||||
SBError
|
||||
SetInputFile (FileSP file);
|
||||
|
||||
SBError
|
||||
SetOutputFile (FileSP file);
|
||||
|
||||
SBError
|
||||
SetErrorFile (FileSP file);
|
||||
|
||||
SBFile
|
||||
GetInputFile ();
|
||||
|
||||
SBFile
|
||||
GetOutputFile ();
|
||||
|
||||
SBFile
|
||||
GetErrorFile ();
|
||||
|
||||
lldb::SBCommandInterpreter
|
||||
GetCommandInterpreter ();
|
||||
|
||||
void
|
||||
HandleCommand (const char *command);
|
||||
|
||||
lldb::SBListener
|
||||
GetListener ();
|
||||
|
||||
void
|
||||
HandleProcessEvent (const lldb::SBProcess &process,
|
||||
const lldb::SBEvent &event,
|
||||
SBFile out,
|
||||
SBFile err);
|
||||
|
||||
void
|
||||
HandleProcessEvent (const lldb::SBProcess &process,
|
||||
const lldb::SBEvent &event,
|
||||
FileSP BORROWED,
|
||||
FileSP BORROWED);
|
||||
|
||||
lldb::SBTarget
|
||||
CreateTarget (const char *filename,
|
||||
const char *target_triple,
|
||||
const char *platform_name,
|
||||
bool add_dependent_modules,
|
||||
lldb::SBError& sb_error);
|
||||
|
||||
lldb::SBTarget
|
||||
CreateTargetWithFileAndTargetTriple (const char *filename,
|
||||
const char *target_triple);
|
||||
|
||||
lldb::SBTarget
|
||||
CreateTargetWithFileAndArch (const char *filename,
|
||||
const char *archname);
|
||||
|
||||
lldb::SBTarget
|
||||
CreateTarget (const char *filename);
|
||||
|
||||
%feature("docstring",
|
||||
"The dummy target holds breakpoints and breakpoint names that will prime newly created targets."
|
||||
) GetDummyTarget;
|
||||
lldb::SBTarget GetDummyTarget();
|
||||
|
||||
%feature("docstring",
|
||||
"Return true if target is deleted from the target list of the debugger."
|
||||
) DeleteTarget;
|
||||
bool
|
||||
DeleteTarget (lldb::SBTarget &target);
|
||||
|
||||
lldb::SBTarget
|
||||
GetTargetAtIndex (uint32_t idx);
|
||||
|
||||
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 (lldb::SBTarget &target);
|
||||
|
||||
lldb::SBPlatform
|
||||
GetSelectedPlatform();
|
||||
|
||||
void
|
||||
SetSelectedPlatform(lldb::SBPlatform &platform);
|
||||
|
||||
%feature("docstring",
|
||||
"Get the number of currently active platforms."
|
||||
) GetNumPlatforms;
|
||||
uint32_t
|
||||
GetNumPlatforms ();
|
||||
|
||||
%feature("docstring",
|
||||
"Get one of the currently active platforms."
|
||||
) GetPlatformAtIndex;
|
||||
lldb::SBPlatform
|
||||
GetPlatformAtIndex (uint32_t idx);
|
||||
|
||||
%feature("docstring",
|
||||
"Get the number of available platforms."
|
||||
) GetNumAvailablePlatforms;
|
||||
uint32_t
|
||||
GetNumAvailablePlatforms ();
|
||||
|
||||
%feature("docstring", "
|
||||
Get the name and description of one of the available platforms.
|
||||
|
||||
@param idx Zero-based index of the platform for which info should be
|
||||
retrieved, must be less than the value returned by
|
||||
GetNumAvailablePlatforms().") GetAvailablePlatformInfoAtIndex;
|
||||
lldb::SBStructuredData
|
||||
GetAvailablePlatformInfoAtIndex (uint32_t idx);
|
||||
|
||||
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 SBStructuredData GetBuildConfiguration();
|
||||
|
||||
static bool
|
||||
StateIsRunningState (lldb::StateType state);
|
||||
|
||||
static bool
|
||||
StateIsStoppedState (lldb::StateType state);
|
||||
|
||||
bool
|
||||
EnableLog (const char *channel, const char ** types);
|
||||
|
||||
void
|
||||
SetLoggingCallback (lldb::LogOutputCallback log_callback, void *baton);
|
||||
|
||||
void
|
||||
DispatchInput (const void *data, size_t data_len);
|
||||
|
||||
void
|
||||
DispatchInputInterrupt ();
|
||||
|
||||
void
|
||||
DispatchInputEndOfFile ();
|
||||
|
||||
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);
|
||||
|
||||
const char *
|
||||
GetReproducerPath() const;
|
||||
|
||||
lldb::ScriptLanguage
|
||||
GetScriptLanguage() const;
|
||||
|
||||
void
|
||||
SetScriptLanguage (lldb::ScriptLanguage script_lang);
|
||||
|
||||
bool
|
||||
GetCloseInputOnEOF () const;
|
||||
|
||||
void
|
||||
SetCloseInputOnEOF (bool b);
|
||||
|
||||
lldb::SBTypeCategory
|
||||
GetCategory (const char* category_name);
|
||||
|
||||
SBTypeCategory
|
||||
GetCategory (lldb::LanguageType lang_type);
|
||||
|
||||
lldb::SBTypeCategory
|
||||
CreateCategory (const char* category_name);
|
||||
|
||||
bool
|
||||
DeleteCategory (const char* category_name);
|
||||
|
||||
uint32_t
|
||||
GetNumCategories ();
|
||||
|
||||
lldb::SBTypeCategory
|
||||
GetCategoryAtIndex (uint32_t);
|
||||
|
||||
lldb::SBTypeCategory
|
||||
GetDefaultCategory();
|
||||
|
||||
lldb::SBTypeFormat
|
||||
GetFormatForType (lldb::SBTypeNameSpecifier);
|
||||
|
||||
lldb::SBTypeSummary
|
||||
GetSummaryForType (lldb::SBTypeNameSpecifier);
|
||||
|
||||
lldb::SBTypeFilter
|
||||
GetFilterForType (lldb::SBTypeNameSpecifier);
|
||||
|
||||
lldb::SBTypeSynthetic
|
||||
GetSyntheticForType (lldb::SBTypeNameSpecifier);
|
||||
|
||||
STRING_EXTENSION(SBDebugger)
|
||||
|
||||
%feature("docstring",
|
||||
"Launch a command interpreter session. Commands are read from standard input or
|
||||
from the input handle specified for the debugger object. Output/errors are
|
||||
similarly redirected to standard output/error or the configured handles.
|
||||
|
||||
@param[in] auto_handle_events If true, automatically handle resulting events.
|
||||
@param[in] spawn_thread If true, start a new thread for IO handling.
|
||||
@param[in] options Parameter collection of type SBCommandInterpreterRunOptions.
|
||||
@param[in] num_errors Initial error counter.
|
||||
@param[in] quit_requested Initial quit request flag.
|
||||
@param[in] stopped_for_crash Initial crash flag.
|
||||
|
||||
@return
|
||||
A tuple with the number of errors encountered by the interpreter, a boolean
|
||||
indicating whether quitting the interpreter was requested and another boolean
|
||||
set to True in case of a crash.
|
||||
|
||||
Example:
|
||||
|
||||
# Start an interactive lldb session from a script (with a valid debugger object
|
||||
# created beforehand):
|
||||
n_errors, quit_requested, has_crashed = debugger.RunCommandInterpreter(True,
|
||||
False, lldb.SBCommandInterpreterRunOptions(), 0, False, False)") RunCommandInterpreter;
|
||||
%apply int& INOUT { int& num_errors };
|
||||
%apply bool& INOUT { bool& quit_requested };
|
||||
%apply bool& INOUT { bool& stopped_for_crash };
|
||||
void
|
||||
RunCommandInterpreter (bool auto_handle_events,
|
||||
bool spawn_thread,
|
||||
SBCommandInterpreterRunOptions &options,
|
||||
int &num_errors,
|
||||
bool &quit_requested,
|
||||
bool &stopped_for_crash);
|
||||
|
||||
lldb::SBError
|
||||
RunREPL (lldb::LanguageType language, const char *repl_options);
|
||||
|
||||
#ifdef SWIGPYTHON
|
||||
%pythoncode%{
|
||||
def __iter__(self):
|
||||
'''Iterate over all targets in a lldb.SBDebugger object.'''
|
||||
return lldb_iter(self, 'GetNumTargets', 'GetTargetAtIndex')
|
||||
|
||||
def __len__(self):
|
||||
'''Return the number of targets in a lldb.SBDebugger object.'''
|
||||
return self.GetNumTargets()
|
||||
%}
|
||||
#endif
|
||||
|
||||
}; // class SBDebugger
|
||||
|
||||
} // namespace lldb
|
67
contrib/llvm-project/lldb/bindings/interface/SBDeclaration.i
Normal file
67
contrib/llvm-project/lldb/bindings/interface/SBDeclaration.i
Normal file
@ -0,0 +1,67 @@
|
||||
//===-- SWIG Interface for SBDeclaration --------------------------*- C++ -*-===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
namespace lldb {
|
||||
|
||||
%feature("docstring",
|
||||
"Specifies an association with a line and column for a variable."
|
||||
) SBDeclaration;
|
||||
class SBDeclaration
|
||||
{
|
||||
public:
|
||||
|
||||
SBDeclaration ();
|
||||
|
||||
SBDeclaration (const lldb::SBDeclaration &rhs);
|
||||
|
||||
~SBDeclaration ();
|
||||
|
||||
bool
|
||||
IsValid () const;
|
||||
|
||||
explicit operator bool() const;
|
||||
|
||||
lldb::SBFileSpec
|
||||
GetFileSpec () const;
|
||||
|
||||
uint32_t
|
||||
GetLine () const;
|
||||
|
||||
uint32_t
|
||||
GetColumn () const;
|
||||
|
||||
bool
|
||||
GetDescription (lldb::SBStream &description);
|
||||
|
||||
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;
|
||||
|
||||
STRING_EXTENSION(SBDeclaration)
|
||||
|
||||
#ifdef SWIGPYTHON
|
||||
%pythoncode %{
|
||||
file = property(GetFileSpec, None, doc='''A read only property that returns an lldb object that represents the file (lldb.SBFileSpec) for this line entry.''')
|
||||
line = property(GetLine, None, doc='''A read only property that returns the 1 based line number for this line entry, a return value of zero indicates that no line information is available.''')
|
||||
column = property(GetColumn, None, doc='''A read only property that returns the 1 based column number for this line entry, a return value of zero indicates that no column information is available.''')
|
||||
%}
|
||||
#endif
|
||||
};
|
||||
|
||||
} // namespace lldb
|
122
contrib/llvm-project/lldb/bindings/interface/SBError.i
Normal file
122
contrib/llvm-project/lldb/bindings/interface/SBError.i
Normal file
@ -0,0 +1,122 @@
|
||||
//===-- SWIG Interface for SBError ------------------------------*- C++ -*-===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
namespace lldb {
|
||||
|
||||
%feature("docstring",
|
||||
"Represents a container for holding any error code.
|
||||
|
||||
For example (from test/python_api/hello_world/TestHelloWorld.py),
|
||||
|
||||
def hello_world_attach_with_id_api(self):
|
||||
'''Create target, spawn a process, and attach to it by id.'''
|
||||
|
||||
target = self.dbg.CreateTarget(self.exe)
|
||||
|
||||
# Spawn a new process and don't display the stdout if not in TraceOn() mode.
|
||||
import subprocess
|
||||
popen = subprocess.Popen([self.exe, 'abc', 'xyz'],
|
||||
stdout = open(os.devnull, 'w') if not self.TraceOn() else None)
|
||||
|
||||
listener = lldb.SBListener('my.attach.listener')
|
||||
error = lldb.SBError()
|
||||
process = target.AttachToProcessWithID(listener, popen.pid, error)
|
||||
|
||||
self.assertTrue(error.Success() and process, PROCESS_IS_VALID)
|
||||
|
||||
# Let's check the stack traces of the attached process.
|
||||
import lldbutil
|
||||
stacktraces = lldbutil.print_stacktraces(process, string_buffer=True)
|
||||
self.expect(stacktraces, exe=False,
|
||||
substrs = ['main.c:%d' % self.line2,
|
||||
'(int)argc=3'])
|
||||
|
||||
listener = lldb.SBListener('my.attach.listener')
|
||||
error = lldb.SBError()
|
||||
process = target.AttachToProcessWithID(listener, popen.pid, error)
|
||||
|
||||
self.assertTrue(error.Success() and process, PROCESS_IS_VALID)
|
||||
|
||||
checks that after the attach, there is no error condition by asserting
|
||||
that error.Success() is True and we get back a valid process object.
|
||||
|
||||
And (from test/python_api/event/TestEvent.py),
|
||||
|
||||
# Now launch the process, and do not stop at entry point.
|
||||
error = lldb.SBError()
|
||||
process = target.Launch(listener, None, None, None, None, None, None, 0, False, error)
|
||||
self.assertTrue(error.Success() and process, PROCESS_IS_VALID)
|
||||
|
||||
checks that after calling the target.Launch() method there's no error
|
||||
condition and we get back a void process object.") SBError;
|
||||
|
||||
class SBError {
|
||||
public:
|
||||
SBError ();
|
||||
|
||||
SBError (const lldb::SBError &rhs);
|
||||
|
||||
~SBError();
|
||||
|
||||
const char *
|
||||
GetCString () const;
|
||||
|
||||
void
|
||||
Clear ();
|
||||
|
||||
bool
|
||||
Fail () const;
|
||||
|
||||
bool
|
||||
Success () const;
|
||||
|
||||
uint32_t
|
||||
GetError () const;
|
||||
|
||||
lldb::ErrorType
|
||||
GetType () const;
|
||||
|
||||
void
|
||||
SetError (uint32_t err, lldb::ErrorType type);
|
||||
|
||||
void
|
||||
SetErrorToErrno ();
|
||||
|
||||
void
|
||||
SetErrorToGenericError ();
|
||||
|
||||
void
|
||||
SetErrorString (const char *err_str);
|
||||
|
||||
%varargs(3, char *str = NULL) SetErrorStringWithFormat;
|
||||
int
|
||||
SetErrorStringWithFormat (const char *format, ...);
|
||||
|
||||
bool
|
||||
IsValid () const;
|
||||
|
||||
explicit operator bool() const;
|
||||
|
||||
bool
|
||||
GetDescription (lldb::SBStream &description);
|
||||
|
||||
STRING_EXTENSION(SBError)
|
||||
|
||||
#ifdef SWIGPYTHON
|
||||
%pythoncode %{
|
||||
value = property(GetError, None, doc='''A read only property that returns the same result as GetError().''')
|
||||
fail = property(Fail, None, doc='''A read only property that returns the same result as Fail().''')
|
||||
success = property(Success, None, doc='''A read only property that returns the same result as Success().''')
|
||||
description = property(GetCString, None, doc='''A read only property that returns the same result as GetCString().''')
|
||||
type = property(GetType, None, doc='''A read only property that returns the same result as GetType().''')
|
||||
%}
|
||||
#endif
|
||||
|
||||
};
|
||||
|
||||
} // namespace lldb
|
153
contrib/llvm-project/lldb/bindings/interface/SBEvent.i
Normal file
153
contrib/llvm-project/lldb/bindings/interface/SBEvent.i
Normal file
@ -0,0 +1,153 @@
|
||||
//===-- SWIG Interface for SBEvent ------------------------------*- C++ -*-===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
namespace lldb {
|
||||
|
||||
class SBBroadcaster;
|
||||
|
||||
%feature("docstring",
|
||||
"API clients can register to receive events.
|
||||
|
||||
For example, check out the following output:
|
||||
|
||||
Try wait for event...
|
||||
Event description: 0x103d0bb70 Event: broadcaster = 0x1009c8410, type = 0x00000001, data = { process = 0x1009c8400 (pid = 21528), state = running}
|
||||
Event data flavor: Process::ProcessEventData
|
||||
Process state: running
|
||||
|
||||
Try wait for event...
|
||||
Event description: 0x103a700a0 Event: broadcaster = 0x1009c8410, type = 0x00000001, data = { process = 0x1009c8400 (pid = 21528), state = stopped}
|
||||
Event data flavor: Process::ProcessEventData
|
||||
Process state: stopped
|
||||
|
||||
Try wait for event...
|
||||
Event description: 0x103d0d4a0 Event: broadcaster = 0x1009c8410, type = 0x00000001, data = { process = 0x1009c8400 (pid = 21528), state = exited}
|
||||
Event data flavor: Process::ProcessEventData
|
||||
Process state: exited
|
||||
|
||||
Try wait for event...
|
||||
timeout occurred waiting for event...
|
||||
|
||||
from test/python_api/event/TestEventspy:
|
||||
|
||||
def do_listen_for_and_print_event(self):
|
||||
'''Create a listener and use SBEvent API to print the events received.'''
|
||||
exe = os.path.join(os.getcwd(), 'a.out')
|
||||
|
||||
# Create a target by the debugger.
|
||||
target = self.dbg.CreateTarget(exe)
|
||||
self.assertTrue(target, VALID_TARGET)
|
||||
|
||||
# Now create a breakpoint on main.c by name 'c'.
|
||||
breakpoint = target.BreakpointCreateByName('c', 'a.out')
|
||||
|
||||
# Now launch the process, and do not stop at the entry point.
|
||||
process = target.LaunchSimple(None, None, os.getcwd())
|
||||
self.assertTrue(process.GetState() == lldb.eStateStopped,
|
||||
PROCESS_STOPPED)
|
||||
|
||||
# Get a handle on the process's broadcaster.
|
||||
broadcaster = process.GetBroadcaster()
|
||||
|
||||
# Create an empty event object.
|
||||
event = lldb.SBEvent()
|
||||
|
||||
# Create a listener object and register with the broadcaster.
|
||||
listener = lldb.SBListener('my listener')
|
||||
rc = broadcaster.AddListener(listener, lldb.SBProcess.eBroadcastBitStateChanged)
|
||||
self.assertTrue(rc, 'AddListener successfully retruns')
|
||||
|
||||
traceOn = self.TraceOn()
|
||||
if traceOn:
|
||||
lldbutil.print_stacktraces(process)
|
||||
|
||||
# Create MyListeningThread class to wait for any kind of event.
|
||||
import threading
|
||||
class MyListeningThread(threading.Thread):
|
||||
def run(self):
|
||||
count = 0
|
||||
# Let's only try at most 4 times to retrieve any kind of event.
|
||||
# After that, the thread exits.
|
||||
while not count > 3:
|
||||
if traceOn:
|
||||
print('Try wait for event...')
|
||||
if listener.WaitForEventForBroadcasterWithType(5,
|
||||
broadcaster,
|
||||
lldb.SBProcess.eBroadcastBitStateChanged,
|
||||
event):
|
||||
if traceOn:
|
||||
desc = lldbutil.get_description(event))
|
||||
print('Event description:', desc)
|
||||
print('Event data flavor:', event.GetDataFlavor())
|
||||
print('Process state:', lldbutil.state_type_to_str(process.GetState()))
|
||||
print()
|
||||
else:
|
||||
if traceOn:
|
||||
print 'timeout occurred waiting for event...'
|
||||
count = count + 1
|
||||
return
|
||||
|
||||
# Let's start the listening thread to retrieve the events.
|
||||
my_thread = MyListeningThread()
|
||||
my_thread.start()
|
||||
|
||||
# Use Python API to continue the process. The listening thread should be
|
||||
# able to receive the state changed events.
|
||||
process.Continue()
|
||||
|
||||
# Use Python API to kill the process. The listening thread should be
|
||||
# able to receive the state changed event, too.
|
||||
process.Kill()
|
||||
|
||||
# Wait until the 'MyListeningThread' terminates.
|
||||
my_thread.join()") SBEvent;
|
||||
class SBEvent
|
||||
{
|
||||
public:
|
||||
SBEvent();
|
||||
|
||||
SBEvent (const lldb::SBEvent &rhs);
|
||||
|
||||
%feature("autodoc",
|
||||
"__init__(self, int type, str data) -> SBEvent (make an event that contains a C string)"
|
||||
) SBEvent;
|
||||
SBEvent (uint32_t event, const char *cstr, uint32_t cstr_len);
|
||||
|
||||
~SBEvent();
|
||||
|
||||
bool
|
||||
IsValid() const;
|
||||
|
||||
explicit operator bool() const;
|
||||
|
||||
const char *
|
||||
GetDataFlavor ();
|
||||
|
||||
uint32_t
|
||||
GetType () const;
|
||||
|
||||
lldb::SBBroadcaster
|
||||
GetBroadcaster () const;
|
||||
|
||||
const char *
|
||||
GetBroadcasterClass () const;
|
||||
|
||||
bool
|
||||
BroadcasterMatchesRef (const lldb::SBBroadcaster &broadcaster);
|
||||
|
||||
void
|
||||
Clear();
|
||||
|
||||
static const char *
|
||||
GetCStringFromEvent (const lldb::SBEvent &event);
|
||||
|
||||
bool
|
||||
GetDescription (lldb::SBStream &description) const;
|
||||
};
|
||||
|
||||
} // namespace lldb
|
@ -0,0 +1,51 @@
|
||||
//===-- SWIG Interface for SBExecutionContext ---------------------*- C++ -*-===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
namespace lldb {
|
||||
|
||||
class SBExecutionContext
|
||||
{
|
||||
public:
|
||||
SBExecutionContext();
|
||||
|
||||
SBExecutionContext (const lldb::SBExecutionContext &rhs);
|
||||
|
||||
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();
|
||||
|
||||
SBTarget
|
||||
GetTarget () const;
|
||||
|
||||
SBProcess
|
||||
GetProcess () const;
|
||||
|
||||
SBThread
|
||||
GetThread () const;
|
||||
|
||||
SBFrame
|
||||
GetFrame () const;
|
||||
|
||||
#ifdef SWIGPYTHON
|
||||
%pythoncode %{
|
||||
target = property(GetTarget, None, doc='''A read only property that returns the same result as GetTarget().''')
|
||||
process = property(GetProcess, None, doc='''A read only property that returns the same result as GetProcess().''')
|
||||
thread = property(GetThread, None, doc='''A read only property that returns the same result as GetThread().''')
|
||||
frame = property(GetFrame, None, doc='''A read only property that returns the same result as GetFrame().''')
|
||||
%}
|
||||
#endif
|
||||
|
||||
};
|
||||
|
||||
} // namespace lldb
|
@ -0,0 +1,158 @@
|
||||
//===-- SWIG interface for SBExpressionOptions -----------------------------------------------*- C++ -*-===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
namespace lldb {
|
||||
|
||||
%feature("docstring",
|
||||
"A container for options to use when evaluating expressions."
|
||||
) SBExpressionOptions;
|
||||
|
||||
class SBExpressionOptions
|
||||
{
|
||||
friend class SBFrame;
|
||||
friend class SBValue;
|
||||
|
||||
public:
|
||||
SBExpressionOptions();
|
||||
|
||||
SBExpressionOptions (const lldb::SBExpressionOptions &rhs);
|
||||
|
||||
~SBExpressionOptions();
|
||||
|
||||
bool
|
||||
GetCoerceResultToId () const;
|
||||
|
||||
%feature("docstring", "Sets whether to coerce the expression result to ObjC id type after evaluation.") SetCoerceResultToId;
|
||||
|
||||
void
|
||||
SetCoerceResultToId (bool coerce = true);
|
||||
|
||||
bool
|
||||
GetUnwindOnError () const;
|
||||
|
||||
%feature("docstring", "Sets whether to unwind the expression stack on error.") SetUnwindOnError;
|
||||
|
||||
void
|
||||
SetUnwindOnError (bool unwind = true);
|
||||
|
||||
bool
|
||||
GetIgnoreBreakpoints () const;
|
||||
|
||||
%feature("docstring", "Sets whether to ignore breakpoint hits while running expressions.") SetUnwindOnError;
|
||||
|
||||
void
|
||||
SetIgnoreBreakpoints (bool ignore = true);
|
||||
|
||||
lldb::DynamicValueType
|
||||
GetFetchDynamicValue () const;
|
||||
|
||||
%feature("docstring", "Sets whether to cast the expression result to its dynamic type.") SetFetchDynamicValue;
|
||||
|
||||
void
|
||||
SetFetchDynamicValue (lldb::DynamicValueType dynamic = lldb::eDynamicCanRunTarget);
|
||||
|
||||
uint32_t
|
||||
GetTimeoutInMicroSeconds () const;
|
||||
|
||||
%feature("docstring", "Sets the timeout in microseconds to run the expression for. If try all threads is set to true and the expression doesn't complete within the specified timeout, all threads will be resumed for the same timeout to see if the expresson will finish.") SetTimeoutInMicroSeconds;
|
||||
void
|
||||
SetTimeoutInMicroSeconds (uint32_t timeout = 0);
|
||||
|
||||
uint32_t
|
||||
GetOneThreadTimeoutInMicroSeconds () const;
|
||||
|
||||
%feature("docstring", "Sets the timeout in microseconds to run the expression on one thread before either timing out or trying all threads.") SetTimeoutInMicroSeconds;
|
||||
void
|
||||
SetOneThreadTimeoutInMicroSeconds (uint32_t timeout = 0);
|
||||
|
||||
bool
|
||||
GetTryAllThreads () const;
|
||||
|
||||
%feature("docstring", "Sets whether to run all threads if the expression does not complete on one thread.") SetTryAllThreads;
|
||||
void
|
||||
SetTryAllThreads (bool run_others = true);
|
||||
|
||||
bool
|
||||
GetStopOthers () const;
|
||||
|
||||
%feature("docstring", "Sets whether to stop other threads at all while running expressins. If false, TryAllThreads does nothing.") SetTryAllThreads;
|
||||
void
|
||||
SetStopOthers (bool stop_others = true);
|
||||
|
||||
bool
|
||||
GetTrapExceptions () const;
|
||||
|
||||
%feature("docstring", "Sets whether to abort expression evaluation if an exception is thrown while executing. Don't set this to false unless you know the function you are calling traps all exceptions itself.") SetTryAllThreads;
|
||||
void
|
||||
SetTrapExceptions (bool trap_exceptions = true);
|
||||
|
||||
%feature ("docstring", "Sets the language that LLDB should assume the expression is written in") SetLanguage;
|
||||
void
|
||||
SetLanguage (lldb::LanguageType language);
|
||||
|
||||
bool
|
||||
GetGenerateDebugInfo ();
|
||||
|
||||
%feature("docstring", "Sets whether to generate debug information for the expression and also controls if a SBModule is generated.") SetGenerateDebugInfo;
|
||||
void
|
||||
SetGenerateDebugInfo (bool b = true);
|
||||
|
||||
bool
|
||||
GetSuppressPersistentResult ();
|
||||
|
||||
%feature("docstring", "Sets whether to produce a persistent result that can be used in future expressions.") SetSuppressPersistentResult;
|
||||
void
|
||||
SetSuppressPersistentResult (bool b = false);
|
||||
|
||||
|
||||
%feature("docstring", "Gets the prefix to use for this expression.") GetPrefix;
|
||||
const char *
|
||||
GetPrefix () const;
|
||||
|
||||
%feature("docstring", "Sets the prefix to use for this expression. This prefix gets inserted after the 'target.expr-prefix' prefix contents, but before the wrapped expression function body.") SetPrefix;
|
||||
void
|
||||
SetPrefix (const char *prefix);
|
||||
|
||||
%feature("docstring", "Sets whether to auto-apply fix-it hints to the expression being evaluated.") SetAutoApplyFixIts;
|
||||
void
|
||||
SetAutoApplyFixIts(bool b = true);
|
||||
|
||||
%feature("docstring", "Gets whether to auto-apply fix-it hints to an expression.") GetAutoApplyFixIts;
|
||||
bool
|
||||
GetAutoApplyFixIts();
|
||||
|
||||
bool
|
||||
GetTopLevel();
|
||||
|
||||
void
|
||||
SetTopLevel(bool b = true);
|
||||
|
||||
%feature("docstring", "Gets whether to JIT an expression if it cannot be interpreted.") GetAllowJIT;
|
||||
bool
|
||||
GetAllowJIT();
|
||||
|
||||
%feature("docstring", "Sets whether to JIT an expression if it cannot be interpreted.") SetAllowJIT;
|
||||
void
|
||||
SetAllowJIT(bool allow);
|
||||
|
||||
protected:
|
||||
|
||||
SBExpressionOptions (lldb_private::EvaluateExpressionOptions &expression_options);
|
||||
|
||||
lldb_private::EvaluateExpressionOptions *
|
||||
get () const;
|
||||
|
||||
lldb_private::EvaluateExpressionOptions &
|
||||
ref () const;
|
||||
|
||||
private:
|
||||
// This auto_pointer is made in the constructor and is always valid.
|
||||
mutable std::unique_ptr<lldb_private::EvaluateExpressionOptions> m_opaque_ap;
|
||||
};
|
||||
|
||||
} // namespace lldb
|
101
contrib/llvm-project/lldb/bindings/interface/SBFile.i
Normal file
101
contrib/llvm-project/lldb/bindings/interface/SBFile.i
Normal file
@ -0,0 +1,101 @@
|
||||
//===-- SWIG Interface for SBFile -----------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
namespace lldb {
|
||||
|
||||
%feature("docstring",
|
||||
"Represents a file."
|
||||
) SBFile;
|
||||
|
||||
class SBFile
|
||||
{
|
||||
public:
|
||||
|
||||
SBFile();
|
||||
|
||||
%feature("docstring", "
|
||||
Initialize a SBFile from a file descriptor. mode is
|
||||
'r', 'r+', or 'w', like fdopen.");
|
||||
SBFile(int fd, const char *mode, bool transfer_ownership);
|
||||
|
||||
%feature("docstring", "initialize a SBFile from a python file object");
|
||||
SBFile(FileSP file);
|
||||
|
||||
%extend {
|
||||
static lldb::SBFile MakeBorrowed(lldb::FileSP BORROWED) {
|
||||
return lldb::SBFile(BORROWED);
|
||||
}
|
||||
static lldb::SBFile MakeForcingIOMethods(lldb::FileSP FORCE_IO_METHODS) {
|
||||
return lldb::SBFile(FORCE_IO_METHODS);
|
||||
}
|
||||
static lldb::SBFile MakeBorrowedForcingIOMethods(lldb::FileSP BORROWED_FORCE_IO_METHODS) {
|
||||
return lldb::SBFile(BORROWED_FORCE_IO_METHODS);
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef SWIGPYTHON
|
||||
%pythoncode {
|
||||
@classmethod
|
||||
def Create(cls, file, borrow=False, force_io_methods=False):
|
||||
"""
|
||||
Create a SBFile from a python file object, with options.
|
||||
|
||||
If borrow is set then the underlying file will
|
||||
not be closed when the SBFile is closed or destroyed.
|
||||
|
||||
If force_scripting_io is set then the python read/write
|
||||
methods will be called even if a file descriptor is available.
|
||||
"""
|
||||
if borrow:
|
||||
if force_io_methods:
|
||||
return cls.MakeBorrowedForcingIOMethods(file)
|
||||
else:
|
||||
return cls.MakeBorrowed(file)
|
||||
else:
|
||||
if force_io_methods:
|
||||
return cls.MakeForcingIOMethods(file)
|
||||
else:
|
||||
return cls(file)
|
||||
}
|
||||
#endif
|
||||
|
||||
~SBFile ();
|
||||
|
||||
%feature("autodoc", "Read(buffer) -> SBError, bytes_read") Read;
|
||||
SBError Read(uint8_t *buf, size_t num_bytes, size_t *OUTPUT);
|
||||
|
||||
%feature("autodoc", "Write(buffer) -> SBError, written_read") Write;
|
||||
SBError Write(const uint8_t *buf, size_t num_bytes, size_t *OUTPUT);
|
||||
|
||||
void Flush();
|
||||
|
||||
bool IsValid() const;
|
||||
|
||||
operator bool() const;
|
||||
|
||||
SBError Close();
|
||||
|
||||
%feature("docstring", "
|
||||
Convert this SBFile into a python io.IOBase file object.
|
||||
|
||||
If the SBFile is itself a wrapper around a python file object,
|
||||
this will return that original object.
|
||||
|
||||
The file returned from here should be considered borrowed,
|
||||
in the sense that you may read and write to it, and flush it,
|
||||
etc, but you should not close it. If you want to close the
|
||||
SBFile, call SBFile.Close().
|
||||
|
||||
If there is no underlying python file to unwrap, GetFile will
|
||||
use the file descriptor, if availble to create a new python
|
||||
file object using `open(fd, mode=..., closefd=False)`
|
||||
");
|
||||
FileSP GetFile();
|
||||
};
|
||||
|
||||
} // namespace lldb
|
107
contrib/llvm-project/lldb/bindings/interface/SBFileSpec.i
Normal file
107
contrib/llvm-project/lldb/bindings/interface/SBFileSpec.i
Normal file
@ -0,0 +1,107 @@
|
||||
//===-- SWIG Interface for SBFileSpec ---------------------------*- C++ -*-===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
namespace lldb {
|
||||
|
||||
%feature("docstring",
|
||||
"Represents a file specification that divides the path into a directory and
|
||||
basename. The string values of the paths are put into uniqued string pools
|
||||
for fast comparisons and efficient memory usage.
|
||||
|
||||
For example, the following code
|
||||
|
||||
lineEntry = context.GetLineEntry()
|
||||
self.expect(lineEntry.GetFileSpec().GetDirectory(), 'The line entry should have the correct directory',
|
||||
exe=False,
|
||||
substrs = [self.mydir])
|
||||
self.expect(lineEntry.GetFileSpec().GetFilename(), 'The line entry should have the correct filename',
|
||||
exe=False,
|
||||
substrs = ['main.c'])
|
||||
self.assertTrue(lineEntry.GetLine() == self.line,
|
||||
'The line entry's line number should match ')
|
||||
|
||||
gets the line entry from the symbol context when a thread is stopped.
|
||||
It gets the file spec corresponding to the line entry and checks that
|
||||
the filename and the directory matches what we expect.") SBFileSpec;
|
||||
class SBFileSpec
|
||||
{
|
||||
public:
|
||||
SBFileSpec ();
|
||||
|
||||
SBFileSpec (const lldb::SBFileSpec &rhs);
|
||||
|
||||
SBFileSpec (const char *path);// Deprecated, use SBFileSpec (const char *path, bool resolve)
|
||||
|
||||
SBFileSpec (const char *path, bool resolve);
|
||||
|
||||
~SBFileSpec ();
|
||||
|
||||
bool operator==(const SBFileSpec &rhs) const;
|
||||
|
||||
bool operator!=(const SBFileSpec &rhs) const;
|
||||
|
||||
bool
|
||||
IsValid() const;
|
||||
|
||||
explicit operator bool() const;
|
||||
|
||||
bool
|
||||
Exists () const;
|
||||
|
||||
bool
|
||||
ResolveExecutableLocation ();
|
||||
|
||||
const char *
|
||||
GetFilename() const;
|
||||
|
||||
const char *
|
||||
GetDirectory() const;
|
||||
|
||||
void
|
||||
SetFilename(const char *filename);
|
||||
|
||||
void
|
||||
SetDirectory(const char *directory);
|
||||
|
||||
uint32_t
|
||||
GetPath (char *dst_path, size_t dst_len) const;
|
||||
|
||||
static int
|
||||
ResolvePath (const char *src_path, char *dst_path, size_t dst_len);
|
||||
|
||||
bool
|
||||
GetDescription (lldb::SBStream &description) const;
|
||||
|
||||
void
|
||||
AppendPathComponent (const char *file_or_directory);
|
||||
|
||||
STRING_EXTENSION(SBFileSpec)
|
||||
|
||||
#ifdef SWIGPYTHON
|
||||
%pythoncode %{
|
||||
def __get_fullpath__(self):
|
||||
spec_dir = self.GetDirectory()
|
||||
spec_file = self.GetFilename()
|
||||
if spec_dir and spec_file:
|
||||
return '%s/%s' % (spec_dir, spec_file)
|
||||
elif spec_dir:
|
||||
return spec_dir
|
||||
elif spec_file:
|
||||
return spec_file
|
||||
return None
|
||||
|
||||
fullpath = property(__get_fullpath__, None, doc='''A read only property that returns the fullpath as a python string.''')
|
||||
basename = property(GetFilename, None, doc='''A read only property that returns the path basename as a python string.''')
|
||||
dirname = property(GetDirectory, None, doc='''A read only property that returns the path directory name as a python string.''')
|
||||
exists = property(Exists, None, doc='''A read only property that returns a boolean value that indicates if the file exists.''')
|
||||
%}
|
||||
#endif
|
||||
|
||||
};
|
||||
|
||||
} // namespace lldb
|
@ -0,0 +1,44 @@
|
||||
//===-- SWIG Interface for SBFileSpecList -----------------------*- C++ -*-===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
namespace lldb {
|
||||
|
||||
class SBFileSpecList
|
||||
{
|
||||
public:
|
||||
SBFileSpecList ();
|
||||
|
||||
SBFileSpecList (const lldb::SBFileSpecList &rhs);
|
||||
|
||||
~SBFileSpecList ();
|
||||
|
||||
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;
|
||||
|
||||
};
|
||||
|
||||
|
||||
} // namespace lldb
|
364
contrib/llvm-project/lldb/bindings/interface/SBFrame.i
Normal file
364
contrib/llvm-project/lldb/bindings/interface/SBFrame.i
Normal file
@ -0,0 +1,364 @@
|
||||
//===-- SWIG Interface for SBFrame ------------------------------*- C++ -*-===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
namespace lldb {
|
||||
|
||||
%feature("docstring",
|
||||
"Represents one of the stack frames associated with a thread.
|
||||
SBThread contains SBFrame(s). For example (from test/lldbutil.py),
|
||||
|
||||
def print_stacktrace(thread, string_buffer = False):
|
||||
'''Prints a simple stack trace of this thread.'''
|
||||
|
||||
...
|
||||
|
||||
for i in range(depth):
|
||||
frame = thread.GetFrameAtIndex(i)
|
||||
function = frame.GetFunction()
|
||||
|
||||
load_addr = addrs[i].GetLoadAddress(target)
|
||||
if not function:
|
||||
file_addr = addrs[i].GetFileAddress()
|
||||
start_addr = frame.GetSymbol().GetStartAddress().GetFileAddress()
|
||||
symbol_offset = file_addr - start_addr
|
||||
print >> output, ' frame #{num}: {addr:#016x} {mod}`{symbol} + {offset}'.format(
|
||||
num=i, addr=load_addr, mod=mods[i], symbol=symbols[i], offset=symbol_offset)
|
||||
else:
|
||||
print >> output, ' frame #{num}: {addr:#016x} {mod}`{func} at {file}:{line} {args}'.format(
|
||||
num=i, addr=load_addr, mod=mods[i],
|
||||
func='%s [inlined]' % funcs[i] if frame.IsInlined() else funcs[i],
|
||||
file=files[i], line=lines[i],
|
||||
args=get_args_as_string(frame, showFuncName=False) if not frame.IsInlined() else '()')
|
||||
|
||||
...
|
||||
|
||||
And,
|
||||
|
||||
for frame in thread:
|
||||
print frame
|
||||
|
||||
See also SBThread."
|
||||
) SBFrame;
|
||||
class SBFrame
|
||||
{
|
||||
public:
|
||||
SBFrame ();
|
||||
|
||||
SBFrame (const lldb::SBFrame &rhs);
|
||||
|
||||
~SBFrame();
|
||||
|
||||
bool
|
||||
IsEqual (const lldb::SBFrame &rhs) const;
|
||||
|
||||
bool
|
||||
IsValid() const;
|
||||
|
||||
explicit operator bool() const;
|
||||
|
||||
uint32_t
|
||||
GetFrameID () const;
|
||||
|
||||
%feature("docstring", "
|
||||
Get the Canonical Frame Address for this stack frame.
|
||||
This is the DWARF standard's definition of a CFA, a stack address
|
||||
that remains constant throughout the lifetime of the function.
|
||||
Returns an lldb::addr_t stack address, or LLDB_INVALID_ADDRESS if
|
||||
the CFA cannot be determined.") GetCFA;
|
||||
lldb::addr_t
|
||||
GetCFA () const;
|
||||
|
||||
lldb::addr_t
|
||||
GetPC () const;
|
||||
|
||||
bool
|
||||
SetPC (lldb::addr_t new_pc);
|
||||
|
||||
lldb::addr_t
|
||||
GetSP () const;
|
||||
|
||||
lldb::addr_t
|
||||
GetFP () const;
|
||||
|
||||
lldb::SBAddress
|
||||
GetPCAddress () const;
|
||||
|
||||
lldb::SBSymbolContext
|
||||
GetSymbolContext (uint32_t resolve_scope) const;
|
||||
|
||||
lldb::SBModule
|
||||
GetModule () const;
|
||||
|
||||
lldb::SBCompileUnit
|
||||
GetCompileUnit () const;
|
||||
|
||||
lldb::SBFunction
|
||||
GetFunction () const;
|
||||
|
||||
lldb::SBSymbol
|
||||
GetSymbol () const;
|
||||
|
||||
%feature("docstring", "
|
||||
Gets the deepest block that contains the frame PC.
|
||||
|
||||
See also GetFrameBlock().") GetBlock;
|
||||
lldb::SBBlock
|
||||
GetBlock () const;
|
||||
|
||||
%feature("docstring", "
|
||||
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().") GetFunctionName;
|
||||
const char *
|
||||
GetFunctionName();
|
||||
|
||||
const char *
|
||||
GetDisplayFunctionName ();
|
||||
|
||||
const char *
|
||||
GetFunctionName() const;
|
||||
|
||||
%feature("docstring", "
|
||||
Returns the language of the frame's SBFunction, or if there.
|
||||
is no SBFunction, guess the language from the mangled name.
|
||||
.") GuessLanguage;
|
||||
lldb::LanguageType
|
||||
GuessLanguage() const;
|
||||
|
||||
%feature("docstring", "
|
||||
Return true if this frame represents an inlined function.
|
||||
|
||||
See also GetFunctionName().") IsInlined;
|
||||
bool
|
||||
IsInlined();
|
||||
|
||||
bool
|
||||
IsInlined() const;
|
||||
|
||||
%feature("docstring", "
|
||||
Return true if this frame is artificial (e.g a frame synthesized to
|
||||
capture a tail call). Local variables may not be available in an artificial
|
||||
frame.") IsArtificial;
|
||||
bool
|
||||
IsArtificial();
|
||||
|
||||
bool
|
||||
IsArtificial() const;
|
||||
|
||||
%feature("docstring", "
|
||||
The version that doesn't supply a 'use_dynamic' value will use the
|
||||
target's default.") EvaluateExpression;
|
||||
lldb::SBValue
|
||||
EvaluateExpression (const char *expr);
|
||||
|
||||
lldb::SBValue
|
||||
EvaluateExpression (const char *expr, lldb::DynamicValueType use_dynamic);
|
||||
|
||||
lldb::SBValue
|
||||
EvaluateExpression (const char *expr, lldb::DynamicValueType use_dynamic, bool unwind_on_error);
|
||||
|
||||
lldb::SBValue
|
||||
EvaluateExpression (const char *expr, SBExpressionOptions &options);
|
||||
|
||||
%feature("docstring", "
|
||||
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.") GetFrameBlock;
|
||||
lldb::SBBlock
|
||||
GetFrameBlock () const;
|
||||
|
||||
lldb::SBLineEntry
|
||||
GetLineEntry () const;
|
||||
|
||||
lldb::SBThread
|
||||
GetThread () const;
|
||||
|
||||
const char *
|
||||
Disassemble () const;
|
||||
|
||||
void
|
||||
Clear();
|
||||
|
||||
bool
|
||||
operator == (const lldb::SBFrame &rhs) const;
|
||||
|
||||
bool
|
||||
operator != (const lldb::SBFrame &rhs) const;
|
||||
|
||||
%feature("docstring", "
|
||||
The version that doesn't supply a 'use_dynamic' value will use the
|
||||
target's default.") GetVariables;
|
||||
lldb::SBValueList
|
||||
GetVariables (bool arguments,
|
||||
bool locals,
|
||||
bool statics,
|
||||
bool in_scope_only);
|
||||
|
||||
lldb::SBValueList
|
||||
GetVariables (bool arguments,
|
||||
bool locals,
|
||||
bool statics,
|
||||
bool in_scope_only,
|
||||
lldb::DynamicValueType use_dynamic);
|
||||
|
||||
lldb::SBValueList
|
||||
GetVariables (const lldb::SBVariablesOptions& options);
|
||||
|
||||
lldb::SBValueList
|
||||
GetRegisters ();
|
||||
|
||||
%feature("docstring", "
|
||||
The version that doesn't supply a 'use_dynamic' value will use the
|
||||
target's default.") FindVariable;
|
||||
lldb::SBValue
|
||||
FindVariable (const char *var_name);
|
||||
|
||||
lldb::SBValue
|
||||
FindVariable (const char *var_name, lldb::DynamicValueType use_dynamic);
|
||||
|
||||
lldb::SBValue
|
||||
FindRegister (const char *name);
|
||||
|
||||
%feature("docstring", "
|
||||
Get a lldb.SBValue for a variable path.
|
||||
|
||||
Variable paths can include access to pointer or instance members:
|
||||
rect_ptr->origin.y
|
||||
pt.x
|
||||
Pointer dereferences:
|
||||
*this->foo_ptr
|
||||
**argv
|
||||
Address of:
|
||||
&pt
|
||||
&my_array[3].x
|
||||
Array accesses and treating pointers as arrays:
|
||||
int_array[1]
|
||||
pt_ptr[22].x
|
||||
|
||||
Unlike EvaluateExpression() which returns lldb.SBValue objects
|
||||
with constant copies of the values at the time of evaluation,
|
||||
the result of this function is a value that will continue to
|
||||
track the current value of the value as execution progresses
|
||||
in the current frame.") GetValueForVariablePath;
|
||||
lldb::SBValue
|
||||
GetValueForVariablePath (const char *var_path);
|
||||
|
||||
lldb::SBValue
|
||||
GetValueForVariablePath (const char *var_path, lldb::DynamicValueType use_dynamic);
|
||||
|
||||
%feature("docstring", "
|
||||
Find variables, register sets, registers, or persistent variables using
|
||||
the frame as the scope.
|
||||
|
||||
The version that doesn't supply a 'use_dynamic' value will use the
|
||||
target's default.") FindValue;
|
||||
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);
|
||||
|
||||
STRING_EXTENSION(SBFrame)
|
||||
|
||||
#ifdef SWIGPYTHON
|
||||
%pythoncode %{
|
||||
def get_all_variables(self):
|
||||
return self.GetVariables(True,True,True,True)
|
||||
|
||||
def get_parent_frame(self):
|
||||
parent_idx = self.idx + 1
|
||||
if parent_idx >= 0 and parent_idx < len(self.thread.frame):
|
||||
return self.thread.frame[parent_idx]
|
||||
else:
|
||||
return SBFrame()
|
||||
|
||||
def get_arguments(self):
|
||||
return self.GetVariables(True,False,False,False)
|
||||
|
||||
def get_locals(self):
|
||||
return self.GetVariables(False,True,False,False)
|
||||
|
||||
def get_statics(self):
|
||||
return self.GetVariables(False,False,True,False)
|
||||
|
||||
def var(self, var_expr_path):
|
||||
'''Calls through to lldb.SBFrame.GetValueForVariablePath() and returns
|
||||
a value that represents the variable expression path'''
|
||||
return self.GetValueForVariablePath(var_expr_path)
|
||||
|
||||
def get_registers_access(self):
|
||||
class registers_access(object):
|
||||
'''A helper object that exposes a flattened view of registers, masking away the notion of register sets for easy scripting.'''
|
||||
def __init__(self, regs):
|
||||
self.regs = regs
|
||||
|
||||
def __getitem__(self, key):
|
||||
if type(key) is str:
|
||||
for i in range(0,len(self.regs)):
|
||||
rs = self.regs[i]
|
||||
for j in range (0,rs.num_children):
|
||||
reg = rs.GetChildAtIndex(j)
|
||||
if reg.name == key: return reg
|
||||
else:
|
||||
return lldb.SBValue()
|
||||
|
||||
return registers_access(self.registers)
|
||||
|
||||
pc = property(GetPC, SetPC)
|
||||
addr = property(GetPCAddress, None, doc='''A read only property that returns the program counter (PC) as a section offset address (lldb.SBAddress).''')
|
||||
fp = property(GetFP, None, doc='''A read only property that returns the frame pointer (FP) as an unsigned integer.''')
|
||||
sp = property(GetSP, None, doc='''A read only property that returns the stack pointer (SP) as an unsigned integer.''')
|
||||
module = property(GetModule, None, doc='''A read only property that returns an lldb object that represents the module (lldb.SBModule) for this stack frame.''')
|
||||
compile_unit = property(GetCompileUnit, None, doc='''A read only property that returns an lldb object that represents the compile unit (lldb.SBCompileUnit) for this stack frame.''')
|
||||
function = property(GetFunction, None, doc='''A read only property that returns an lldb object that represents the function (lldb.SBFunction) for this stack frame.''')
|
||||
symbol = property(GetSymbol, None, doc='''A read only property that returns an lldb object that represents the symbol (lldb.SBSymbol) for this stack frame.''')
|
||||
block = property(GetBlock, None, doc='''A read only property that returns an lldb object that represents the block (lldb.SBBlock) for this stack frame.''')
|
||||
is_inlined = property(IsInlined, None, doc='''A read only property that returns an boolean that indicates if the block frame is an inlined function.''')
|
||||
name = property(GetFunctionName, None, doc='''A read only property that retuns the name for the function that this frame represents. Inlined stack frame might have a concrete function that differs from the name of the inlined function (a named lldb.SBBlock).''')
|
||||
line_entry = property(GetLineEntry, None, doc='''A read only property that returns an lldb object that represents the line table entry (lldb.SBLineEntry) for this stack frame.''')
|
||||
thread = property(GetThread, None, doc='''A read only property that returns an lldb object that represents the thread (lldb.SBThread) for this stack frame.''')
|
||||
disassembly = property(Disassemble, None, doc='''A read only property that returns the disassembly for this stack frame as a python string.''')
|
||||
idx = property(GetFrameID, None, doc='''A read only property that returns the zero based stack frame index.''')
|
||||
variables = property(get_all_variables, None, doc='''A read only property that returns a list() that contains a collection of lldb.SBValue objects that represent the variables in this stack frame.''')
|
||||
vars = property(get_all_variables, None, doc='''A read only property that returns a list() that contains a collection of lldb.SBValue objects that represent the variables in this stack frame.''')
|
||||
locals = property(get_locals, None, doc='''A read only property that returns a list() that contains a collection of lldb.SBValue objects that represent the local variables in this stack frame.''')
|
||||
args = property(get_arguments, None, doc='''A read only property that returns a list() that contains a collection of lldb.SBValue objects that represent the argument variables in this stack frame.''')
|
||||
arguments = property(get_arguments, None, doc='''A read only property that returns a list() that contains a collection of lldb.SBValue objects that represent the argument variables in this stack frame.''')
|
||||
statics = property(get_statics, None, doc='''A read only property that returns a list() that contains a collection of lldb.SBValue objects that represent the static variables in this stack frame.''')
|
||||
registers = property(GetRegisters, None, doc='''A read only property that returns a list() that contains a collection of lldb.SBValue objects that represent the CPU registers for this stack frame.''')
|
||||
regs = property(GetRegisters, None, doc='''A read only property that returns a list() that contains a collection of lldb.SBValue objects that represent the CPU registers for this stack frame.''')
|
||||
register = property(get_registers_access, None, doc='''A read only property that returns an helper object providing a flattened indexable view of the CPU registers for this stack frame.''')
|
||||
reg = property(get_registers_access, None, doc='''A read only property that returns an helper object providing a flattened indexable view of the CPU registers for this stack frame''')
|
||||
parent = property(get_parent_frame, None, doc='''A read only property that returns the parent (caller) frame of the current frame.''')
|
||||
%}
|
||||
#endif
|
||||
};
|
||||
|
||||
} // namespace lldb
|
134
contrib/llvm-project/lldb/bindings/interface/SBFunction.i
Normal file
134
contrib/llvm-project/lldb/bindings/interface/SBFunction.i
Normal file
@ -0,0 +1,134 @@
|
||||
//===-- SWIG Interface for SBFunction ---------------------------*- C++ -*-===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
namespace lldb {
|
||||
|
||||
%feature("docstring",
|
||||
"Represents a generic function, which can be inlined or not.
|
||||
|
||||
For example (from test/lldbutil.py, but slightly modified for doc purpose),
|
||||
|
||||
...
|
||||
|
||||
frame = thread.GetFrameAtIndex(i)
|
||||
addr = frame.GetPCAddress()
|
||||
load_addr = addr.GetLoadAddress(target)
|
||||
function = frame.GetFunction()
|
||||
mod_name = frame.GetModule().GetFileSpec().GetFilename()
|
||||
|
||||
if not function:
|
||||
# No debug info for 'function'.
|
||||
symbol = frame.GetSymbol()
|
||||
file_addr = addr.GetFileAddress()
|
||||
start_addr = symbol.GetStartAddress().GetFileAddress()
|
||||
symbol_name = symbol.GetName()
|
||||
symbol_offset = file_addr - start_addr
|
||||
print >> output, ' frame #{num}: {addr:#016x} {mod}`{symbol} + {offset}'.format(
|
||||
num=i, addr=load_addr, mod=mod_name, symbol=symbol_name, offset=symbol_offset)
|
||||
else:
|
||||
# Debug info is available for 'function'.
|
||||
func_name = frame.GetFunctionName()
|
||||
file_name = frame.GetLineEntry().GetFileSpec().GetFilename()
|
||||
line_num = frame.GetLineEntry().GetLine()
|
||||
print >> output, ' frame #{num}: {addr:#016x} {mod}`{func} at {file}:{line} {args}'.format(
|
||||
num=i, addr=load_addr, mod=mod_name,
|
||||
func='%s [inlined]' % func_name] if frame.IsInlined() else func_name,
|
||||
file=file_name, line=line_num, args=get_args_as_string(frame, showFuncName=False))
|
||||
|
||||
...") SBFunction;
|
||||
class SBFunction
|
||||
{
|
||||
public:
|
||||
|
||||
SBFunction ();
|
||||
|
||||
SBFunction (const lldb::SBFunction &rhs);
|
||||
|
||||
~SBFunction ();
|
||||
|
||||
bool
|
||||
IsValid () const;
|
||||
|
||||
explicit operator bool() const;
|
||||
|
||||
const char *
|
||||
GetName() const;
|
||||
|
||||
const char *
|
||||
GetDisplayName() const;
|
||||
|
||||
const char *
|
||||
GetMangledName () const;
|
||||
|
||||
lldb::SBInstructionList
|
||||
GetInstructions (lldb::SBTarget target);
|
||||
|
||||
lldb::SBInstructionList
|
||||
GetInstructions (lldb::SBTarget target, const char *flavor);
|
||||
|
||||
lldb::SBAddress
|
||||
GetStartAddress ();
|
||||
|
||||
lldb::SBAddress
|
||||
GetEndAddress ();
|
||||
|
||||
const char *
|
||||
GetArgumentName (uint32_t arg_idx);
|
||||
|
||||
uint32_t
|
||||
GetPrologueByteSize ();
|
||||
|
||||
lldb::SBType
|
||||
GetType ();
|
||||
|
||||
lldb::SBBlock
|
||||
GetBlock ();
|
||||
|
||||
lldb::LanguageType
|
||||
GetLanguage ();
|
||||
|
||||
%feature("docstring", "
|
||||
Returns true if the function was compiled with optimization.
|
||||
Optimization, in this case, is meant to indicate that the debugger
|
||||
experience may be confusing for the user -- variables optimized away,
|
||||
stepping jumping between source lines -- and the driver may want to
|
||||
provide some guidance to the user about this.
|
||||
Returns false if unoptimized, or unknown.") GetIsOptimized;
|
||||
bool
|
||||
GetIsOptimized();
|
||||
|
||||
bool
|
||||
GetDescription (lldb::SBStream &description);
|
||||
|
||||
bool
|
||||
operator == (const lldb::SBFunction &rhs) const;
|
||||
|
||||
bool
|
||||
operator != (const lldb::SBFunction &rhs) const;
|
||||
|
||||
STRING_EXTENSION(SBFunction)
|
||||
|
||||
#ifdef SWIGPYTHON
|
||||
%pythoncode %{
|
||||
def get_instructions_from_current_target (self):
|
||||
return self.GetInstructions (target)
|
||||
|
||||
addr = property(GetStartAddress, None, doc='''A read only property that returns an lldb object that represents the start address (lldb.SBAddress) for this function.''')
|
||||
end_addr = property(GetEndAddress, None, doc='''A read only property that returns an lldb object that represents the end address (lldb.SBAddress) for this function.''')
|
||||
block = property(GetBlock, None, doc='''A read only property that returns an lldb object that represents the top level lexical block (lldb.SBBlock) for this function.''')
|
||||
instructions = property(get_instructions_from_current_target, None, doc='''A read only property that returns an lldb object that represents the instructions (lldb.SBInstructionList) for this function.''')
|
||||
mangled = property(GetMangledName, None, doc='''A read only property that returns the mangled (linkage) name for this function as a string.''')
|
||||
name = property(GetName, None, doc='''A read only property that returns the name for this function as a string.''')
|
||||
prologue_size = property(GetPrologueByteSize, None, doc='''A read only property that returns the size in bytes of the prologue instructions as an unsigned integer.''')
|
||||
type = property(GetType, None, doc='''A read only property that returns an lldb object that represents the return type (lldb.SBType) for this function.''')
|
||||
%}
|
||||
#endif
|
||||
|
||||
};
|
||||
|
||||
} // namespace lldb
|
49
contrib/llvm-project/lldb/bindings/interface/SBHostOS.i
Normal file
49
contrib/llvm-project/lldb/bindings/interface/SBHostOS.i
Normal file
@ -0,0 +1,49 @@
|
||||
//===-- SWIG Interface for SBHostOS -----------------------------*- C++ -*-===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
namespace lldb {
|
||||
|
||||
class SBHostOS
|
||||
{
|
||||
public:
|
||||
|
||||
static lldb::SBFileSpec
|
||||
GetProgramFileSpec ();
|
||||
|
||||
static lldb::SBFileSpec
|
||||
GetLLDBPythonPath ();
|
||||
|
||||
static lldb::SBFileSpec
|
||||
GetLLDBPath (lldb::PathType path_type);
|
||||
|
||||
static lldb::SBFileSpec
|
||||
GetUserHomeDirectory ();
|
||||
|
||||
static void
|
||||
ThreadCreated (const char *name);
|
||||
|
||||
static lldb::thread_t
|
||||
ThreadCreate (const char *name,
|
||||
lldb::thread_func_t,
|
||||
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);
|
||||
};
|
||||
|
||||
} // namespace lldb
|
104
contrib/llvm-project/lldb/bindings/interface/SBInstruction.i
Normal file
104
contrib/llvm-project/lldb/bindings/interface/SBInstruction.i
Normal file
@ -0,0 +1,104 @@
|
||||
//===-- SWIG Interface for SBInstruction ------------------------*- C++ -*-===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
// There's a lot to be fixed here, but need to wait for underlying insn implementation
|
||||
// to be revised & settle down first.
|
||||
|
||||
namespace lldb {
|
||||
|
||||
class SBInstruction
|
||||
{
|
||||
public:
|
||||
|
||||
SBInstruction ();
|
||||
|
||||
SBInstruction (const SBInstruction &rhs);
|
||||
|
||||
~SBInstruction ();
|
||||
|
||||
bool
|
||||
IsValid();
|
||||
|
||||
explicit operator bool() const;
|
||||
|
||||
lldb::SBAddress
|
||||
GetAddress();
|
||||
|
||||
|
||||
const char *
|
||||
GetMnemonic (lldb::SBTarget target);
|
||||
|
||||
const char *
|
||||
GetOperands (lldb::SBTarget target);
|
||||
|
||||
const char *
|
||||
GetComment (lldb::SBTarget target);
|
||||
|
||||
lldb::SBData
|
||||
GetData (lldb::SBTarget target);
|
||||
|
||||
size_t
|
||||
GetByteSize ();
|
||||
|
||||
bool
|
||||
DoesBranch ();
|
||||
|
||||
bool
|
||||
HasDelaySlot ();
|
||||
|
||||
bool
|
||||
CanSetBreakpoint ();
|
||||
|
||||
void
|
||||
Print (lldb::SBFile out);
|
||||
|
||||
void
|
||||
Print (lldb::FileSP BORROWED);
|
||||
|
||||
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);
|
||||
|
||||
STRING_EXTENSION(SBInstruction)
|
||||
|
||||
#ifdef SWIGPYTHON
|
||||
%pythoncode %{
|
||||
def __mnemonic_property__ (self):
|
||||
return self.GetMnemonic (target)
|
||||
def __operands_property__ (self):
|
||||
return self.GetOperands (target)
|
||||
def __comment_property__ (self):
|
||||
return self.GetComment (target)
|
||||
def __file_addr_property__ (self):
|
||||
return self.GetAddress ().GetFileAddress()
|
||||
def __load_adrr_property__ (self):
|
||||
return self.GetComment (target)
|
||||
|
||||
mnemonic = property(__mnemonic_property__, None, doc='''A read only property that returns the mnemonic for this instruction as a string.''')
|
||||
operands = property(__operands_property__, None, doc='''A read only property that returns the operands for this instruction as a string.''')
|
||||
comment = property(__comment_property__, None, doc='''A read only property that returns the comment for this instruction as a string.''')
|
||||
addr = property(GetAddress, None, doc='''A read only property that returns an lldb object that represents the address (lldb.SBAddress) for this instruction.''')
|
||||
size = property(GetByteSize, None, doc='''A read only property that returns the size in bytes for this instruction as an integer.''')
|
||||
is_branch = property(DoesBranch, None, doc='''A read only property that returns a boolean value that indicates if this instruction is a branch instruction.''')
|
||||
%}
|
||||
#endif
|
||||
|
||||
|
||||
};
|
||||
|
||||
} // namespace lldb
|
107
contrib/llvm-project/lldb/bindings/interface/SBInstructionList.i
Normal file
107
contrib/llvm-project/lldb/bindings/interface/SBInstructionList.i
Normal file
@ -0,0 +1,107 @@
|
||||
//===-- SWIG Interface for SBInstructionList --------------------*- C++ -*-===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
namespace lldb {
|
||||
|
||||
%feature("docstring",
|
||||
"Represents a list of machine instructions. SBFunction and SBSymbol have
|
||||
GetInstructions() methods which return SBInstructionList instances.
|
||||
|
||||
SBInstructionList supports instruction (SBInstruction instance) iteration.
|
||||
For example (see also SBDebugger for a more complete example),
|
||||
|
||||
def disassemble_instructions (insts):
|
||||
for i in insts:
|
||||
print i
|
||||
|
||||
defines a function which takes an SBInstructionList instance and prints out
|
||||
the machine instructions in assembly format."
|
||||
) SBInstructionList;
|
||||
class SBInstructionList
|
||||
{
|
||||
public:
|
||||
|
||||
SBInstructionList ();
|
||||
|
||||
SBInstructionList (const SBInstructionList &rhs);
|
||||
|
||||
~SBInstructionList ();
|
||||
|
||||
bool
|
||||
IsValid () const;
|
||||
|
||||
explicit operator bool() const;
|
||||
|
||||
size_t
|
||||
GetSize ();
|
||||
|
||||
lldb::SBInstruction
|
||||
GetInstructionAtIndex (uint32_t idx);
|
||||
|
||||
size_t GetInstructionsCount(const SBAddress &start, const SBAddress &end,
|
||||
bool canSetBreakpoint);
|
||||
|
||||
void
|
||||
Clear ();
|
||||
|
||||
void
|
||||
AppendInstruction (lldb::SBInstruction inst);
|
||||
|
||||
void
|
||||
Print (lldb::SBFile out);
|
||||
|
||||
void
|
||||
Print (lldb::FileSP BORROWED);
|
||||
|
||||
bool
|
||||
GetDescription (lldb::SBStream &description);
|
||||
|
||||
bool
|
||||
DumpEmulationForAllInstructions (const char *triple);
|
||||
|
||||
STRING_EXTENSION(SBInstructionList)
|
||||
|
||||
#ifdef SWIGPYTHON
|
||||
%pythoncode %{
|
||||
def __iter__(self):
|
||||
'''Iterate over all instructions in a lldb.SBInstructionList
|
||||
object.'''
|
||||
return lldb_iter(self, 'GetSize', 'GetInstructionAtIndex')
|
||||
|
||||
def __len__(self):
|
||||
'''Access len of the instruction list.'''
|
||||
return int(self.GetSize())
|
||||
|
||||
def __getitem__(self, key):
|
||||
'''Access instructions by integer index for array access or by lldb.SBAddress to find an instruction that matches a section offset address object.'''
|
||||
if type(key) is int:
|
||||
# Find an instruction by index
|
||||
if key < len(self):
|
||||
return self.GetInstructionAtIndex(key)
|
||||
elif type(key) is SBAddress:
|
||||
# Find an instruction using a lldb.SBAddress object
|
||||
lookup_file_addr = key.file_addr
|
||||
closest_inst = None
|
||||
for idx in range(self.GetSize()):
|
||||
inst = self.GetInstructionAtIndex(idx)
|
||||
inst_file_addr = inst.addr.file_addr
|
||||
if inst_file_addr == lookup_file_addr:
|
||||
return inst
|
||||
elif inst_file_addr > lookup_file_addr:
|
||||
return closest_inst
|
||||
else:
|
||||
closest_inst = inst
|
||||
return None
|
||||
%}
|
||||
#endif
|
||||
|
||||
};
|
||||
|
||||
} // namespace lldb
|
@ -0,0 +1,21 @@
|
||||
//===-- SWIG Interface for SBLanguageRuntime --------------------*- C++ -*-===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
namespace lldb {
|
||||
|
||||
class SBLanguageRuntime
|
||||
{
|
||||
public:
|
||||
static lldb::LanguageType
|
||||
GetLanguageTypeFromString (const char *string);
|
||||
|
||||
static const char *
|
||||
GetNameForLanguageType (lldb::LanguageType language);
|
||||
};
|
||||
|
||||
} // namespace lldb
|
131
contrib/llvm-project/lldb/bindings/interface/SBLaunchInfo.i
Normal file
131
contrib/llvm-project/lldb/bindings/interface/SBLaunchInfo.i
Normal file
@ -0,0 +1,131 @@
|
||||
//===-- SWIG Interface for SBLaunchInfo--------------------------*- C++ -*-===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
namespace lldb {
|
||||
|
||||
class SBLaunchInfo
|
||||
{
|
||||
public:
|
||||
SBLaunchInfo (const char **argv);
|
||||
|
||||
pid_t
|
||||
GetProcessID();
|
||||
|
||||
uint32_t
|
||||
GetUserID();
|
||||
|
||||
uint32_t
|
||||
GetGroupID();
|
||||
|
||||
bool
|
||||
UserIDIsValid ();
|
||||
|
||||
bool
|
||||
GroupIDIsValid ();
|
||||
|
||||
void
|
||||
SetUserID (uint32_t uid);
|
||||
|
||||
void
|
||||
SetGroupID (uint32_t gid);
|
||||
|
||||
lldb::SBFileSpec
|
||||
GetExecutableFile ();
|
||||
|
||||
void
|
||||
SetExecutableFile (lldb::SBFileSpec exe_file, bool add_as_first_arg);
|
||||
|
||||
lldb::SBListener
|
||||
GetListener ();
|
||||
|
||||
void
|
||||
SetListener (lldb::SBListener &listener);
|
||||
|
||||
uint32_t
|
||||
GetNumArguments ();
|
||||
|
||||
const char *
|
||||
GetArgumentAtIndex (uint32_t idx);
|
||||
|
||||
void
|
||||
SetArguments (const char **argv, bool append);
|
||||
|
||||
uint32_t
|
||||
GetNumEnvironmentEntries ();
|
||||
|
||||
const char *
|
||||
GetEnvironmentEntryAtIndex (uint32_t idx);
|
||||
|
||||
void
|
||||
SetEnvironmentEntries (const char **envp, bool append);
|
||||
|
||||
void
|
||||
Clear ();
|
||||
|
||||
const char *
|
||||
GetWorkingDirectory () const;
|
||||
|
||||
void
|
||||
SetWorkingDirectory (const char *working_dir);
|
||||
|
||||
uint32_t
|
||||
GetLaunchFlags ();
|
||||
|
||||
void
|
||||
SetLaunchFlags (uint32_t flags);
|
||||
|
||||
const char *
|
||||
GetProcessPluginName ();
|
||||
|
||||
void
|
||||
SetProcessPluginName (const char *plugin_name);
|
||||
|
||||
const char *
|
||||
GetShell ();
|
||||
|
||||
void
|
||||
SetShell (const char * path);
|
||||
|
||||
bool
|
||||
GetShellExpandArguments ();
|
||||
|
||||
void
|
||||
SetShellExpandArguments (bool expand);
|
||||
|
||||
uint32_t
|
||||
GetResumeCount ();
|
||||
|
||||
void
|
||||
SetResumeCount (uint32_t c);
|
||||
|
||||
bool
|
||||
AddCloseFileAction (int fd);
|
||||
|
||||
bool
|
||||
AddDuplicateFileAction (int fd, int dup_fd);
|
||||
|
||||
bool
|
||||
AddOpenFileAction (int fd, const char *path, bool read, bool write);
|
||||
|
||||
bool
|
||||
AddSuppressFileAction (int fd, bool read, bool write);
|
||||
|
||||
void
|
||||
SetLaunchEventData (const char *data);
|
||||
|
||||
const char *
|
||||
GetLaunchEventData () const;
|
||||
|
||||
bool
|
||||
GetDetachOnError() const;
|
||||
|
||||
void
|
||||
SetDetachOnError(bool enable);
|
||||
};
|
||||
|
||||
} // namespace lldb
|
100
contrib/llvm-project/lldb/bindings/interface/SBLineEntry.i
Normal file
100
contrib/llvm-project/lldb/bindings/interface/SBLineEntry.i
Normal file
@ -0,0 +1,100 @@
|
||||
//===-- SWIG Interface for SBLineEntry --------------------------*- C++ -*-===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
namespace lldb {
|
||||
|
||||
%feature("docstring",
|
||||
"Specifies an association with a contiguous range of instructions and
|
||||
a source file location. SBCompileUnit contains SBLineEntry(s). For example,
|
||||
|
||||
for lineEntry in compileUnit:
|
||||
print('line entry: %s:%d' % (str(lineEntry.GetFileSpec()),
|
||||
lineEntry.GetLine()))
|
||||
print('start addr: %s' % str(lineEntry.GetStartAddress()))
|
||||
print('end addr: %s' % str(lineEntry.GetEndAddress()))
|
||||
|
||||
produces:
|
||||
|
||||
line entry: /Volumes/data/lldb/svn/trunk/test/python_api/symbol-context/main.c:20
|
||||
start addr: a.out[0x100000d98]
|
||||
end addr: a.out[0x100000da3]
|
||||
line entry: /Volumes/data/lldb/svn/trunk/test/python_api/symbol-context/main.c:21
|
||||
start addr: a.out[0x100000da3]
|
||||
end addr: a.out[0x100000da9]
|
||||
line entry: /Volumes/data/lldb/svn/trunk/test/python_api/symbol-context/main.c:22
|
||||
start addr: a.out[0x100000da9]
|
||||
end addr: a.out[0x100000db6]
|
||||
line entry: /Volumes/data/lldb/svn/trunk/test/python_api/symbol-context/main.c:23
|
||||
start addr: a.out[0x100000db6]
|
||||
end addr: a.out[0x100000dbc]
|
||||
...
|
||||
|
||||
See also SBCompileUnit."
|
||||
) SBLineEntry;
|
||||
class SBLineEntry
|
||||
{
|
||||
public:
|
||||
|
||||
SBLineEntry ();
|
||||
|
||||
SBLineEntry (const lldb::SBLineEntry &rhs);
|
||||
|
||||
~SBLineEntry ();
|
||||
|
||||
lldb::SBAddress
|
||||
GetStartAddress () const;
|
||||
|
||||
lldb::SBAddress
|
||||
GetEndAddress () const;
|
||||
|
||||
bool
|
||||
IsValid () const;
|
||||
|
||||
explicit operator bool() const;
|
||||
|
||||
lldb::SBFileSpec
|
||||
GetFileSpec () const;
|
||||
|
||||
uint32_t
|
||||
GetLine () const;
|
||||
|
||||
uint32_t
|
||||
GetColumn () const;
|
||||
|
||||
bool
|
||||
GetDescription (lldb::SBStream &description);
|
||||
|
||||
void
|
||||
SetFileSpec (lldb::SBFileSpec filespec);
|
||||
|
||||
void
|
||||
SetLine (uint32_t line);
|
||||
|
||||
void
|
||||
SetColumn (uint32_t column);
|
||||
|
||||
bool
|
||||
operator == (const lldb::SBLineEntry &rhs) const;
|
||||
|
||||
bool
|
||||
operator != (const lldb::SBLineEntry &rhs) const;
|
||||
|
||||
STRING_EXTENSION(SBLineEntry)
|
||||
|
||||
#ifdef SWIGPYTHON
|
||||
%pythoncode %{
|
||||
file = property(GetFileSpec, None, doc='''A read only property that returns an lldb object that represents the file (lldb.SBFileSpec) for this line entry.''')
|
||||
line = property(GetLine, None, doc='''A read only property that returns the 1 based line number for this line entry, a return value of zero indicates that no line information is available.''')
|
||||
column = property(GetColumn, None, doc='''A read only property that returns the 1 based column number for this line entry, a return value of zero indicates that no column information is available.''')
|
||||
addr = property(GetStartAddress, None, doc='''A read only property that returns an lldb object that represents the start address (lldb.SBAddress) for this line entry.''')
|
||||
end_addr = property(GetEndAddress, None, doc='''A read only property that returns an lldb object that represents the end address (lldb.SBAddress) for this line entry.''')
|
||||
%}
|
||||
#endif
|
||||
};
|
||||
|
||||
} // namespace lldb
|
100
contrib/llvm-project/lldb/bindings/interface/SBListener.i
Normal file
100
contrib/llvm-project/lldb/bindings/interface/SBListener.i
Normal file
@ -0,0 +1,100 @@
|
||||
//===-- SWIG Interface for SBListener ---------------------------*- C++ -*-===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
namespace lldb {
|
||||
|
||||
%feature("docstring",
|
||||
"API clients can register its own listener to debugger events.
|
||||
|
||||
See aslo SBEvent for example usage of creating and adding a listener."
|
||||
) SBListener;
|
||||
class SBListener
|
||||
{
|
||||
public:
|
||||
SBListener ();
|
||||
|
||||
SBListener (const char *name);
|
||||
|
||||
SBListener (const SBListener &rhs);
|
||||
|
||||
~SBListener ();
|
||||
|
||||
void
|
||||
AddEvent (const lldb::SBEvent &event);
|
||||
|
||||
void
|
||||
Clear ();
|
||||
|
||||
bool
|
||||
IsValid () const;
|
||||
|
||||
explicit operator bool() const;
|
||||
|
||||
uint32_t
|
||||
StartListeningForEventClass (SBDebugger &debugger,
|
||||
const char *broadcaster_class,
|
||||
uint32_t event_mask);
|
||||
|
||||
uint32_t
|
||||
StopListeningForEventClass (SBDebugger &debugger,
|
||||
const char *broadcaster_class,
|
||||
uint32_t event_mask);
|
||||
|
||||
uint32_t
|
||||
StartListeningForEvents (const lldb::SBBroadcaster& broadcaster,
|
||||
uint32_t event_mask);
|
||||
|
||||
bool
|
||||
StopListeningForEvents (const lldb::SBBroadcaster& broadcaster,
|
||||
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);
|
||||
|
||||
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
|
||||
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);
|
||||
};
|
||||
|
||||
} // namespace lldb
|
@ -0,0 +1,61 @@
|
||||
//===-- SWIG Interface for SBMemoryRegionInfo -------------------*- C++ -*-===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
namespace lldb {
|
||||
|
||||
%feature("docstring",
|
||||
"API clients can get information about memory regions in processes."
|
||||
) SBMemoryRegionInfo;
|
||||
|
||||
class SBMemoryRegionInfo
|
||||
{
|
||||
public:
|
||||
|
||||
SBMemoryRegionInfo ();
|
||||
|
||||
SBMemoryRegionInfo (const lldb::SBMemoryRegionInfo &rhs);
|
||||
|
||||
~SBMemoryRegionInfo ();
|
||||
|
||||
void
|
||||
Clear();
|
||||
|
||||
lldb::addr_t
|
||||
GetRegionBase ();
|
||||
|
||||
lldb::addr_t
|
||||
GetRegionEnd ();
|
||||
|
||||
bool
|
||||
IsReadable ();
|
||||
|
||||
bool
|
||||
IsWritable ();
|
||||
|
||||
bool
|
||||
IsExecutable ();
|
||||
|
||||
bool
|
||||
IsMapped ();
|
||||
|
||||
const char *
|
||||
GetName ();
|
||||
|
||||
bool
|
||||
operator == (const lldb::SBMemoryRegionInfo &rhs) const;
|
||||
|
||||
bool
|
||||
operator != (const lldb::SBMemoryRegionInfo &rhs) const;
|
||||
|
||||
bool
|
||||
GetDescription (lldb::SBStream &description);
|
||||
|
||||
STRING_EXTENSION(SBMemoryRegionInfo)
|
||||
};
|
||||
|
||||
} // namespace lldb
|
@ -0,0 +1,37 @@
|
||||
//===-- SBMemoryRegionInfoList.h --------------------------------*- C++ -*-===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
namespace lldb {
|
||||
|
||||
class SBMemoryRegionInfoList
|
||||
{
|
||||
public:
|
||||
|
||||
SBMemoryRegionInfoList ();
|
||||
|
||||
SBMemoryRegionInfoList (const lldb::SBMemoryRegionInfoList &rhs);
|
||||
|
||||
~SBMemoryRegionInfoList ();
|
||||
|
||||
uint32_t
|
||||
GetSize () const;
|
||||
|
||||
bool
|
||||
GetMemoryRegionAtIndex (uint32_t idx, SBMemoryRegionInfo ®ion_info);
|
||||
|
||||
void
|
||||
Append (lldb::SBMemoryRegionInfo ®ion);
|
||||
|
||||
void
|
||||
Append (lldb::SBMemoryRegionInfoList ®ion_list);
|
||||
|
||||
void
|
||||
Clear ();
|
||||
};
|
||||
|
||||
} // namespace lldb
|
554
contrib/llvm-project/lldb/bindings/interface/SBModule.i
Normal file
554
contrib/llvm-project/lldb/bindings/interface/SBModule.i
Normal file
@ -0,0 +1,554 @@
|
||||
//===-- SWIG Interface for SBModule -----------------------------*- C++ -*-===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
namespace lldb {
|
||||
|
||||
#ifdef SWIGPYTHON
|
||||
%pythoncode%{
|
||||
# ==================================
|
||||
# Helper function for SBModule class
|
||||
# ==================================
|
||||
def in_range(symbol, section):
|
||||
"""Test whether a symbol is within the range of a section."""
|
||||
symSA = symbol.GetStartAddress().GetFileAddress()
|
||||
symEA = symbol.GetEndAddress().GetFileAddress()
|
||||
secSA = section.GetFileAddress()
|
||||
secEA = secSA + section.GetByteSize()
|
||||
|
||||
if symEA != LLDB_INVALID_ADDRESS:
|
||||
if secSA <= symSA and symEA <= secEA:
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
else:
|
||||
if secSA <= symSA and symSA < secEA:
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
%}
|
||||
#endif
|
||||
|
||||
%feature("docstring",
|
||||
"Represents an executable image and its associated object and symbol files.
|
||||
|
||||
The module is designed to be able to select a single slice of an
|
||||
executable image as it would appear on disk and during program
|
||||
execution.
|
||||
|
||||
You can retrieve SBModule from SBSymbolContext, which in turn is available
|
||||
from SBFrame.
|
||||
|
||||
SBModule supports symbol iteration, for example,
|
||||
|
||||
for symbol in module:
|
||||
name = symbol.GetName()
|
||||
saddr = symbol.GetStartAddress()
|
||||
eaddr = symbol.GetEndAddress()
|
||||
|
||||
and rich comparison methods which allow the API program to use,
|
||||
|
||||
if thisModule == thatModule:
|
||||
print('This module is the same as that module')
|
||||
|
||||
to test module equality. A module also contains object file sections, namely
|
||||
SBSection. SBModule supports section iteration through section_iter(), for
|
||||
example,
|
||||
|
||||
print('Number of sections: %d' % module.GetNumSections())
|
||||
for sec in module.section_iter():
|
||||
print(sec)
|
||||
|
||||
And to iterate the symbols within a SBSection, use symbol_in_section_iter(),
|
||||
|
||||
# Iterates the text section and prints each symbols within each sub-section.
|
||||
for subsec in text_sec:
|
||||
print(INDENT + repr(subsec))
|
||||
for sym in exe_module.symbol_in_section_iter(subsec):
|
||||
print(INDENT2 + repr(sym))
|
||||
print(INDENT2 + 'symbol type: %s' % symbol_type_to_str(sym.GetType()))
|
||||
|
||||
produces this following output:
|
||||
|
||||
[0x0000000100001780-0x0000000100001d5c) a.out.__TEXT.__text
|
||||
id = {0x00000004}, name = 'mask_access(MaskAction, unsigned int)', range = [0x00000001000017c0-0x0000000100001870)
|
||||
symbol type: code
|
||||
id = {0x00000008}, name = 'thread_func(void*)', range = [0x0000000100001870-0x00000001000019b0)
|
||||
symbol type: code
|
||||
id = {0x0000000c}, name = 'main', range = [0x00000001000019b0-0x0000000100001d5c)
|
||||
symbol type: code
|
||||
id = {0x00000023}, name = 'start', address = 0x0000000100001780
|
||||
symbol type: code
|
||||
[0x0000000100001d5c-0x0000000100001da4) a.out.__TEXT.__stubs
|
||||
id = {0x00000024}, name = '__stack_chk_fail', range = [0x0000000100001d5c-0x0000000100001d62)
|
||||
symbol type: trampoline
|
||||
id = {0x00000028}, name = 'exit', range = [0x0000000100001d62-0x0000000100001d68)
|
||||
symbol type: trampoline
|
||||
id = {0x00000029}, name = 'fflush', range = [0x0000000100001d68-0x0000000100001d6e)
|
||||
symbol type: trampoline
|
||||
id = {0x0000002a}, name = 'fgets', range = [0x0000000100001d6e-0x0000000100001d74)
|
||||
symbol type: trampoline
|
||||
id = {0x0000002b}, name = 'printf', range = [0x0000000100001d74-0x0000000100001d7a)
|
||||
symbol type: trampoline
|
||||
id = {0x0000002c}, name = 'pthread_create', range = [0x0000000100001d7a-0x0000000100001d80)
|
||||
symbol type: trampoline
|
||||
id = {0x0000002d}, name = 'pthread_join', range = [0x0000000100001d80-0x0000000100001d86)
|
||||
symbol type: trampoline
|
||||
id = {0x0000002e}, name = 'pthread_mutex_lock', range = [0x0000000100001d86-0x0000000100001d8c)
|
||||
symbol type: trampoline
|
||||
id = {0x0000002f}, name = 'pthread_mutex_unlock', range = [0x0000000100001d8c-0x0000000100001d92)
|
||||
symbol type: trampoline
|
||||
id = {0x00000030}, name = 'rand', range = [0x0000000100001d92-0x0000000100001d98)
|
||||
symbol type: trampoline
|
||||
id = {0x00000031}, name = 'strtoul', range = [0x0000000100001d98-0x0000000100001d9e)
|
||||
symbol type: trampoline
|
||||
id = {0x00000032}, name = 'usleep', range = [0x0000000100001d9e-0x0000000100001da4)
|
||||
symbol type: trampoline
|
||||
[0x0000000100001da4-0x0000000100001e2c) a.out.__TEXT.__stub_helper
|
||||
[0x0000000100001e2c-0x0000000100001f10) a.out.__TEXT.__cstring
|
||||
[0x0000000100001f10-0x0000000100001f68) a.out.__TEXT.__unwind_info
|
||||
[0x0000000100001f68-0x0000000100001ff8) a.out.__TEXT.__eh_frame
|
||||
"
|
||||
) SBModule;
|
||||
class SBModule
|
||||
{
|
||||
public:
|
||||
|
||||
SBModule ();
|
||||
|
||||
SBModule (const lldb::SBModule &rhs);
|
||||
|
||||
SBModule (const lldb::SBModuleSpec &module_spec);
|
||||
|
||||
SBModule (lldb::SBProcess &process,
|
||||
lldb::addr_t header_addr);
|
||||
|
||||
~SBModule ();
|
||||
|
||||
bool
|
||||
IsValid () const;
|
||||
|
||||
explicit operator bool() const;
|
||||
|
||||
void
|
||||
Clear();
|
||||
|
||||
%feature("docstring", "
|
||||
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.") GetFileSpec;
|
||||
lldb::SBFileSpec
|
||||
GetFileSpec () const;
|
||||
|
||||
%feature("docstring", "
|
||||
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.") GetPlatformFileSpec;
|
||||
lldb::SBFileSpec
|
||||
GetPlatformFileSpec () const;
|
||||
|
||||
bool
|
||||
SetPlatformFileSpec (const lldb::SBFileSpec &platform_file);
|
||||
|
||||
lldb::SBFileSpec
|
||||
GetRemoteInstallFileSpec ();
|
||||
|
||||
bool
|
||||
SetRemoteInstallFileSpec (lldb::SBFileSpec &file);
|
||||
|
||||
%feature("docstring", "Returns the UUID of the module as a Python string."
|
||||
) GetUUIDString;
|
||||
const char *
|
||||
GetUUIDString () const;
|
||||
|
||||
bool operator==(const lldb::SBModule &rhs) const;
|
||||
|
||||
bool operator!=(const lldb::SBModule &rhs) const;
|
||||
|
||||
lldb::SBSection
|
||||
FindSection (const char *sect_name);
|
||||
|
||||
lldb::SBAddress
|
||||
ResolveFileAddress (lldb::addr_t vm_addr);
|
||||
|
||||
lldb::SBSymbolContext
|
||||
ResolveSymbolContextForAddress (const lldb::SBAddress& addr,
|
||||
uint32_t resolve_scope);
|
||||
|
||||
bool
|
||||
GetDescription (lldb::SBStream &description);
|
||||
|
||||
uint32_t
|
||||
GetNumCompileUnits();
|
||||
|
||||
lldb::SBCompileUnit
|
||||
GetCompileUnitAtIndex (uint32_t);
|
||||
|
||||
%feature("docstring", "
|
||||
Find compile units related to *this module and passed source
|
||||
file.
|
||||
|
||||
@param[in] sb_file_spec
|
||||
A lldb::SBFileSpec object that contains source file
|
||||
specification.
|
||||
|
||||
@return
|
||||
A lldb::SBSymbolContextList that gets filled in with all of
|
||||
the symbol contexts for all the matches.") FindCompileUnits;
|
||||
lldb::SBSymbolContextList
|
||||
FindCompileUnits (const lldb::SBFileSpec &sb_file_spec);
|
||||
|
||||
size_t
|
||||
GetNumSymbols ();
|
||||
|
||||
lldb::SBSymbol
|
||||
GetSymbolAtIndex (size_t idx);
|
||||
|
||||
lldb::SBSymbol
|
||||
FindSymbol (const char *name,
|
||||
lldb::SymbolType type = eSymbolTypeAny);
|
||||
|
||||
lldb::SBSymbolContextList
|
||||
FindSymbols (const char *name,
|
||||
lldb::SymbolType type = eSymbolTypeAny);
|
||||
|
||||
|
||||
size_t
|
||||
GetNumSections ();
|
||||
|
||||
lldb::SBSection
|
||||
GetSectionAtIndex (size_t idx);
|
||||
|
||||
|
||||
%feature("docstring", "
|
||||
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 symbol context list that gets filled in with all of the
|
||||
matches.") FindFunctions;
|
||||
lldb::SBSymbolContextList
|
||||
FindFunctions (const char *name,
|
||||
uint32_t name_type_mask = lldb::eFunctionNameTypeAny);
|
||||
|
||||
lldb::SBType
|
||||
FindFirstType (const char* name);
|
||||
|
||||
lldb::SBTypeList
|
||||
FindTypes (const char* type);
|
||||
|
||||
lldb::SBType
|
||||
GetTypeByID (lldb::user_id_t uid);
|
||||
|
||||
lldb::SBType
|
||||
GetBasicType(lldb::BasicType type);
|
||||
|
||||
%feature("docstring", "
|
||||
Get all types matching 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 type_mask") GetTypes;
|
||||
lldb::SBTypeList
|
||||
GetTypes (uint32_t type_mask = lldb::eTypeClassAny);
|
||||
|
||||
%feature("docstring", "
|
||||
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 max_matches.
|
||||
|
||||
@return
|
||||
A list of matched variables in an SBValueList.") FindGlobalVariables;
|
||||
lldb::SBValueList
|
||||
FindGlobalVariables (lldb::SBTarget &target,
|
||||
const char *name,
|
||||
uint32_t max_matches);
|
||||
|
||||
%feature("docstring", "
|
||||
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).") FindFirstGlobalVariable;
|
||||
lldb::SBValue
|
||||
FindFirstGlobalVariable (lldb::SBTarget &target, const char *name);
|
||||
|
||||
lldb::ByteOrder
|
||||
GetByteOrder ();
|
||||
|
||||
uint32_t
|
||||
GetAddressByteSize();
|
||||
|
||||
const char *
|
||||
GetTriple ();
|
||||
|
||||
uint32_t
|
||||
GetVersion (uint32_t *versions,
|
||||
uint32_t num_versions);
|
||||
|
||||
lldb::SBFileSpec
|
||||
GetSymbolFileSpec() const;
|
||||
|
||||
lldb::SBAddress
|
||||
GetObjectFileHeaderAddress() const;
|
||||
|
||||
lldb::SBAddress
|
||||
GetObjectFileEntryPointAddress() const;
|
||||
|
||||
STRING_EXTENSION(SBModule)
|
||||
|
||||
#ifdef SWIGPYTHON
|
||||
%pythoncode %{
|
||||
def __len__(self):
|
||||
'''Return the number of symbols in a lldb.SBModule object.'''
|
||||
return self.GetNumSymbols()
|
||||
|
||||
def __iter__(self):
|
||||
'''Iterate over all symbols in a lldb.SBModule object.'''
|
||||
return lldb_iter(self, 'GetNumSymbols', 'GetSymbolAtIndex')
|
||||
|
||||
def section_iter(self):
|
||||
'''Iterate over all sections in a lldb.SBModule object.'''
|
||||
return lldb_iter(self, 'GetNumSections', 'GetSectionAtIndex')
|
||||
|
||||
def compile_unit_iter(self):
|
||||
'''Iterate over all compile units in a lldb.SBModule object.'''
|
||||
return lldb_iter(self, 'GetNumCompileUnits', 'GetCompileUnitAtIndex')
|
||||
|
||||
def symbol_in_section_iter(self, section):
|
||||
'''Given a module and its contained section, returns an iterator on the
|
||||
symbols within the section.'''
|
||||
for sym in self:
|
||||
if in_range(sym, section):
|
||||
yield sym
|
||||
|
||||
class symbols_access(object):
|
||||
re_compile_type = type(re.compile('.'))
|
||||
'''A helper object that will lazily hand out lldb.SBSymbol objects for a module when supplied an index, name, or regular expression.'''
|
||||
def __init__(self, sbmodule):
|
||||
self.sbmodule = sbmodule
|
||||
|
||||
def __len__(self):
|
||||
if self.sbmodule:
|
||||
return int(self.sbmodule.GetNumSymbols())
|
||||
return 0
|
||||
|
||||
def __getitem__(self, key):
|
||||
count = len(self)
|
||||
if type(key) is int:
|
||||
if key < count:
|
||||
return self.sbmodule.GetSymbolAtIndex(key)
|
||||
elif type(key) is str:
|
||||
matches = []
|
||||
sc_list = self.sbmodule.FindSymbols(key)
|
||||
for sc in sc_list:
|
||||
symbol = sc.symbol
|
||||
if symbol:
|
||||
matches.append(symbol)
|
||||
return matches
|
||||
elif isinstance(key, self.re_compile_type):
|
||||
matches = []
|
||||
for idx in range(count):
|
||||
symbol = self.sbmodule.GetSymbolAtIndex(idx)
|
||||
added = False
|
||||
name = symbol.name
|
||||
if name:
|
||||
re_match = key.search(name)
|
||||
if re_match:
|
||||
matches.append(symbol)
|
||||
added = True
|
||||
if not added:
|
||||
mangled = symbol.mangled
|
||||
if mangled:
|
||||
re_match = key.search(mangled)
|
||||
if re_match:
|
||||
matches.append(symbol)
|
||||
return matches
|
||||
else:
|
||||
print("error: unsupported item type: %s" % type(key))
|
||||
return None
|
||||
|
||||
def get_symbols_access_object(self):
|
||||
'''An accessor function that returns a symbols_access() object which allows lazy symbol access from a lldb.SBModule object.'''
|
||||
return self.symbols_access (self)
|
||||
|
||||
def get_compile_units_access_object (self):
|
||||
'''An accessor function that returns a compile_units_access() object which allows lazy compile unit access from a lldb.SBModule object.'''
|
||||
return self.compile_units_access (self)
|
||||
|
||||
def get_symbols_array(self):
|
||||
'''An accessor function that returns a list() that contains all symbols in a lldb.SBModule object.'''
|
||||
symbols = []
|
||||
for idx in range(self.num_symbols):
|
||||
symbols.append(self.GetSymbolAtIndex(idx))
|
||||
return symbols
|
||||
|
||||
class sections_access(object):
|
||||
re_compile_type = type(re.compile('.'))
|
||||
'''A helper object that will lazily hand out lldb.SBSection objects for a module when supplied an index, name, or regular expression.'''
|
||||
def __init__(self, sbmodule):
|
||||
self.sbmodule = sbmodule
|
||||
|
||||
def __len__(self):
|
||||
if self.sbmodule:
|
||||
return int(self.sbmodule.GetNumSections())
|
||||
return 0
|
||||
|
||||
def __getitem__(self, key):
|
||||
count = len(self)
|
||||
if type(key) is int:
|
||||
if key < count:
|
||||
return self.sbmodule.GetSectionAtIndex(key)
|
||||
elif type(key) is str:
|
||||
for idx in range(count):
|
||||
section = self.sbmodule.GetSectionAtIndex(idx)
|
||||
if section.name == key:
|
||||
return section
|
||||
elif isinstance(key, self.re_compile_type):
|
||||
matches = []
|
||||
for idx in range(count):
|
||||
section = self.sbmodule.GetSectionAtIndex(idx)
|
||||
name = section.name
|
||||
if name:
|
||||
re_match = key.search(name)
|
||||
if re_match:
|
||||
matches.append(section)
|
||||
return matches
|
||||
else:
|
||||
print("error: unsupported item type: %s" % type(key))
|
||||
return None
|
||||
|
||||
class compile_units_access(object):
|
||||
re_compile_type = type(re.compile('.'))
|
||||
'''A helper object that will lazily hand out lldb.SBCompileUnit objects for a module when supplied an index, full or partial path, or regular expression.'''
|
||||
def __init__(self, sbmodule):
|
||||
self.sbmodule = sbmodule
|
||||
|
||||
def __len__(self):
|
||||
if self.sbmodule:
|
||||
return int(self.sbmodule.GetNumCompileUnits())
|
||||
return 0
|
||||
|
||||
def __getitem__(self, key):
|
||||
count = len(self)
|
||||
if type(key) is int:
|
||||
if key < count:
|
||||
return self.sbmodule.GetCompileUnitAtIndex(key)
|
||||
elif type(key) is str:
|
||||
is_full_path = key[0] == '/'
|
||||
for idx in range(count):
|
||||
comp_unit = self.sbmodule.GetCompileUnitAtIndex(idx)
|
||||
if is_full_path:
|
||||
if comp_unit.file.fullpath == key:
|
||||
return comp_unit
|
||||
else:
|
||||
if comp_unit.file.basename == key:
|
||||
return comp_unit
|
||||
elif isinstance(key, self.re_compile_type):
|
||||
matches = []
|
||||
for idx in range(count):
|
||||
comp_unit = self.sbmodule.GetCompileUnitAtIndex(idx)
|
||||
fullpath = comp_unit.file.fullpath
|
||||
if fullpath:
|
||||
re_match = key.search(fullpath)
|
||||
if re_match:
|
||||
matches.append(comp_unit)
|
||||
return matches
|
||||
else:
|
||||
print("error: unsupported item type: %s" % type(key))
|
||||
return None
|
||||
|
||||
def get_sections_access_object(self):
|
||||
'''An accessor function that returns a sections_access() object which allows lazy section array access.'''
|
||||
return self.sections_access (self)
|
||||
|
||||
def get_sections_array(self):
|
||||
'''An accessor function that returns an array object that contains all sections in this module object.'''
|
||||
if not hasattr(self, 'sections_array'):
|
||||
self.sections_array = []
|
||||
for idx in range(self.num_sections):
|
||||
self.sections_array.append(self.GetSectionAtIndex(idx))
|
||||
return self.sections_array
|
||||
|
||||
def get_compile_units_array(self):
|
||||
'''An accessor function that returns an array object that contains all compile_units in this module object.'''
|
||||
if not hasattr(self, 'compile_units_array'):
|
||||
self.compile_units_array = []
|
||||
for idx in range(self.GetNumCompileUnits()):
|
||||
self.compile_units_array.append(self.GetCompileUnitAtIndex(idx))
|
||||
return self.compile_units_array
|
||||
|
||||
symbols = property(get_symbols_array, None, doc='''A read only property that returns a list() of lldb.SBSymbol objects contained in this module.''')
|
||||
symbol = property(get_symbols_access_object, None, doc='''A read only property that can be used to access symbols by index ("symbol = module.symbol[0]"), name ("symbols = module.symbol['main']"), or using a regular expression ("symbols = module.symbol[re.compile(...)]"). The return value is a single lldb.SBSymbol object for array access, and a list() of lldb.SBSymbol objects for name and regular expression access''')
|
||||
sections = property(get_sections_array, None, doc='''A read only property that returns a list() of lldb.SBSection objects contained in this module.''')
|
||||
compile_units = property(get_compile_units_array, None, doc='''A read only property that returns a list() of lldb.SBCompileUnit objects contained in this module.''')
|
||||
section = property(get_sections_access_object, None, doc='''A read only property that can be used to access symbols by index ("section = module.section[0]"), name ("sections = module.section[\'main\']"), or using a regular expression ("sections = module.section[re.compile(...)]"). The return value is a single lldb.SBSection object for array access, and a list() of lldb.SBSection objects for name and regular expression access''')
|
||||
section = property(get_sections_access_object, None, doc='''A read only property that can be used to access compile units by index ("compile_unit = module.compile_unit[0]"), name ("compile_unit = module.compile_unit[\'main.cpp\']"), or using a regular expression ("compile_unit = module.compile_unit[re.compile(...)]"). The return value is a single lldb.SBCompileUnit object for array access or by full or partial path, and a list() of lldb.SBCompileUnit objects regular expressions.''')
|
||||
|
||||
def get_uuid(self):
|
||||
return uuid.UUID (self.GetUUIDString())
|
||||
|
||||
uuid = property(get_uuid, None, doc='''A read only property that returns a standard python uuid.UUID object that represents the UUID of this module.''')
|
||||
file = property(GetFileSpec, None, doc='''A read only property that returns an lldb object that represents the file (lldb.SBFileSpec) for this object file for this module as it is represented where it is being debugged.''')
|
||||
platform_file = property(GetPlatformFileSpec, None, doc='''A read only property that returns an lldb object that represents the file (lldb.SBFileSpec) for this object file for this module as it is represented on the current host system.''')
|
||||
byte_order = property(GetByteOrder, None, doc='''A read only property that returns an lldb enumeration value (lldb.eByteOrderLittle, lldb.eByteOrderBig, lldb.eByteOrderInvalid) that represents the byte order for this module.''')
|
||||
addr_size = property(GetAddressByteSize, None, doc='''A read only property that returns the size in bytes of an address for this module.''')
|
||||
triple = property(GetTriple, None, doc='''A read only property that returns the target triple (arch-vendor-os) for this module.''')
|
||||
num_symbols = property(GetNumSymbols, None, doc='''A read only property that returns number of symbols in the module symbol table as an integer.''')
|
||||
num_sections = property(GetNumSections, None, doc='''A read only property that returns number of sections in the module as an integer.''')
|
||||
|
||||
%}
|
||||
#endif
|
||||
|
||||
};
|
||||
|
||||
} // namespace lldb
|
134
contrib/llvm-project/lldb/bindings/interface/SBModuleSpec.i
Normal file
134
contrib/llvm-project/lldb/bindings/interface/SBModuleSpec.i
Normal file
@ -0,0 +1,134 @@
|
||||
//===-- SWIG Interface for SBModule -----------------------------*- C++ -*-===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
namespace lldb {
|
||||
|
||||
class SBModuleSpec
|
||||
{
|
||||
public:
|
||||
|
||||
SBModuleSpec ();
|
||||
|
||||
SBModuleSpec (const lldb::SBModuleSpec &rhs);
|
||||
|
||||
~SBModuleSpec ();
|
||||
|
||||
bool
|
||||
IsValid () const;
|
||||
|
||||
explicit operator bool() const;
|
||||
|
||||
void
|
||||
Clear();
|
||||
|
||||
%feature("docstring", "
|
||||
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.") GetFileSpec;
|
||||
lldb::SBFileSpec
|
||||
GetFileSpec ();
|
||||
|
||||
void
|
||||
SetFileSpec (const lldb::SBFileSpec &fspec);
|
||||
|
||||
%feature("docstring", "
|
||||
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.") GetPlatformFileSpec;
|
||||
lldb::SBFileSpec
|
||||
GetPlatformFileSpec ();
|
||||
|
||||
void
|
||||
SetPlatformFileSpec (const lldb::SBFileSpec &fspec);
|
||||
|
||||
lldb::SBFileSpec
|
||||
GetSymbolFileSpec ();
|
||||
|
||||
void
|
||||
SetSymbolFileSpec (const lldb::SBFileSpec &fspec);
|
||||
|
||||
const char *
|
||||
GetObjectName ();
|
||||
|
||||
void
|
||||
SetObjectName (const char *name);
|
||||
|
||||
const char *
|
||||
GetTriple ();
|
||||
|
||||
void
|
||||
SetTriple (const char *triple);
|
||||
|
||||
const uint8_t *
|
||||
GetUUIDBytes ();
|
||||
|
||||
size_t
|
||||
GetUUIDLength ();
|
||||
|
||||
bool
|
||||
SetUUIDBytes (const uint8_t *uuid, size_t uuid_len);
|
||||
|
||||
bool
|
||||
GetDescription (lldb::SBStream &description);
|
||||
|
||||
STRING_EXTENSION(SBModuleSpec)
|
||||
};
|
||||
|
||||
|
||||
class SBModuleSpecList
|
||||
{
|
||||
public:
|
||||
SBModuleSpecList();
|
||||
|
||||
SBModuleSpecList (const SBModuleSpecList &rhs);
|
||||
|
||||
~SBModuleSpecList();
|
||||
|
||||
static SBModuleSpecList
|
||||
GetModuleSpecifications (const char *path);
|
||||
|
||||
void
|
||||
Append (const lldb::SBModuleSpec &spec);
|
||||
|
||||
void
|
||||
Append (const lldb::SBModuleSpecList &spec_list);
|
||||
|
||||
lldb::SBModuleSpec
|
||||
FindFirstMatchingSpec (const lldb::SBModuleSpec &match_spec);
|
||||
|
||||
lldb::SBModuleSpecList
|
||||
FindMatchingSpecs (const lldb::SBModuleSpec &match_spec);
|
||||
|
||||
size_t
|
||||
GetSize();
|
||||
|
||||
lldb::SBModuleSpec
|
||||
GetSpecAtIndex (size_t i);
|
||||
|
||||
bool
|
||||
GetDescription (lldb::SBStream &description);
|
||||
|
||||
STRING_EXTENSION(SBModuleSpecList)
|
||||
};
|
||||
|
||||
} // namespace lldb
|
197
contrib/llvm-project/lldb/bindings/interface/SBPlatform.i
Normal file
197
contrib/llvm-project/lldb/bindings/interface/SBPlatform.i
Normal file
@ -0,0 +1,197 @@
|
||||
//===-- SWIG Interface for SBPlatform ---------------------------*- C++ -*-===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
namespace lldb {
|
||||
|
||||
|
||||
class SBPlatformConnectOptions
|
||||
{
|
||||
public:
|
||||
SBPlatformConnectOptions (const char *url);
|
||||
|
||||
SBPlatformConnectOptions (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
|
||||
SetLocalCacheDirectory(const char *path);
|
||||
};
|
||||
|
||||
class SBPlatformShellCommand
|
||||
{
|
||||
public:
|
||||
SBPlatformShellCommand (const char *shell_command);
|
||||
|
||||
SBPlatformShellCommand (const SBPlatformShellCommand &rhs);
|
||||
|
||||
~SBPlatformShellCommand();
|
||||
|
||||
void
|
||||
Clear();
|
||||
|
||||
const char *
|
||||
GetCommand();
|
||||
|
||||
void
|
||||
SetCommand(const char *shell_command);
|
||||
|
||||
const char *
|
||||
GetWorkingDirectory ();
|
||||
|
||||
void
|
||||
SetWorkingDirectory (const char *path);
|
||||
|
||||
uint32_t
|
||||
GetTimeoutSeconds ();
|
||||
|
||||
void
|
||||
SetTimeoutSeconds (uint32_t sec);
|
||||
|
||||
int
|
||||
GetSignal ();
|
||||
|
||||
int
|
||||
GetStatus ();
|
||||
|
||||
const char *
|
||||
GetOutput ();
|
||||
};
|
||||
|
||||
%feature("docstring",
|
||||
"A class that represents a platform that can represent the current host or a remote host debug platform.
|
||||
|
||||
The SBPlatform class represents the current host, or a remote host.
|
||||
It can be connected to a remote platform in order to provide ways
|
||||
to remotely launch and attach to processes, upload/download files,
|
||||
create directories, run remote shell commands, find locally cached
|
||||
versions of files from the remote system, and much more.
|
||||
|
||||
SBPlatform objects can be created and then used to connect to a remote
|
||||
platform which allows the SBPlatform to be used to get a list of the
|
||||
current processes on the remote host, attach to one of those processes,
|
||||
install programs on the remote system, attach and launch processes,
|
||||
and much more.
|
||||
|
||||
Every SBTarget has a corresponding SBPlatform. The platform can be
|
||||
specified upon target creation, or the currently selected platform
|
||||
will attempt to be used when creating the target automatically as long
|
||||
as the currently selected platform matches the target architecture
|
||||
and executable type. If the architecture or executable type do not match,
|
||||
a suitable platform will be found automatically."
|
||||
|
||||
) SBPlatform;
|
||||
class SBPlatform
|
||||
{
|
||||
public:
|
||||
|
||||
SBPlatform ();
|
||||
|
||||
SBPlatform (const char *);
|
||||
|
||||
~SBPlatform();
|
||||
|
||||
bool
|
||||
IsValid () const;
|
||||
|
||||
explicit operator bool() const;
|
||||
|
||||
void
|
||||
Clear ();
|
||||
|
||||
const char *
|
||||
GetWorkingDirectory();
|
||||
|
||||
bool
|
||||
SetWorkingDirectory(const char *);
|
||||
|
||||
const char *
|
||||
GetName ();
|
||||
|
||||
SBError
|
||||
ConnectRemote (lldb::SBPlatformConnectOptions &connect_options);
|
||||
|
||||
void
|
||||
DisconnectRemote ();
|
||||
|
||||
bool
|
||||
IsConnected();
|
||||
|
||||
const char *
|
||||
GetTriple();
|
||||
|
||||
const char *
|
||||
GetHostname ();
|
||||
|
||||
const char *
|
||||
GetOSBuild ();
|
||||
|
||||
const char *
|
||||
GetOSDescription ();
|
||||
|
||||
uint32_t
|
||||
GetOSMajorVersion ();
|
||||
|
||||
uint32_t
|
||||
GetOSMinorVersion ();
|
||||
|
||||
uint32_t
|
||||
GetOSUpdateVersion ();
|
||||
|
||||
lldb::SBError
|
||||
Get (lldb::SBFileSpec &src, lldb::SBFileSpec &dst);
|
||||
|
||||
lldb::SBError
|
||||
Put (lldb::SBFileSpec &src, lldb::SBFileSpec &dst);
|
||||
|
||||
lldb::SBError
|
||||
Install (lldb::SBFileSpec &src, lldb::SBFileSpec &dst);
|
||||
|
||||
lldb::SBError
|
||||
Run (lldb::SBPlatformShellCommand &shell_command);
|
||||
|
||||
lldb::SBError
|
||||
Launch (lldb::SBLaunchInfo &launch_info);
|
||||
|
||||
lldb::SBError
|
||||
Kill (const lldb::pid_t pid);
|
||||
|
||||
lldb::SBError
|
||||
MakeDirectory (const char *path, uint32_t file_permissions = lldb::eFilePermissionsDirectoryDefault);
|
||||
|
||||
uint32_t
|
||||
GetFilePermissions (const char *path);
|
||||
|
||||
lldb::SBError
|
||||
SetFilePermissions (const char *path, uint32_t file_permissions);
|
||||
|
||||
lldb::SBUnixSignals
|
||||
GetUnixSignals();
|
||||
|
||||
};
|
||||
|
||||
} // namespace lldb
|
505
contrib/llvm-project/lldb/bindings/interface/SBProcess.i
Normal file
505
contrib/llvm-project/lldb/bindings/interface/SBProcess.i
Normal file
@ -0,0 +1,505 @@
|
||||
//===-- SWIG Interface for SBProcess ----------------------------*- C++ -*-===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
namespace lldb {
|
||||
|
||||
%feature("docstring",
|
||||
"Represents the process associated with the target program.
|
||||
|
||||
SBProcess supports thread iteration. For example (from test/lldbutil.py),
|
||||
|
||||
# ==================================================
|
||||
# Utility functions related to Threads and Processes
|
||||
# ==================================================
|
||||
|
||||
def get_stopped_threads(process, reason):
|
||||
'''Returns the thread(s) with the specified stop reason in a list.
|
||||
|
||||
The list can be empty if no such thread exists.
|
||||
'''
|
||||
threads = []
|
||||
for t in process:
|
||||
if t.GetStopReason() == reason:
|
||||
threads.append(t)
|
||||
return threads
|
||||
|
||||
...
|
||||
"
|
||||
) SBProcess;
|
||||
class SBProcess
|
||||
{
|
||||
public:
|
||||
enum
|
||||
{
|
||||
eBroadcastBitStateChanged = (1 << 0),
|
||||
eBroadcastBitInterrupt = (1 << 1),
|
||||
eBroadcastBitSTDOUT = (1 << 2),
|
||||
eBroadcastBitSTDERR = (1 << 3),
|
||||
eBroadcastBitProfileData = (1 << 4),
|
||||
eBroadcastBitStructuredData = (1 << 5)
|
||||
};
|
||||
|
||||
SBProcess ();
|
||||
|
||||
SBProcess (const lldb::SBProcess& rhs);
|
||||
|
||||
~SBProcess();
|
||||
|
||||
static const char *
|
||||
GetBroadcasterClassName ();
|
||||
|
||||
const char *
|
||||
GetPluginName ();
|
||||
|
||||
const char *
|
||||
GetShortPluginName ();
|
||||
|
||||
void
|
||||
Clear ();
|
||||
|
||||
bool
|
||||
IsValid() const;
|
||||
|
||||
explicit operator bool() const;
|
||||
|
||||
lldb::SBTarget
|
||||
GetTarget() const;
|
||||
|
||||
lldb::ByteOrder
|
||||
GetByteOrder() const;
|
||||
|
||||
%feature("autodoc", "
|
||||
Writes data into the current process's stdin. API client specifies a Python
|
||||
string as the only argument.") PutSTDIN;
|
||||
size_t
|
||||
PutSTDIN (const char *src, size_t src_len);
|
||||
|
||||
%feature("autodoc", "
|
||||
Reads data from the current process's stdout stream. API client specifies
|
||||
the size of the buffer to read data into. It returns the byte buffer in a
|
||||
Python string.") GetSTDOUT;
|
||||
size_t
|
||||
GetSTDOUT (char *dst, size_t dst_len) const;
|
||||
|
||||
%feature("autodoc", "
|
||||
Reads data from the current process's stderr stream. API client specifies
|
||||
the size of the buffer to read data into. It returns the byte buffer in a
|
||||
Python string.") GetSTDERR;
|
||||
size_t
|
||||
GetSTDERR (char *dst, size_t dst_len) const;
|
||||
|
||||
size_t
|
||||
GetAsyncProfileData(char *dst, size_t dst_len) const;
|
||||
|
||||
void
|
||||
ReportEventState (const lldb::SBEvent &event, SBFile out) const;
|
||||
|
||||
void
|
||||
ReportEventState (const lldb::SBEvent &event, FileSP BORROWED) const;
|
||||
|
||||
void
|
||||
AppendEventStateReport (const lldb::SBEvent &event, lldb::SBCommandReturnObject &result);
|
||||
|
||||
%feature("docstring", "
|
||||
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.") RemoteAttachToProcessWithID;
|
||||
bool
|
||||
RemoteAttachToProcessWithID (lldb::pid_t pid,
|
||||
lldb::SBError& error);
|
||||
|
||||
%feature("docstring",
|
||||
"See SBTarget.Launch for argument description and usage."
|
||||
) RemoteLaunch;
|
||||
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 ();
|
||||
|
||||
%feature("autodoc", "
|
||||
Returns the INDEX'th thread from the list of current threads. The index
|
||||
of a thread is only valid for the current stop. For a persistent thread
|
||||
identifier use either the thread ID or the IndexID. See help on SBThread
|
||||
for more details.") GetThreadAtIndex;
|
||||
lldb::SBThread
|
||||
GetThreadAtIndex (size_t index);
|
||||
|
||||
%feature("autodoc", "
|
||||
Returns the thread with the given thread ID.") GetThreadByID;
|
||||
lldb::SBThread
|
||||
GetThreadByID (lldb::tid_t sb_thread_id);
|
||||
|
||||
%feature("autodoc", "
|
||||
Returns the thread with the given thread IndexID.") GetThreadByIndexID;
|
||||
lldb::SBThread
|
||||
GetThreadByIndexID (uint32_t index_id);
|
||||
|
||||
%feature("autodoc", "
|
||||
Returns the currently selected thread.") GetSelectedThread;
|
||||
lldb::SBThread
|
||||
GetSelectedThread () const;
|
||||
|
||||
%feature("autodoc", "
|
||||
Lazily create a thread on demand through the current OperatingSystem plug-in, if the current OperatingSystem plug-in supports it.") CreateOSPluginThread;
|
||||
lldb::SBThread
|
||||
CreateOSPluginThread (lldb::tid_t tid, lldb::addr_t context);
|
||||
|
||||
bool
|
||||
SetSelectedThread (const lldb::SBThread &thread);
|
||||
|
||||
bool
|
||||
SetSelectedThreadByID (lldb::tid_t tid);
|
||||
|
||||
bool
|
||||
SetSelectedThreadByIndexID (uint32_t index_id);
|
||||
|
||||
//------------------------------------------------------------------
|
||||
// Queue related functions
|
||||
//------------------------------------------------------------------
|
||||
uint32_t
|
||||
GetNumQueues ();
|
||||
|
||||
lldb::SBQueue
|
||||
GetQueueAtIndex (uint32_t index);
|
||||
|
||||
//------------------------------------------------------------------
|
||||
// Stepping related functions
|
||||
//------------------------------------------------------------------
|
||||
|
||||
lldb::StateType
|
||||
GetState ();
|
||||
|
||||
int
|
||||
GetExitStatus ();
|
||||
|
||||
const char *
|
||||
GetExitDescription ();
|
||||
|
||||
%feature("autodoc", "
|
||||
Returns the process ID of the process.") GetProcessID;
|
||||
lldb::pid_t
|
||||
GetProcessID ();
|
||||
|
||||
%feature("autodoc", "
|
||||
Returns an integer ID that is guaranteed to be unique across all process instances. This is not the process ID, just a unique integer for comparison and caching purposes.") GetUniqueID;
|
||||
uint32_t
|
||||
GetUniqueID();
|
||||
|
||||
uint32_t
|
||||
GetAddressByteSize() const;
|
||||
|
||||
%feature("docstring", "
|
||||
Kills the process and shuts down all threads that were spawned to
|
||||
track and monitor process.") Destroy;
|
||||
lldb::SBError
|
||||
Destroy ();
|
||||
|
||||
lldb::SBError
|
||||
Continue ();
|
||||
|
||||
lldb::SBError
|
||||
Stop ();
|
||||
|
||||
%feature("docstring", "Same as Destroy(self).") Destroy;
|
||||
lldb::SBError
|
||||
Kill ();
|
||||
|
||||
lldb::SBError
|
||||
Detach ();
|
||||
|
||||
%feature("docstring", "Sends the process a unix signal.") Signal;
|
||||
lldb::SBError
|
||||
Signal (int signal);
|
||||
|
||||
lldb::SBUnixSignals
|
||||
GetUnixSignals();
|
||||
|
||||
%feature("docstring", "
|
||||
Returns a stop id that will increase every time the process executes. If
|
||||
include_expression_stops is true, then stops caused by expression evaluation
|
||||
will cause the returned value to increase, otherwise the counter returned will
|
||||
only increase when execution is continued explicitly by the user. Note, the value
|
||||
will always increase, but may increase by more than one per stop.") GetStopID;
|
||||
uint32_t
|
||||
GetStopID(bool include_expression_stops = false);
|
||||
|
||||
void
|
||||
SendAsyncInterrupt();
|
||||
|
||||
%feature("autodoc", "
|
||||
Reads memory from the current process's address space and removes any
|
||||
traps that may have been inserted into the memory. It returns the byte
|
||||
buffer in a Python string. Example:
|
||||
|
||||
# Read 4 bytes from address 'addr' and assume error.Success() is True.
|
||||
content = process.ReadMemory(addr, 4, error)
|
||||
new_bytes = bytearray(content)") ReadMemory;
|
||||
size_t
|
||||
ReadMemory (addr_t addr, void *buf, size_t size, lldb::SBError &error);
|
||||
|
||||
%feature("autodoc", "
|
||||
Writes memory to the current process's address space and maintains any
|
||||
traps that might be present due to software breakpoints. Example:
|
||||
|
||||
# Create a Python string from the byte array.
|
||||
new_value = str(bytes)
|
||||
result = process.WriteMemory(addr, new_value, error)
|
||||
if not error.Success() or result != len(bytes):
|
||||
print('SBProcess.WriteMemory() failed!')") WriteMemory;
|
||||
size_t
|
||||
WriteMemory (addr_t addr, const void *buf, size_t size, lldb::SBError &error);
|
||||
|
||||
%feature("autodoc", "
|
||||
Reads a NULL terminated C string from the current process's address space.
|
||||
It returns a python string of the exact length, or truncates the string if
|
||||
the maximum character limit is reached. Example:
|
||||
|
||||
# Read a C string of at most 256 bytes from address '0x1000'
|
||||
error = lldb.SBError()
|
||||
cstring = process.ReadCStringFromMemory(0x1000, 256, error)
|
||||
if error.Success():
|
||||
print('cstring: ', cstring)
|
||||
else
|
||||
print('error: ', error)") ReadCStringFromMemory;
|
||||
|
||||
size_t
|
||||
ReadCStringFromMemory (addr_t addr, void *char_buf, size_t size, lldb::SBError &error);
|
||||
|
||||
%feature("autodoc", "
|
||||
Reads an unsigned integer from memory given a byte size and an address.
|
||||
Returns the unsigned integer that was read. Example:
|
||||
|
||||
# Read a 4 byte unsigned integer from address 0x1000
|
||||
error = lldb.SBError()
|
||||
uint = ReadUnsignedFromMemory(0x1000, 4, error)
|
||||
if error.Success():
|
||||
print('integer: %u' % uint)
|
||||
else
|
||||
print('error: ', error)") ReadUnsignedFromMemory;
|
||||
|
||||
uint64_t
|
||||
ReadUnsignedFromMemory (addr_t addr, uint32_t byte_size, lldb::SBError &error);
|
||||
|
||||
%feature("autodoc", "
|
||||
Reads a pointer from memory from an address and returns the value. Example:
|
||||
|
||||
# Read a pointer from address 0x1000
|
||||
error = lldb.SBError()
|
||||
ptr = ReadPointerFromMemory(0x1000, error)
|
||||
if error.Success():
|
||||
print('pointer: 0x%x' % ptr)
|
||||
else
|
||||
print('error: ', error)") ReadPointerFromMemory;
|
||||
|
||||
lldb::addr_t
|
||||
ReadPointerFromMemory (addr_t addr, lldb::SBError &error);
|
||||
|
||||
|
||||
// Events
|
||||
static lldb::StateType
|
||||
GetStateFromEvent (const lldb::SBEvent &event);
|
||||
|
||||
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);
|
||||
|
||||
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;
|
||||
|
||||
bool
|
||||
GetDescription (lldb::SBStream &description);
|
||||
|
||||
uint32_t
|
||||
GetNumSupportedHardwareWatchpoints (lldb::SBError &error) const;
|
||||
|
||||
uint32_t
|
||||
LoadImage (lldb::SBFileSpec &image_spec, lldb::SBError &error);
|
||||
|
||||
%feature("autodoc", "
|
||||
Load the library whose filename is given by image_spec looking in all the
|
||||
paths supplied in the paths argument. If successful, return a token that
|
||||
can be passed to UnloadImage and fill loaded_path with the path that was
|
||||
successfully loaded. On failure, return
|
||||
lldb.LLDB_INVALID_IMAGE_TOKEN.") LoadImageUsingPaths;
|
||||
uint32_t
|
||||
LoadImageUsingPaths(const lldb::SBFileSpec &image_spec,
|
||||
SBStringList &paths,
|
||||
lldb::SBFileSpec &loaded_path,
|
||||
SBError &error);
|
||||
|
||||
lldb::SBError
|
||||
UnloadImage (uint32_t image_token);
|
||||
|
||||
lldb::SBError
|
||||
SendEventData (const char *event_data);
|
||||
|
||||
%feature("autodoc", "
|
||||
Return the number of different thread-origin extended backtraces
|
||||
this process can support as a uint32_t.
|
||||
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).") GetNumExtendedBacktraceTypes;
|
||||
|
||||
uint32_t
|
||||
GetNumExtendedBacktraceTypes ();
|
||||
|
||||
%feature("autodoc", "
|
||||
Takes an index argument, returns the name of one of the thread-origin
|
||||
extended backtrace methods as a str.") GetExtendedBacktraceTypeAtIndex;
|
||||
|
||||
const char *
|
||||
GetExtendedBacktraceTypeAtIndex (uint32_t idx);
|
||||
|
||||
lldb::SBThreadCollection
|
||||
GetHistoryThreads (addr_t addr);
|
||||
|
||||
bool
|
||||
IsInstrumentationRuntimePresent(lldb::InstrumentationRuntimeType type);
|
||||
|
||||
lldb::SBError
|
||||
SaveCore(const char *file_name);
|
||||
|
||||
lldb::SBTrace
|
||||
StartTrace(SBTraceOptions &options, lldb::SBError &error);
|
||||
|
||||
lldb::SBError
|
||||
GetMemoryRegionInfo(lldb::addr_t load_addr, lldb::SBMemoryRegionInfo ®ion_info);
|
||||
|
||||
lldb::SBMemoryRegionInfoList
|
||||
GetMemoryRegions();
|
||||
|
||||
%feature("autodoc", "
|
||||
Get information about the process.
|
||||
Valid process info will only be returned when the process is alive,
|
||||
use IsValid() to check if the info returned is valid.
|
||||
|
||||
process_info = process.GetProcessInfo()
|
||||
if process_info.IsValid():
|
||||
process_info.GetProcessID()") GetProcessInfo;
|
||||
lldb::SBProcessInfo
|
||||
GetProcessInfo();
|
||||
|
||||
STRING_EXTENSION(SBProcess)
|
||||
|
||||
#ifdef SWIGPYTHON
|
||||
%pythoncode %{
|
||||
def __get_is_alive__(self):
|
||||
'''Returns "True" if the process is currently alive, "False" otherwise'''
|
||||
s = self.GetState()
|
||||
if (s == eStateAttaching or
|
||||
s == eStateLaunching or
|
||||
s == eStateStopped or
|
||||
s == eStateRunning or
|
||||
s == eStateStepping or
|
||||
s == eStateCrashed or
|
||||
s == eStateSuspended):
|
||||
return True
|
||||
return False
|
||||
|
||||
def __get_is_running__(self):
|
||||
'''Returns "True" if the process is currently running, "False" otherwise'''
|
||||
state = self.GetState()
|
||||
if state == eStateRunning or state == eStateStepping:
|
||||
return True
|
||||
return False
|
||||
|
||||
def __get_is_stopped__(self):
|
||||
'''Returns "True" if the process is currently stopped, "False" otherwise'''
|
||||
state = self.GetState()
|
||||
if state == eStateStopped or state == eStateCrashed or state == eStateSuspended:
|
||||
return True
|
||||
return False
|
||||
|
||||
class threads_access(object):
|
||||
'''A helper object that will lazily hand out thread for a process when supplied an index.'''
|
||||
def __init__(self, sbprocess):
|
||||
self.sbprocess = sbprocess
|
||||
|
||||
def __len__(self):
|
||||
if self.sbprocess:
|
||||
return int(self.sbprocess.GetNumThreads())
|
||||
return 0
|
||||
|
||||
def __getitem__(self, key):
|
||||
if type(key) is int and key < len(self):
|
||||
return self.sbprocess.GetThreadAtIndex(key)
|
||||
return None
|
||||
|
||||
def get_threads_access_object(self):
|
||||
'''An accessor function that returns a modules_access() object which allows lazy thread access from a lldb.SBProcess object.'''
|
||||
return self.threads_access (self)
|
||||
|
||||
def get_process_thread_list(self):
|
||||
'''An accessor function that returns a list() that contains all threads in a lldb.SBProcess object.'''
|
||||
threads = []
|
||||
accessor = self.get_threads_access_object()
|
||||
for idx in range(len(accessor)):
|
||||
threads.append(accessor[idx])
|
||||
return threads
|
||||
|
||||
def __iter__(self):
|
||||
'''Iterate over all threads in a lldb.SBProcess object.'''
|
||||
return lldb_iter(self, 'GetNumThreads', 'GetThreadAtIndex')
|
||||
|
||||
def __len__(self):
|
||||
'''Return the number of threads in a lldb.SBProcess object.'''
|
||||
return self.GetNumThreads()
|
||||
|
||||
|
||||
threads = property(get_process_thread_list, None, doc='''A read only property that returns a list() of lldb.SBThread objects for this process.''')
|
||||
thread = property(get_threads_access_object, None, doc='''A read only property that returns an object that can access threads by thread index (thread = lldb.process.thread[12]).''')
|
||||
is_alive = property(__get_is_alive__, None, doc='''A read only property that returns a boolean value that indicates if this process is currently alive.''')
|
||||
is_running = property(__get_is_running__, None, doc='''A read only property that returns a boolean value that indicates if this process is currently running.''')
|
||||
is_stopped = property(__get_is_stopped__, None, doc='''A read only property that returns a boolean value that indicates if this process is currently stopped.''')
|
||||
id = property(GetProcessID, None, doc='''A read only property that returns the process ID as an integer.''')
|
||||
target = property(GetTarget, None, doc='''A read only property that an lldb object that represents the target (lldb.SBTarget) that owns this process.''')
|
||||
num_threads = property(GetNumThreads, None, doc='''A read only property that returns the number of threads in this process as an integer.''')
|
||||
selected_thread = property(GetSelectedThread, SetSelectedThread, doc='''A read/write property that gets/sets the currently selected thread in this process. The getter returns a lldb.SBThread object and the setter takes an lldb.SBThread object.''')
|
||||
state = property(GetState, None, doc='''A read only property that returns an lldb enumeration value (see enumerations that start with "lldb.eState") that represents the current state of this process (running, stopped, exited, etc.).''')
|
||||
exit_state = property(GetExitStatus, None, doc='''A read only property that returns an exit status as an integer of this process when the process state is lldb.eStateExited.''')
|
||||
exit_description = property(GetExitDescription, None, doc='''A read only property that returns an exit description as a string of this process when the process state is lldb.eStateExited.''')
|
||||
broadcaster = property(GetBroadcaster, None, doc='''A read only property that an lldb object that represents the broadcaster (lldb.SBBroadcaster) for this process.''')
|
||||
%}
|
||||
#endif
|
||||
|
||||
};
|
||||
|
||||
} // namespace lldb
|
67
contrib/llvm-project/lldb/bindings/interface/SBProcessInfo.i
Normal file
67
contrib/llvm-project/lldb/bindings/interface/SBProcessInfo.i
Normal file
@ -0,0 +1,67 @@
|
||||
//===-- SWIG Interface for SBProcessInfo-------------------------*- C++ -*-===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
namespace lldb {
|
||||
|
||||
%feature("docstring",
|
||||
"Describes an existing process and any discoverable information that pertains to
|
||||
that process."
|
||||
) SBProcessInfo;
|
||||
|
||||
class SBProcessInfo
|
||||
{
|
||||
public:
|
||||
SBProcessInfo();
|
||||
|
||||
SBProcessInfo (const SBProcessInfo &rhs);
|
||||
|
||||
~SBProcessInfo ();
|
||||
|
||||
bool
|
||||
IsValid ();
|
||||
|
||||
explicit operator bool() const;
|
||||
|
||||
const char *
|
||||
GetName ();
|
||||
|
||||
SBFileSpec
|
||||
GetExecutableFile ();
|
||||
|
||||
lldb::pid_t
|
||||
GetProcessID ();
|
||||
|
||||
uint32_t
|
||||
GetUserID ();
|
||||
|
||||
uint32_t
|
||||
GetGroupID ();
|
||||
|
||||
bool
|
||||
UserIDIsValid ();
|
||||
|
||||
bool
|
||||
GroupIDIsValid ();
|
||||
|
||||
uint32_t
|
||||
GetEffectiveUserID ();
|
||||
|
||||
uint32_t
|
||||
GetEffectiveGroupID ();
|
||||
|
||||
bool
|
||||
EffectiveUserIDIsValid ();
|
||||
|
||||
bool
|
||||
EffectiveGroupIDIsValid ();
|
||||
|
||||
lldb::pid_t
|
||||
GetParentProcessID ();
|
||||
};
|
||||
|
||||
} // namespace lldb
|
74
contrib/llvm-project/lldb/bindings/interface/SBQueue.i
Normal file
74
contrib/llvm-project/lldb/bindings/interface/SBQueue.i
Normal file
@ -0,0 +1,74 @@
|
||||
//===-- SWIG Interface for SBQueue.h -----------------------------*- C++ -*-===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
namespace lldb {
|
||||
|
||||
class SBQueue
|
||||
{
|
||||
public:
|
||||
SBQueue ();
|
||||
|
||||
SBQueue (const lldb::QueueSP& queue_sp);
|
||||
|
||||
~SBQueue();
|
||||
|
||||
bool
|
||||
IsValid() const;
|
||||
|
||||
explicit operator bool() const;
|
||||
|
||||
void
|
||||
Clear ();
|
||||
|
||||
lldb::SBProcess
|
||||
GetProcess ();
|
||||
|
||||
%feature("autodoc", "
|
||||
Returns an lldb::queue_id_t type unique identifier number for this
|
||||
queue that will not be used by any other queue during this process'
|
||||
execution. These ID numbers often start at 1 with the first
|
||||
system-created queues and increment from there.")
|
||||
GetQueueID;
|
||||
|
||||
lldb::queue_id_t
|
||||
GetQueueID () const;
|
||||
|
||||
const char *
|
||||
GetName () const;
|
||||
|
||||
%feature("autodoc", "
|
||||
Returns an lldb::QueueKind enumerated value (e.g. eQueueKindUnknown,
|
||||
eQueueKindSerial, eQueueKindConcurrent) describing the type of this
|
||||
queue.")
|
||||
GetKind();
|
||||
|
||||
lldb::QueueKind
|
||||
GetKind();
|
||||
|
||||
uint32_t
|
||||
GetIndexID () const;
|
||||
|
||||
uint32_t
|
||||
GetNumThreads ();
|
||||
|
||||
lldb::SBThread
|
||||
GetThreadAtIndex (uint32_t);
|
||||
|
||||
uint32_t
|
||||
GetNumPendingItems ();
|
||||
|
||||
lldb::SBQueueItem
|
||||
GetPendingItemAtIndex (uint32_t);
|
||||
|
||||
uint32_t
|
||||
GetNumRunningItems ();
|
||||
|
||||
};
|
||||
|
||||
} // namespace lldb
|
||||
|
47
contrib/llvm-project/lldb/bindings/interface/SBQueueItem.i
Normal file
47
contrib/llvm-project/lldb/bindings/interface/SBQueueItem.i
Normal file
@ -0,0 +1,47 @@
|
||||
//===-- SWIG Interface for SBQueueItem.h ------------------------*- C++ -*-===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
namespace lldb {
|
||||
|
||||
class SBQueueItem
|
||||
{
|
||||
public:
|
||||
SBQueueItem ();
|
||||
|
||||
SBQueueItem (const lldb::QueueItemSP& queue_item_sp);
|
||||
|
||||
~SBQueueItem();
|
||||
|
||||
bool
|
||||
IsValid() const;
|
||||
|
||||
explicit operator bool() const;
|
||||
|
||||
void
|
||||
Clear ();
|
||||
|
||||
lldb::QueueItemKind
|
||||
GetKind () const;
|
||||
|
||||
void
|
||||
SetKind (lldb::QueueItemKind kind);
|
||||
|
||||
lldb::SBAddress
|
||||
GetAddress () const;
|
||||
|
||||
void
|
||||
SetAddress (lldb::SBAddress addr);
|
||||
|
||||
void
|
||||
SetQueueItem (const lldb::QueueItemSP& queue_item_sp);
|
||||
|
||||
lldb::SBThread
|
||||
GetExtendedBacktraceThread (const char *type);
|
||||
};
|
||||
|
||||
} // namespace lldb
|
149
contrib/llvm-project/lldb/bindings/interface/SBSection.i
Normal file
149
contrib/llvm-project/lldb/bindings/interface/SBSection.i
Normal file
@ -0,0 +1,149 @@
|
||||
//===-- SWIG Interface for SBSection ----------------------------*- C++ -*-===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
namespace lldb {
|
||||
|
||||
%feature("docstring",
|
||||
"Represents an executable image section.
|
||||
|
||||
SBSection supports iteration through its subsection, represented as SBSection
|
||||
as well. For example,
|
||||
|
||||
for sec in exe_module:
|
||||
if sec.GetName() == '__TEXT':
|
||||
print sec
|
||||
break
|
||||
print INDENT + 'Number of subsections: %d' % sec.GetNumSubSections()
|
||||
for subsec in sec:
|
||||
print INDENT + repr(subsec)
|
||||
|
||||
produces:
|
||||
|
||||
[0x0000000100000000-0x0000000100002000) a.out.__TEXT
|
||||
Number of subsections: 6
|
||||
[0x0000000100001780-0x0000000100001d5c) a.out.__TEXT.__text
|
||||
[0x0000000100001d5c-0x0000000100001da4) a.out.__TEXT.__stubs
|
||||
[0x0000000100001da4-0x0000000100001e2c) a.out.__TEXT.__stub_helper
|
||||
[0x0000000100001e2c-0x0000000100001f10) a.out.__TEXT.__cstring
|
||||
[0x0000000100001f10-0x0000000100001f68) a.out.__TEXT.__unwind_info
|
||||
[0x0000000100001f68-0x0000000100001ff8) a.out.__TEXT.__eh_frame
|
||||
|
||||
See also SBModule."
|
||||
) SBSection;
|
||||
|
||||
class SBSection
|
||||
{
|
||||
public:
|
||||
|
||||
SBSection ();
|
||||
|
||||
SBSection (const lldb::SBSection &rhs);
|
||||
|
||||
~SBSection ();
|
||||
|
||||
bool
|
||||
IsValid () const;
|
||||
|
||||
explicit operator bool() const;
|
||||
|
||||
const char *
|
||||
GetName ();
|
||||
|
||||
lldb::SBSection
|
||||
GetParent();
|
||||
|
||||
lldb::SBSection
|
||||
FindSubSection (const char *sect_name);
|
||||
|
||||
size_t
|
||||
GetNumSubSections ();
|
||||
|
||||
lldb::SBSection
|
||||
GetSubSectionAtIndex (size_t idx);
|
||||
|
||||
lldb::addr_t
|
||||
GetFileAddress ();
|
||||
|
||||
lldb::addr_t
|
||||
GetLoadAddress (lldb::SBTarget &target);
|
||||
|
||||
lldb::addr_t
|
||||
GetByteSize ();
|
||||
|
||||
uint64_t
|
||||
GetFileOffset ();
|
||||
|
||||
uint64_t
|
||||
GetFileByteSize ();
|
||||
|
||||
lldb::SBData
|
||||
GetSectionData ();
|
||||
|
||||
lldb::SBData
|
||||
GetSectionData (uint64_t offset,
|
||||
uint64_t size);
|
||||
|
||||
SectionType
|
||||
GetSectionType ();
|
||||
|
||||
uint32_t
|
||||
GetPermissions() const;
|
||||
|
||||
%feature("docstring", "
|
||||
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") GetTargetByteSize;
|
||||
uint32_t
|
||||
GetTargetByteSize ();
|
||||
|
||||
bool
|
||||
GetDescription (lldb::SBStream &description);
|
||||
|
||||
bool
|
||||
operator == (const lldb::SBSection &rhs);
|
||||
|
||||
bool
|
||||
operator != (const lldb::SBSection &rhs);
|
||||
|
||||
STRING_EXTENSION(SBSection)
|
||||
|
||||
#ifdef SWIGPYTHON
|
||||
%pythoncode %{
|
||||
def __iter__(self):
|
||||
'''Iterate over all subsections in a lldb.SBSection object.'''
|
||||
return lldb_iter(self, 'GetNumSubSections', 'GetSubSectionAtIndex')
|
||||
|
||||
def __len__(self):
|
||||
'''Return the number of subsections in a lldb.SBSection object.'''
|
||||
return self.GetNumSubSections()
|
||||
|
||||
def get_addr(self):
|
||||
return SBAddress(self, 0)
|
||||
|
||||
name = property(GetName, None, doc='''A read only property that returns the name of this section as a string.''')
|
||||
addr = property(get_addr, None, doc='''A read only property that returns an lldb object that represents the start address (lldb.SBAddress) for this section.''')
|
||||
file_addr = property(GetFileAddress, None, doc='''A read only property that returns an integer that represents the starting "file" address for this section, or the address of the section in the object file in which it is defined.''')
|
||||
size = property(GetByteSize, None, doc='''A read only property that returns the size in bytes of this section as an integer.''')
|
||||
file_offset = property(GetFileOffset, None, doc='''A read only property that returns the file offset in bytes of this section as an integer.''')
|
||||
file_size = property(GetFileByteSize, None, doc='''A read only property that returns the file size in bytes of this section as an integer.''')
|
||||
data = property(GetSectionData, None, doc='''A read only property that returns an lldb object that represents the bytes for this section (lldb.SBData) for this section.''')
|
||||
type = property(GetSectionType, None, doc='''A read only property that returns an lldb enumeration value (see enumerations that start with "lldb.eSectionType") that represents the type of this section (code, data, etc.).''')
|
||||
target_byte_size = property(GetTargetByteSize, None, doc='''A read only property that returns the size of a target byte represented by this section as a number of host bytes.''')
|
||||
%}
|
||||
#endif
|
||||
|
||||
private:
|
||||
|
||||
std::unique_ptr<lldb_private::SectionImpl> m_opaque_ap;
|
||||
};
|
||||
|
||||
} // namespace lldb
|
@ -0,0 +1,59 @@
|
||||
//===-- SWIG Interface for SBSourceManager ----------------------*- C++ -*-===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
namespace lldb {
|
||||
|
||||
%feature("docstring",
|
||||
"Represents a central authority for displaying source code.
|
||||
|
||||
For example (from test/source-manager/TestSourceManager.py),
|
||||
|
||||
# Create the filespec for 'main.c'.
|
||||
filespec = lldb.SBFileSpec('main.c', False)
|
||||
source_mgr = self.dbg.GetSourceManager()
|
||||
# Use a string stream as the destination.
|
||||
stream = lldb.SBStream()
|
||||
source_mgr.DisplaySourceLinesWithLineNumbers(filespec,
|
||||
self.line,
|
||||
2, # context before
|
||||
2, # context after
|
||||
'=>', # prefix for current line
|
||||
stream)
|
||||
|
||||
# 2
|
||||
# 3 int main(int argc, char const *argv[]) {
|
||||
# => 4 printf('Hello world.\\n'); // Set break point at this line.
|
||||
# 5 return 0;
|
||||
# 6 }
|
||||
self.expect(stream.GetData(), 'Source code displayed correctly',
|
||||
exe=False,
|
||||
patterns = ['=> %d.*Hello world' % self.line])") SBSourceManager;
|
||||
class SBSourceManager
|
||||
{
|
||||
public:
|
||||
SBSourceManager (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);
|
||||
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);
|
||||
};
|
||||
|
||||
} // namespace lldb
|
102
contrib/llvm-project/lldb/bindings/interface/SBStream.i
Normal file
102
contrib/llvm-project/lldb/bindings/interface/SBStream.i
Normal file
@ -0,0 +1,102 @@
|
||||
//===-- SWIG Interface for SBStream -----------------------------*- C++ -*-===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
namespace lldb {
|
||||
|
||||
%feature("docstring",
|
||||
"Represents a destination for streaming data output to. By default, a string
|
||||
stream is created.
|
||||
|
||||
For example (from test/source-manager/TestSourceManager.py),
|
||||
|
||||
# Create the filespec for 'main.c'.
|
||||
filespec = lldb.SBFileSpec('main.c', False)
|
||||
source_mgr = self.dbg.GetSourceManager()
|
||||
# Use a string stream as the destination.
|
||||
stream = lldb.SBStream()
|
||||
source_mgr.DisplaySourceLinesWithLineNumbers(filespec,
|
||||
self.line,
|
||||
2, # context before
|
||||
2, # context after
|
||||
'=>', # prefix for current line
|
||||
stream)
|
||||
|
||||
# 2
|
||||
# 3 int main(int argc, char const *argv[]) {
|
||||
# => 4 printf('Hello world.\\n'); // Set break point at this line.
|
||||
# 5 return 0;
|
||||
# 6 }
|
||||
self.expect(stream.GetData(), 'Source code displayed correctly',
|
||||
exe=False,
|
||||
patterns = ['=> %d.*Hello world' % self.line])") SBStream;
|
||||
class SBStream
|
||||
{
|
||||
public:
|
||||
|
||||
SBStream ();
|
||||
|
||||
~SBStream ();
|
||||
|
||||
bool
|
||||
IsValid() const;
|
||||
|
||||
explicit operator bool() const;
|
||||
|
||||
%feature("docstring", "
|
||||
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.") GetData;
|
||||
const char *
|
||||
GetData ();
|
||||
|
||||
%feature("docstring", "
|
||||
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.") GetSize;
|
||||
size_t
|
||||
GetSize();
|
||||
|
||||
// wrapping the variadic Printf() with a plain Print()
|
||||
// because it is hard to support varargs in SWIG bridgings
|
||||
%extend {
|
||||
void Print (const char* str)
|
||||
{
|
||||
self->Printf("%s", str);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
RedirectToFile (const char *path, bool append);
|
||||
|
||||
void
|
||||
RedirectToFile (lldb::SBFile file);
|
||||
|
||||
void
|
||||
RedirectToFile (lldb::FileSP file);
|
||||
|
||||
%extend {
|
||||
%feature("autodoc", "DEPRECATED, use RedirectToFile");
|
||||
void
|
||||
RedirectToFileHandle (lldb::FileSP file, bool transfer_fh_ownership) {
|
||||
self->RedirectToFile(file);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
RedirectToFileDescriptor (int fd, bool transfer_fh_ownership);
|
||||
|
||||
%feature("docstring", "
|
||||
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.") Clear;
|
||||
void
|
||||
Clear ();
|
||||
};
|
||||
|
||||
} // namespace lldb
|
57
contrib/llvm-project/lldb/bindings/interface/SBStringList.i
Normal file
57
contrib/llvm-project/lldb/bindings/interface/SBStringList.i
Normal file
@ -0,0 +1,57 @@
|
||||
//===-- SWIG Interface for SBStringList -------------------------*- C++ -*-===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
namespace lldb {
|
||||
|
||||
class SBStringList
|
||||
{
|
||||
public:
|
||||
|
||||
SBStringList ();
|
||||
|
||||
SBStringList (const lldb::SBStringList &rhs);
|
||||
|
||||
~SBStringList ();
|
||||
|
||||
bool
|
||||
IsValid() const;
|
||||
|
||||
explicit operator bool() const;
|
||||
|
||||
void
|
||||
AppendString (const char *str);
|
||||
|
||||
void
|
||||
AppendList (const char **strv, int strc);
|
||||
|
||||
void
|
||||
AppendList (const lldb::SBStringList &strings);
|
||||
|
||||
uint32_t
|
||||
GetSize () const;
|
||||
|
||||
const char *
|
||||
GetStringAtIndex (size_t idx);
|
||||
|
||||
void
|
||||
Clear ();
|
||||
|
||||
#ifdef SWIGPYTHON
|
||||
%pythoncode%{
|
||||
def __iter__(self):
|
||||
'''Iterate over all strings in a lldb.SBStringList object.'''
|
||||
return lldb_iter(self, 'GetSize', 'GetStringAtIndex')
|
||||
|
||||
def __len__(self):
|
||||
'''Return the number of strings in a lldb.SBStringList object.'''
|
||||
return self.GetSize()
|
||||
%}
|
||||
#endif
|
||||
};
|
||||
|
||||
} // namespace lldb
|
@ -0,0 +1,63 @@
|
||||
//===-- SWIG Interface for SBStructuredData ---------------------*- C++ -*-===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
namespace lldb {
|
||||
|
||||
%feature("docstring",
|
||||
"A class representing a StructuredData event.
|
||||
|
||||
This class wraps the event type generated by StructuredData
|
||||
features."
|
||||
) SBStructuredData;
|
||||
class SBStructuredData
|
||||
{
|
||||
public:
|
||||
SBStructuredData();
|
||||
|
||||
SBStructuredData(const lldb::SBStructuredData &rhs);
|
||||
|
||||
SBStructuredData(const lldb::EventSP &event_sp);
|
||||
|
||||
~SBStructuredData();
|
||||
|
||||
bool
|
||||
IsValid() const;
|
||||
|
||||
explicit operator bool() const;
|
||||
|
||||
void
|
||||
Clear();
|
||||
|
||||
lldb::StructuredDataType GetType() const;
|
||||
|
||||
size_t GetSize() const;
|
||||
|
||||
bool GetKeys(lldb::SBStringList &keys) const;
|
||||
|
||||
lldb::SBStructuredData GetValueForKey(const char *key) const;
|
||||
|
||||
lldb::SBStructuredData GetItemAtIndex(size_t idx) const;
|
||||
|
||||
uint64_t GetIntegerValue(uint64_t fail_value = 0) const;
|
||||
|
||||
double GetFloatValue(double fail_value = 0.0) const;
|
||||
|
||||
bool GetBooleanValue(bool fail_value = false) const;
|
||||
|
||||
size_t GetStringValue(char *dst, size_t dst_len) const;
|
||||
|
||||
lldb::SBError
|
||||
GetAsJSON(lldb::SBStream &stream) const;
|
||||
|
||||
lldb::SBError
|
||||
GetDescription(lldb::SBStream &stream) const;
|
||||
|
||||
lldb::SBError
|
||||
SetFromJSON(lldb::SBStream &stream);
|
||||
};
|
||||
}
|
96
contrib/llvm-project/lldb/bindings/interface/SBSymbol.i
Normal file
96
contrib/llvm-project/lldb/bindings/interface/SBSymbol.i
Normal file
@ -0,0 +1,96 @@
|
||||
//===-- SWIG Interface for SBSymbol -----------------------------*- C++ -*-===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
namespace lldb {
|
||||
|
||||
%feature("docstring",
|
||||
"Represents the symbol possibly associated with a stack frame.
|
||||
SBModule contains SBSymbol(s). SBSymbol can also be retrieved from SBFrame.
|
||||
|
||||
See also SBModule and SBFrame."
|
||||
) SBSymbol;
|
||||
class SBSymbol
|
||||
{
|
||||
public:
|
||||
|
||||
SBSymbol ();
|
||||
|
||||
~SBSymbol ();
|
||||
|
||||
SBSymbol (const lldb::SBSymbol &rhs);
|
||||
|
||||
bool
|
||||
IsValid () const;
|
||||
|
||||
explicit operator bool() const;
|
||||
|
||||
|
||||
const char *
|
||||
GetName() const;
|
||||
|
||||
const char *
|
||||
GetDisplayName() const;
|
||||
|
||||
const char *
|
||||
GetMangledName () const;
|
||||
|
||||
lldb::SBInstructionList
|
||||
GetInstructions (lldb::SBTarget target);
|
||||
|
||||
lldb::SBInstructionList
|
||||
GetInstructions (lldb::SBTarget target, const char *flavor_string);
|
||||
|
||||
SBAddress
|
||||
GetStartAddress ();
|
||||
|
||||
SBAddress
|
||||
GetEndAddress ();
|
||||
|
||||
uint32_t
|
||||
GetPrologueByteSize ();
|
||||
|
||||
SymbolType
|
||||
GetType ();
|
||||
|
||||
bool
|
||||
GetDescription (lldb::SBStream &description);
|
||||
|
||||
bool
|
||||
IsExternal();
|
||||
|
||||
bool
|
||||
IsSynthetic();
|
||||
|
||||
bool
|
||||
operator == (const lldb::SBSymbol &rhs) const;
|
||||
|
||||
bool
|
||||
operator != (const lldb::SBSymbol &rhs) const;
|
||||
|
||||
STRING_EXTENSION(SBSymbol)
|
||||
|
||||
#ifdef SWIGPYTHON
|
||||
%pythoncode %{
|
||||
def get_instructions_from_current_target (self):
|
||||
return self.GetInstructions (target)
|
||||
|
||||
name = property(GetName, None, doc='''A read only property that returns the name for this symbol as a string.''')
|
||||
mangled = property(GetMangledName, None, doc='''A read only property that returns the mangled (linkage) name for this symbol as a string.''')
|
||||
type = property(GetType, None, doc='''A read only property that returns an lldb enumeration value (see enumerations that start with "lldb.eSymbolType") that represents the type of this symbol.''')
|
||||
addr = property(GetStartAddress, None, doc='''A read only property that returns an lldb object that represents the start address (lldb.SBAddress) for this symbol.''')
|
||||
end_addr = property(GetEndAddress, None, doc='''A read only property that returns an lldb object that represents the end address (lldb.SBAddress) for this symbol.''')
|
||||
prologue_size = property(GetPrologueByteSize, None, doc='''A read only property that returns the size in bytes of the prologue instructions as an unsigned integer.''')
|
||||
instructions = property(get_instructions_from_current_target, None, doc='''A read only property that returns an lldb object that represents the instructions (lldb.SBInstructionList) for this symbol.''')
|
||||
external = property(IsExternal, None, doc='''A read only property that returns a boolean value that indicates if this symbol is externally visiable (exported) from the module that contains it.''')
|
||||
synthetic = property(IsSynthetic, None, doc='''A read only property that returns a boolean value that indicates if this symbol was synthetically created from information in module that contains it.''')
|
||||
%}
|
||||
#endif
|
||||
|
||||
};
|
||||
|
||||
} // namespace lldb
|
@ -0,0 +1,99 @@
|
||||
//===-- SWIG Interface for SBSymbolContext ----------------------*- C++ -*-===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
namespace lldb {
|
||||
|
||||
%feature("docstring",
|
||||
"A context object that provides access to core debugger entities.
|
||||
|
||||
Many debugger functions require a context when doing lookups. This class
|
||||
provides a common structure that can be used as the result of a query that
|
||||
can contain a single result.
|
||||
|
||||
For example,
|
||||
|
||||
exe = os.path.join(os.getcwd(), 'a.out')
|
||||
|
||||
# Create a target for the debugger.
|
||||
target = self.dbg.CreateTarget(exe)
|
||||
|
||||
# Now create a breakpoint on main.c by name 'c'.
|
||||
breakpoint = target.BreakpointCreateByName('c', 'a.out')
|
||||
|
||||
# Now launch the process, and do not stop at entry point.
|
||||
process = target.LaunchSimple(None, None, os.getcwd())
|
||||
|
||||
# The inferior should stop on 'c'.
|
||||
from lldbutil import get_stopped_thread
|
||||
thread = get_stopped_thread(process, lldb.eStopReasonBreakpoint)
|
||||
frame0 = thread.GetFrameAtIndex(0)
|
||||
|
||||
# Now get the SBSymbolContext from this frame. We want everything. :-)
|
||||
context = frame0.GetSymbolContext(lldb.eSymbolContextEverything)
|
||||
|
||||
# Get the module.
|
||||
module = context.GetModule()
|
||||
...
|
||||
|
||||
# And the compile unit associated with the frame.
|
||||
compileUnit = context.GetCompileUnit()
|
||||
...
|
||||
"
|
||||
) SBSymbolContext;
|
||||
class SBSymbolContext
|
||||
{
|
||||
public:
|
||||
SBSymbolContext ();
|
||||
|
||||
SBSymbolContext (const lldb::SBSymbolContext& rhs);
|
||||
|
||||
~SBSymbolContext ();
|
||||
|
||||
bool
|
||||
IsValid () const;
|
||||
|
||||
explicit operator bool() const;
|
||||
|
||||
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);
|
||||
|
||||
lldb::SBSymbolContext
|
||||
GetParentOfInlinedScope (const lldb::SBAddress &curr_frame_pc,
|
||||
lldb::SBAddress &parent_frame_addr) const;
|
||||
|
||||
|
||||
bool
|
||||
GetDescription (lldb::SBStream &description);
|
||||
|
||||
STRING_EXTENSION(SBSymbolContext)
|
||||
|
||||
#ifdef SWIGPYTHON
|
||||
%pythoncode %{
|
||||
module = property(GetModule, SetModule, doc='''A read/write property that allows the getting/setting of the module (lldb.SBModule) in this symbol context.''')
|
||||
compile_unit = property(GetCompileUnit, SetCompileUnit, doc='''A read/write property that allows the getting/setting of the compile unit (lldb.SBCompileUnit) in this symbol context.''')
|
||||
function = property(GetFunction, SetFunction, doc='''A read/write property that allows the getting/setting of the function (lldb.SBFunction) in this symbol context.''')
|
||||
block = property(GetBlock, SetBlock, doc='''A read/write property that allows the getting/setting of the block (lldb.SBBlock) in this symbol context.''')
|
||||
symbol = property(GetSymbol, SetSymbol, doc='''A read/write property that allows the getting/setting of the symbol (lldb.SBSymbol) in this symbol context.''')
|
||||
line_entry = property(GetLineEntry, SetLineEntry, doc='''A read/write property that allows the getting/setting of the line entry (lldb.SBLineEntry) in this symbol context.''')
|
||||
%}
|
||||
#endif
|
||||
|
||||
};
|
||||
|
||||
} // namespace lldb
|
@ -0,0 +1,139 @@
|
||||
//===-- SWIG Interface for SBSymbolContextList ------------------*- C++ -*-===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
namespace lldb {
|
||||
|
||||
%feature("docstring",
|
||||
"Represents a list of symbol context object. See also SBSymbolContext.
|
||||
|
||||
For example (from test/python_api/target/TestTargetAPI.py),
|
||||
|
||||
def find_functions(self, exe_name):
|
||||
'''Exercise SBTaget.FindFunctions() API.'''
|
||||
exe = os.path.join(os.getcwd(), exe_name)
|
||||
|
||||
# Create a target by the debugger.
|
||||
target = self.dbg.CreateTarget(exe)
|
||||
self.assertTrue(target, VALID_TARGET)
|
||||
|
||||
list = lldb.SBSymbolContextList()
|
||||
num = target.FindFunctions('c', lldb.eFunctionNameTypeAuto, False, list)
|
||||
self.assertTrue(num == 1 and list.GetSize() == 1)
|
||||
|
||||
for sc in list:
|
||||
self.assertTrue(sc.GetModule().GetFileSpec().GetFilename() == exe_name)
|
||||
self.assertTrue(sc.GetSymbol().GetName() == 'c')") SBSymbolContextList;
|
||||
class SBSymbolContextList
|
||||
{
|
||||
public:
|
||||
SBSymbolContextList ();
|
||||
|
||||
SBSymbolContextList (const lldb::SBSymbolContextList& rhs);
|
||||
|
||||
~SBSymbolContextList ();
|
||||
|
||||
bool
|
||||
IsValid () const;
|
||||
|
||||
explicit operator bool() const;
|
||||
|
||||
uint32_t
|
||||
GetSize() const;
|
||||
|
||||
SBSymbolContext
|
||||
GetContextAtIndex (uint32_t idx);
|
||||
|
||||
void
|
||||
Append (lldb::SBSymbolContext &sc);
|
||||
|
||||
void
|
||||
Append (lldb::SBSymbolContextList &sc_list);
|
||||
|
||||
bool
|
||||
GetDescription (lldb::SBStream &description);
|
||||
|
||||
void
|
||||
Clear();
|
||||
|
||||
STRING_EXTENSION(SBSymbolContextList)
|
||||
|
||||
#ifdef SWIGPYTHON
|
||||
%pythoncode %{
|
||||
def __iter__(self):
|
||||
'''Iterate over all symbol contexts in a lldb.SBSymbolContextList
|
||||
object.'''
|
||||
return lldb_iter(self, 'GetSize', 'GetContextAtIndex')
|
||||
|
||||
def __len__(self):
|
||||
return int(self.GetSize())
|
||||
|
||||
def __getitem__(self, key):
|
||||
count = len(self)
|
||||
if type(key) is int:
|
||||
if key < count:
|
||||
return self.GetContextAtIndex(key)
|
||||
else:
|
||||
raise IndexError
|
||||
raise TypeError
|
||||
|
||||
def get_module_array(self):
|
||||
a = []
|
||||
for i in range(len(self)):
|
||||
obj = self.GetContextAtIndex(i).module
|
||||
if obj:
|
||||
a.append(obj)
|
||||
return a
|
||||
|
||||
def get_compile_unit_array(self):
|
||||
a = []
|
||||
for i in range(len(self)):
|
||||
obj = self.GetContextAtIndex(i).compile_unit
|
||||
if obj:
|
||||
a.append(obj)
|
||||
return a
|
||||
def get_function_array(self):
|
||||
a = []
|
||||
for i in range(len(self)):
|
||||
obj = self.GetContextAtIndex(i).function
|
||||
if obj:
|
||||
a.append(obj)
|
||||
return a
|
||||
def get_block_array(self):
|
||||
a = []
|
||||
for i in range(len(self)):
|
||||
obj = self.GetContextAtIndex(i).block
|
||||
if obj:
|
||||
a.append(obj)
|
||||
return a
|
||||
def get_symbol_array(self):
|
||||
a = []
|
||||
for i in range(len(self)):
|
||||
obj = self.GetContextAtIndex(i).symbol
|
||||
if obj:
|
||||
a.append(obj)
|
||||
return a
|
||||
def get_line_entry_array(self):
|
||||
a = []
|
||||
for i in range(len(self)):
|
||||
obj = self.GetContextAtIndex(i).line_entry
|
||||
if obj:
|
||||
a.append(obj)
|
||||
return a
|
||||
|
||||
modules = property(get_module_array, None, doc='''Returns a list() of lldb.SBModule objects, one for each module in each SBSymbolContext object in this list.''')
|
||||
compile_units = property(get_compile_unit_array, None, doc='''Returns a list() of lldb.SBCompileUnit objects, one for each compile unit in each SBSymbolContext object in this list.''')
|
||||
functions = property(get_function_array, None, doc='''Returns a list() of lldb.SBFunction objects, one for each function in each SBSymbolContext object in this list.''')
|
||||
blocks = property(get_block_array, None, doc='''Returns a list() of lldb.SBBlock objects, one for each block in each SBSymbolContext object in this list.''')
|
||||
line_entries = property(get_line_entry_array, None, doc='''Returns a list() of lldb.SBLineEntry objects, one for each line entry in each SBSymbolContext object in this list.''')
|
||||
symbols = property(get_symbol_array, None, doc='''Returns a list() of lldb.SBSymbol objects, one for each symbol in each SBSymbolContext object in this list.''')
|
||||
%}
|
||||
#endif
|
||||
|
||||
};
|
||||
|
||||
} // namespace lldb
|
1070
contrib/llvm-project/lldb/bindings/interface/SBTarget.i
Normal file
1070
contrib/llvm-project/lldb/bindings/interface/SBTarget.i
Normal file
File diff suppressed because it is too large
Load Diff
461
contrib/llvm-project/lldb/bindings/interface/SBThread.i
Normal file
461
contrib/llvm-project/lldb/bindings/interface/SBThread.i
Normal file
@ -0,0 +1,461 @@
|
||||
//===-- SWIG Interface for SBThread -----------------------------*- C++ -*-===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
namespace lldb {
|
||||
|
||||
%feature("docstring",
|
||||
"Represents a thread of execution. SBProcess contains SBThread(s).
|
||||
|
||||
SBThreads can be referred to by their ID, which maps to the system specific thread
|
||||
identifier, or by IndexID. The ID may or may not be unique depending on whether the
|
||||
system reuses its thread identifiers. The IndexID is a monotonically increasing identifier
|
||||
that will always uniquely reference a particular thread, and when that thread goes
|
||||
away it will not be reused.
|
||||
|
||||
SBThread supports frame iteration. For example (from test/python_api/
|
||||
lldbutil/iter/TestLLDBIterator.py),
|
||||
|
||||
from lldbutil import print_stacktrace
|
||||
stopped_due_to_breakpoint = False
|
||||
for thread in process:
|
||||
if self.TraceOn():
|
||||
print_stacktrace(thread)
|
||||
ID = thread.GetThreadID()
|
||||
if thread.GetStopReason() == lldb.eStopReasonBreakpoint:
|
||||
stopped_due_to_breakpoint = True
|
||||
for frame in thread:
|
||||
self.assertTrue(frame.GetThread().GetThreadID() == ID)
|
||||
if self.TraceOn():
|
||||
print frame
|
||||
|
||||
self.assertTrue(stopped_due_to_breakpoint)
|
||||
|
||||
See also SBProcess and SBFrame."
|
||||
) SBThread;
|
||||
class SBThread
|
||||
{
|
||||
public:
|
||||
//------------------------------------------------------------------
|
||||
// Broadcaster bits.
|
||||
//------------------------------------------------------------------
|
||||
enum
|
||||
{
|
||||
eBroadcastBitStackChanged = (1 << 0),
|
||||
eBroadcastBitThreadSuspended = (1 << 1),
|
||||
eBroadcastBitThreadResumed = (1 << 2),
|
||||
eBroadcastBitSelectedFrameChanged = (1 << 3),
|
||||
eBroadcastBitThreadSelected = (1 << 4)
|
||||
};
|
||||
|
||||
|
||||
SBThread ();
|
||||
|
||||
SBThread (const lldb::SBThread &thread);
|
||||
|
||||
~SBThread();
|
||||
|
||||
static const char *
|
||||
GetBroadcasterClassName ();
|
||||
|
||||
static bool
|
||||
EventIsThreadEvent (const SBEvent &event);
|
||||
|
||||
static SBFrame
|
||||
GetStackFrameFromEvent (const SBEvent &event);
|
||||
|
||||
static SBThread
|
||||
GetThreadFromEvent (const SBEvent &event);
|
||||
|
||||
bool
|
||||
IsValid() const;
|
||||
|
||||
explicit operator bool() const;
|
||||
|
||||
void
|
||||
Clear ();
|
||||
|
||||
lldb::StopReason
|
||||
GetStopReason();
|
||||
|
||||
%feature("docstring", "
|
||||
Get the number of words associated with the stop reason.
|
||||
See also GetStopReasonDataAtIndex().") GetStopReasonDataCount;
|
||||
size_t
|
||||
GetStopReasonDataCount();
|
||||
|
||||
%feature("docstring", "
|
||||
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") GetStopReasonDataAtIndex;
|
||||
uint64_t
|
||||
GetStopReasonDataAtIndex(uint32_t idx);
|
||||
|
||||
%feature("autodoc", "
|
||||
Collects a thread's stop reason extended information dictionary and prints it
|
||||
into the SBStream in a JSON format. The format of this JSON dictionary depends
|
||||
on the stop reason and is currently used only for instrumentation plugins.") GetStopReasonExtendedInfoAsJSON;
|
||||
bool
|
||||
GetStopReasonExtendedInfoAsJSON (lldb::SBStream &stream);
|
||||
|
||||
%feature("autodoc", "
|
||||
Returns a collection of historical stack traces that are significant to the
|
||||
current stop reason. Used by ThreadSanitizer, where we provide various stack
|
||||
traces that were involved in a data race or other type of detected issue.") GetStopReasonExtendedBacktraces;
|
||||
SBThreadCollection
|
||||
GetStopReasonExtendedBacktraces (InstrumentationRuntimeType type);
|
||||
|
||||
|
||||
%feature("autodoc", "
|
||||
Pass only an (int)length and expect to get a Python string describing the
|
||||
stop reason.") GetStopDescription;
|
||||
size_t
|
||||
GetStopDescription (char *dst_or_null, size_t dst_len);
|
||||
|
||||
SBValue
|
||||
GetStopReturnValue ();
|
||||
|
||||
%feature("autodoc", "
|
||||
Returns a unique thread identifier (type lldb::tid_t, typically a 64-bit type)
|
||||
for the current SBThread that will remain constant throughout the thread's
|
||||
lifetime in this process and will not be reused by another thread during this
|
||||
process lifetime. On Mac OS X systems, this is a system-wide unique thread
|
||||
identifier; this identifier is also used by other tools like sample which helps
|
||||
to associate data from those tools with lldb. See related GetIndexID.")
|
||||
GetThreadID;
|
||||
lldb::tid_t
|
||||
GetThreadID () const;
|
||||
|
||||
%feature("autodoc", "
|
||||
Return the index number for this SBThread. The index number is the same thing
|
||||
that a user gives as an argument to 'thread select' in the command line lldb.
|
||||
These numbers start at 1 (for the first thread lldb sees in a debug session)
|
||||
and increments up throughout the process lifetime. An index number will not be
|
||||
reused for a different thread later in a process - thread 1 will always be
|
||||
associated with the same thread. See related GetThreadID.
|
||||
This method returns a uint32_t index number, takes no arguments.")
|
||||
GetIndexID;
|
||||
uint32_t
|
||||
GetIndexID () const;
|
||||
|
||||
const char *
|
||||
GetName () const;
|
||||
|
||||
%feature("autodoc", "
|
||||
Return the queue name associated with this thread, if any, as a str.
|
||||
For example, with a libdispatch (aka Grand Central Dispatch) queue.") GetQueueName;
|
||||
|
||||
const char *
|
||||
GetQueueName() const;
|
||||
|
||||
%feature("autodoc", "
|
||||
Return the dispatch_queue_id for this thread, if any, as a lldb::queue_id_t.
|
||||
For example, with a libdispatch (aka Grand Central Dispatch) queue.") GetQueueID;
|
||||
|
||||
lldb::queue_id_t
|
||||
GetQueueID() const;
|
||||
|
||||
%feature("docstring", "
|
||||
Takes a path string and a SBStream reference as parameters, returns a bool.
|
||||
Collects the thread's 'info' dictionary from the remote system, uses the path
|
||||
argument to descend into the dictionary to an item of interest, and prints
|
||||
it into the SBStream in a natural format. Return bool is to indicate if
|
||||
anything was printed into the stream (true) or not (false).") GetInfoItemByPathAsString;
|
||||
|
||||
bool
|
||||
GetInfoItemByPathAsString (const char *path, lldb::SBStream &strm);
|
||||
|
||||
%feature("autodoc", "
|
||||
Return the SBQueue for this thread. If this thread is not currently associated
|
||||
with a libdispatch queue, the SBQueue object's IsValid() method will return false.
|
||||
If this SBThread is actually a HistoryThread, we may be able to provide QueueID
|
||||
and QueueName, but not provide an SBQueue. Those individual attributes may have
|
||||
been saved for the HistoryThread without enough information to reconstitute the
|
||||
entire SBQueue at that time.
|
||||
This method takes no arguments, returns an SBQueue.") GetQueue;
|
||||
|
||||
lldb::SBQueue
|
||||
GetQueue () const;
|
||||
|
||||
void
|
||||
StepOver (lldb::RunMode stop_other_threads = lldb::eOnlyDuringStepping);
|
||||
|
||||
%feature("autodoc",
|
||||
"Do a source level single step over in the currently selected thread.") StepOver;
|
||||
void
|
||||
StepOver (lldb::RunMode stop_other_threads, SBError &error);
|
||||
|
||||
void
|
||||
StepInto (lldb::RunMode stop_other_threads = lldb::eOnlyDuringStepping);
|
||||
|
||||
void
|
||||
StepInto (const char *target_name, lldb::RunMode stop_other_threads = lldb::eOnlyDuringStepping);
|
||||
|
||||
%feature("autodoc", "
|
||||
Step the current thread from the current source line to the line given by end_line, stopping if
|
||||
the thread steps into the function given by target_name. If target_name is None, then stepping will stop
|
||||
in any of the places we would normally stop.") StepInto;
|
||||
void
|
||||
StepInto (const char *target_name,
|
||||
uint32_t end_line,
|
||||
SBError &error,
|
||||
lldb::RunMode stop_other_threads = lldb::eOnlyDuringStepping);
|
||||
|
||||
void
|
||||
StepOut ();
|
||||
|
||||
%feature("autodoc",
|
||||
"Step out of the currently selected thread.") StepOut;
|
||||
void
|
||||
StepOut (SBError &error);
|
||||
|
||||
void
|
||||
StepOutOfFrame (SBFrame &frame);
|
||||
|
||||
%feature("autodoc",
|
||||
"Step out of the specified frame.") StepOutOfFrame;
|
||||
void
|
||||
StepOutOfFrame (SBFrame &frame, SBError &error);
|
||||
|
||||
void
|
||||
StepInstruction(bool step_over);
|
||||
|
||||
%feature("autodoc",
|
||||
"Do an instruction level single step in the currently selected thread.") StepInstruction;
|
||||
void
|
||||
StepInstruction(bool step_over, SBError &error);
|
||||
|
||||
SBError
|
||||
StepOverUntil (lldb::SBFrame &frame,
|
||||
lldb::SBFileSpec &file_spec,
|
||||
uint32_t line);
|
||||
|
||||
SBError
|
||||
StepUsingScriptedThreadPlan (const char *script_class_name);
|
||||
|
||||
SBError
|
||||
StepUsingScriptedThreadPlan (const char *script_class_name, bool resume_immediately);
|
||||
|
||||
SBError
|
||||
StepUsingScriptedThreadPlan(const char *script_class_name,
|
||||
lldb::SBStructuredData &args_data,
|
||||
bool resume_immediately);
|
||||
|
||||
SBError
|
||||
JumpToLine (lldb::SBFileSpec &file_spec, uint32_t line);
|
||||
|
||||
void
|
||||
RunToAddress (lldb::addr_t addr);
|
||||
|
||||
void
|
||||
RunToAddress (lldb::addr_t addr, SBError &error);
|
||||
|
||||
%feature("autodoc", "
|
||||
Force a return from the frame passed in (and any frames younger than it)
|
||||
without executing any more code in those frames. If return_value contains
|
||||
a valid SBValue, that will be set as the return value from frame. Note, at
|
||||
present only scalar return values are supported.") ReturnFromFrame;
|
||||
|
||||
SBError
|
||||
ReturnFromFrame (SBFrame &frame, SBValue &return_value);
|
||||
|
||||
%feature("autodoc", "
|
||||
Unwind the stack frames from the innermost expression evaluation.
|
||||
This API is equivalent to 'thread return -x'.") UnwindInnermostExpression;
|
||||
|
||||
SBError
|
||||
UnwindInnermostExpression();
|
||||
|
||||
%feature("docstring", "
|
||||
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, RunToAddres), the
|
||||
thread will now 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.") Suspend;
|
||||
bool
|
||||
Suspend();
|
||||
|
||||
bool
|
||||
Suspend(SBError &error);
|
||||
|
||||
bool
|
||||
Resume ();
|
||||
|
||||
bool
|
||||
Resume (SBError &error);
|
||||
|
||||
bool
|
||||
IsSuspended();
|
||||
|
||||
bool
|
||||
IsStopped();
|
||||
|
||||
uint32_t
|
||||
GetNumFrames ();
|
||||
|
||||
lldb::SBFrame
|
||||
GetFrameAtIndex (uint32_t idx);
|
||||
|
||||
lldb::SBFrame
|
||||
GetSelectedFrame ();
|
||||
|
||||
lldb::SBFrame
|
||||
SetSelectedFrame (uint32_t frame_idx);
|
||||
|
||||
lldb::SBProcess
|
||||
GetProcess ();
|
||||
|
||||
bool
|
||||
GetDescription (lldb::SBStream &description) const;
|
||||
|
||||
%feature("docstring", "
|
||||
Get the description strings for this thread that match what the
|
||||
lldb driver will present, using the thread-format (stop_format==false)
|
||||
or thread-stop-format (stop_format = true).") GetDescription;
|
||||
bool GetDescription(lldb::SBStream &description, bool stop_format) const;
|
||||
|
||||
bool
|
||||
GetStatus (lldb::SBStream &status) const;
|
||||
|
||||
bool
|
||||
operator == (const lldb::SBThread &rhs) const;
|
||||
|
||||
bool
|
||||
operator != (const lldb::SBThread &rhs) const;
|
||||
|
||||
%feature("autodoc","
|
||||
Given an argument of str to specify the type of thread-origin extended
|
||||
backtrace to retrieve, query whether the origin of this thread is
|
||||
available. An SBThread is retured; SBThread.IsValid will return true
|
||||
if an extended backtrace was available. The returned SBThread is not
|
||||
a part of the SBProcess' thread list and it cannot be manipulated like
|
||||
normal threads -- you cannot step or resume it, for instance -- it is
|
||||
intended to used primarily for generating a backtrace. You may request
|
||||
the returned thread's own thread origin in turn.") GetExtendedBacktraceThread;
|
||||
lldb::SBThread
|
||||
GetExtendedBacktraceThread (const char *type);
|
||||
|
||||
%feature("autodoc","
|
||||
Takes no arguments, returns a uint32_t.
|
||||
If this SBThread is an ExtendedBacktrace thread, get the IndexID of the
|
||||
original thread that this ExtendedBacktrace thread represents, if
|
||||
available. The thread that was running this backtrace in the past may
|
||||
not have been registered with lldb's thread index (if it was created,
|
||||
did its work, and was destroyed without lldb ever stopping execution).
|
||||
In that case, this ExtendedBacktrace thread's IndexID will be returned.") GetExtendedBacktraceOriginatingIndexID;
|
||||
uint32_t
|
||||
GetExtendedBacktraceOriginatingIndexID();
|
||||
|
||||
%feature("autodoc","
|
||||
Returns an SBValue object represeting the current exception for the thread,
|
||||
if there is any. Currently, this works for Obj-C code and returns an SBValue
|
||||
representing the NSException object at the throw site or that's currently
|
||||
being processes.") GetCurrentException;
|
||||
lldb::SBValue
|
||||
GetCurrentException();
|
||||
|
||||
%feature("autodoc","
|
||||
Returns a historical (fake) SBThread representing the stack trace of an
|
||||
exception, if there is one for the thread. Currently, this works for Obj-C
|
||||
code, and can retrieve the throw-site backtrace of an NSException object
|
||||
even when the program is no longer at the throw site.") GetCurrentExceptionBacktrace;
|
||||
lldb::SBThread
|
||||
GetCurrentExceptionBacktrace();
|
||||
|
||||
%feature("autodoc","
|
||||
Takes no arguments, returns a bool.
|
||||
lldb may be able to detect that function calls should not be executed
|
||||
on a given thread at a particular point in time. It is recommended that
|
||||
this is checked before performing an inferior function call on a given
|
||||
thread.") SafeToCallFunctions;
|
||||
bool
|
||||
SafeToCallFunctions ();
|
||||
|
||||
STRING_EXTENSION(SBThread)
|
||||
|
||||
#ifdef SWIGPYTHON
|
||||
%pythoncode %{
|
||||
def __iter__(self):
|
||||
'''Iterate over all frames in a lldb.SBThread object.'''
|
||||
return lldb_iter(self, 'GetNumFrames', 'GetFrameAtIndex')
|
||||
|
||||
def __len__(self):
|
||||
'''Return the number of frames in a lldb.SBThread object.'''
|
||||
return self.GetNumFrames()
|
||||
|
||||
class frames_access(object):
|
||||
'''A helper object that will lazily hand out frames for a thread when supplied an index.'''
|
||||
def __init__(self, sbthread):
|
||||
self.sbthread = sbthread
|
||||
|
||||
def __len__(self):
|
||||
if self.sbthread:
|
||||
return int(self.sbthread.GetNumFrames())
|
||||
return 0
|
||||
|
||||
def __getitem__(self, key):
|
||||
if type(key) is int and key < self.sbthread.GetNumFrames():
|
||||
return self.sbthread.GetFrameAtIndex(key)
|
||||
return None
|
||||
|
||||
def get_frames_access_object(self):
|
||||
'''An accessor function that returns a frames_access() object which allows lazy frame access from a lldb.SBThread object.'''
|
||||
return self.frames_access (self)
|
||||
|
||||
def get_thread_frames(self):
|
||||
'''An accessor function that returns a list() that contains all frames in a lldb.SBThread object.'''
|
||||
frames = []
|
||||
for frame in self:
|
||||
frames.append(frame)
|
||||
return frames
|
||||
|
||||
id = property(GetThreadID, None, doc='''A read only property that returns the thread ID as an integer.''')
|
||||
idx = property(GetIndexID, None, doc='''A read only property that returns the thread index ID as an integer. Thread index ID values start at 1 and increment as threads come and go and can be used to uniquely identify threads.''')
|
||||
return_value = property(GetStopReturnValue, None, doc='''A read only property that returns an lldb object that represents the return value from the last stop (lldb.SBValue) if we just stopped due to stepping out of a function.''')
|
||||
process = property(GetProcess, None, doc='''A read only property that returns an lldb object that represents the process (lldb.SBProcess) that owns this thread.''')
|
||||
num_frames = property(GetNumFrames, None, doc='''A read only property that returns the number of stack frames in this thread as an integer.''')
|
||||
frames = property(get_thread_frames, None, doc='''A read only property that returns a list() of lldb.SBFrame objects for all frames in this thread.''')
|
||||
frame = property(get_frames_access_object, None, doc='''A read only property that returns an object that can be used to access frames as an array ("frame_12 = lldb.thread.frame[12]").''')
|
||||
name = property(GetName, None, doc='''A read only property that returns the name of this thread as a string.''')
|
||||
queue = property(GetQueueName, None, doc='''A read only property that returns the dispatch queue name of this thread as a string.''')
|
||||
queue_id = property(GetQueueID, None, doc='''A read only property that returns the dispatch queue id of this thread as an integer.''')
|
||||
stop_reason = property(GetStopReason, None, doc='''A read only property that returns an lldb enumeration value (see enumerations that start with "lldb.eStopReason") that represents the reason this thread stopped.''')
|
||||
is_suspended = property(IsSuspended, None, doc='''A read only property that returns a boolean value that indicates if this thread is suspended.''')
|
||||
is_stopped = property(IsStopped, None, doc='''A read only property that returns a boolean value that indicates if this thread is stopped but not exited.''')
|
||||
%}
|
||||
#endif
|
||||
|
||||
};
|
||||
|
||||
} // namespace lldb
|
@ -0,0 +1,39 @@
|
||||
//===-- SWIG Interface for SBThreadCollection -------------------*- C++ -*-===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
namespace lldb {
|
||||
|
||||
%feature("docstring",
|
||||
"Represents a collection of SBThread objects."
|
||||
) SBThreadCollection;
|
||||
class SBThreadCollection
|
||||
{
|
||||
public:
|
||||
|
||||
SBThreadCollection ();
|
||||
|
||||
SBThreadCollection (const SBThreadCollection &rhs);
|
||||
|
||||
~SBThreadCollection ();
|
||||
|
||||
bool
|
||||
IsValid () const;
|
||||
|
||||
explicit operator bool() const;
|
||||
|
||||
size_t
|
||||
GetSize ();
|
||||
|
||||
lldb::SBThread
|
||||
GetThreadAtIndex (size_t idx);
|
||||
|
||||
};
|
||||
|
||||
} // namespace lldb
|
137
contrib/llvm-project/lldb/bindings/interface/SBThreadPlan.i
Normal file
137
contrib/llvm-project/lldb/bindings/interface/SBThreadPlan.i
Normal file
@ -0,0 +1,137 @@
|
||||
//===-- SBThread.h ----------------------------------------------*- C++ -*-===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef LLDB_SBThreadPlan_h_
|
||||
#define LLDB_SBThreadPlan_h_
|
||||
|
||||
#include "lldb/API/SBDefines.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
namespace lldb {
|
||||
|
||||
%feature("docstring",
|
||||
"Represents a plan for the execution control of a given thread.
|
||||
|
||||
See also SBThread and SBFrame."
|
||||
) SBThread;
|
||||
|
||||
class SBThreadPlan
|
||||
{
|
||||
|
||||
friend class lldb_private::ThreadPlan;
|
||||
|
||||
public:
|
||||
SBThreadPlan ();
|
||||
|
||||
SBThreadPlan (const lldb::SBThreadPlan &threadPlan);
|
||||
|
||||
SBThreadPlan (const lldb::ThreadPlanSP& lldb_object_sp);
|
||||
|
||||
SBThreadPlan (lldb::SBThread &thread, const char *class_name);
|
||||
|
||||
~SBThreadPlan ();
|
||||
|
||||
bool
|
||||
IsValid();
|
||||
|
||||
bool
|
||||
IsValid() const;
|
||||
|
||||
explicit operator bool() const;
|
||||
|
||||
void
|
||||
Clear ();
|
||||
|
||||
lldb::StopReason
|
||||
GetStopReason();
|
||||
|
||||
%feature("docstring", "
|
||||
Get the number of words associated with the stop reason.
|
||||
See also GetStopReasonDataAtIndex().") GetStopReasonDataCount;
|
||||
size_t
|
||||
GetStopReasonDataCount();
|
||||
|
||||
%feature("docstring", "
|
||||
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") GetStopReasonDataAtIndex;
|
||||
uint64_t
|
||||
GetStopReasonDataAtIndex(uint32_t idx);
|
||||
|
||||
SBThread
|
||||
GetThread () const;
|
||||
|
||||
bool
|
||||
GetDescription (lldb::SBStream &description) const;
|
||||
|
||||
void
|
||||
SetPlanComplete (bool success);
|
||||
|
||||
bool
|
||||
IsPlanComplete();
|
||||
|
||||
bool
|
||||
IsPlanStale();
|
||||
|
||||
SBThreadPlan
|
||||
QueueThreadPlanForStepOverRange (SBAddress &start_address,
|
||||
lldb::addr_t range_size);
|
||||
|
||||
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);
|
||||
|
||||
SBThreadPlan
|
||||
QueueThreadPlanForStepScripted(const char *script_class_name);
|
||||
|
||||
SBThreadPlan
|
||||
QueueThreadPlanForStepScripted(const char *script_class_name,
|
||||
SBError &error);
|
||||
SBThreadPlan
|
||||
QueueThreadPlanForStepScripted(const char *script_class_name,
|
||||
SBStructuredData &args_data,
|
||||
SBError &error);
|
||||
|
||||
|
||||
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;
|
||||
|
||||
private:
|
||||
lldb::ThreadPlanSP m_opaque_sp;
|
||||
};
|
||||
|
||||
} // namespace lldb
|
||||
|
||||
#endif // LLDB_SBThreadPlan_h_
|
35
contrib/llvm-project/lldb/bindings/interface/SBTrace.i
Normal file
35
contrib/llvm-project/lldb/bindings/interface/SBTrace.i
Normal file
@ -0,0 +1,35 @@
|
||||
//===-- SWIG Interface for SBTrace.h ----------------------------*- C++ -*-===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
namespace lldb {
|
||||
|
||||
class LLDB_API SBTrace {
|
||||
public:
|
||||
SBTrace();
|
||||
size_t GetTraceData(SBError &error, void *buf,
|
||||
size_t size, size_t offset,
|
||||
lldb::tid_t thread_id);
|
||||
|
||||
size_t GetMetaData(SBError &error, void *buf,
|
||||
size_t size, size_t offset,
|
||||
lldb::tid_t thread_id);
|
||||
|
||||
void StopTrace(SBError &error,
|
||||
lldb::tid_t thread_id);
|
||||
|
||||
void GetTraceConfig(SBTraceOptions &options,
|
||||
SBError &error);
|
||||
|
||||
lldb::user_id_t GetTraceUID();
|
||||
|
||||
explicit operator bool() const;
|
||||
|
||||
bool IsValid();
|
||||
|
||||
};
|
||||
} // namespace lldb
|
@ -0,0 +1,39 @@
|
||||
//===-- SWIG Interface for SBTraceOptions -----------------------*- C++ -*-===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
namespace lldb {
|
||||
|
||||
class LLDB_API SBTraceOptions {
|
||||
public:
|
||||
SBTraceOptions();
|
||||
|
||||
lldb::TraceType getType() const;
|
||||
|
||||
uint64_t getTraceBufferSize() const;
|
||||
|
||||
lldb::SBStructuredData getTraceParams(lldb::SBError &error);
|
||||
|
||||
uint64_t getMetaDataBufferSize() const;
|
||||
|
||||
void setTraceParams(lldb::SBStructuredData ¶ms);
|
||||
|
||||
void setType(lldb::TraceType type);
|
||||
|
||||
void setTraceBufferSize(uint64_t size);
|
||||
|
||||
void setMetaDataBufferSize(uint64_t size);
|
||||
|
||||
void setThreadID(lldb::tid_t thread_id);
|
||||
|
||||
lldb::tid_t getThreadID();
|
||||
|
||||
explicit operator bool() const;
|
||||
|
||||
bool IsValid();
|
||||
};
|
||||
}
|
487
contrib/llvm-project/lldb/bindings/interface/SBType.i
Normal file
487
contrib/llvm-project/lldb/bindings/interface/SBType.i
Normal file
@ -0,0 +1,487 @@
|
||||
//===-- SWIG Interface for SBType -------------------------------*- C++ -*-===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
namespace lldb {
|
||||
|
||||
%feature("docstring",
|
||||
"Represents a member of a type in lldb.") SBTypeMember;
|
||||
|
||||
class SBTypeMember
|
||||
{
|
||||
public:
|
||||
SBTypeMember ();
|
||||
|
||||
SBTypeMember (const lldb::SBTypeMember& rhs);
|
||||
|
||||
~SBTypeMember();
|
||||
|
||||
bool
|
||||
IsValid() const;
|
||||
|
||||
explicit operator bool() const;
|
||||
|
||||
const char *
|
||||
GetName ();
|
||||
|
||||
lldb::SBType
|
||||
GetType ();
|
||||
|
||||
uint64_t
|
||||
GetOffsetInBytes();
|
||||
|
||||
uint64_t
|
||||
GetOffsetInBits();
|
||||
|
||||
bool
|
||||
IsBitfield();
|
||||
|
||||
uint32_t
|
||||
GetBitfieldSizeInBits();
|
||||
|
||||
STRING_EXTENSION_LEVEL(SBTypeMember, lldb::eDescriptionLevelBrief)
|
||||
|
||||
#ifdef SWIGPYTHON
|
||||
%pythoncode %{
|
||||
name = property(GetName, None, doc='''A read only property that returns the name for this member as a string.''')
|
||||
type = property(GetType, None, doc='''A read only property that returns an lldb object that represents the type (lldb.SBType) for this member.''')
|
||||
byte_offset = property(GetOffsetInBytes, None, doc='''A read only property that returns offset in bytes for this member as an integer.''')
|
||||
bit_offset = property(GetOffsetInBits, None, doc='''A read only property that returns offset in bits for this member as an integer.''')
|
||||
is_bitfield = property(IsBitfield, None, doc='''A read only property that returns true if this member is a bitfield.''')
|
||||
bitfield_bit_size = property(GetBitfieldSizeInBits, None, doc='''A read only property that returns the bitfield size in bits for this member as an integer, or zero if this member is not a bitfield.''')
|
||||
%}
|
||||
#endif
|
||||
|
||||
protected:
|
||||
std::unique_ptr<lldb_private::TypeMemberImpl> m_opaque_ap;
|
||||
};
|
||||
|
||||
class SBTypeMemberFunction
|
||||
{
|
||||
public:
|
||||
SBTypeMemberFunction ();
|
||||
|
||||
SBTypeMemberFunction (const lldb::SBTypeMemberFunction& rhs);
|
||||
|
||||
~SBTypeMemberFunction();
|
||||
|
||||
bool
|
||||
IsValid() const;
|
||||
|
||||
explicit operator bool() 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);
|
||||
|
||||
STRING_EXTENSION_LEVEL(SBTypeMemberFunction, lldb::eDescriptionLevelBrief)
|
||||
protected:
|
||||
lldb::TypeMemberFunctionImplSP m_opaque_sp;
|
||||
};
|
||||
|
||||
%feature("docstring",
|
||||
"Represents a data type in lldb. The FindFirstType() method of SBTarget/SBModule
|
||||
returns a SBType.
|
||||
|
||||
SBType supports the eq/ne operator. For example,
|
||||
|
||||
main.cpp:
|
||||
|
||||
class Task {
|
||||
public:
|
||||
int id;
|
||||
Task *next;
|
||||
Task(int i, Task *n):
|
||||
id(i),
|
||||
next(n)
|
||||
{}
|
||||
};
|
||||
|
||||
int main (int argc, char const *argv[])
|
||||
{
|
||||
Task *task_head = new Task(-1, NULL);
|
||||
Task *task1 = new Task(1, NULL);
|
||||
Task *task2 = new Task(2, NULL);
|
||||
Task *task3 = new Task(3, NULL); // Orphaned.
|
||||
Task *task4 = new Task(4, NULL);
|
||||
Task *task5 = new Task(5, NULL);
|
||||
|
||||
task_head->next = task1;
|
||||
task1->next = task2;
|
||||
task2->next = task4;
|
||||
task4->next = task5;
|
||||
|
||||
int total = 0;
|
||||
Task *t = task_head;
|
||||
while (t != NULL) {
|
||||
if (t->id >= 0)
|
||||
++total;
|
||||
t = t->next;
|
||||
}
|
||||
printf('We have a total number of %d tasks\\n', total);
|
||||
|
||||
// This corresponds to an empty task list.
|
||||
Task *empty_task_head = new Task(-1, NULL);
|
||||
|
||||
return 0; // Break at this line
|
||||
}
|
||||
|
||||
find_type.py:
|
||||
|
||||
# Get the type 'Task'.
|
||||
task_type = target.FindFirstType('Task')
|
||||
self.assertTrue(task_type)
|
||||
|
||||
# Get the variable 'task_head'.
|
||||
frame0.FindVariable('task_head')
|
||||
task_head_type = task_head.GetType()
|
||||
self.assertTrue(task_head_type.IsPointerType())
|
||||
|
||||
# task_head_type is 'Task *'.
|
||||
task_pointer_type = task_type.GetPointerType()
|
||||
self.assertTrue(task_head_type == task_pointer_type)
|
||||
|
||||
# Get the child mmember 'id' from 'task_head'.
|
||||
id = task_head.GetChildMemberWithName('id')
|
||||
id_type = id.GetType()
|
||||
|
||||
# SBType.GetBasicType() takes an enum 'BasicType' (lldb-enumerations.h).
|
||||
int_type = id_type.GetBasicType(lldb.eBasicTypeInt)
|
||||
# id_type and int_type should be the same type!
|
||||
self.assertTrue(id_type == int_type)
|
||||
|
||||
...") SBType;
|
||||
class SBType
|
||||
{
|
||||
public:
|
||||
SBType ();
|
||||
|
||||
SBType (const lldb::SBType &rhs);
|
||||
|
||||
~SBType ();
|
||||
|
||||
bool
|
||||
IsValid();
|
||||
|
||||
explicit operator bool() 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
|
||||
SBType::GetTypedefedType();
|
||||
|
||||
lldb::SBType
|
||||
GetDereferencedType();
|
||||
|
||||
lldb::SBType
|
||||
GetUnqualifiedType();
|
||||
|
||||
lldb::SBType
|
||||
GetCanonicalType();
|
||||
|
||||
lldb::SBType
|
||||
GetArrayElementType ();
|
||||
|
||||
lldb::SBType
|
||||
GetArrayType (uint64_t size);
|
||||
|
||||
lldb::SBType
|
||||
GetVectorElementType ();
|
||||
|
||||
lldb::BasicType
|
||||
GetBasicType();
|
||||
|
||||
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();
|
||||
|
||||
const char*
|
||||
GetName();
|
||||
|
||||
const char *
|
||||
GetDisplayTypeName ();
|
||||
|
||||
lldb::TypeClass
|
||||
GetTypeClass ();
|
||||
|
||||
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);
|
||||
|
||||
bool
|
||||
IsTypeComplete ();
|
||||
|
||||
uint32_t
|
||||
GetTypeFlags ();
|
||||
|
||||
bool operator==(lldb::SBType &rhs);
|
||||
|
||||
bool operator!=(lldb::SBType &rhs);
|
||||
|
||||
STRING_EXTENSION_LEVEL(SBType, lldb::eDescriptionLevelBrief)
|
||||
|
||||
#ifdef SWIGPYTHON
|
||||
%pythoncode %{
|
||||
def template_arg_array(self):
|
||||
num_args = self.num_template_args
|
||||
if num_args:
|
||||
template_args = []
|
||||
for i in range(num_args):
|
||||
template_args.append(self.GetTemplateArgumentType(i))
|
||||
return template_args
|
||||
return None
|
||||
|
||||
name = property(GetName, None, doc='''A read only property that returns the name for this type as a string.''')
|
||||
size = property(GetByteSize, None, doc='''A read only property that returns size in bytes for this type as an integer.''')
|
||||
is_pointer = property(IsPointerType, None, doc='''A read only property that returns a boolean value that indicates if this type is a pointer type.''')
|
||||
is_reference = property(IsReferenceType, None, doc='''A read only property that returns a boolean value that indicates if this type is a reference type.''')
|
||||
is_reference = property(IsReferenceType, None, doc='''A read only property that returns a boolean value that indicates if this type is a function type.''')
|
||||
num_fields = property(GetNumberOfFields, None, doc='''A read only property that returns number of fields in this type as an integer.''')
|
||||
num_bases = property(GetNumberOfDirectBaseClasses, None, doc='''A read only property that returns number of direct base classes in this type as an integer.''')
|
||||
num_vbases = property(GetNumberOfVirtualBaseClasses, None, doc='''A read only property that returns number of virtual base classes in this type as an integer.''')
|
||||
num_template_args = property(GetNumberOfTemplateArguments, None, doc='''A read only property that returns number of template arguments in this type as an integer.''')
|
||||
template_args = property(template_arg_array, None, doc='''A read only property that returns a list() of lldb.SBType objects that represent all template arguments in this type.''')
|
||||
type = property(GetTypeClass, None, doc='''A read only property that returns an lldb enumeration value (see enumerations that start with "lldb.eTypeClass") that represents a classification for this type.''')
|
||||
is_complete = property(IsTypeComplete, None, doc='''A read only property that returns a boolean value that indicates if this type is a complete type (True) or a forward declaration (False).''')
|
||||
|
||||
def get_bases_array(self):
|
||||
'''An accessor function that returns a list() that contains all direct base classes in a lldb.SBType object.'''
|
||||
bases = []
|
||||
for idx in range(self.GetNumberOfDirectBaseClasses()):
|
||||
bases.append(self.GetDirectBaseClassAtIndex(idx))
|
||||
return bases
|
||||
|
||||
def get_vbases_array(self):
|
||||
'''An accessor function that returns a list() that contains all fields in a lldb.SBType object.'''
|
||||
vbases = []
|
||||
for idx in range(self.GetNumberOfVirtualBaseClasses()):
|
||||
vbases.append(self.GetVirtualBaseClassAtIndex(idx))
|
||||
return vbases
|
||||
|
||||
def get_fields_array(self):
|
||||
'''An accessor function that returns a list() that contains all fields in a lldb.SBType object.'''
|
||||
fields = []
|
||||
for idx in range(self.GetNumberOfFields()):
|
||||
fields.append(self.GetFieldAtIndex(idx))
|
||||
return fields
|
||||
|
||||
def get_members_array(self):
|
||||
'''An accessor function that returns a list() that contains all members (base classes and fields) in a lldb.SBType object in ascending bit offset order.'''
|
||||
members = []
|
||||
bases = self.get_bases_array()
|
||||
fields = self.get_fields_array()
|
||||
vbases = self.get_vbases_array()
|
||||
for base in bases:
|
||||
bit_offset = base.bit_offset
|
||||
added = False
|
||||
for idx, member in enumerate(members):
|
||||
if member.bit_offset > bit_offset:
|
||||
members.insert(idx, base)
|
||||
added = True
|
||||
break
|
||||
if not added:
|
||||
members.append(base)
|
||||
for vbase in vbases:
|
||||
bit_offset = vbase.bit_offset
|
||||
added = False
|
||||
for idx, member in enumerate(members):
|
||||
if member.bit_offset > bit_offset:
|
||||
members.insert(idx, vbase)
|
||||
added = True
|
||||
break
|
||||
if not added:
|
||||
members.append(vbase)
|
||||
for field in fields:
|
||||
bit_offset = field.bit_offset
|
||||
added = False
|
||||
for idx, member in enumerate(members):
|
||||
if member.bit_offset > bit_offset:
|
||||
members.insert(idx, field)
|
||||
added = True
|
||||
break
|
||||
if not added:
|
||||
members.append(field)
|
||||
return members
|
||||
|
||||
def get_enum_members_array(self):
|
||||
'''An accessor function that returns a list() that contains all enum members in an lldb.SBType object.'''
|
||||
enum_members_list = []
|
||||
sb_enum_members = self.GetEnumMembers()
|
||||
for idx in range(sb_enum_members.GetSize()):
|
||||
enum_members_list.append(sb_enum_members.GetTypeEnumMemberAtIndex(idx))
|
||||
return enum_members_list
|
||||
|
||||
bases = property(get_bases_array, None, doc='''A read only property that returns a list() of lldb.SBTypeMember objects that represent all of the direct base classes for this type.''')
|
||||
vbases = property(get_vbases_array, None, doc='''A read only property that returns a list() of lldb.SBTypeMember objects that represent all of the virtual base classes for this type.''')
|
||||
fields = property(get_fields_array, None, doc='''A read only property that returns a list() of lldb.SBTypeMember objects that represent all of the fields for this type.''')
|
||||
members = property(get_members_array, None, doc='''A read only property that returns a list() of all lldb.SBTypeMember objects that represent all of the base classes, virtual base classes and fields for this type in ascending bit offset order.''')
|
||||
enum_members = property(get_enum_members_array, None, doc='''A read only property that returns a list() of all lldb.SBTypeEnumMember objects that represent the enum members for this type.''')
|
||||
%}
|
||||
#endif
|
||||
|
||||
};
|
||||
|
||||
%feature("docstring",
|
||||
"Represents a list of SBTypes. The FindTypes() method of SBTarget/SBModule
|
||||
returns a SBTypeList.
|
||||
|
||||
SBTypeList supports SBType iteration. For example,
|
||||
|
||||
main.cpp:
|
||||
|
||||
class Task {
|
||||
public:
|
||||
int id;
|
||||
Task *next;
|
||||
Task(int i, Task *n):
|
||||
id(i),
|
||||
next(n)
|
||||
{}
|
||||
};
|
||||
|
||||
...
|
||||
|
||||
find_type.py:
|
||||
|
||||
# Get the type 'Task'.
|
||||
type_list = target.FindTypes('Task')
|
||||
self.assertTrue(len(type_list) == 1)
|
||||
# To illustrate the SBType iteration.
|
||||
for type in type_list:
|
||||
# do something with type
|
||||
|
||||
...") SBTypeList;
|
||||
class SBTypeList
|
||||
{
|
||||
public:
|
||||
SBTypeList();
|
||||
|
||||
bool
|
||||
IsValid();
|
||||
|
||||
explicit operator bool() const;
|
||||
|
||||
void
|
||||
Append (lldb::SBType type);
|
||||
|
||||
lldb::SBType
|
||||
GetTypeAtIndex (uint32_t index);
|
||||
|
||||
uint32_t
|
||||
GetSize();
|
||||
|
||||
~SBTypeList();
|
||||
|
||||
#ifdef SWIGPYTHON
|
||||
%pythoncode%{
|
||||
def __iter__(self):
|
||||
'''Iterate over all types in a lldb.SBTypeList object.'''
|
||||
return lldb_iter(self, 'GetSize', 'GetTypeAtIndex')
|
||||
|
||||
def __len__(self):
|
||||
'''Return the number of types in a lldb.SBTypeList object.'''
|
||||
return self.GetSize()
|
||||
%}
|
||||
#endif
|
||||
};
|
||||
|
||||
} // namespace lldb
|
225
contrib/llvm-project/lldb/bindings/interface/SBTypeCategory.i
Normal file
225
contrib/llvm-project/lldb/bindings/interface/SBTypeCategory.i
Normal file
@ -0,0 +1,225 @@
|
||||
//===-- SWIG Interface for SBTypeCategory---------------------------*- C++ -*-===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
namespace lldb {
|
||||
|
||||
%feature("docstring",
|
||||
"Represents a category that can contain formatters for types.") SBTypeCategory;
|
||||
|
||||
class SBTypeCategory
|
||||
{
|
||||
public:
|
||||
|
||||
SBTypeCategory();
|
||||
|
||||
SBTypeCategory (const lldb::SBTypeCategory &rhs);
|
||||
|
||||
~SBTypeCategory ();
|
||||
|
||||
bool
|
||||
IsValid() const;
|
||||
|
||||
explicit operator bool() 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 ();
|
||||
|
||||
uint32_t
|
||||
GetNumSynthetics ();
|
||||
|
||||
lldb::SBTypeNameSpecifier
|
||||
GetTypeNameSpecifierForFilterAtIndex (uint32_t);
|
||||
|
||||
lldb::SBTypeNameSpecifier
|
||||
GetTypeNameSpecifierForFormatAtIndex (uint32_t);
|
||||
|
||||
lldb::SBTypeNameSpecifier
|
||||
GetTypeNameSpecifierForSummaryAtIndex (uint32_t);
|
||||
|
||||
lldb::SBTypeNameSpecifier
|
||||
GetTypeNameSpecifierForSyntheticAtIndex (uint32_t);
|
||||
|
||||
lldb::SBTypeFilter
|
||||
GetFilterForType (lldb::SBTypeNameSpecifier);
|
||||
|
||||
lldb::SBTypeFormat
|
||||
GetFormatForType (lldb::SBTypeNameSpecifier);
|
||||
|
||||
lldb::SBTypeSummary
|
||||
GetSummaryForType (lldb::SBTypeNameSpecifier);
|
||||
|
||||
lldb::SBTypeSynthetic
|
||||
GetSyntheticForType (lldb::SBTypeNameSpecifier);
|
||||
|
||||
lldb::SBTypeFilter
|
||||
GetFilterAtIndex (uint32_t);
|
||||
|
||||
lldb::SBTypeFormat
|
||||
GetFormatAtIndex (uint32_t);
|
||||
|
||||
lldb::SBTypeSummary
|
||||
GetSummaryAtIndex (uint32_t);
|
||||
|
||||
lldb::SBTypeSynthetic
|
||||
GetSyntheticAtIndex (uint32_t);
|
||||
|
||||
bool
|
||||
AddTypeFormat (lldb::SBTypeNameSpecifier,
|
||||
lldb::SBTypeFormat);
|
||||
|
||||
bool
|
||||
DeleteTypeFormat (lldb::SBTypeNameSpecifier);
|
||||
|
||||
bool
|
||||
AddTypeSummary (lldb::SBTypeNameSpecifier,
|
||||
lldb::SBTypeSummary);
|
||||
|
||||
bool
|
||||
DeleteTypeSummary (lldb::SBTypeNameSpecifier);
|
||||
|
||||
bool
|
||||
AddTypeFilter (lldb::SBTypeNameSpecifier,
|
||||
lldb::SBTypeFilter);
|
||||
|
||||
bool
|
||||
DeleteTypeFilter (lldb::SBTypeNameSpecifier);
|
||||
|
||||
bool
|
||||
AddTypeSynthetic (lldb::SBTypeNameSpecifier,
|
||||
lldb::SBTypeSynthetic);
|
||||
|
||||
bool
|
||||
DeleteTypeSynthetic (lldb::SBTypeNameSpecifier);
|
||||
|
||||
STRING_EXTENSION_LEVEL(SBTypeCategory, lldb::eDescriptionLevelBrief)
|
||||
|
||||
#ifdef SWIGPYTHON
|
||||
%pythoncode %{
|
||||
|
||||
class formatters_access_class(object):
|
||||
'''A helper object that will lazily hand out formatters for a specific category.'''
|
||||
def __init__(self, sbcategory, get_count_function, get_at_index_function, get_by_name_function):
|
||||
self.sbcategory = sbcategory
|
||||
self.get_count_function = get_count_function
|
||||
self.get_at_index_function = get_at_index_function
|
||||
self.get_by_name_function = get_by_name_function
|
||||
self.regex_type = type(re.compile('.'))
|
||||
|
||||
|
||||
def __len__(self):
|
||||
if self.sbcategory and self.get_count_function:
|
||||
return int(self.get_count_function(self.sbcategory))
|
||||
return 0
|
||||
|
||||
def __getitem__(self, key):
|
||||
num_items = len(self)
|
||||
if type(key) is int:
|
||||
if key < num_items:
|
||||
return self.get_at_index_function(self.sbcategory,key)
|
||||
elif type(key) is str:
|
||||
return self.get_by_name_function(self.sbcategory,SBTypeNameSpecifier(key))
|
||||
elif isinstance(key,self.regex_type):
|
||||
return self.get_by_name_function(self.sbcategory,SBTypeNameSpecifier(key.pattern,True))
|
||||
else:
|
||||
print("error: unsupported item type: %s" % type(key))
|
||||
return None
|
||||
|
||||
def get_formats_access_object(self):
|
||||
'''An accessor function that returns an accessor object which allows lazy format access from a lldb.SBTypeCategory object.'''
|
||||
return self.formatters_access_class (self,self.__class__.GetNumFormats,self.__class__.GetFormatAtIndex,self.__class__.GetFormatForType)
|
||||
|
||||
def get_formats_array(self):
|
||||
'''An accessor function that returns a list() that contains all formats in a lldb.SBCategory object.'''
|
||||
formats = []
|
||||
for idx in range(self.GetNumFormats()):
|
||||
formats.append(self.GetFormatAtIndex(idx))
|
||||
return formats
|
||||
|
||||
def get_summaries_access_object(self):
|
||||
'''An accessor function that returns an accessor object which allows lazy summary access from a lldb.SBTypeCategory object.'''
|
||||
return self.formatters_access_class (self,self.__class__.GetNumSummaries,self.__class__.GetSummaryAtIndex,self.__class__.GetSummaryForType)
|
||||
|
||||
def get_summaries_array(self):
|
||||
'''An accessor function that returns a list() that contains all summaries in a lldb.SBCategory object.'''
|
||||
summaries = []
|
||||
for idx in range(self.GetNumSummaries()):
|
||||
summaries.append(self.GetSummaryAtIndex(idx))
|
||||
return summaries
|
||||
|
||||
def get_synthetics_access_object(self):
|
||||
'''An accessor function that returns an accessor object which allows lazy synthetic children provider access from a lldb.SBTypeCategory object.'''
|
||||
return self.formatters_access_class (self,self.__class__.GetNumSynthetics,self.__class__.GetSyntheticAtIndex,self.__class__.GetSyntheticForType)
|
||||
|
||||
def get_synthetics_array(self):
|
||||
'''An accessor function that returns a list() that contains all synthetic children providers in a lldb.SBCategory object.'''
|
||||
synthetics = []
|
||||
for idx in range(self.GetNumSynthetics()):
|
||||
synthetics.append(self.GetSyntheticAtIndex(idx))
|
||||
return synthetics
|
||||
|
||||
def get_filters_access_object(self):
|
||||
'''An accessor function that returns an accessor object which allows lazy filter access from a lldb.SBTypeCategory object.'''
|
||||
return self.formatters_access_class (self,self.__class__.GetNumFilters,self.__class__.GetFilterAtIndex,self.__class__.GetFilterForType)
|
||||
|
||||
def get_filters_array(self):
|
||||
'''An accessor function that returns a list() that contains all filters in a lldb.SBCategory object.'''
|
||||
filters = []
|
||||
for idx in range(self.GetNumFilters()):
|
||||
filters.append(self.GetFilterAtIndex(idx))
|
||||
return filters
|
||||
|
||||
formats = property(get_formats_array, None, doc='''A read only property that returns a list() of lldb.SBTypeFormat objects contained in this category''')
|
||||
format = property(get_formats_access_object, None, doc=r'''A read only property that returns an object that you can use to look for formats by index or type name.''')
|
||||
summaries = property(get_summaries_array, None, doc='''A read only property that returns a list() of lldb.SBTypeSummary objects contained in this category''')
|
||||
summary = property(get_summaries_access_object, None, doc=r'''A read only property that returns an object that you can use to look for summaries by index or type name or regular expression.''')
|
||||
filters = property(get_filters_array, None, doc='''A read only property that returns a list() of lldb.SBTypeFilter objects contained in this category''')
|
||||
filter = property(get_filters_access_object, None, doc=r'''A read only property that returns an object that you can use to look for filters by index or type name or regular expression.''')
|
||||
synthetics = property(get_synthetics_array, None, doc='''A read only property that returns a list() of lldb.SBTypeSynthetic objects contained in this category''')
|
||||
synthetic = property(get_synthetics_access_object, None, doc=r'''A read only property that returns an object that you can use to look for synthetic children provider by index or type name or regular expression.''')
|
||||
num_formats = property(GetNumFormats, None)
|
||||
num_summaries = property(GetNumSummaries, None)
|
||||
num_filters = property(GetNumFilters, None)
|
||||
num_synthetics = property(GetNumSynthetics, None)
|
||||
name = property(GetName, None)
|
||||
enabled = property(GetEnabled, SetEnabled)
|
||||
%}
|
||||
#endif
|
||||
|
||||
};
|
||||
|
||||
|
||||
} // namespace lldb
|
||||
|
107
contrib/llvm-project/lldb/bindings/interface/SBTypeEnumMember.i
Normal file
107
contrib/llvm-project/lldb/bindings/interface/SBTypeEnumMember.i
Normal file
@ -0,0 +1,107 @@
|
||||
//===-- SWIG Interface for SBTypeEnumMember ---------------------*- C++ -*-===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
namespace lldb {
|
||||
|
||||
%feature(
|
||||
"docstring",
|
||||
"Represents a member of an enum in lldb."
|
||||
) SBTypeEnumMember;
|
||||
|
||||
class SBTypeEnumMember
|
||||
{
|
||||
public:
|
||||
SBTypeEnumMember ();
|
||||
|
||||
SBTypeEnumMember (const SBTypeEnumMember& rhs);
|
||||
|
||||
~SBTypeEnumMember();
|
||||
|
||||
bool
|
||||
IsValid() const;
|
||||
|
||||
explicit operator bool() const;
|
||||
|
||||
int64_t
|
||||
GetValueAsSigned();
|
||||
|
||||
uint64_t
|
||||
GetValueAsUnsigned();
|
||||
|
||||
const char *
|
||||
GetName ();
|
||||
|
||||
lldb::SBType
|
||||
GetType ();
|
||||
|
||||
bool
|
||||
GetDescription (lldb::SBStream &description,
|
||||
lldb::DescriptionLevel description_level);
|
||||
|
||||
STRING_EXTENSION_LEVEL(SBTypeEnumMember, lldb::eDescriptionLevelBrief)
|
||||
#ifdef SWIGPYTHON
|
||||
%pythoncode %{
|
||||
name = property(GetName, None, doc='''A read only property that returns the name for this enum member as a string.''')
|
||||
type = property(GetType, None, doc='''A read only property that returns an lldb object that represents the type (lldb.SBType) for this enum member.''')
|
||||
signed = property(GetValueAsSigned, None, doc='''A read only property that returns the value of this enum member as a signed integer.''')
|
||||
unsigned = property(GetValueAsUnsigned, None, doc='''A read only property that returns the value of this enum member as a unsigned integer.''')
|
||||
%}
|
||||
#endif
|
||||
|
||||
protected:
|
||||
friend class SBType;
|
||||
friend class SBTypeEnumMemberList;
|
||||
|
||||
void
|
||||
reset (lldb_private::TypeEnumMemberImpl *);
|
||||
|
||||
lldb_private::TypeEnumMemberImpl &
|
||||
ref ();
|
||||
|
||||
const lldb_private::TypeEnumMemberImpl &
|
||||
ref () const;
|
||||
|
||||
lldb::TypeEnumMemberImplSP m_opaque_sp;
|
||||
|
||||
SBTypeEnumMember (const lldb::TypeEnumMemberImplSP &);
|
||||
};
|
||||
|
||||
%feature(
|
||||
"docstring",
|
||||
"Represents a list of SBTypeEnumMembers."
|
||||
) SBTypeEnumMemberList;
|
||||
|
||||
class SBTypeEnumMemberList
|
||||
{
|
||||
public:
|
||||
SBTypeEnumMemberList();
|
||||
|
||||
SBTypeEnumMemberList(const SBTypeEnumMemberList& rhs);
|
||||
|
||||
~SBTypeEnumMemberList();
|
||||
|
||||
bool
|
||||
IsValid();
|
||||
|
||||
explicit operator bool() const;
|
||||
|
||||
void
|
||||
Append (SBTypeEnumMember entry);
|
||||
|
||||
SBTypeEnumMember
|
||||
GetTypeEnumMemberAtIndex (uint32_t index);
|
||||
|
||||
uint32_t
|
||||
GetSize();
|
||||
|
||||
|
||||
private:
|
||||
std::unique_ptr<lldb_private::TypeEnumMemberListImpl> m_opaque_ap;
|
||||
};
|
||||
|
||||
} // namespace lldb
|
75
contrib/llvm-project/lldb/bindings/interface/SBTypeFilter.i
Normal file
75
contrib/llvm-project/lldb/bindings/interface/SBTypeFilter.i
Normal file
@ -0,0 +1,75 @@
|
||||
//===-- SWIG Interface for SBTypeFilter----------------------------*- C++ -*-===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
namespace lldb {
|
||||
|
||||
%feature("docstring",
|
||||
"Represents a filter that can be associated to one or more types.") SBTypeFilter;
|
||||
|
||||
class SBTypeFilter
|
||||
{
|
||||
public:
|
||||
|
||||
SBTypeFilter();
|
||||
|
||||
SBTypeFilter (uint32_t options);
|
||||
|
||||
SBTypeFilter (const lldb::SBTypeFilter &rhs);
|
||||
|
||||
~SBTypeFilter ();
|
||||
|
||||
bool
|
||||
IsValid() const;
|
||||
|
||||
explicit operator bool() const;
|
||||
|
||||
bool
|
||||
IsEqualTo (lldb::SBTypeFilter &rhs);
|
||||
|
||||
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);
|
||||
|
||||
bool
|
||||
operator == (lldb::SBTypeFilter &rhs);
|
||||
|
||||
bool
|
||||
operator != (lldb::SBTypeFilter &rhs);
|
||||
|
||||
STRING_EXTENSION_LEVEL(SBTypeFilter, lldb::eDescriptionLevelBrief)
|
||||
|
||||
#ifdef SWIGPYTHON
|
||||
%pythoncode %{
|
||||
options = property(GetOptions, SetOptions)
|
||||
count = property(GetNumberOfExpressionPaths)
|
||||
%}
|
||||
#endif
|
||||
|
||||
};
|
||||
|
||||
} // namespace lldb
|
77
contrib/llvm-project/lldb/bindings/interface/SBTypeFormat.i
Normal file
77
contrib/llvm-project/lldb/bindings/interface/SBTypeFormat.i
Normal file
@ -0,0 +1,77 @@
|
||||
//===-- SWIG Interface for SBTypeFormat----------------------------*- C++ -*-===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
namespace lldb {
|
||||
|
||||
%feature("docstring",
|
||||
"Represents a format that can be associated to one or more types.") SBTypeFormat;
|
||||
|
||||
class SBTypeFormat
|
||||
{
|
||||
public:
|
||||
|
||||
SBTypeFormat();
|
||||
|
||||
SBTypeFormat (lldb::Format format, uint32_t options = 0);
|
||||
|
||||
SBTypeFormat (const char* type, uint32_t options = 0);
|
||||
|
||||
SBTypeFormat (const lldb::SBTypeFormat &rhs);
|
||||
|
||||
~SBTypeFormat ();
|
||||
|
||||
bool
|
||||
IsValid() const;
|
||||
|
||||
explicit operator bool() const;
|
||||
|
||||
bool
|
||||
IsEqualTo (lldb::SBTypeFormat &rhs);
|
||||
|
||||
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);
|
||||
|
||||
bool
|
||||
operator == (lldb::SBTypeFormat &rhs);
|
||||
|
||||
bool
|
||||
operator != (lldb::SBTypeFormat &rhs);
|
||||
|
||||
STRING_EXTENSION_LEVEL(SBTypeFormat, lldb::eDescriptionLevelBrief)
|
||||
|
||||
#ifdef SWIGPYTHON
|
||||
%pythoncode %{
|
||||
format = property(GetFormat, SetFormat)
|
||||
options = property(GetOptions, SetOptions)
|
||||
%}
|
||||
#endif
|
||||
|
||||
};
|
||||
|
||||
|
||||
} // namespace lldb
|
||||
|
@ -0,0 +1,69 @@
|
||||
//===-- SWIG Interface for SBTypeNameSpecifier---------------------------*- C++ -*-===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
namespace lldb {
|
||||
|
||||
%feature("docstring",
|
||||
"Represents a general way to provide a type name to LLDB APIs.") SBTypeNameSpecifier;
|
||||
|
||||
class SBTypeNameSpecifier
|
||||
{
|
||||
public:
|
||||
|
||||
SBTypeNameSpecifier();
|
||||
|
||||
SBTypeNameSpecifier (const char* name,
|
||||
bool is_regex = false);
|
||||
|
||||
SBTypeNameSpecifier (SBType type);
|
||||
|
||||
SBTypeNameSpecifier (const lldb::SBTypeNameSpecifier &rhs);
|
||||
|
||||
~SBTypeNameSpecifier ();
|
||||
|
||||
bool
|
||||
IsValid() const;
|
||||
|
||||
explicit operator bool() const;
|
||||
|
||||
bool
|
||||
IsEqualTo (lldb::SBTypeNameSpecifier &rhs);
|
||||
|
||||
const char*
|
||||
GetName();
|
||||
|
||||
lldb::SBType
|
||||
GetType ();
|
||||
|
||||
bool
|
||||
IsRegex();
|
||||
|
||||
bool
|
||||
GetDescription (lldb::SBStream &description,
|
||||
lldb::DescriptionLevel description_level);
|
||||
|
||||
bool
|
||||
operator == (lldb::SBTypeNameSpecifier &rhs);
|
||||
|
||||
bool
|
||||
operator != (lldb::SBTypeNameSpecifier &rhs);
|
||||
|
||||
STRING_EXTENSION_LEVEL(SBTypeNameSpecifier, lldb::eDescriptionLevelBrief)
|
||||
|
||||
#ifdef SWIGPYTHON
|
||||
%pythoncode %{
|
||||
name = property(GetName)
|
||||
is_regex = property(IsRegex)
|
||||
%}
|
||||
#endif
|
||||
|
||||
|
||||
};
|
||||
|
||||
} // namespace lldb
|
||||
|
119
contrib/llvm-project/lldb/bindings/interface/SBTypeSummary.i
Normal file
119
contrib/llvm-project/lldb/bindings/interface/SBTypeSummary.i
Normal file
@ -0,0 +1,119 @@
|
||||
//===-- SWIG Interface for SBTypeSummary---------------------------*- C++ -*-===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
namespace lldb {
|
||||
class SBTypeSummaryOptions
|
||||
{
|
||||
public:
|
||||
SBTypeSummaryOptions();
|
||||
|
||||
SBTypeSummaryOptions (const lldb::SBTypeSummaryOptions &rhs);
|
||||
|
||||
~SBTypeSummaryOptions ();
|
||||
|
||||
bool
|
||||
IsValid ();
|
||||
|
||||
explicit operator bool() const;
|
||||
|
||||
lldb::LanguageType
|
||||
GetLanguage ();
|
||||
|
||||
lldb::TypeSummaryCapping
|
||||
GetCapping ();
|
||||
|
||||
void
|
||||
SetLanguage (lldb::LanguageType);
|
||||
|
||||
void
|
||||
SetCapping (lldb::TypeSummaryCapping);
|
||||
};
|
||||
|
||||
%feature("docstring",
|
||||
"Represents a summary that can be associated to one or more types.") SBTypeSummary;
|
||||
|
||||
class SBTypeSummary
|
||||
{
|
||||
public:
|
||||
|
||||
SBTypeSummary();
|
||||
|
||||
static SBTypeSummary
|
||||
CreateWithSummaryString (const char* data, uint32_t options = 0);
|
||||
|
||||
static SBTypeSummary
|
||||
CreateWithFunctionName (const char* data, uint32_t options = 0);
|
||||
|
||||
static SBTypeSummary
|
||||
CreateWithScriptCode (const char* data, uint32_t options = 0);
|
||||
|
||||
SBTypeSummary (const lldb::SBTypeSummary &rhs);
|
||||
|
||||
~SBTypeSummary ();
|
||||
|
||||
bool
|
||||
IsValid() const;
|
||||
|
||||
explicit operator bool() const;
|
||||
|
||||
bool
|
||||
IsEqualTo (lldb::SBTypeSummary &rhs);
|
||||
|
||||
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);
|
||||
|
||||
bool
|
||||
operator == (lldb::SBTypeSummary &rhs);
|
||||
|
||||
bool
|
||||
operator != (lldb::SBTypeSummary &rhs);
|
||||
|
||||
STRING_EXTENSION_LEVEL(SBTypeSummary, lldb::eDescriptionLevelBrief)
|
||||
|
||||
#ifdef SWIGPYTHON
|
||||
%pythoncode %{
|
||||
options = property(GetOptions, SetOptions)
|
||||
is_summary_string = property(IsSummaryString)
|
||||
is_function_name = property(IsFunctionName)
|
||||
is_function_name = property(IsFunctionCode)
|
||||
summary_data = property(GetData)
|
||||
%}
|
||||
#endif
|
||||
|
||||
};
|
||||
|
||||
} // namespace lldb
|
||||
|
@ -0,0 +1,78 @@
|
||||
//===-- SWIG Interface for SBTypeSynthetic-------------------------*- C++ -*-===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
namespace lldb {
|
||||
|
||||
%feature("docstring",
|
||||
"Represents a summary that can be associated to one or more types.") SBTypeSynthetic;
|
||||
|
||||
class SBTypeSynthetic
|
||||
{
|
||||
public:
|
||||
|
||||
SBTypeSynthetic();
|
||||
|
||||
static lldb::SBTypeSynthetic
|
||||
CreateWithClassName (const char* data, uint32_t options = 0);
|
||||
|
||||
static lldb::SBTypeSynthetic
|
||||
CreateWithScriptCode (const char* data, uint32_t options = 0);
|
||||
|
||||
SBTypeSynthetic (const lldb::SBTypeSynthetic &rhs);
|
||||
|
||||
~SBTypeSynthetic ();
|
||||
|
||||
bool
|
||||
IsValid() const;
|
||||
|
||||
explicit operator bool() const;
|
||||
|
||||
bool
|
||||
IsEqualTo (lldb::SBTypeSynthetic &rhs);
|
||||
|
||||
bool
|
||||
IsClassCode();
|
||||
|
||||
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);
|
||||
|
||||
bool
|
||||
operator == (lldb::SBTypeSynthetic &rhs);
|
||||
|
||||
bool
|
||||
operator != (lldb::SBTypeSynthetic &rhs);
|
||||
|
||||
STRING_EXTENSION_LEVEL(SBTypeSynthetic, lldb::eDescriptionLevelBrief)
|
||||
|
||||
#ifdef SWIGPYTHON
|
||||
%pythoncode %{
|
||||
options = property(GetOptions, SetOptions)
|
||||
contains_code = property(IsClassCode, None)
|
||||
synthetic_data = property(GetData, None)
|
||||
%}
|
||||
#endif
|
||||
|
||||
};
|
||||
|
||||
} // namespace lldb
|
76
contrib/llvm-project/lldb/bindings/interface/SBUnixSignals.i
Normal file
76
contrib/llvm-project/lldb/bindings/interface/SBUnixSignals.i
Normal file
@ -0,0 +1,76 @@
|
||||
//===-- SWIG Interface for SBUnixSignals ------------------------*- C++ -*-===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
namespace lldb {
|
||||
|
||||
%feature("docstring",
|
||||
"Allows you to manipulate LLDB's signal disposition"
|
||||
) SBUnixSignals;
|
||||
class SBUnixSignals
|
||||
{
|
||||
public:
|
||||
SBUnixSignals ();
|
||||
|
||||
SBUnixSignals (const lldb::SBUnixSignals &rhs);
|
||||
|
||||
~SBUnixSignals();
|
||||
|
||||
void
|
||||
Clear ();
|
||||
|
||||
bool
|
||||
IsValid () const;
|
||||
|
||||
explicit operator bool() const;
|
||||
|
||||
const char *
|
||||
GetSignalAsCString (int32_t signo) const;
|
||||
|
||||
int32_t
|
||||
GetSignalNumberFromName (const char *name) const;
|
||||
|
||||
bool
|
||||
GetShouldSuppress (int32_t signo) const;
|
||||
|
||||
bool
|
||||
SetShouldSuppress (int32_t signo,
|
||||
bool value);
|
||||
|
||||
bool
|
||||
GetShouldStop (int32_t signo) const;
|
||||
|
||||
bool
|
||||
SetShouldStop (int32_t signo,
|
||||
bool value);
|
||||
|
||||
bool
|
||||
GetShouldNotify (int32_t signo) const;
|
||||
|
||||
bool
|
||||
SetShouldNotify (int32_t signo, bool value);
|
||||
|
||||
int32_t
|
||||
GetNumSignals () const;
|
||||
|
||||
int32_t
|
||||
GetSignalAtIndex (int32_t index) const;
|
||||
|
||||
#ifdef SWIGPYTHON
|
||||
%pythoncode %{
|
||||
def get_unix_signals_list(self):
|
||||
signals = []
|
||||
for idx in range(0, self.GetNumSignals()):
|
||||
signals.append(self.GetSignalAtIndex(sig))
|
||||
return signals
|
||||
|
||||
threads = property(get_unix_signals_list, None, doc='''A read only property that returns a list() of valid signal numbers for this platform.''')
|
||||
%}
|
||||
#endif
|
||||
};
|
||||
|
||||
} // namespace lldb
|
598
contrib/llvm-project/lldb/bindings/interface/SBValue.i
Normal file
598
contrib/llvm-project/lldb/bindings/interface/SBValue.i
Normal file
@ -0,0 +1,598 @@
|
||||
//===-- SWIG Interface for SBValue ------------------------------*- C++ -*-===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
namespace lldb {
|
||||
|
||||
%feature("docstring",
|
||||
"Represents the value of a variable, a register, or an expression.
|
||||
|
||||
SBValue supports iteration through its child, which in turn is represented
|
||||
as an SBValue. For example, we can get the general purpose registers of a
|
||||
frame as an SBValue, and iterate through all the registers,
|
||||
|
||||
registerSet = frame.registers # Returns an SBValueList.
|
||||
for regs in registerSet:
|
||||
if 'general purpose registers' in regs.name.lower():
|
||||
GPRs = regs
|
||||
break
|
||||
|
||||
print('%s (number of children = %d):' % (GPRs.name, GPRs.num_children))
|
||||
for reg in GPRs:
|
||||
print('Name: ', reg.name, ' Value: ', reg.value)
|
||||
|
||||
produces the output:
|
||||
|
||||
General Purpose Registers (number of children = 21):
|
||||
Name: rax Value: 0x0000000100000c5c
|
||||
Name: rbx Value: 0x0000000000000000
|
||||
Name: rcx Value: 0x00007fff5fbffec0
|
||||
Name: rdx Value: 0x00007fff5fbffeb8
|
||||
Name: rdi Value: 0x0000000000000001
|
||||
Name: rsi Value: 0x00007fff5fbffea8
|
||||
Name: rbp Value: 0x00007fff5fbffe80
|
||||
Name: rsp Value: 0x00007fff5fbffe60
|
||||
Name: r8 Value: 0x0000000008668682
|
||||
Name: r9 Value: 0x0000000000000000
|
||||
Name: r10 Value: 0x0000000000001200
|
||||
Name: r11 Value: 0x0000000000000206
|
||||
Name: r12 Value: 0x0000000000000000
|
||||
Name: r13 Value: 0x0000000000000000
|
||||
Name: r14 Value: 0x0000000000000000
|
||||
Name: r15 Value: 0x0000000000000000
|
||||
Name: rip Value: 0x0000000100000dae
|
||||
Name: rflags Value: 0x0000000000000206
|
||||
Name: cs Value: 0x0000000000000027
|
||||
Name: fs Value: 0x0000000000000010
|
||||
Name: gs Value: 0x0000000000000048
|
||||
|
||||
See also linked_list_iter() for another perspective on how to iterate through an
|
||||
SBValue instance which interprets the value object as representing the head of a
|
||||
linked list."
|
||||
) SBValue;
|
||||
class SBValue
|
||||
{
|
||||
public:
|
||||
SBValue ();
|
||||
|
||||
SBValue (const SBValue &rhs);
|
||||
|
||||
~SBValue ();
|
||||
|
||||
bool
|
||||
IsValid();
|
||||
|
||||
explicit operator bool() const;
|
||||
|
||||
void
|
||||
Clear();
|
||||
|
||||
SBError
|
||||
GetError();
|
||||
|
||||
lldb::user_id_t
|
||||
GetID ();
|
||||
|
||||
const char *
|
||||
GetName();
|
||||
|
||||
const char *
|
||||
GetTypeName ();
|
||||
|
||||
const char *
|
||||
GetDisplayTypeName ();
|
||||
|
||||
size_t
|
||||
GetByteSize ();
|
||||
|
||||
bool
|
||||
IsInScope ();
|
||||
|
||||
lldb::Format
|
||||
GetFormat ();
|
||||
|
||||
void
|
||||
SetFormat (lldb::Format format);
|
||||
|
||||
const char *
|
||||
GetValue ();
|
||||
|
||||
int64_t
|
||||
GetValueAsSigned(SBError& error, int64_t fail_value=0);
|
||||
|
||||
uint64_t
|
||||
GetValueAsUnsigned(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 ();
|
||||
|
||||
bool
|
||||
GetValueDidChange ();
|
||||
|
||||
const char *
|
||||
GetSummary ();
|
||||
|
||||
const char *
|
||||
GetSummary (lldb::SBStream& stream,
|
||||
lldb::SBTypeSummaryOptions& options);
|
||||
|
||||
const char *
|
||||
GetObjectDescription ();
|
||||
|
||||
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 ();
|
||||
|
||||
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::SBTypeSynthetic
|
||||
GetTypeSynthetic ();
|
||||
|
||||
lldb::SBValue
|
||||
GetChildAtIndex (uint32_t idx);
|
||||
|
||||
%feature("docstring", "
|
||||
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 synthetic_allowed
|
||||
is 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 the SBValue.Dereference
|
||||
method (or the equivalent deref property).
|
||||
|
||||
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 synthetic_allowed is 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] synthetic_allowed
|
||||
If 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.") GetChildAtIndex;
|
||||
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);
|
||||
|
||||
lldb::SBValue
|
||||
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);
|
||||
|
||||
lldb::SBValue
|
||||
CreateValueFromData (const char* name,
|
||||
lldb::SBData data,
|
||||
lldb::SBType type);
|
||||
|
||||
lldb::SBType
|
||||
GetType();
|
||||
|
||||
%feature("docstring", "
|
||||
Returns the child member index.
|
||||
|
||||
Matches children of this object only and will match base classes and
|
||||
member names if this is a clang typed object.
|
||||
|
||||
@param[in] name
|
||||
The name of the child value to get
|
||||
|
||||
@return
|
||||
An index to the child member value.") GetIndexOfChildWithName;
|
||||
uint32_t
|
||||
GetIndexOfChildWithName (const char *name);
|
||||
|
||||
lldb::SBValue
|
||||
GetChildMemberWithName (const char *name);
|
||||
|
||||
%feature("docstring", "
|
||||
Returns the child member value.
|
||||
|
||||
Matches child members of this object and child members of any base
|
||||
classes.
|
||||
|
||||
@param[in] name
|
||||
The name 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.
|
||||
|
||||
@return
|
||||
A new SBValue object that represents the child member value.") GetChildMemberWithName;
|
||||
lldb::SBValue
|
||||
GetChildMemberWithName (const char *name, lldb::DynamicValueType use_dynamic);
|
||||
|
||||
%feature("docstring", "Expands nested expressions like .a->b[0].c[1]->d."
|
||||
) GetValueForExpressionPath;
|
||||
lldb::SBValue
|
||||
GetValueForExpressionPath(const char* expr_path);
|
||||
|
||||
lldb::SBDeclaration
|
||||
GetDeclaration ();
|
||||
|
||||
bool
|
||||
MightHaveChildren ();
|
||||
|
||||
bool
|
||||
IsRuntimeSupportValue ();
|
||||
|
||||
uint32_t
|
||||
GetNumChildren ();
|
||||
|
||||
%feature("doctstring", "
|
||||
Returns the number for children.
|
||||
|
||||
@param[in] max
|
||||
If max is less the lldb.UINT32_MAX, then the returned value is
|
||||
capped to max.
|
||||
|
||||
@return
|
||||
An integer value capped to the argument max.") GetNumChildren;
|
||||
uint32_t
|
||||
GetNumChildren (uint32_t max);
|
||||
|
||||
void *
|
||||
GetOpaqueType();
|
||||
|
||||
lldb::SBValue
|
||||
Dereference ();
|
||||
|
||||
lldb::SBValue
|
||||
AddressOf();
|
||||
|
||||
bool
|
||||
TypeIsPointerType ();
|
||||
|
||||
lldb::SBTarget
|
||||
GetTarget();
|
||||
|
||||
lldb::SBProcess
|
||||
GetProcess();
|
||||
|
||||
lldb::SBThread
|
||||
GetThread();
|
||||
|
||||
lldb::SBFrame
|
||||
GetFrame();
|
||||
|
||||
%feature("docstring", "
|
||||
Find and watch a variable.
|
||||
It returns an SBWatchpoint, which may be invalid.") Watch;
|
||||
lldb::SBWatchpoint
|
||||
Watch (bool resolve_location, bool read, bool write, SBError &error);
|
||||
|
||||
%feature("docstring", "
|
||||
Find and watch the location pointed to by a variable.
|
||||
It returns an SBWatchpoint, which may be invalid.") WatchPointee;
|
||||
lldb::SBWatchpoint
|
||||
WatchPointee (bool resolve_location, bool read, bool write, SBError &error);
|
||||
|
||||
bool
|
||||
GetDescription (lldb::SBStream &description);
|
||||
|
||||
bool
|
||||
GetExpressionPath (lldb::SBStream &description);
|
||||
|
||||
%feature("docstring", "
|
||||
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.") GetPointeeData;
|
||||
lldb::SBData
|
||||
GetPointeeData (uint32_t item_idx = 0,
|
||||
uint32_t item_count = 1);
|
||||
|
||||
%feature("docstring", "
|
||||
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.") GetData;
|
||||
lldb::SBData
|
||||
GetData ();
|
||||
|
||||
bool
|
||||
SetData (lldb::SBData &data, lldb::SBError& error);
|
||||
|
||||
lldb::addr_t
|
||||
GetLoadAddress();
|
||||
|
||||
lldb::SBAddress
|
||||
GetAddress();
|
||||
|
||||
lldb::SBValue
|
||||
Persist ();
|
||||
|
||||
%feature("docstring", "Returns an expression path for this value."
|
||||
) GetExpressionPath;
|
||||
bool
|
||||
GetExpressionPath (lldb::SBStream &description, bool qualify_cxx_base_classes);
|
||||
|
||||
lldb::SBValue
|
||||
EvaluateExpression(const char *expr) const;
|
||||
|
||||
lldb::SBValue
|
||||
EvaluateExpression(const char *expr,
|
||||
const SBExpressionOptions &options) const;
|
||||
|
||||
lldb::SBValue
|
||||
EvaluateExpression(const char *expr,
|
||||
const SBExpressionOptions &options,
|
||||
const char *name) const;
|
||||
|
||||
STRING_EXTENSION(SBValue)
|
||||
|
||||
#ifdef SWIGPYTHON
|
||||
%pythoncode %{
|
||||
def __get_dynamic__ (self):
|
||||
'''Helper function for the "SBValue.dynamic" property.'''
|
||||
return self.GetDynamicValue (eDynamicCanRunTarget)
|
||||
|
||||
class children_access(object):
|
||||
'''A helper object that will lazily hand out thread for a process when supplied an index.'''
|
||||
|
||||
def __init__(self, sbvalue):
|
||||
self.sbvalue = sbvalue
|
||||
|
||||
def __len__(self):
|
||||
if self.sbvalue:
|
||||
return int(self.sbvalue.GetNumChildren())
|
||||
return 0
|
||||
|
||||
def __getitem__(self, key):
|
||||
if type(key) is int and key < len(self):
|
||||
return self.sbvalue.GetChildAtIndex(key)
|
||||
return None
|
||||
|
||||
def get_child_access_object(self):
|
||||
'''An accessor function that returns a children_access() object which allows lazy member variable access from a lldb.SBValue object.'''
|
||||
return self.children_access (self)
|
||||
|
||||
def get_value_child_list(self):
|
||||
'''An accessor function that returns a list() that contains all children in a lldb.SBValue object.'''
|
||||
children = []
|
||||
accessor = self.get_child_access_object()
|
||||
for idx in range(len(accessor)):
|
||||
children.append(accessor[idx])
|
||||
return children
|
||||
|
||||
def __iter__(self):
|
||||
'''Iterate over all child values of a lldb.SBValue object.'''
|
||||
return lldb_iter(self, 'GetNumChildren', 'GetChildAtIndex')
|
||||
|
||||
def __len__(self):
|
||||
'''Return the number of child values of a lldb.SBValue object.'''
|
||||
return self.GetNumChildren()
|
||||
|
||||
children = property(get_value_child_list, None, doc='''A read only property that returns a list() of lldb.SBValue objects for the children of the value.''')
|
||||
child = property(get_child_access_object, None, doc='''A read only property that returns an object that can access children of a variable by index (child_value = value.children[12]).''')
|
||||
name = property(GetName, None, doc='''A read only property that returns the name of this value as a string.''')
|
||||
type = property(GetType, None, doc='''A read only property that returns a lldb.SBType object that represents the type for this value.''')
|
||||
size = property(GetByteSize, None, doc='''A read only property that returns the size in bytes of this value.''')
|
||||
is_in_scope = property(IsInScope, None, doc='''A read only property that returns a boolean value that indicates whether this value is currently lexically in scope.''')
|
||||
format = property(GetName, SetFormat, doc='''A read/write property that gets/sets the format used for lldb.SBValue().GetValue() for this value. See enumerations that start with "lldb.eFormat".''')
|
||||
value = property(GetValue, SetValueFromCString, doc='''A read/write property that gets/sets value from a string.''')
|
||||
value_type = property(GetValueType, None, doc='''A read only property that returns an lldb enumeration value (see enumerations that start with "lldb.eValueType") that represents the type of this value (local, argument, global, register, etc.).''')
|
||||
changed = property(GetValueDidChange, None, doc='''A read only property that returns a boolean value that indicates if this value has changed since it was last updated.''')
|
||||
data = property(GetData, None, doc='''A read only property that returns an lldb object (lldb.SBData) that represents the bytes that make up the value for this object.''')
|
||||
load_addr = property(GetLoadAddress, None, doc='''A read only property that returns the load address of this value as an integer.''')
|
||||
addr = property(GetAddress, None, doc='''A read only property that returns an lldb.SBAddress that represents the address of this value if it is in memory.''')
|
||||
deref = property(Dereference, None, doc='''A read only property that returns an lldb.SBValue that is created by dereferencing this value.''')
|
||||
address_of = property(AddressOf, None, doc='''A read only property that returns an lldb.SBValue that represents the address-of this value.''')
|
||||
error = property(GetError, None, doc='''A read only property that returns the lldb.SBError that represents the error from the last time the variable value was calculated.''')
|
||||
summary = property(GetSummary, None, doc='''A read only property that returns the summary for this value as a string''')
|
||||
description = property(GetObjectDescription, None, doc='''A read only property that returns the language-specific description of this value as a string''')
|
||||
dynamic = property(__get_dynamic__, None, doc='''A read only property that returns an lldb.SBValue that is created by finding the dynamic type of this value.''')
|
||||
location = property(GetLocation, None, doc='''A read only property that returns the location of this value as a string.''')
|
||||
target = property(GetTarget, None, doc='''A read only property that returns the lldb.SBTarget that this value is associated with.''')
|
||||
process = property(GetProcess, None, doc='''A read only property that returns the lldb.SBProcess that this value is associated with, the returned value might be invalid and should be tested.''')
|
||||
thread = property(GetThread, None, doc='''A read only property that returns the lldb.SBThread that this value is associated with, the returned value might be invalid and should be tested.''')
|
||||
frame = property(GetFrame, None, doc='''A read only property that returns the lldb.SBFrame that this value is associated with, the returned value might be invalid and should be tested.''')
|
||||
num_children = property(GetNumChildren, None, doc='''A read only property that returns the number of child lldb.SBValues that this value has.''')
|
||||
unsigned = property(GetValueAsUnsigned, None, doc='''A read only property that returns the value of this SBValue as an usigned integer.''')
|
||||
signed = property(GetValueAsSigned, None, doc='''A read only property that returns the value of this SBValue as a signed integer.''')
|
||||
|
||||
def get_expr_path(self):
|
||||
s = SBStream()
|
||||
self.GetExpressionPath (s)
|
||||
return s.GetData()
|
||||
|
||||
path = property(get_expr_path, None, doc='''A read only property that returns the expression path that one can use to reach this value in an expression.''')
|
||||
|
||||
def synthetic_child_from_expression(self, name, expr, options=None):
|
||||
if options is None: options = lldb.SBExpressionOptions()
|
||||
child = self.CreateValueFromExpression(name, expr, options)
|
||||
child.SetSyntheticChildrenGenerated(True)
|
||||
return child
|
||||
|
||||
def synthetic_child_from_data(self, name, data, type):
|
||||
child = self.CreateValueFromData(name, data, type)
|
||||
child.SetSyntheticChildrenGenerated(True)
|
||||
return child
|
||||
|
||||
def synthetic_child_from_address(self, name, addr, type):
|
||||
child = self.CreateValueFromAddress(name, addr, type)
|
||||
child.SetSyntheticChildrenGenerated(True)
|
||||
return child
|
||||
|
||||
def __eol_test(val):
|
||||
"""Default function for end of list test takes an SBValue object.
|
||||
|
||||
Return True if val is invalid or it corresponds to a null pointer.
|
||||
Otherwise, return False.
|
||||
"""
|
||||
if not val or val.GetValueAsUnsigned() == 0:
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
|
||||
# ==================================================
|
||||
# Iterator for lldb.SBValue treated as a linked list
|
||||
# ==================================================
|
||||
def linked_list_iter(self, next_item_name, end_of_list_test=__eol_test):
|
||||
"""Generator adaptor to support iteration for SBValue as a linked list.
|
||||
|
||||
linked_list_iter() is a special purpose iterator to treat the SBValue as
|
||||
the head of a list data structure, where you specify the child member
|
||||
name which points to the next item on the list and you specify the
|
||||
end-of-list test function which takes an SBValue for an item and returns
|
||||
True if EOL is reached and False if not.
|
||||
|
||||
linked_list_iter() also detects infinite loop and bails out early.
|
||||
|
||||
The end_of_list_test arg, if omitted, defaults to the __eol_test
|
||||
function above.
|
||||
|
||||
For example,
|
||||
|
||||
# Get Frame #0.
|
||||
...
|
||||
|
||||
# Get variable 'task_head'.
|
||||
task_head = frame0.FindVariable('task_head')
|
||||
...
|
||||
|
||||
for t in task_head.linked_list_iter('next'):
|
||||
print t
|
||||
"""
|
||||
if end_of_list_test(self):
|
||||
return
|
||||
item = self
|
||||
visited = set()
|
||||
try:
|
||||
while not end_of_list_test(item) and not item.GetValueAsUnsigned() in visited:
|
||||
visited.add(item.GetValueAsUnsigned())
|
||||
yield item
|
||||
# Prepare for the next iteration.
|
||||
item = item.GetChildMemberWithName(next_item_name)
|
||||
except:
|
||||
# Exception occurred. Stop the generator.
|
||||
pass
|
||||
|
||||
return
|
||||
%}
|
||||
#endif
|
||||
|
||||
};
|
||||
|
||||
} // namespace lldb
|
172
contrib/llvm-project/lldb/bindings/interface/SBValueList.i
Normal file
172
contrib/llvm-project/lldb/bindings/interface/SBValueList.i
Normal file
@ -0,0 +1,172 @@
|
||||
//===-- SWIG Interface for SBValueList --------------------------*- C++ -*-===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
namespace lldb {
|
||||
|
||||
%feature("docstring",
|
||||
"Represents a collection of SBValues. Both SBFrame's GetVariables() and
|
||||
GetRegisters() return a SBValueList.
|
||||
|
||||
SBValueList supports SBValue iteration. For example (from test/lldbutil.py),
|
||||
|
||||
def get_registers(frame, kind):
|
||||
'''Returns the registers given the frame and the kind of registers desired.
|
||||
|
||||
Returns None if there's no such kind.
|
||||
'''
|
||||
registerSet = frame.GetRegisters() # Return type of SBValueList.
|
||||
for value in registerSet:
|
||||
if kind.lower() in value.GetName().lower():
|
||||
return value
|
||||
|
||||
return None
|
||||
|
||||
def get_GPRs(frame):
|
||||
'''Returns the general purpose registers of the frame as an SBValue.
|
||||
|
||||
The returned SBValue object is iterable. An example:
|
||||
...
|
||||
from lldbutil import get_GPRs
|
||||
regs = get_GPRs(frame)
|
||||
for reg in regs:
|
||||
print('%s => %s' % (reg.GetName(), reg.GetValue()))
|
||||
...
|
||||
'''
|
||||
return get_registers(frame, 'general purpose')
|
||||
|
||||
def get_FPRs(frame):
|
||||
'''Returns the floating point registers of the frame as an SBValue.
|
||||
|
||||
The returned SBValue object is iterable. An example:
|
||||
...
|
||||
from lldbutil import get_FPRs
|
||||
regs = get_FPRs(frame)
|
||||
for reg in regs:
|
||||
print('%s => %s' % (reg.GetName(), reg.GetValue()))
|
||||
...
|
||||
'''
|
||||
return get_registers(frame, 'floating point')
|
||||
|
||||
def get_ESRs(frame):
|
||||
'''Returns the exception state registers of the frame as an SBValue.
|
||||
|
||||
The returned SBValue object is iterable. An example:
|
||||
...
|
||||
from lldbutil import get_ESRs
|
||||
regs = get_ESRs(frame)
|
||||
for reg in regs:
|
||||
print('%s => %s' % (reg.GetName(), reg.GetValue()))
|
||||
...
|
||||
'''
|
||||
return get_registers(frame, 'exception state')"
|
||||
) SBValueList;
|
||||
class SBValueList
|
||||
{
|
||||
public:
|
||||
|
||||
SBValueList ();
|
||||
|
||||
SBValueList (const lldb::SBValueList &rhs);
|
||||
|
||||
~SBValueList();
|
||||
|
||||
bool
|
||||
IsValid() const;
|
||||
|
||||
explicit operator bool() const;
|
||||
|
||||
void
|
||||
Clear();
|
||||
|
||||
void
|
||||
Append (const lldb::SBValue &val_obj);
|
||||
|
||||
void
|
||||
Append (const lldb::SBValueList& value_list);
|
||||
|
||||
uint32_t
|
||||
GetSize() const;
|
||||
|
||||
lldb::SBValue
|
||||
GetValueAtIndex (uint32_t idx) const;
|
||||
|
||||
lldb::SBValue
|
||||
FindValueObjectByUID (lldb::user_id_t uid);
|
||||
|
||||
lldb::SBValue
|
||||
GetFirstValueByName (const char* name) const;
|
||||
|
||||
%extend {
|
||||
%nothreadallow;
|
||||
std::string lldb::SBValueList::__str__ (){
|
||||
lldb::SBStream description;
|
||||
const size_t n = $self->GetSize();
|
||||
if (n)
|
||||
{
|
||||
for (size_t i=0; i<n; ++i)
|
||||
$self->GetValueAtIndex(i).GetDescription(description);
|
||||
}
|
||||
else
|
||||
{
|
||||
description.Printf("<empty> lldb.SBValueList()");
|
||||
}
|
||||
const char *desc = description.GetData();
|
||||
size_t desc_len = description.GetSize();
|
||||
if (desc_len > 0 && (desc[desc_len-1] == '\n' || desc[desc_len-1] == '\r'))
|
||||
--desc_len;
|
||||
return std::string(desc, desc_len);
|
||||
}
|
||||
%clearnothreadallow;
|
||||
}
|
||||
|
||||
#ifdef SWIGPYTHON
|
||||
%pythoncode %{
|
||||
def __iter__(self):
|
||||
'''Iterate over all values in a lldb.SBValueList object.'''
|
||||
return lldb_iter(self, 'GetSize', 'GetValueAtIndex')
|
||||
|
||||
def __len__(self):
|
||||
return int(self.GetSize())
|
||||
|
||||
def __getitem__(self, key):
|
||||
count = len(self)
|
||||
#------------------------------------------------------------
|
||||
# Access with "int" to get Nth item in the list
|
||||
#------------------------------------------------------------
|
||||
if type(key) is int:
|
||||
if key < count:
|
||||
return self.GetValueAtIndex(key)
|
||||
#------------------------------------------------------------
|
||||
# Access with "str" to get values by name
|
||||
#------------------------------------------------------------
|
||||
elif type(key) is str:
|
||||
matches = []
|
||||
for idx in range(count):
|
||||
value = self.GetValueAtIndex(idx)
|
||||
if value.name == key:
|
||||
matches.append(value)
|
||||
return matches
|
||||
#------------------------------------------------------------
|
||||
# Match with regex
|
||||
#------------------------------------------------------------
|
||||
elif isinstance(key, type(re.compile('.'))):
|
||||
matches = []
|
||||
for idx in range(count):
|
||||
value = self.GetValueAtIndex(idx)
|
||||
re_match = key.search(value.name)
|
||||
if re_match:
|
||||
matches.append(value)
|
||||
return matches
|
||||
|
||||
%}
|
||||
#endif
|
||||
|
||||
|
||||
};
|
||||
|
||||
} // namespace lldb
|
@ -0,0 +1,68 @@
|
||||
//===-- SWIG Interface for SBVariablesOptions ----------------------*- C++ -*-===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
namespace lldb {
|
||||
|
||||
class SBVariablesOptions
|
||||
{
|
||||
public:
|
||||
SBVariablesOptions ();
|
||||
|
||||
SBVariablesOptions (const SBVariablesOptions& options);
|
||||
|
||||
~SBVariablesOptions ();
|
||||
|
||||
bool
|
||||
IsValid () const;
|
||||
|
||||
explicit operator bool() const;
|
||||
|
||||
bool
|
||||
GetIncludeArguments () const;
|
||||
|
||||
void
|
||||
SetIncludeArguments (bool);
|
||||
|
||||
bool
|
||||
GetIncludeRecognizedArguments (const lldb::SBTarget &) const;
|
||||
|
||||
void
|
||||
SetIncludeRecognizedArguments (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);
|
||||
};
|
||||
|
||||
} // namespace lldb
|
96
contrib/llvm-project/lldb/bindings/interface/SBWatchpoint.i
Normal file
96
contrib/llvm-project/lldb/bindings/interface/SBWatchpoint.i
Normal file
@ -0,0 +1,96 @@
|
||||
//===-- SWIG Interface for SBWatchpoint -----------------*- C++ -*-===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
namespace lldb {
|
||||
|
||||
%feature("docstring",
|
||||
"Represents an instance of watchpoint for a specific target program.
|
||||
|
||||
A watchpoint is determined by the address and the byte size that resulted in
|
||||
this particular instantiation. Each watchpoint has its settable options.
|
||||
|
||||
See also SBTarget.watchpoint_iter() for example usage of iterating through the
|
||||
watchpoints of the target."
|
||||
) SBWatchpoint;
|
||||
class SBWatchpoint
|
||||
{
|
||||
public:
|
||||
|
||||
SBWatchpoint ();
|
||||
|
||||
SBWatchpoint (const lldb::SBWatchpoint &rhs);
|
||||
|
||||
~SBWatchpoint ();
|
||||
|
||||
bool
|
||||
IsValid();
|
||||
|
||||
explicit operator bool() const;
|
||||
|
||||
bool operator==(const SBWatchpoint &rhs) const;
|
||||
|
||||
bool operator!=(const SBWatchpoint &rhs) const;
|
||||
|
||||
SBError
|
||||
GetError();
|
||||
|
||||
watch_id_t
|
||||
GetID ();
|
||||
|
||||
%feature("docstring", "
|
||||
With -1 representing an invalid hardware index.") GetHardwareIndex;
|
||||
int32_t
|
||||
GetHardwareIndex ();
|
||||
|
||||
lldb::addr_t
|
||||
GetWatchAddress ();
|
||||
|
||||
size_t
|
||||
GetWatchSize();
|
||||
|
||||
void
|
||||
SetEnabled(bool enabled);
|
||||
|
||||
bool
|
||||
IsEnabled ();
|
||||
|
||||
uint32_t
|
||||
GetHitCount ();
|
||||
|
||||
uint32_t
|
||||
GetIgnoreCount ();
|
||||
|
||||
void
|
||||
SetIgnoreCount (uint32_t n);
|
||||
|
||||
%feature("docstring", "
|
||||
Get the condition expression for the watchpoint.") GetCondition;
|
||||
const char *
|
||||
GetCondition ();
|
||||
|
||||
%feature("docstring", "
|
||||
The watchpoint stops only if the condition expression evaluates to true.") SetCondition;
|
||||
void
|
||||
SetCondition (const char *condition);
|
||||
|
||||
bool
|
||||
GetDescription (lldb::SBStream &description, DescriptionLevel level);
|
||||
|
||||
static bool
|
||||
EventIsWatchpointEvent (const lldb::SBEvent &event);
|
||||
|
||||
static lldb::WatchpointEventType
|
||||
GetWatchpointEventTypeFromEvent (const lldb::SBEvent& event);
|
||||
|
||||
static lldb::SBWatchpoint
|
||||
GetWatchpointFromEvent (const lldb::SBEvent& event);
|
||||
|
||||
STRING_EXTENSION_LEVEL(SBWatchpoint, lldb::eDescriptionLevelVerbose)
|
||||
};
|
||||
|
||||
} // namespace lldb
|
82
contrib/llvm-project/lldb/bindings/interfaces.swig
Normal file
82
contrib/llvm-project/lldb/bindings/interfaces.swig
Normal file
@ -0,0 +1,82 @@
|
||||
/* Various liblldb typedefs that SWIG needs to know about. */
|
||||
#define __extension__ /* Undefine GCC keyword to make Swig happy when processing glibc's stdint.h. */
|
||||
/* The ISO C99 standard specifies that in C++ implementations limit macros such
|
||||
as INT32_MAX should only be defined if __STDC_LIMIT_MACROS is. */
|
||||
#define __STDC_LIMIT_MACROS
|
||||
%include "stdint.i"
|
||||
|
||||
%include "lldb/lldb-defines.h"
|
||||
%include "lldb/lldb-enumerations.h"
|
||||
%include "lldb/lldb-forward.h"
|
||||
%include "lldb/lldb-types.h"
|
||||
|
||||
/* Forward declaration of SB classes. */
|
||||
%include "lldb/API/SBDefines.h"
|
||||
|
||||
/* Python interface files with docstrings. */
|
||||
%include "./interface/SBAddress.i"
|
||||
%include "./interface/SBAttachInfo.i"
|
||||
%include "./interface/SBBlock.i"
|
||||
%include "./interface/SBBreakpoint.i"
|
||||
%include "./interface/SBBreakpointLocation.i"
|
||||
%include "./interface/SBBreakpointName.i"
|
||||
%include "./interface/SBBroadcaster.i"
|
||||
%include "./interface/SBCommandInterpreter.i"
|
||||
%include "./interface/SBCommandReturnObject.i"
|
||||
%include "./interface/SBCommunication.i"
|
||||
%include "./interface/SBCompileUnit.i"
|
||||
%include "./interface/SBData.i"
|
||||
%include "./interface/SBDebugger.i"
|
||||
%include "./interface/SBDeclaration.i"
|
||||
%include "./interface/SBError.i"
|
||||
%include "./interface/SBEvent.i"
|
||||
%include "./interface/SBExecutionContext.i"
|
||||
%include "./interface/SBExpressionOptions.i"
|
||||
%include "./interface/SBFile.i"
|
||||
%include "./interface/SBFileSpec.i"
|
||||
%include "./interface/SBFileSpecList.i"
|
||||
%include "./interface/SBFrame.i"
|
||||
%include "./interface/SBFunction.i"
|
||||
%include "./interface/SBHostOS.i"
|
||||
%include "./interface/SBInstruction.i"
|
||||
%include "./interface/SBInstructionList.i"
|
||||
%include "./interface/SBLanguageRuntime.i"
|
||||
%include "./interface/SBLaunchInfo.i"
|
||||
%include "./interface/SBLineEntry.i"
|
||||
%include "./interface/SBListener.i"
|
||||
%include "./interface/SBMemoryRegionInfo.i"
|
||||
%include "./interface/SBMemoryRegionInfoList.i"
|
||||
%include "./interface/SBModule.i"
|
||||
%include "./interface/SBModuleSpec.i"
|
||||
%include "./interface/SBPlatform.i"
|
||||
%include "./interface/SBProcess.i"
|
||||
%include "./interface/SBProcessInfo.i"
|
||||
%include "./interface/SBQueue.i"
|
||||
%include "./interface/SBQueueItem.i"
|
||||
%include "./interface/SBSection.i"
|
||||
%include "./interface/SBSourceManager.i"
|
||||
%include "./interface/SBStream.i"
|
||||
%include "./interface/SBStringList.i"
|
||||
%include "./interface/SBStructuredData.i"
|
||||
%include "./interface/SBSymbol.i"
|
||||
%include "./interface/SBSymbolContext.i"
|
||||
%include "./interface/SBSymbolContextList.i"
|
||||
%include "./interface/SBTarget.i"
|
||||
%include "./interface/SBThread.i"
|
||||
%include "./interface/SBThreadCollection.i"
|
||||
%include "./interface/SBThreadPlan.i"
|
||||
%include "./interface/SBTrace.i"
|
||||
%include "./interface/SBTraceOptions.i"
|
||||
%include "./interface/SBType.i"
|
||||
%include "./interface/SBTypeCategory.i"
|
||||
%include "./interface/SBTypeEnumMember.i"
|
||||
%include "./interface/SBTypeFilter.i"
|
||||
%include "./interface/SBTypeFormat.i"
|
||||
%include "./interface/SBTypeNameSpecifier.i"
|
||||
%include "./interface/SBTypeSummary.i"
|
||||
%include "./interface/SBTypeSynthetic.i"
|
||||
%include "./interface/SBUnixSignals.i"
|
||||
%include "./interface/SBValue.i"
|
||||
%include "./interface/SBValueList.i"
|
||||
%include "./interface/SBVariablesOptions.i"
|
||||
%include "./interface/SBWatchpoint.i"
|
21
contrib/llvm-project/lldb/bindings/lua.swig
Normal file
21
contrib/llvm-project/lldb/bindings/lua.swig
Normal file
@ -0,0 +1,21 @@
|
||||
/*
|
||||
lldb.swig
|
||||
|
||||
This is the input file for SWIG, to create the appropriate C++ wrappers and
|
||||
functions for various scripting languages, to enable them to call the
|
||||
liblldb Script Bridge functions.
|
||||
*/
|
||||
|
||||
%module lldb
|
||||
|
||||
%include <std_string.i>
|
||||
%include "./lua/lua-typemaps.swig"
|
||||
%include "./macros.swig"
|
||||
%include "./headers.swig"
|
||||
|
||||
%{
|
||||
using namespace lldb_private;
|
||||
using namespace lldb;
|
||||
%}
|
||||
|
||||
%include "./interfaces.swig"
|
1
contrib/llvm-project/lldb/bindings/lua/lua-typemaps.swig
Normal file
1
contrib/llvm-project/lldb/bindings/lua/lua-typemaps.swig
Normal file
@ -0,0 +1 @@
|
||||
%include <typemaps.i>
|
33
contrib/llvm-project/lldb/bindings/macros.swig
Normal file
33
contrib/llvm-project/lldb/bindings/macros.swig
Normal file
@ -0,0 +1,33 @@
|
||||
%define STRING_EXTENSION_LEVEL(Class, Level)
|
||||
%extend {
|
||||
%nothreadallow;
|
||||
std::string lldb:: ## Class ## ::__str__(){
|
||||
lldb::SBStream stream;
|
||||
$self->GetDescription (stream, Level);
|
||||
const char *desc = stream.GetData();
|
||||
size_t desc_len = stream.GetSize();
|
||||
if (desc_len > 0 && (desc[desc_len-1] == '\n' || desc[desc_len-1] == '\r')) {
|
||||
--desc_len;
|
||||
}
|
||||
return std::string(desc, desc_len);
|
||||
}
|
||||
%clearnothreadallow;
|
||||
}
|
||||
%enddef
|
||||
|
||||
%define STRING_EXTENSION(Class)
|
||||
%extend {
|
||||
%nothreadallow;
|
||||
std::string lldb:: ## Class ## ::__str__(){
|
||||
lldb::SBStream stream;
|
||||
$self->GetDescription (stream);
|
||||
const char *desc = stream.GetData();
|
||||
size_t desc_len = stream.GetSize();
|
||||
if (desc_len > 0 && (desc[desc_len-1] == '\n' || desc[desc_len-1] == '\r')) {
|
||||
--desc_len;
|
||||
}
|
||||
return std::string(desc, desc_len);
|
||||
}
|
||||
%clearnothreadallow;
|
||||
}
|
||||
%enddef
|
138
contrib/llvm-project/lldb/bindings/python.swig
Normal file
138
contrib/llvm-project/lldb/bindings/python.swig
Normal file
@ -0,0 +1,138 @@
|
||||
/*
|
||||
lldb.swig
|
||||
|
||||
This is the input file for SWIG, to create the appropriate C++ wrappers and
|
||||
functions for various scripting languages, to enable them to call the
|
||||
liblldb Script Bridge functions.
|
||||
*/
|
||||
|
||||
/* Define our module docstring. */
|
||||
%define DOCSTRING
|
||||
"The lldb module contains the public APIs for Python binding.
|
||||
|
||||
Some of the important classes are described here:
|
||||
|
||||
o SBTarget: Represents the target program running under the debugger.
|
||||
o SBProcess: Represents the process associated with the target program.
|
||||
o SBThread: Represents a thread of execution. SBProcess contains SBThread(s).
|
||||
o SBFrame: Represents one of the stack frames associated with a thread. SBThread
|
||||
contains SBFrame(s).
|
||||
o SBSymbolContext: A container that stores various debugger related info.
|
||||
o SBValue: Represents the value of a variable, a register, or an expression.
|
||||
o SBModule: Represents an executable image and its associated object and symbol
|
||||
files. SBTarget contains SBModule(s).
|
||||
o SBBreakpoint: Represents a logical breakpoint and its associated settings.
|
||||
SBTarget contains SBBreakpoint(s).
|
||||
o SBSymbol: Represents the symbol possibly associated with a stack frame.
|
||||
o SBCompileUnit: Represents a compilation unit, or compiled source file.
|
||||
o SBFunction: Represents a generic function, which can be inlined or not.
|
||||
o SBBlock: Represents a lexical block. SBFunction contains SBBlock(s).
|
||||
o SBLineEntry: Specifies an association with a contiguous range of instructions
|
||||
and a source file location. SBCompileUnit contains SBLineEntry(s)."
|
||||
%enddef
|
||||
|
||||
/*
|
||||
Since version 3.0.9, swig's logic for importing the native module has changed in
|
||||
a way that is incompatible with our usage of the python module as __init__.py
|
||||
(See swig bug #769). Fortunately, since version 3.0.11, swig provides a way for
|
||||
us to override the module import logic to suit our needs. This does that.
|
||||
|
||||
Older swig versions will simply ignore this setting.
|
||||
*/
|
||||
%define MODULEIMPORT
|
||||
"try:
|
||||
# Try an absolute import first. If we're being loaded from lldb,
|
||||
# _lldb should be a built-in module.
|
||||
import $module
|
||||
except ImportError:
|
||||
# Relative import should work if we are being loaded by Python.
|
||||
from . import $module"
|
||||
%enddef
|
||||
// These versions will not generate working python modules, so error out early.
|
||||
#if SWIG_VERSION >= 0x030009 && SWIG_VERSION < 0x030011
|
||||
#error Swig versions 3.0.9 and 3.0.10 are incompatible with lldb.
|
||||
#endif
|
||||
|
||||
// The name of the module to be created.
|
||||
%module(docstring=DOCSTRING, moduleimport=MODULEIMPORT) lldb
|
||||
|
||||
// Parameter types will be used in the autodoc string.
|
||||
%feature("autodoc", "1");
|
||||
|
||||
%define ARRAYHELPER(type,name)
|
||||
%inline %{
|
||||
type *new_ ## name (int nitems) {
|
||||
return (type *) malloc(sizeof(type)*nitems);
|
||||
}
|
||||
void delete_ ## name(type *t) {
|
||||
free(t);
|
||||
}
|
||||
type name ## _get(type *t, int index) {
|
||||
return t[index];
|
||||
}
|
||||
void name ## _set(type *t, int index, type val) {
|
||||
t[index] = val;
|
||||
}
|
||||
%}
|
||||
%enddef
|
||||
|
||||
%pythoncode%{
|
||||
import uuid
|
||||
import re
|
||||
import os
|
||||
|
||||
import six
|
||||
%}
|
||||
|
||||
// Include the version of swig that was used to generate this interface.
|
||||
%define EMBED_VERSION(VERSION)
|
||||
%pythoncode%{
|
||||
# SWIG_VERSION is written as a single hex number, but the components of it are
|
||||
# meant to be interpreted in decimal. So, 0x030012 is swig 3.0.12, and not
|
||||
# 3.0.18.
|
||||
def _to_int(hex):
|
||||
return hex // 0x10 % 0x10 * 10 + hex % 0x10
|
||||
swig_version = (_to_int(VERSION // 0x10000), _to_int(VERSION // 0x100), _to_int(VERSION))
|
||||
del _to_int
|
||||
%}
|
||||
%enddef
|
||||
EMBED_VERSION(SWIG_VERSION)
|
||||
|
||||
%pythoncode%{
|
||||
# ===================================
|
||||
# Iterator for lldb container objects
|
||||
# ===================================
|
||||
def lldb_iter(obj, getsize, getelem):
|
||||
"""A generator adaptor to support iteration for lldb container objects."""
|
||||
size = getattr(obj, getsize)
|
||||
elem = getattr(obj, getelem)
|
||||
for i in range(size()):
|
||||
yield elem(i)
|
||||
%}
|
||||
|
||||
%include <std_string.i>
|
||||
%include "./python/python-typemaps.swig"
|
||||
%include "./macros.swig"
|
||||
%include "./headers.swig"
|
||||
|
||||
%{
|
||||
#include "../source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h"
|
||||
#include "../bindings/python/python-swigsafecast.swig"
|
||||
using namespace lldb_private;
|
||||
using namespace lldb_private::python;
|
||||
using namespace lldb;
|
||||
%}
|
||||
|
||||
%include "./interfaces.swig"
|
||||
%include "./python/python-extensions.swig"
|
||||
%include "./python/python-wrapper.swig"
|
||||
|
||||
%pythoncode%{
|
||||
debugger_unique_id = 0
|
||||
SBDebugger.Initialize()
|
||||
debugger = None
|
||||
target = None
|
||||
process = None
|
||||
thread = None
|
||||
frame = None
|
||||
%}
|
@ -0,0 +1,17 @@
|
||||
import os
|
||||
import sys
|
||||
|
||||
pkgRelDir = sys.argv[1]
|
||||
pkgFiles = sys.argv[2:]
|
||||
|
||||
getFileName = lambda f: os.path.splitext(os.path.basename(f))[0]
|
||||
importNames = ', '.join('"{}"'.format(getFileName(f)) for f in pkgFiles)
|
||||
|
||||
script = """__all__ = [{import_names}]
|
||||
for x in __all__:
|
||||
__import__('lldb.{pkg_name}.' + x)
|
||||
""".format(import_names=importNames, pkg_name=pkgRelDir.replace("/", "."))
|
||||
|
||||
pkgIniFile = os.path.normpath(os.path.join(pkgRelDir, "__init__.py"))
|
||||
with open(pkgIniFile, "w") as f:
|
||||
f.write(script)
|
592
contrib/llvm-project/lldb/bindings/python/python-extensions.swig
Normal file
592
contrib/llvm-project/lldb/bindings/python/python-extensions.swig
Normal file
@ -0,0 +1,592 @@
|
||||
%extend lldb::SBBreakpoint {
|
||||
%pythoncode %{
|
||||
def __eq__(self, rhs):
|
||||
if not isinstance(rhs, type(self)):
|
||||
return False
|
||||
|
||||
return getattr(_lldb,self.__class__.__name__+"___eq__")(self, rhs)
|
||||
|
||||
def __ne__(self, rhs):
|
||||
if not isinstance(rhs, type(self)):
|
||||
return True
|
||||
|
||||
return getattr(_lldb,self.__class__.__name__+"___ne__")(self, rhs)
|
||||
%}
|
||||
}
|
||||
|
||||
%extend lldb::SBBroadcaster {
|
||||
%pythoncode %{
|
||||
def __eq__(self, rhs):
|
||||
if not isinstance(rhs, type(self)):
|
||||
return False
|
||||
|
||||
return getattr(_lldb,self.__class__.__name__+"___eq__")(self, rhs)
|
||||
|
||||
def __ne__(self, rhs):
|
||||
if not isinstance(rhs, type(self)):
|
||||
return True
|
||||
|
||||
return getattr(_lldb,self.__class__.__name__+"___ne__")(self, rhs)
|
||||
%}
|
||||
}
|
||||
|
||||
%extend lldb::SBCommandReturnObject {
|
||||
/* the write() and flush() calls are not part of the SB API proper, and are solely for Python usage
|
||||
they are meant to make an SBCommandReturnObject into a file-like object so that instructions of the sort
|
||||
print >>sb_command_return_object, "something"
|
||||
will work correctly */
|
||||
|
||||
void lldb::SBCommandReturnObject::write (const char* str)
|
||||
{
|
||||
if (str)
|
||||
$self->Printf("%s",str);
|
||||
}
|
||||
void lldb::SBCommandReturnObject::flush ()
|
||||
{}
|
||||
}
|
||||
|
||||
%extend lldb::SBCompileUnit {
|
||||
%pythoncode %{
|
||||
def __eq__(self, rhs):
|
||||
if not isinstance(rhs, type(self)):
|
||||
return False
|
||||
|
||||
return getattr(_lldb,self.__class__.__name__+"___eq__")(self, rhs)
|
||||
|
||||
def __ne__(self, rhs):
|
||||
if not isinstance(rhs, type(self)):
|
||||
return True
|
||||
|
||||
return getattr(_lldb,self.__class__.__name__+"___ne__")(self, rhs)
|
||||
%}
|
||||
}
|
||||
|
||||
%extend lldb::SBDeclaration {
|
||||
%pythoncode %{
|
||||
def __eq__(self, rhs):
|
||||
if not isinstance(rhs, type(self)):
|
||||
return False
|
||||
|
||||
return getattr(_lldb,self.__class__.__name__+"___eq__")(self, rhs)
|
||||
|
||||
def __ne__(self, rhs):
|
||||
if not isinstance(rhs, type(self)):
|
||||
return True
|
||||
|
||||
return getattr(_lldb,self.__class__.__name__+"___ne__")(self, rhs)
|
||||
%}
|
||||
}
|
||||
|
||||
%extend lldb::SBFunction {
|
||||
%pythoncode %{
|
||||
def __eq__(self, rhs):
|
||||
if not isinstance(rhs, type(self)):
|
||||
return False
|
||||
|
||||
return getattr(_lldb,self.__class__.__name__+"___eq__")(self, rhs)
|
||||
|
||||
def __ne__(self, rhs):
|
||||
if not isinstance(rhs, type(self)):
|
||||
return True
|
||||
|
||||
return getattr(_lldb,self.__class__.__name__+"___ne__")(self, rhs)
|
||||
%}
|
||||
}
|
||||
|
||||
%extend lldb::SBLineEntry {
|
||||
%pythoncode %{
|
||||
def __eq__(self, rhs):
|
||||
if not isinstance(rhs, type(self)):
|
||||
return False
|
||||
|
||||
return getattr(_lldb,self.__class__.__name__+"___eq__")(self, rhs)
|
||||
|
||||
def __ne__(self, rhs):
|
||||
if not isinstance(rhs, type(self)):
|
||||
return True
|
||||
|
||||
return getattr(_lldb,self.__class__.__name__+"___ne__")(self, rhs)
|
||||
%}
|
||||
}
|
||||
|
||||
%extend lldb::SBModule {
|
||||
%pythoncode %{
|
||||
def __eq__(self, rhs):
|
||||
if not isinstance(rhs, type(self)):
|
||||
return False
|
||||
|
||||
return getattr(_lldb,self.__class__.__name__+"___eq__")(self, rhs)
|
||||
|
||||
def __ne__(self, rhs):
|
||||
if not isinstance(rhs, type(self)):
|
||||
return True
|
||||
|
||||
return getattr(_lldb,self.__class__.__name__+"___ne__")(self, rhs)
|
||||
%}
|
||||
}
|
||||
|
||||
%extend lldb::SBSection {
|
||||
%pythoncode %{
|
||||
def __eq__(self, rhs):
|
||||
if not isinstance(rhs, type(self)):
|
||||
return False
|
||||
|
||||
return getattr(_lldb,self.__class__.__name__+"___eq__")(self, rhs)
|
||||
|
||||
def __ne__(self, rhs):
|
||||
if not isinstance(rhs, type(self)):
|
||||
return True
|
||||
|
||||
return getattr(_lldb,self.__class__.__name__+"___ne__")(self, rhs)
|
||||
%}
|
||||
}
|
||||
%extend lldb::SBStream {
|
||||
/* the write() and flush() calls are not part of the SB API proper, and are solely for Python usage
|
||||
they are meant to make an SBStream into a file-like object so that instructions of the sort
|
||||
print >>sb_stream, "something"
|
||||
will work correctly */
|
||||
|
||||
void lldb::SBStream::write (const char* str)
|
||||
{
|
||||
if (str)
|
||||
$self->Printf("%s",str);
|
||||
}
|
||||
void lldb::SBStream::flush ()
|
||||
{}
|
||||
}
|
||||
%extend lldb::SBSymbol {
|
||||
%pythoncode %{
|
||||
def __eq__(self, rhs):
|
||||
if not isinstance(rhs, type(self)):
|
||||
return False
|
||||
|
||||
return getattr(_lldb,self.__class__.__name__+"___eq__")(self, rhs)
|
||||
|
||||
def __ne__(self, rhs):
|
||||
if not isinstance(rhs, type(self)):
|
||||
return True
|
||||
|
||||
return getattr(_lldb,self.__class__.__name__+"___ne__")(self, rhs)
|
||||
%}
|
||||
}
|
||||
|
||||
%extend lldb::SBTarget {
|
||||
%pythoncode %{
|
||||
def __eq__(self, rhs):
|
||||
if not isinstance(rhs, type(self)):
|
||||
return False
|
||||
|
||||
return getattr(_lldb,self.__class__.__name__+"___eq__")(self, rhs)
|
||||
|
||||
def __ne__(self, rhs):
|
||||
if not isinstance(rhs, type(self)):
|
||||
return True
|
||||
|
||||
return getattr(_lldb,self.__class__.__name__+"___ne__")(self, rhs)
|
||||
%}
|
||||
}
|
||||
|
||||
%extend lldb::SBTypeFilter {
|
||||
%pythoncode %{
|
||||
def __eq__(self, rhs):
|
||||
if not isinstance(rhs, type(self)):
|
||||
return False
|
||||
|
||||
return getattr(_lldb,self.__class__.__name__+"___eq__")(self, rhs)
|
||||
|
||||
def __ne__(self, rhs):
|
||||
if not isinstance(rhs, type(self)):
|
||||
return True
|
||||
|
||||
return getattr(_lldb,self.__class__.__name__+"___ne__")(self, rhs)
|
||||
%}
|
||||
}
|
||||
|
||||
%extend lldb::SBTypeNameSpecifier {
|
||||
%pythoncode %{
|
||||
def __eq__(self, rhs):
|
||||
if not isinstance(rhs, type(self)):
|
||||
return False
|
||||
|
||||
return getattr(_lldb,self.__class__.__name__+"___eq__")(self, rhs)
|
||||
|
||||
def __ne__(self, rhs):
|
||||
if not isinstance(rhs, type(self)):
|
||||
return True
|
||||
|
||||
return getattr(_lldb,self.__class__.__name__+"___ne__")(self, rhs)
|
||||
%}
|
||||
}
|
||||
|
||||
%extend lldb::SBTypeSummary {
|
||||
%pythoncode %{
|
||||
def __eq__(self, rhs):
|
||||
if not isinstance(rhs, type(self)):
|
||||
return False
|
||||
|
||||
return getattr(_lldb,self.__class__.__name__+"___eq__")(self, rhs)
|
||||
|
||||
def __ne__(self, rhs):
|
||||
if not isinstance(rhs, type(self)):
|
||||
return True
|
||||
|
||||
return getattr(_lldb,self.__class__.__name__+"___ne__")(self, rhs)
|
||||
%}
|
||||
}
|
||||
|
||||
%extend lldb::SBTypeSynthetic {
|
||||
%pythoncode %{
|
||||
def __eq__(self, rhs):
|
||||
if not isinstance(rhs, type(self)):
|
||||
return False
|
||||
|
||||
return getattr(_lldb,self.__class__.__name__+"___eq__")(self, rhs)
|
||||
|
||||
def __ne__(self, rhs):
|
||||
if not isinstance(rhs, type(self)):
|
||||
return True
|
||||
|
||||
return getattr(_lldb,self.__class__.__name__+"___ne__")(self, rhs)
|
||||
%}
|
||||
}
|
||||
|
||||
%extend lldb::SBThread {
|
||||
%pythoncode %{
|
||||
def __eq__(self, rhs):
|
||||
if not isinstance(rhs, type(self)):
|
||||
return False
|
||||
|
||||
return getattr(_lldb,self.__class__.__name__+"___eq__")(self, rhs)
|
||||
|
||||
def __ne__(self, rhs):
|
||||
if not isinstance(rhs, type(self)):
|
||||
return True
|
||||
|
||||
return getattr(_lldb,self.__class__.__name__+"___ne__")(self, rhs)
|
||||
%}
|
||||
}
|
||||
|
||||
%pythoncode %{
|
||||
|
||||
def command(command_name=None, doc=None):
|
||||
import lldb
|
||||
"""A decorator function that registers an LLDB command line
|
||||
command that is bound to the function it is attached to."""
|
||||
def callable(function):
|
||||
"""Registers an lldb command for the decorated function."""
|
||||
command = "command script add -f %s.%s %s" % (function.__module__, function.__name__, command_name or function.__name__)
|
||||
lldb.debugger.HandleCommand(command)
|
||||
if doc:
|
||||
function.__doc__ = doc
|
||||
return function
|
||||
|
||||
return callable
|
||||
|
||||
class declaration(object):
|
||||
'''A class that represents a source declaration location with file, line and column.'''
|
||||
def __init__(self, file, line, col):
|
||||
self.file = file
|
||||
self.line = line
|
||||
self.col = col
|
||||
|
||||
class value_iter(object):
|
||||
def __iter__(self):
|
||||
return self
|
||||
|
||||
def __next__(self):
|
||||
if self.index >= self.length:
|
||||
raise StopIteration()
|
||||
child_sbvalue = self.sbvalue.GetChildAtIndex(self.index)
|
||||
self.index += 1
|
||||
return value(child_sbvalue)
|
||||
|
||||
def next(self):
|
||||
return self.__next__()
|
||||
|
||||
def __init__(self,value):
|
||||
self.index = 0
|
||||
self.sbvalue = value
|
||||
if type(self.sbvalue) is value:
|
||||
self.sbvalue = self.sbvalue.sbvalue
|
||||
self.length = self.sbvalue.GetNumChildren()
|
||||
|
||||
class value(object):
|
||||
'''A class designed to wrap lldb.SBValue() objects so the resulting object
|
||||
can be used as a variable would be in code. So if you have a Point structure
|
||||
variable in your code in the current frame named "pt", you can initialize an instance
|
||||
of this class with it:
|
||||
|
||||
pt = lldb.value(lldb.frame.FindVariable("pt"))
|
||||
print pt
|
||||
print pt.x
|
||||
print pt.y
|
||||
|
||||
pt = lldb.value(lldb.frame.FindVariable("rectangle_array"))
|
||||
print rectangle_array[12]
|
||||
print rectangle_array[5].origin.x'''
|
||||
def __init__(self, sbvalue):
|
||||
self.sbvalue = sbvalue
|
||||
|
||||
def __nonzero__(self):
|
||||
return self.sbvalue.__nonzero__()
|
||||
|
||||
def __bool__(self):
|
||||
return self.sbvalue.__bool__()
|
||||
|
||||
def __str__(self):
|
||||
return self.sbvalue.__str__()
|
||||
|
||||
def __getitem__(self, key):
|
||||
# Allow array access if this value has children...
|
||||
if type(key) is value:
|
||||
key = int(key)
|
||||
if type(key) is int:
|
||||
child_sbvalue = (self.sbvalue.GetValueForExpressionPath("[%i]" % key))
|
||||
if child_sbvalue and child_sbvalue.IsValid():
|
||||
return value(child_sbvalue)
|
||||
raise IndexError("Index '%d' is out of range" % key)
|
||||
raise TypeError("No array item of type %s" % str(type(key)))
|
||||
|
||||
def __iter__(self):
|
||||
return value_iter(self.sbvalue)
|
||||
|
||||
def __getattr__(self, name):
|
||||
child_sbvalue = self.sbvalue.GetChildMemberWithName (name)
|
||||
if child_sbvalue and child_sbvalue.IsValid():
|
||||
return value(child_sbvalue)
|
||||
raise AttributeError("Attribute '%s' is not defined" % name)
|
||||
|
||||
def __add__(self, other):
|
||||
return int(self) + int(other)
|
||||
|
||||
def __sub__(self, other):
|
||||
return int(self) - int(other)
|
||||
|
||||
def __mul__(self, other):
|
||||
return int(self) * int(other)
|
||||
|
||||
def __floordiv__(self, other):
|
||||
return int(self) // int(other)
|
||||
|
||||
def __mod__(self, other):
|
||||
return int(self) % int(other)
|
||||
|
||||
def __divmod__(self, other):
|
||||
return int(self) % int(other)
|
||||
|
||||
def __pow__(self, other):
|
||||
return int(self) ** int(other)
|
||||
|
||||
def __lshift__(self, other):
|
||||
return int(self) << int(other)
|
||||
|
||||
def __rshift__(self, other):
|
||||
return int(self) >> int(other)
|
||||
|
||||
def __and__(self, other):
|
||||
return int(self) & int(other)
|
||||
|
||||
def __xor__(self, other):
|
||||
return int(self) ^ int(other)
|
||||
|
||||
def __or__(self, other):
|
||||
return int(self) | int(other)
|
||||
|
||||
def __div__(self, other):
|
||||
return int(self) / int(other)
|
||||
|
||||
def __truediv__(self, other):
|
||||
return int(self) / int(other)
|
||||
|
||||
def __iadd__(self, other):
|
||||
result = self.__add__(other)
|
||||
self.sbvalue.SetValueFromCString (str(result))
|
||||
return result
|
||||
|
||||
def __isub__(self, other):
|
||||
result = self.__sub__(other)
|
||||
self.sbvalue.SetValueFromCString (str(result))
|
||||
return result
|
||||
|
||||
def __imul__(self, other):
|
||||
result = self.__mul__(other)
|
||||
self.sbvalue.SetValueFromCString (str(result))
|
||||
return result
|
||||
|
||||
def __idiv__(self, other):
|
||||
result = self.__div__(other)
|
||||
self.sbvalue.SetValueFromCString (str(result))
|
||||
return result
|
||||
|
||||
def __itruediv__(self, other):
|
||||
result = self.__truediv__(other)
|
||||
self.sbvalue.SetValueFromCString (str(result))
|
||||
return result
|
||||
|
||||
def __ifloordiv__(self, other):
|
||||
result = self.__floordiv__(self, other)
|
||||
self.sbvalue.SetValueFromCString (str(result))
|
||||
return result
|
||||
|
||||
def __imod__(self, other):
|
||||
result = self.__and__(self, other)
|
||||
self.sbvalue.SetValueFromCString (str(result))
|
||||
return result
|
||||
|
||||
def __ipow__(self, other):
|
||||
result = self.__pow__(self, other)
|
||||
self.sbvalue.SetValueFromCString (str(result))
|
||||
return result
|
||||
|
||||
def __ipow__(self, other, modulo):
|
||||
result = self.__pow__(self, other, modulo)
|
||||
self.sbvalue.SetValueFromCString (str(result))
|
||||
return result
|
||||
|
||||
def __ilshift__(self, other):
|
||||
result = self.__lshift__(other)
|
||||
self.sbvalue.SetValueFromCString (str(result))
|
||||
return result
|
||||
|
||||
def __irshift__(self, other):
|
||||
result = self.__rshift__(other)
|
||||
self.sbvalue.SetValueFromCString (str(result))
|
||||
return result
|
||||
|
||||
def __iand__(self, other):
|
||||
result = self.__and__(self, other)
|
||||
self.sbvalue.SetValueFromCString (str(result))
|
||||
return result
|
||||
|
||||
def __ixor__(self, other):
|
||||
result = self.__xor__(self, other)
|
||||
self.sbvalue.SetValueFromCString (str(result))
|
||||
return result
|
||||
|
||||
def __ior__(self, other):
|
||||
result = self.__ior__(self, other)
|
||||
self.sbvalue.SetValueFromCString (str(result))
|
||||
return result
|
||||
|
||||
def __neg__(self):
|
||||
return -int(self)
|
||||
|
||||
def __pos__(self):
|
||||
return +int(self)
|
||||
|
||||
def __abs__(self):
|
||||
return abs(int(self))
|
||||
|
||||
def __invert__(self):
|
||||
return ~int(self)
|
||||
|
||||
def __complex__(self):
|
||||
return complex (int(self))
|
||||
|
||||
def __int__(self):
|
||||
is_num,is_sign = is_numeric_type(self.sbvalue.GetType().GetCanonicalType().GetBasicType())
|
||||
if is_num and not is_sign: return self.sbvalue.GetValueAsUnsigned()
|
||||
return self.sbvalue.GetValueAsSigned()
|
||||
|
||||
def __long__(self):
|
||||
return self.__int__()
|
||||
|
||||
def __float__(self):
|
||||
return float (self.sbvalue.GetValueAsSigned())
|
||||
|
||||
def __oct__(self):
|
||||
return '0%o' % self.sbvalue.GetValueAsUnsigned()
|
||||
|
||||
def __hex__(self):
|
||||
return '0x%x' % self.sbvalue.GetValueAsUnsigned()
|
||||
|
||||
def __len__(self):
|
||||
return self.sbvalue.GetNumChildren()
|
||||
|
||||
def __eq__(self, other):
|
||||
if type(other) is int:
|
||||
return int(self) == other
|
||||
elif type(other) is str:
|
||||
return str(self) == other
|
||||
elif type(other) is value:
|
||||
self_err = SBError()
|
||||
other_err = SBError()
|
||||
self_val = self.sbvalue.GetValueAsUnsigned(self_err)
|
||||
if self_err.fail:
|
||||
raise ValueError("unable to extract value of self")
|
||||
other_val = other.sbvalue.GetValueAsUnsigned(other_err)
|
||||
if other_err.fail:
|
||||
raise ValueError("unable to extract value of other")
|
||||
return self_val == other_val
|
||||
raise TypeError("Unknown type %s, No equality operation defined." % str(type(other)))
|
||||
|
||||
def __ne__(self, other):
|
||||
return not self.__eq__(other)
|
||||
%}
|
||||
|
||||
%pythoncode %{
|
||||
|
||||
class SBSyntheticValueProvider(object):
|
||||
def __init__(self,valobj):
|
||||
pass
|
||||
|
||||
def num_children(self):
|
||||
return 0
|
||||
|
||||
def get_child_index(self,name):
|
||||
return None
|
||||
|
||||
def get_child_at_index(self,idx):
|
||||
return None
|
||||
|
||||
def update(self):
|
||||
pass
|
||||
|
||||
def has_children(self):
|
||||
return False
|
||||
|
||||
|
||||
%}
|
||||
|
||||
%pythoncode %{
|
||||
|
||||
# given an lldb.SBBasicType it returns a tuple
|
||||
# (is_numeric, is_signed)
|
||||
# the value of is_signed is undefined if is_numeric == false
|
||||
def is_numeric_type(basic_type):
|
||||
if basic_type == eBasicTypeInvalid: return (False,False)
|
||||
if basic_type == eBasicTypeVoid: return (False,False)
|
||||
if basic_type == eBasicTypeChar: return (True,False)
|
||||
if basic_type == eBasicTypeSignedChar: return (True,True)
|
||||
if basic_type == eBasicTypeUnsignedChar: return (True,False)
|
||||
if basic_type == eBasicTypeWChar: return (True,False)
|
||||
if basic_type == eBasicTypeSignedWChar: return (True,True)
|
||||
if basic_type == eBasicTypeUnsignedWChar: return (True,False)
|
||||
if basic_type == eBasicTypeChar16: return (True,False)
|
||||
if basic_type == eBasicTypeChar32: return (True,False)
|
||||
if basic_type == eBasicTypeShort: return (True,True)
|
||||
if basic_type == eBasicTypeUnsignedShort: return (True,False)
|
||||
if basic_type == eBasicTypeInt: return (True,True)
|
||||
if basic_type == eBasicTypeUnsignedInt: return (True,False)
|
||||
if basic_type == eBasicTypeLong: return (True,True)
|
||||
if basic_type == eBasicTypeUnsignedLong: return (True,False)
|
||||
if basic_type == eBasicTypeLongLong: return (True,True)
|
||||
if basic_type == eBasicTypeUnsignedLongLong: return (True,False)
|
||||
if basic_type == eBasicTypeInt128: return (True,True)
|
||||
if basic_type == eBasicTypeUnsignedInt128: return (True,False)
|
||||
if basic_type == eBasicTypeBool: return (False,False)
|
||||
if basic_type == eBasicTypeHalf: return (True,True)
|
||||
if basic_type == eBasicTypeFloat: return (True,True)
|
||||
if basic_type == eBasicTypeDouble: return (True,True)
|
||||
if basic_type == eBasicTypeLongDouble: return (True,True)
|
||||
if basic_type == eBasicTypeFloatComplex: return (True,True)
|
||||
if basic_type == eBasicTypeDoubleComplex: return (True,True)
|
||||
if basic_type == eBasicTypeLongDoubleComplex: return (True,True)
|
||||
if basic_type == eBasicTypeObjCID: return (False,False)
|
||||
if basic_type == eBasicTypeObjCClass: return (False,False)
|
||||
if basic_type == eBasicTypeObjCSel: return (False,False)
|
||||
if basic_type == eBasicTypeNullPtr: return (False,False)
|
||||
#if basic_type == eBasicTypeOther:
|
||||
return (False,False)
|
||||
|
||||
%}
|
@ -0,0 +1,154 @@
|
||||
// leaving this undefined ensures we will get a linker error if we try to use SBTypeToSWIGWrapper()
|
||||
// for a type for which we did not specialze this function
|
||||
template <typename SBClass>
|
||||
PyObject*
|
||||
SBTypeToSWIGWrapper (SBClass* sb_object);
|
||||
|
||||
template <typename SBClass>
|
||||
PyObject*
|
||||
SBTypeToSWIGWrapper (SBClass& sb_object)
|
||||
{
|
||||
return SBTypeToSWIGWrapper(&sb_object);
|
||||
}
|
||||
|
||||
template <typename SBClass>
|
||||
PyObject*
|
||||
SBTypeToSWIGWrapper (const SBClass& sb_object)
|
||||
{
|
||||
return SBTypeToSWIGWrapper(&sb_object);
|
||||
}
|
||||
|
||||
template <>
|
||||
PyObject*
|
||||
SBTypeToSWIGWrapper (PyObject* py_object)
|
||||
{
|
||||
return py_object;
|
||||
}
|
||||
|
||||
template <>
|
||||
PyObject*
|
||||
SBTypeToSWIGWrapper (unsigned int* c_int)
|
||||
{
|
||||
if (!c_int)
|
||||
return NULL;
|
||||
return PyInt_FromLong(*c_int);
|
||||
}
|
||||
|
||||
template <>
|
||||
PyObject*
|
||||
SBTypeToSWIGWrapper (lldb::SBEvent* event_sb)
|
||||
{
|
||||
return SWIG_NewPointerObj((void *) event_sb, SWIGTYPE_p_lldb__SBEvent, 0);
|
||||
}
|
||||
|
||||
template <>
|
||||
PyObject*
|
||||
SBTypeToSWIGWrapper (lldb::SBProcess* process_sb)
|
||||
{
|
||||
return SWIG_NewPointerObj((void *) process_sb, SWIGTYPE_p_lldb__SBProcess, 0);
|
||||
}
|
||||
|
||||
template <>
|
||||
PyObject*
|
||||
SBTypeToSWIGWrapper (lldb::SBThread* thread_sb)
|
||||
{
|
||||
return SWIG_NewPointerObj((void *) thread_sb, SWIGTYPE_p_lldb__SBThread, 0);
|
||||
}
|
||||
|
||||
template <>
|
||||
PyObject*
|
||||
SBTypeToSWIGWrapper (lldb::SBThreadPlan* thread_plan_sb)
|
||||
{
|
||||
return SWIG_NewPointerObj((void *) thread_plan_sb, SWIGTYPE_p_lldb__SBThreadPlan, 0);
|
||||
}
|
||||
|
||||
template <>
|
||||
PyObject*
|
||||
SBTypeToSWIGWrapper (lldb::SBTarget* target_sb)
|
||||
{
|
||||
return SWIG_NewPointerObj((void *) target_sb, SWIGTYPE_p_lldb__SBTarget, 0);
|
||||
}
|
||||
|
||||
template <>
|
||||
PyObject*
|
||||
SBTypeToSWIGWrapper (lldb::SBFrame* frame_sb)
|
||||
{
|
||||
return SWIG_NewPointerObj((void *) frame_sb, SWIGTYPE_p_lldb__SBFrame, 0);
|
||||
}
|
||||
|
||||
template <>
|
||||
PyObject*
|
||||
SBTypeToSWIGWrapper (lldb::SBDebugger* debugger_sb)
|
||||
{
|
||||
return SWIG_NewPointerObj((void *) debugger_sb, SWIGTYPE_p_lldb__SBDebugger, 0);
|
||||
}
|
||||
|
||||
template <>
|
||||
PyObject*
|
||||
SBTypeToSWIGWrapper (lldb::SBBreakpoint* breakpoint_sb)
|
||||
{
|
||||
return SWIG_NewPointerObj((void *) breakpoint_sb, SWIGTYPE_p_lldb__SBBreakpoint, 0);
|
||||
}
|
||||
|
||||
template <>
|
||||
PyObject*
|
||||
SBTypeToSWIGWrapper (lldb::SBWatchpoint* watchpoint_sb)
|
||||
{
|
||||
return SWIG_NewPointerObj((void *) watchpoint_sb, SWIGTYPE_p_lldb__SBWatchpoint, 0);
|
||||
}
|
||||
|
||||
template <>
|
||||
PyObject*
|
||||
SBTypeToSWIGWrapper (lldb::SBBreakpointLocation* breakpoint_location_sb)
|
||||
{
|
||||
return SWIG_NewPointerObj((void *) breakpoint_location_sb, SWIGTYPE_p_lldb__SBBreakpointLocation, 0);
|
||||
}
|
||||
|
||||
template <>
|
||||
PyObject*
|
||||
SBTypeToSWIGWrapper (lldb::SBBreakpointName* breakpoint_name_sb)
|
||||
{
|
||||
return SWIG_NewPointerObj((void *) breakpoint_name_sb, SWIGTYPE_p_lldb__SBBreakpointName, 0);
|
||||
}
|
||||
|
||||
template <>
|
||||
PyObject*
|
||||
SBTypeToSWIGWrapper (lldb::SBValue* value_sb)
|
||||
{
|
||||
return SWIG_NewPointerObj((void *) value_sb, SWIGTYPE_p_lldb__SBValue, 0);
|
||||
}
|
||||
|
||||
template <>
|
||||
PyObject*
|
||||
SBTypeToSWIGWrapper (lldb::SBCommandReturnObject* cmd_ret_obj_sb)
|
||||
{
|
||||
return SWIG_NewPointerObj((void *) cmd_ret_obj_sb, SWIGTYPE_p_lldb__SBCommandReturnObject, 0);
|
||||
}
|
||||
|
||||
template <>
|
||||
PyObject*
|
||||
SBTypeToSWIGWrapper (lldb::SBExecutionContext* ctx_sb)
|
||||
{
|
||||
return SWIG_NewPointerObj((void *) ctx_sb, SWIGTYPE_p_lldb__SBExecutionContext, 0);
|
||||
}
|
||||
|
||||
template <>
|
||||
PyObject*
|
||||
SBTypeToSWIGWrapper (lldb::SBTypeSummaryOptions* summary_options_sb)
|
||||
{
|
||||
return SWIG_NewPointerObj((void *) summary_options_sb, SWIGTYPE_p_lldb__SBTypeSummaryOptions, 0);
|
||||
}
|
||||
|
||||
template <>
|
||||
PyObject*
|
||||
SBTypeToSWIGWrapper (lldb::SBStructuredData* structured_data_sb)
|
||||
{
|
||||
return SWIG_NewPointerObj((void *) structured_data_sb, SWIGTYPE_p_lldb__SBStructuredData, 0);
|
||||
}
|
||||
|
||||
template <>
|
||||
PyObject*
|
||||
SBTypeToSWIGWrapper (lldb::SBSymbolContext* sym_ctx_sb)
|
||||
{
|
||||
return SWIG_NewPointerObj((void *) sym_ctx_sb, SWIGTYPE_p_lldb__SBSymbolContext, 0);
|
||||
}
|
530
contrib/llvm-project/lldb/bindings/python/python-typemaps.swig
Normal file
530
contrib/llvm-project/lldb/bindings/python/python-typemaps.swig
Normal file
@ -0,0 +1,530 @@
|
||||
/* Typemap definitions, to allow SWIG to properly handle 'char**' data types. */
|
||||
|
||||
%typemap(in) char ** {
|
||||
/* Check if is a list */
|
||||
if (PythonList::Check($input)) {
|
||||
PythonList list(PyRefType::Borrowed, $input);
|
||||
int size = list.GetSize();
|
||||
int i = 0;
|
||||
$1 = (char**)malloc((size+1)*sizeof(char*));
|
||||
for (i = 0; i < size; i++) {
|
||||
PythonString py_str = list.GetItemAtIndex(i).AsType<PythonString>();
|
||||
if (!py_str.IsAllocated()) {
|
||||
PyErr_SetString(PyExc_TypeError,"list must contain strings");
|
||||
free($1);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
$1[i] = const_cast<char*>(py_str.GetString().data());
|
||||
}
|
||||
$1[i] = 0;
|
||||
} else if ($input == Py_None) {
|
||||
$1 = NULL;
|
||||
} else {
|
||||
PyErr_SetString(PyExc_TypeError,"not a list");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
%typemap(typecheck) char ** {
|
||||
/* Check if is a list */
|
||||
$1 = 1;
|
||||
if (PythonList::Check($input)) {
|
||||
PythonList list(PyRefType::Borrowed, $input);
|
||||
int size = list.GetSize();
|
||||
int i = 0;
|
||||
for (i = 0; i < size; i++) {
|
||||
PythonString s = list.GetItemAtIndex(i).AsType<PythonString>();
|
||||
if (!s.IsAllocated()) { $1 = 0; }
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$1 = ( ($input == Py_None) ? 1 : 0);
|
||||
}
|
||||
}
|
||||
|
||||
%typemap(freearg) char** {
|
||||
free((char *) $1);
|
||||
}
|
||||
|
||||
%typemap(out) char** {
|
||||
int len;
|
||||
int i;
|
||||
len = 0;
|
||||
while ($1[len]) len++;
|
||||
PythonList list(len);
|
||||
for (i = 0; i < len; i++)
|
||||
list.SetItemAtIndex(i, PythonString($1[i]));
|
||||
$result = list.release();
|
||||
}
|
||||
|
||||
|
||||
%typemap(in) lldb::tid_t {
|
||||
if (PythonInteger::Check($input))
|
||||
{
|
||||
PythonInteger py_int(PyRefType::Borrowed, $input);
|
||||
$1 = static_cast<lldb::tid_t>(py_int.GetInteger());
|
||||
}
|
||||
else
|
||||
{
|
||||
PyErr_SetString(PyExc_ValueError, "Expecting an integer");
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
%typemap(in) lldb::StateType {
|
||||
if (PythonInteger::Check($input))
|
||||
{
|
||||
PythonInteger py_int(PyRefType::Borrowed, $input);
|
||||
int64_t state_type_value = py_int.GetInteger() ;
|
||||
|
||||
if (state_type_value > lldb::StateType::kLastStateType) {
|
||||
PyErr_SetString(PyExc_ValueError, "Not a valid StateType value");
|
||||
return nullptr;
|
||||
}
|
||||
$1 = static_cast<lldb::StateType>(state_type_value);
|
||||
}
|
||||
else
|
||||
{
|
||||
PyErr_SetString(PyExc_ValueError, "Expecting an integer");
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
/* Typemap definitions to allow SWIG to properly handle char buffer. */
|
||||
|
||||
// typemap for a char buffer
|
||||
%typemap(in) (char *dst, size_t dst_len) {
|
||||
if (!PyInt_Check($input)) {
|
||||
PyErr_SetString(PyExc_ValueError, "Expecting an integer");
|
||||
return NULL;
|
||||
}
|
||||
$2 = PyInt_AsLong($input);
|
||||
if ($2 <= 0) {
|
||||
PyErr_SetString(PyExc_ValueError, "Positive integer expected");
|
||||
return NULL;
|
||||
}
|
||||
$1 = (char *) malloc($2);
|
||||
}
|
||||
// SBProcess::ReadCStringFromMemory() uses a void*, but needs to be treated
|
||||
// as char data instead of byte data.
|
||||
%typemap(in) (void *char_buf, size_t size) = (char *dst, size_t dst_len);
|
||||
|
||||
// Return the char buffer. Discarding any previous return result
|
||||
%typemap(argout) (char *dst, size_t dst_len) {
|
||||
Py_XDECREF($result); /* Blow away any previous result */
|
||||
if (result == 0) {
|
||||
PythonString string("");
|
||||
$result = string.release();
|
||||
Py_INCREF($result);
|
||||
} else {
|
||||
llvm::StringRef ref(static_cast<const char*>($1), result);
|
||||
PythonString string(ref);
|
||||
$result = string.release();
|
||||
}
|
||||
free($1);
|
||||
}
|
||||
// SBProcess::ReadCStringFromMemory() uses a void*, but needs to be treated
|
||||
// as char data instead of byte data.
|
||||
%typemap(argout) (void *char_buf, size_t size) = (char *dst, size_t dst_len);
|
||||
|
||||
|
||||
// typemap for handling an snprintf-like API like SBThread::GetStopDescription.
|
||||
%typemap(in) (char *dst_or_null, size_t dst_len) {
|
||||
if (!PyInt_Check($input)) {
|
||||
PyErr_SetString(PyExc_ValueError, "Expecting an integer");
|
||||
return NULL;
|
||||
}
|
||||
$2 = PyInt_AsLong($input);
|
||||
if ($2 <= 0) {
|
||||
PyErr_SetString(PyExc_ValueError, "Positive integer expected");
|
||||
return NULL;
|
||||
}
|
||||
$1 = (char *) malloc($2);
|
||||
}
|
||||
%typemap(argout) (char *dst_or_null, size_t dst_len) {
|
||||
Py_XDECREF($result); /* Blow away any previous result */
|
||||
llvm::StringRef ref($1);
|
||||
PythonString string(ref);
|
||||
$result = string.release();
|
||||
free($1);
|
||||
}
|
||||
|
||||
|
||||
// typemap for an outgoing buffer
|
||||
// See also SBEvent::SBEvent(uint32_t event, const char *cstr, uint32_t cstr_len).
|
||||
// Ditto for SBProcess::PutSTDIN(const char *src, size_t src_len).
|
||||
%typemap(in) (const char *cstr, uint32_t cstr_len),
|
||||
(const char *src, size_t src_len) {
|
||||
if (PythonString::Check($input)) {
|
||||
PythonString str(PyRefType::Borrowed, $input);
|
||||
$1 = (char*)str.GetString().data();
|
||||
$2 = str.GetSize();
|
||||
}
|
||||
else if(PythonByteArray::Check($input)) {
|
||||
PythonByteArray bytearray(PyRefType::Borrowed, $input);
|
||||
$1 = (char*)bytearray.GetBytes().data();
|
||||
$2 = bytearray.GetSize();
|
||||
}
|
||||
else if (PythonBytes::Check($input)) {
|
||||
PythonBytes bytes(PyRefType::Borrowed, $input);
|
||||
$1 = (char*)bytes.GetBytes().data();
|
||||
$2 = bytes.GetSize();
|
||||
}
|
||||
else {
|
||||
PyErr_SetString(PyExc_ValueError, "Expecting a string");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
// For SBProcess::WriteMemory, SBTarget::GetInstructions and SBDebugger::DispatchInput.
|
||||
%typemap(in) (const void *buf, size_t size),
|
||||
(const void *data, size_t data_len) {
|
||||
if (PythonString::Check($input)) {
|
||||
PythonString str(PyRefType::Borrowed, $input);
|
||||
$1 = (void*)str.GetString().data();
|
||||
$2 = str.GetSize();
|
||||
}
|
||||
else if(PythonByteArray::Check($input)) {
|
||||
PythonByteArray bytearray(PyRefType::Borrowed, $input);
|
||||
$1 = (void*)bytearray.GetBytes().data();
|
||||
$2 = bytearray.GetSize();
|
||||
}
|
||||
else if (PythonBytes::Check($input)) {
|
||||
PythonBytes bytes(PyRefType::Borrowed, $input);
|
||||
$1 = (void*)bytes.GetBytes().data();
|
||||
$2 = bytes.GetSize();
|
||||
}
|
||||
else {
|
||||
PyErr_SetString(PyExc_ValueError, "Expecting a buffer");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
// typemap for an incoming buffer
|
||||
// See also SBProcess::ReadMemory.
|
||||
%typemap(in) (void *buf, size_t size) {
|
||||
if (PyInt_Check($input)) {
|
||||
$2 = PyInt_AsLong($input);
|
||||
} else if (PyLong_Check($input)) {
|
||||
$2 = PyLong_AsLong($input);
|
||||
} else {
|
||||
PyErr_SetString(PyExc_ValueError, "Expecting an integer or long object");
|
||||
return NULL;
|
||||
}
|
||||
if ($2 <= 0) {
|
||||
PyErr_SetString(PyExc_ValueError, "Positive integer expected");
|
||||
return NULL;
|
||||
}
|
||||
$1 = (void *) malloc($2);
|
||||
}
|
||||
|
||||
// Return the buffer. Discarding any previous return result
|
||||
// See also SBProcess::ReadMemory.
|
||||
%typemap(argout) (void *buf, size_t size) {
|
||||
Py_XDECREF($result); /* Blow away any previous result */
|
||||
if (result == 0) {
|
||||
$result = Py_None;
|
||||
Py_INCREF($result);
|
||||
} else {
|
||||
PythonBytes bytes(static_cast<const uint8_t*>($1), result);
|
||||
$result = bytes.release();
|
||||
}
|
||||
free($1);
|
||||
}
|
||||
|
||||
%{
|
||||
namespace {
|
||||
template <class T>
|
||||
T PyLongAsT(PyObject *obj) {
|
||||
static_assert(true, "unsupported type");
|
||||
}
|
||||
|
||||
template <> uint64_t PyLongAsT<uint64_t>(PyObject *obj) {
|
||||
return static_cast<uint64_t>(PyLong_AsUnsignedLongLong(obj));
|
||||
}
|
||||
|
||||
template <> uint32_t PyLongAsT<uint32_t>(PyObject *obj) {
|
||||
return static_cast<uint32_t>(PyLong_AsUnsignedLong(obj));
|
||||
}
|
||||
|
||||
template <> int64_t PyLongAsT<int64_t>(PyObject *obj) {
|
||||
return static_cast<int64_t>(PyLong_AsLongLong(obj));
|
||||
}
|
||||
|
||||
template <> int32_t PyLongAsT<int32_t>(PyObject *obj) {
|
||||
return static_cast<int32_t>(PyLong_AsLong(obj));
|
||||
}
|
||||
|
||||
template <class T>
|
||||
bool SetNumberFromPyObject(T &number, PyObject *obj) {
|
||||
if (PyInt_Check(obj))
|
||||
number = static_cast<T>(PyInt_AsLong(obj));
|
||||
else if (PyLong_Check(obj))
|
||||
number = PyLongAsT<T>(obj);
|
||||
else return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template <>
|
||||
bool SetNumberFromPyObject<double>(double &number, PyObject *obj) {
|
||||
if (PyFloat_Check(obj)) {
|
||||
number = PyFloat_AsDouble(obj);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
%}
|
||||
|
||||
// these typemaps allow Python users to pass list objects
|
||||
// and have them turn into C++ arrays (this is useful, for instance
|
||||
// when creating SBData objects from lists of numbers)
|
||||
%typemap(in) (uint64_t* array, size_t array_len),
|
||||
(uint32_t* array, size_t array_len),
|
||||
(int64_t* array, size_t array_len),
|
||||
(int32_t* array, size_t array_len),
|
||||
(double* array, size_t array_len) {
|
||||
/* Check if is a list */
|
||||
if (PyList_Check($input)) {
|
||||
int size = PyList_Size($input);
|
||||
int i = 0;
|
||||
$2 = size;
|
||||
$1 = ($1_type) malloc(size * sizeof($*1_type));
|
||||
for (i = 0; i < size; i++) {
|
||||
PyObject *o = PyList_GetItem($input,i);
|
||||
if (!SetNumberFromPyObject($1[i], o)) {
|
||||
PyErr_SetString(PyExc_TypeError,"list must contain numbers");
|
||||
free($1);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (PyErr_Occurred()) {
|
||||
free($1);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
} else if ($input == Py_None) {
|
||||
$1 = NULL;
|
||||
$2 = 0;
|
||||
} else {
|
||||
PyErr_SetString(PyExc_TypeError,"not a list");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
%typemap(freearg) (uint64_t* array, size_t array_len),
|
||||
(uint32_t* array, size_t array_len),
|
||||
(int64_t* array, size_t array_len),
|
||||
(int32_t* array, size_t array_len),
|
||||
(double* array, size_t array_len) {
|
||||
free($1);
|
||||
}
|
||||
|
||||
// these typemaps wrap SBModule::GetVersion() from requiring a memory buffer
|
||||
// to the more Pythonic style where a list is returned and no previous allocation
|
||||
// is necessary - this will break if more than 50 versions are ever returned
|
||||
%typemap(typecheck) (uint32_t *versions, uint32_t num_versions) {
|
||||
$1 = ($input == Py_None ? 1 : 0);
|
||||
}
|
||||
|
||||
%typemap(in, numinputs=0) (uint32_t *versions) {
|
||||
$1 = (uint32_t*)malloc(sizeof(uint32_t) * 50);
|
||||
}
|
||||
|
||||
%typemap(in, numinputs=0) (uint32_t num_versions) {
|
||||
$1 = 50;
|
||||
}
|
||||
|
||||
%typemap(argout) (uint32_t *versions, uint32_t num_versions) {
|
||||
uint32_t count = result;
|
||||
if (count >= $2)
|
||||
count = $2;
|
||||
PyObject* list = PyList_New(count);
|
||||
for (uint32_t j = 0; j < count; j++)
|
||||
{
|
||||
PyObject* item = PyInt_FromLong($1[j]);
|
||||
int ok = PyList_SetItem(list,j,item);
|
||||
if (ok != 0)
|
||||
{
|
||||
$result = Py_None;
|
||||
break;
|
||||
}
|
||||
}
|
||||
$result = list;
|
||||
}
|
||||
|
||||
%typemap(freearg) (uint32_t *versions) {
|
||||
free($1);
|
||||
}
|
||||
|
||||
|
||||
// For Log::LogOutputCallback
|
||||
%typemap(in) (lldb::LogOutputCallback log_callback, void *baton) {
|
||||
if (!($input == Py_None || PyCallable_Check(reinterpret_cast<PyObject*>($input)))) {
|
||||
PyErr_SetString(PyExc_TypeError, "Need a callable object or None!");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// FIXME (filcab): We can't currently check if our callback is already
|
||||
// LLDBSwigPythonCallPythonLogOutputCallback (to DECREF the previous
|
||||
// baton) nor can we just remove all traces of a callback, if we want to
|
||||
// revert to a file logging mechanism.
|
||||
|
||||
// Don't lose the callback reference
|
||||
Py_INCREF($input);
|
||||
$1 = LLDBSwigPythonCallPythonLogOutputCallback;
|
||||
$2 = $input;
|
||||
}
|
||||
|
||||
%typemap(typecheck) (lldb::LogOutputCallback log_callback, void *baton) {
|
||||
$1 = $input == Py_None;
|
||||
$1 = $1 || PyCallable_Check(reinterpret_cast<PyObject*>($input));
|
||||
}
|
||||
|
||||
|
||||
%typemap(in) lldb::FileSP {
|
||||
PythonFile py_file(PyRefType::Borrowed, $input);
|
||||
if (!py_file) {
|
||||
PyErr_SetString(PyExc_TypeError, "not a file");
|
||||
return nullptr;
|
||||
}
|
||||
auto sp = unwrapOrSetPythonException(py_file.ConvertToFile());
|
||||
if (!sp)
|
||||
return nullptr;
|
||||
$1 = sp;
|
||||
}
|
||||
|
||||
%typemap(in) lldb::FileSP FORCE_IO_METHODS {
|
||||
PythonFile py_file(PyRefType::Borrowed, $input);
|
||||
if (!py_file) {
|
||||
PyErr_SetString(PyExc_TypeError, "not a file");
|
||||
return nullptr;
|
||||
}
|
||||
auto sp = unwrapOrSetPythonException(py_file.ConvertToFileForcingUseOfScriptingIOMethods());
|
||||
if (!sp)
|
||||
return nullptr;
|
||||
$1 = sp;
|
||||
}
|
||||
|
||||
%typemap(in) lldb::FileSP BORROWED {
|
||||
PythonFile py_file(PyRefType::Borrowed, $input);
|
||||
if (!py_file) {
|
||||
PyErr_SetString(PyExc_TypeError, "not a file");
|
||||
return nullptr;
|
||||
}
|
||||
auto sp = unwrapOrSetPythonException(py_file.ConvertToFile(/*borrowed=*/true));
|
||||
if (!sp)
|
||||
return nullptr;
|
||||
$1 = sp;
|
||||
}
|
||||
|
||||
%typemap(in) lldb::FileSP BORROWED_FORCE_IO_METHODS {
|
||||
PythonFile py_file(PyRefType::Borrowed, $input);
|
||||
if (!py_file) {
|
||||
PyErr_SetString(PyExc_TypeError, "not a file");
|
||||
return nullptr;
|
||||
}
|
||||
auto sp = unwrapOrSetPythonException(py_file.ConvertToFileForcingUseOfScriptingIOMethods(/*borrowed=*/true));
|
||||
if (!sp)
|
||||
return nullptr;
|
||||
$1 = sp;
|
||||
}
|
||||
|
||||
%typecheck(SWIG_TYPECHECK_POINTER) lldb::FileSP {
|
||||
if (PythonFile::Check($input)) {
|
||||
$1 = 1;
|
||||
} else {
|
||||
PyErr_Clear();
|
||||
$1 = 0;
|
||||
}
|
||||
}
|
||||
|
||||
%typemap(out) lldb::FileSP {
|
||||
$result = nullptr;
|
||||
lldb::FileSP &sp = $1;
|
||||
if (sp) {
|
||||
PythonFile pyfile = unwrapOrSetPythonException(PythonFile::FromFile(*sp));
|
||||
if (!pyfile.IsValid())
|
||||
return nullptr;
|
||||
$result = pyfile.release();
|
||||
}
|
||||
if (!$result)
|
||||
{
|
||||
$result = Py_None;
|
||||
Py_INCREF(Py_None);
|
||||
}
|
||||
}
|
||||
|
||||
%typemap(in) (const char* string, int len) {
|
||||
if ($input == Py_None)
|
||||
{
|
||||
$1 = NULL;
|
||||
$2 = 0;
|
||||
}
|
||||
else if (PythonString::Check($input))
|
||||
{
|
||||
PythonString py_str(PyRefType::Borrowed, $input);
|
||||
llvm::StringRef str = py_str.GetString();
|
||||
$1 = const_cast<char*>(str.data());
|
||||
$2 = str.size();
|
||||
// In Python 2, if $input is a PyUnicode object then this
|
||||
// will trigger a Unicode -> String conversion, in which
|
||||
// case the `PythonString` will now own the PyString. Thus
|
||||
// if it goes out of scope, the data will be deleted. The
|
||||
// only way to avoid this is to leak the Python object in
|
||||
// that case. Note that if there was no conversion, then
|
||||
// releasing the string will not leak anything, since we
|
||||
// created this as a borrowed reference.
|
||||
py_str.release();
|
||||
}
|
||||
else
|
||||
{
|
||||
PyErr_SetString(PyExc_TypeError,"not a string-like object");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
// These two pybuffer macros are copied out of swig/Lib/python/pybuffer.i,
|
||||
// and fixed so they will not crash if PyObject_GetBuffer fails.
|
||||
// https://github.com/swig/swig/issues/1640
|
||||
|
||||
%define %pybuffer_mutable_binary(TYPEMAP, SIZE)
|
||||
%typemap(in) (TYPEMAP, SIZE) {
|
||||
int res; Py_ssize_t size = 0; void *buf = 0;
|
||||
Py_buffer view;
|
||||
res = PyObject_GetBuffer($input, &view, PyBUF_WRITABLE);
|
||||
if (res < 0) {
|
||||
PyErr_Clear();
|
||||
%argument_fail(res, "(TYPEMAP, SIZE)", $symname, $argnum);
|
||||
}
|
||||
size = view.len;
|
||||
buf = view.buf;
|
||||
PyBuffer_Release(&view);
|
||||
$1 = ($1_ltype) buf;
|
||||
$2 = ($2_ltype) (size/sizeof($*1_type));
|
||||
}
|
||||
%enddef
|
||||
|
||||
%define %pybuffer_binary(TYPEMAP, SIZE)
|
||||
%typemap(in) (TYPEMAP, SIZE) {
|
||||
int res; Py_ssize_t size = 0; const void *buf = 0;
|
||||
Py_buffer view;
|
||||
res = PyObject_GetBuffer($input, &view, PyBUF_CONTIG_RO);
|
||||
if (res < 0) {
|
||||
PyErr_Clear();
|
||||
%argument_fail(res, "(TYPEMAP, SIZE)", $symname, $argnum);
|
||||
}
|
||||
size = view.len;
|
||||
buf = view.buf;
|
||||
PyBuffer_Release(&view);
|
||||
$1 = ($1_ltype) buf;
|
||||
$2 = ($2_ltype) (size / sizeof($*1_type));
|
||||
}
|
||||
%enddef
|
||||
|
||||
%pybuffer_binary(const uint8_t *buf, size_t num_bytes);
|
||||
%pybuffer_mutable_binary(uint8_t *buf, size_t num_bytes);
|
1074
contrib/llvm-project/lldb/bindings/python/python-wrapper.swig
Normal file
1074
contrib/llvm-project/lldb/bindings/python/python-wrapper.swig
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user