Skip to content

Cherrypick llvm.org binding changes #546

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Jan 9, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions lldb/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ if (LLDB_ENABLE_PYTHON)
endif ()

if (LLDB_ENABLE_PYTHON OR LLDB_ENABLE_LUA)
add_subdirectory(scripts)
add_subdirectory(bindings)
endif ()

# We need the headers generated by instrinsics_gen before we can compile
Expand Down Expand Up @@ -97,7 +97,7 @@ if(LLDB_INCLUDE_TESTS)
endif()

if (LLDB_ENABLE_PYTHON)
get_target_property(lldb_scripts_dir swig_wrapper BINARY_DIR)
get_target_property(lldb_bindings_dir swig_wrapper BINARY_DIR)

if(LLDB_BUILD_FRAMEWORK)
set(lldb_python_build_path "${LLDB_FRAMEWORK_ABSOLUTE_BUILD_DIR}/LLDB.framework/Resources/Python/lldb")
Expand All @@ -109,7 +109,7 @@ if (LLDB_ENABLE_PYTHON)
# to liblldb.so for the Python API(hardlink on Windows).
add_custom_target(finish_swig ALL VERBATIM
COMMAND ${CMAKE_COMMAND} -E make_directory ${lldb_python_build_path}
DEPENDS ${lldb_scripts_dir}/lldb.py
DEPENDS ${lldb_bindings_dir}/lldb.py
COMMENT "Python script sym-linking LLDB Python API")

if(NOT LLDB_USE_SYSTEM_SIX)
Expand All @@ -121,7 +121,7 @@ if (LLDB_ENABLE_PYTHON)

add_custom_command(TARGET finish_swig POST_BUILD VERBATIM
COMMAND ${CMAKE_COMMAND} -E copy
"${lldb_scripts_dir}/lldb.py"
"${lldb_bindings_dir}/lldb.py"
"${lldb_python_build_path}/__init__.py")

function(create_python_package pkg_dir)
Expand All @@ -131,7 +131,7 @@ if (LLDB_ENABLE_PYTHON)
endif()
if(NOT ARG_NOINIT)
set(init_cmd COMMAND ${PYTHON_EXECUTABLE}
"${LLDB_SOURCE_DIR}/scripts/Python/createPythonInit.py"
"${LLDB_SOURCE_DIR}/bindings/python/createPythonInit.py"
"${pkg_dir}" ${ARG_FILES})
endif()
add_custom_command(TARGET finish_swig POST_BUILD VERBATIM
Expand Down
6 changes: 3 additions & 3 deletions lldb/scripts/CMakeLists.txt → lldb/bindings/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
file(GLOB SWIG_INTERFACES interface/*.i)
file(GLOB SWIG_INTERFACES interfaces/*.i)
file(GLOB_RECURSE SWIG_SOURCES *.swig)
file(GLOB SWIG_HEADERS
${LLDB_SOURCE_DIR}/include/lldb/API/*.h
Expand Down Expand Up @@ -46,7 +46,7 @@ if (LLDB_ENABLE_PYTHON)
-python
-threads
-o ${CMAKE_CURRENT_BINARY_DIR}/LLDBWrapPython.cpp
${LLDB_SOURCE_DIR}/scripts/lldb.swig
${LLDB_SOURCE_DIR}/bindings/python.swig
VERBATIM
COMMENT "Builds LLDB Python wrapper")

Expand All @@ -67,7 +67,7 @@ if (LLDB_ENABLE_LUA)
-lua
-w503
-o ${CMAKE_CURRENT_BINARY_DIR}/LLDBWrapLua.cpp
${LLDB_SOURCE_DIR}/scripts/lldb_lua.swig
${LLDB_SOURCE_DIR}/bindings/lua.swig
VERBATIM
COMMENT "Builds LLDB Lua wrapper")

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,8 @@ public:
lldb::SBLineEntry
GetLineEntry ();

STRING_EXTENSION(SBAddress)

#ifdef SWIGPYTHON
%pythoncode %{
def __get_load_addr_property__ (self):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@ public:
bool locals,
bool statics);

STRING_EXTENSION(SBBlock)

#ifdef SWIGPYTHON
%pythoncode %{
def get_range_at_index(self, idx):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,8 @@ public:
bool
IsHardware ();

STRING_EXTENSION(SBBreakpoint)

#ifdef SWIGPYTHON
%pythoncode %{

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,8 @@ public:

SBBreakpoint
GetBreakpoint ();

STRING_EXTENSION_LEVEL(SBBreakpointLocation, lldb::eDescriptionLevelFull)
};

} // namespace lldb
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ public:

bool GetDescription(lldb::SBStream &description);

STRING_EXTENSION(SBBreakpointName)
};

} // namespace lldb
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@ public:
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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,8 @@ public:
bool
operator != (const lldb::SBCompileUnit &rhs) const;

STRING_EXTENSION(SBCompileUnit)

#ifdef SWIGPYTHON
%pythoncode %{
def __iter__(self):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,8 @@ public:
bool
SetDataFromDoubleArray (double* array, size_t array_len);

STRING_EXTENSION(SBData)

#ifdef SWIGPYTHON
%pythoncode %{

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -479,6 +479,8 @@ public:
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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ namespace lldb {
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.''')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,8 @@ public:
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().''')
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ public:
void
AppendPathComponent (const char *file_or_directory);

STRING_EXTENSION(SBFileSpec)

#ifdef SWIGPYTHON
%pythoncode %{
def __get_fullpath__(self):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,8 @@ public:
bool
GetDescription (lldb::SBStream &description);

STRING_EXTENSION(SBFrame)

#ifdef SWIGPYTHON
%pythoncode %{
def get_all_variables(self):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,8 @@ public:
bool
operator != (const lldb::SBFunction &rhs) const;

STRING_EXTENSION(SBFunction)

#ifdef SWIGPYTHON
%pythoncode %{
def get_instructions_from_current_target (self):
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ public:
bool
TestEmulation (lldb::SBStream &output_stream, const char *test_file);

STRING_EXTENSION(SBInstruction)

#ifdef SWIGPYTHON
%pythoncode %{
def __mnemonic_property__ (self):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ public:
bool
DumpEmulationForAllInstructions (const char *triple);

STRING_EXTENSION(SBInstructionList)

#ifdef SWIGPYTHON
%pythoncode %{
def __iter__(self):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ public:
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.''')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ public:
bool
GetDescription (lldb::SBStream &description);

STRING_EXTENSION(SBMemoryRegionInfo)
};

} // namespace lldb
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,8 @@ public:
lldb::SBAddress
GetObjectFileEntryPointAddress() const;

STRING_EXTENSION(SBModule)

#ifdef SWIGPYTHON
%pythoncode %{
def __len__(self):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ public:
bool
GetDescription (lldb::SBStream &description);

STRING_EXTENSION(SBModuleSpec)
};


Expand Down Expand Up @@ -127,6 +128,7 @@ public:
bool
GetDescription (lldb::SBStream &description);

STRING_EXTENSION(SBModuleSpecList)
};

} // namespace lldb
Original file line number Diff line number Diff line change
Expand Up @@ -417,6 +417,8 @@ public:
lldb::SBProcessInfo
GetProcessInfo();

STRING_EXTENSION(SBProcess)

#ifdef SWIGPYTHON
%pythoncode %{
def __get_is_alive__(self):
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,8 @@ public:
bool
operator != (const lldb::SBSection &rhs);

STRING_EXTENSION(SBSection)

#ifdef SWIGPYTHON
%pythoncode %{
def __iter__(self):
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ public:
bool
operator != (const lldb::SBSymbol &rhs) const;

STRING_EXTENSION(SBSymbol)

#ifdef SWIGPYTHON
%pythoncode %{
def get_instructions_from_current_target (self):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ public:
bool
GetDescription (lldb::SBStream &description);

STRING_EXTENSION(SBSymbolContext)

#ifdef SWIGPYTHON
%pythoncode %{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ public:
void
Clear();

STRING_EXTENSION(SBSymbolContextList)

#ifdef SWIGPYTHON
%pythoncode %{
def __iter__(self):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

namespace lldb {


%feature("docstring",
"Represents the target program running under the debugger.

Expand Down Expand Up @@ -968,6 +967,8 @@ public:
lldb::SBValue
EvaluateExpression (const char *expr, const lldb::SBExpressionOptions &options);

STRING_EXTENSION_LEVEL(SBTarget, lldb::eDescriptionLevelBrief)

#ifdef SWIGPYTHON
%pythoncode %{
class modules_access(object):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -402,6 +402,8 @@ public:
bool
SafeToCallFunctions ();

STRING_EXTENSION(SBThread)

#ifdef SWIGPYTHON
%pythoncode %{
def __iter__(self):
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ public:
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.''')
Expand Down Expand Up @@ -100,6 +102,7 @@ public:
GetDescription (lldb::SBStream &description,
lldb::DescriptionLevel description_level);

STRING_EXTENSION_LEVEL(SBTypeMemberFunction, lldb::eDescriptionLevelBrief)
protected:
lldb::TypeMemberFunctionImplSP m_opaque_sp;
};
Expand Down Expand Up @@ -314,6 +317,8 @@ public:

bool operator!=(lldb::SBType &rhs);

STRING_EXTENSION_LEVEL(SBType, lldb::eDescriptionLevelBrief)

#ifdef SWIGPYTHON
%pythoncode %{
def template_arg_array(self):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,8 @@ namespace lldb {
bool
DeleteTypeSynthetic (lldb::SBTypeNameSpecifier);

STRING_EXTENSION_LEVEL(SBTypeCategory, lldb::eDescriptionLevelBrief)

#ifdef SWIGPYTHON
%pythoncode %{

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ public:
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.''')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ namespace lldb {
bool
operator != (lldb::SBTypeFilter &rhs);

STRING_EXTENSION_LEVEL(SBTypeFilter, lldb::eDescriptionLevelBrief)

#ifdef SWIGPYTHON
%pythoncode %{
options = property(GetOptions, SetOptions)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ namespace lldb {
bool
operator != (lldb::SBTypeFormat &rhs);

STRING_EXTENSION_LEVEL(SBTypeFormat, lldb::eDescriptionLevelBrief)

#ifdef SWIGPYTHON
%pythoncode %{
format = property(GetFormat, SetFormat)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ namespace lldb {
bool
operator != (lldb::SBTypeNameSpecifier &rhs);

STRING_EXTENSION_LEVEL(SBTypeNameSpecifier, lldb::eDescriptionLevelBrief)

#ifdef SWIGPYTHON
%pythoncode %{
name = property(GetName)
Expand Down
Loading