svn commit: r359575 - in vendor/llvm-project/release-10.x/lldb/bindings: . interface lua python

Dimitry Andric dim at FreeBSD.org
Thu Apr 2 20:01:02 UTC 2020


Author: dim
Date: Thu Apr  2 19:52:43 2020
New Revision: 359575
URL: https://svnweb.freebsd.org/changeset/base/359575

Log:
  Add lldb/bindings to vendor area, since emaste is going to add support
  for lldb's lua bindings.

Added:
  vendor/llvm-project/release-10.x/lldb/bindings/
  vendor/llvm-project/release-10.x/lldb/bindings/headers.swig
  vendor/llvm-project/release-10.x/lldb/bindings/interface/
  vendor/llvm-project/release-10.x/lldb/bindings/interface/SBAddress.i
  vendor/llvm-project/release-10.x/lldb/bindings/interface/SBAttachInfo.i
  vendor/llvm-project/release-10.x/lldb/bindings/interface/SBBlock.i
  vendor/llvm-project/release-10.x/lldb/bindings/interface/SBBreakpoint.i
  vendor/llvm-project/release-10.x/lldb/bindings/interface/SBBreakpointLocation.i
  vendor/llvm-project/release-10.x/lldb/bindings/interface/SBBreakpointName.i
  vendor/llvm-project/release-10.x/lldb/bindings/interface/SBBroadcaster.i
  vendor/llvm-project/release-10.x/lldb/bindings/interface/SBCommandInterpreter.i
  vendor/llvm-project/release-10.x/lldb/bindings/interface/SBCommandReturnObject.i
  vendor/llvm-project/release-10.x/lldb/bindings/interface/SBCommunication.i
  vendor/llvm-project/release-10.x/lldb/bindings/interface/SBCompileUnit.i
  vendor/llvm-project/release-10.x/lldb/bindings/interface/SBData.i
  vendor/llvm-project/release-10.x/lldb/bindings/interface/SBDebugger.i
  vendor/llvm-project/release-10.x/lldb/bindings/interface/SBDeclaration.i
  vendor/llvm-project/release-10.x/lldb/bindings/interface/SBError.i
  vendor/llvm-project/release-10.x/lldb/bindings/interface/SBEvent.i
  vendor/llvm-project/release-10.x/lldb/bindings/interface/SBExecutionContext.i
  vendor/llvm-project/release-10.x/lldb/bindings/interface/SBExpressionOptions.i
  vendor/llvm-project/release-10.x/lldb/bindings/interface/SBFile.i
  vendor/llvm-project/release-10.x/lldb/bindings/interface/SBFileSpec.i
  vendor/llvm-project/release-10.x/lldb/bindings/interface/SBFileSpecList.i
  vendor/llvm-project/release-10.x/lldb/bindings/interface/SBFrame.i
  vendor/llvm-project/release-10.x/lldb/bindings/interface/SBFunction.i
  vendor/llvm-project/release-10.x/lldb/bindings/interface/SBHostOS.i
  vendor/llvm-project/release-10.x/lldb/bindings/interface/SBInstruction.i
  vendor/llvm-project/release-10.x/lldb/bindings/interface/SBInstructionList.i
  vendor/llvm-project/release-10.x/lldb/bindings/interface/SBLanguageRuntime.i
  vendor/llvm-project/release-10.x/lldb/bindings/interface/SBLaunchInfo.i
  vendor/llvm-project/release-10.x/lldb/bindings/interface/SBLineEntry.i
  vendor/llvm-project/release-10.x/lldb/bindings/interface/SBListener.i
  vendor/llvm-project/release-10.x/lldb/bindings/interface/SBMemoryRegionInfo.i
  vendor/llvm-project/release-10.x/lldb/bindings/interface/SBMemoryRegionInfoList.i
  vendor/llvm-project/release-10.x/lldb/bindings/interface/SBModule.i
  vendor/llvm-project/release-10.x/lldb/bindings/interface/SBModuleSpec.i
  vendor/llvm-project/release-10.x/lldb/bindings/interface/SBPlatform.i
  vendor/llvm-project/release-10.x/lldb/bindings/interface/SBProcess.i
  vendor/llvm-project/release-10.x/lldb/bindings/interface/SBProcessInfo.i
  vendor/llvm-project/release-10.x/lldb/bindings/interface/SBQueue.i
  vendor/llvm-project/release-10.x/lldb/bindings/interface/SBQueueItem.i
  vendor/llvm-project/release-10.x/lldb/bindings/interface/SBSection.i
  vendor/llvm-project/release-10.x/lldb/bindings/interface/SBSourceManager.i
  vendor/llvm-project/release-10.x/lldb/bindings/interface/SBStream.i
  vendor/llvm-project/release-10.x/lldb/bindings/interface/SBStringList.i
  vendor/llvm-project/release-10.x/lldb/bindings/interface/SBStructuredData.i
  vendor/llvm-project/release-10.x/lldb/bindings/interface/SBSymbol.i
  vendor/llvm-project/release-10.x/lldb/bindings/interface/SBSymbolContext.i
  vendor/llvm-project/release-10.x/lldb/bindings/interface/SBSymbolContextList.i
  vendor/llvm-project/release-10.x/lldb/bindings/interface/SBTarget.i
  vendor/llvm-project/release-10.x/lldb/bindings/interface/SBThread.i
  vendor/llvm-project/release-10.x/lldb/bindings/interface/SBThreadCollection.i
  vendor/llvm-project/release-10.x/lldb/bindings/interface/SBThreadPlan.i
  vendor/llvm-project/release-10.x/lldb/bindings/interface/SBTrace.i
  vendor/llvm-project/release-10.x/lldb/bindings/interface/SBTraceOptions.i
  vendor/llvm-project/release-10.x/lldb/bindings/interface/SBType.i
  vendor/llvm-project/release-10.x/lldb/bindings/interface/SBTypeCategory.i
  vendor/llvm-project/release-10.x/lldb/bindings/interface/SBTypeEnumMember.i
  vendor/llvm-project/release-10.x/lldb/bindings/interface/SBTypeFilter.i
  vendor/llvm-project/release-10.x/lldb/bindings/interface/SBTypeFormat.i
  vendor/llvm-project/release-10.x/lldb/bindings/interface/SBTypeNameSpecifier.i
  vendor/llvm-project/release-10.x/lldb/bindings/interface/SBTypeSummary.i
  vendor/llvm-project/release-10.x/lldb/bindings/interface/SBTypeSynthetic.i
  vendor/llvm-project/release-10.x/lldb/bindings/interface/SBUnixSignals.i
  vendor/llvm-project/release-10.x/lldb/bindings/interface/SBValue.i
  vendor/llvm-project/release-10.x/lldb/bindings/interface/SBValueList.i
  vendor/llvm-project/release-10.x/lldb/bindings/interface/SBVariablesOptions.i
  vendor/llvm-project/release-10.x/lldb/bindings/interface/SBWatchpoint.i
  vendor/llvm-project/release-10.x/lldb/bindings/interfaces.swig
  vendor/llvm-project/release-10.x/lldb/bindings/lua/
  vendor/llvm-project/release-10.x/lldb/bindings/lua.swig
  vendor/llvm-project/release-10.x/lldb/bindings/lua/lua-typemaps.swig
  vendor/llvm-project/release-10.x/lldb/bindings/macros.swig
  vendor/llvm-project/release-10.x/lldb/bindings/python/
  vendor/llvm-project/release-10.x/lldb/bindings/python.swig
  vendor/llvm-project/release-10.x/lldb/bindings/python/createPythonInit.py   (contents, props changed)
  vendor/llvm-project/release-10.x/lldb/bindings/python/python-extensions.swig
  vendor/llvm-project/release-10.x/lldb/bindings/python/python-swigsafecast.swig
  vendor/llvm-project/release-10.x/lldb/bindings/python/python-typemaps.swig
  vendor/llvm-project/release-10.x/lldb/bindings/python/python-wrapper.swig

Added: vendor/llvm-project/release-10.x/lldb/bindings/headers.swig
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ vendor/llvm-project/release-10.x/lldb/bindings/headers.swig	Thu Apr  2 19:52:43 2020	(r359575)
@@ -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"
+%}

Added: vendor/llvm-project/release-10.x/lldb/bindings/interface/SBAddress.i
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ vendor/llvm-project/release-10.x/lldb/bindings/interface/SBAddress.i	Thu Apr  2 19:52:43 2020	(r359575)
@@ -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

Added: vendor/llvm-project/release-10.x/lldb/bindings/interface/SBAttachInfo.i
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ vendor/llvm-project/release-10.x/lldb/bindings/interface/SBAttachInfo.i	Thu Apr  2 19:52:43 2020	(r359575)
@@ -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

Added: vendor/llvm-project/release-10.x/lldb/bindings/interface/SBBlock.i
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ vendor/llvm-project/release-10.x/lldb/bindings/interface/SBBlock.i	Thu Apr  2 19:52:43 2020	(r359575)
@@ -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

Added: vendor/llvm-project/release-10.x/lldb/bindings/interface/SBBreakpoint.i
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ vendor/llvm-project/release-10.x/lldb/bindings/interface/SBBreakpoint.i	Thu Apr  2 19:52:43 2020	(r359575)
@@ -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

Added: vendor/llvm-project/release-10.x/lldb/bindings/interface/SBBreakpointLocation.i
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ vendor/llvm-project/release-10.x/lldb/bindings/interface/SBBreakpointLocation.i	Thu Apr  2 19:52:43 2020	(r359575)
@@ -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 ();

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***


More information about the svn-src-all mailing list