Skip to content

Commit f1a0a3e

Browse files
authored
Merge pull request #546 from JDevlieghere/cherrypick/bindings
Cherrypick llvm.org binding changes
2 parents b0df6ff + 93743a2 commit f1a0a3e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

81 files changed

+761
-1144
lines changed

lldb/CMakeLists.txt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ if (LLDB_ENABLE_PYTHON)
5656
endif ()
5757

5858
if (LLDB_ENABLE_PYTHON OR LLDB_ENABLE_LUA)
59-
add_subdirectory(scripts)
59+
add_subdirectory(bindings)
6060
endif ()
6161

6262
# We need the headers generated by instrinsics_gen before we can compile
@@ -97,7 +97,7 @@ if(LLDB_INCLUDE_TESTS)
9797
endif()
9898

9999
if (LLDB_ENABLE_PYTHON)
100-
get_target_property(lldb_scripts_dir swig_wrapper BINARY_DIR)
100+
get_target_property(lldb_bindings_dir swig_wrapper BINARY_DIR)
101101

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

115115
if(NOT LLDB_USE_SYSTEM_SIX)
@@ -121,7 +121,7 @@ if (LLDB_ENABLE_PYTHON)
121121

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

127127
function(create_python_package pkg_dir)
@@ -131,7 +131,7 @@ if (LLDB_ENABLE_PYTHON)
131131
endif()
132132
if(NOT ARG_NOINIT)
133133
set(init_cmd COMMAND ${PYTHON_EXECUTABLE}
134-
"${LLDB_SOURCE_DIR}/scripts/Python/createPythonInit.py"
134+
"${LLDB_SOURCE_DIR}/bindings/python/createPythonInit.py"
135135
"${pkg_dir}" ${ARG_FILES})
136136
endif()
137137
add_custom_command(TARGET finish_swig POST_BUILD VERBATIM

lldb/scripts/CMakeLists.txt renamed to lldb/bindings/CMakeLists.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
file(GLOB SWIG_INTERFACES interface/*.i)
1+
file(GLOB SWIG_INTERFACES interfaces/*.i)
22
file(GLOB_RECURSE SWIG_SOURCES *.swig)
33
file(GLOB SWIG_HEADERS
44
${LLDB_SOURCE_DIR}/include/lldb/API/*.h
@@ -46,7 +46,7 @@ if (LLDB_ENABLE_PYTHON)
4646
-python
4747
-threads
4848
-o ${CMAKE_CURRENT_BINARY_DIR}/LLDBWrapPython.cpp
49-
${LLDB_SOURCE_DIR}/scripts/lldb.swig
49+
${LLDB_SOURCE_DIR}/bindings/python.swig
5050
VERBATIM
5151
COMMENT "Builds LLDB Python wrapper")
5252

@@ -67,7 +67,7 @@ if (LLDB_ENABLE_LUA)
6767
-lua
6868
-w503
6969
-o ${CMAKE_CURRENT_BINARY_DIR}/LLDBWrapLua.cpp
70-
${LLDB_SOURCE_DIR}/scripts/lldb_lua.swig
70+
${LLDB_SOURCE_DIR}/bindings/lua.swig
7171
VERBATIM
7272
COMMENT "Builds LLDB Lua wrapper")
7373

File renamed without changes.

lldb/scripts/interface/SBAddress.i renamed to lldb/bindings/interface/SBAddress.i

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,8 @@ public:
140140
lldb::SBLineEntry
141141
GetLineEntry ();
142142

143+
STRING_EXTENSION(SBAddress)
144+
143145
#ifdef SWIGPYTHON
144146
%pythoncode %{
145147
def __get_load_addr_property__ (self):

lldb/scripts/interface/SBBlock.i renamed to lldb/bindings/interface/SBBlock.i

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,8 @@ public:
100100
bool locals,
101101
bool statics);
102102

103+
STRING_EXTENSION(SBBlock)
104+
103105
#ifdef SWIGPYTHON
104106
%pythoncode %{
105107
def get_range_at_index(self, idx):

lldb/scripts/interface/SBBreakpoint.i renamed to lldb/bindings/interface/SBBreakpoint.i

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,8 @@ public:
249249
bool
250250
IsHardware ();
251251

252+
STRING_EXTENSION(SBBreakpoint)
253+
252254
#ifdef SWIGPYTHON
253255
%pythoncode %{
254256

lldb/scripts/interface/SBBreakpointLocation.i renamed to lldb/bindings/interface/SBBreakpointLocation.i

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,8 @@ public:
134134

135135
SBBreakpoint
136136
GetBreakpoint ();
137+
138+
STRING_EXTENSION_LEVEL(SBBreakpointLocation, lldb::eDescriptionLevelFull)
137139
};
138140

139141
} // namespace lldb

lldb/scripts/interface/SBBreakpointName.i renamed to lldb/bindings/interface/SBBreakpointName.i

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ public:
108108

109109
bool GetDescription(lldb::SBStream &description);
110110

111+
STRING_EXTENSION(SBBreakpointName)
111112
};
112113

113114
} // namespace lldb

lldb/scripts/interface/SBCommandReturnObject.i renamed to lldb/bindings/interface/SBCommandReturnObject.i

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,8 @@ public:
9696
void SetImmediateOutputFile(lldb::FileSP BORROWED);
9797
void SetImmediateErrorFile(lldb::FileSP BORROWED);
9898

99+
STRING_EXTENSION(SBCommandReturnObject)
100+
99101
%extend {
100102
// transfer_ownership does nothing, and is here for compatibility with
101103
// old scripts. Ownership is tracked by reference count in the ordinary way.

lldb/scripts/interface/SBCompileUnit.i renamed to lldb/bindings/interface/SBCompileUnit.i

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,8 @@ public:
116116
bool
117117
operator != (const lldb::SBCompileUnit &rhs) const;
118118

119+
STRING_EXTENSION(SBCompileUnit)
120+
119121
#ifdef SWIGPYTHON
120122
%pythoncode %{
121123
def __iter__(self):

lldb/scripts/interface/SBData.i renamed to lldb/bindings/interface/SBData.i

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,8 @@ public:
134134
bool
135135
SetDataFromDoubleArray (double* array, size_t array_len);
136136

137+
STRING_EXTENSION(SBData)
138+
137139
#ifdef SWIGPYTHON
138140
%pythoncode %{
139141

lldb/scripts/interface/SBDebugger.i renamed to lldb/bindings/interface/SBDebugger.i

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -479,6 +479,8 @@ public:
479479
lldb::SBTypeSynthetic
480480
GetSyntheticForType (lldb::SBTypeNameSpecifier);
481481

482+
STRING_EXTENSION(SBDebugger)
483+
482484
%feature("docstring",
483485
"Launch a command interpreter session. Commands are read from standard input or
484486
from the input handle specified for the debugger object. Output/errors are

lldb/scripts/interface/SBDeclaration.i renamed to lldb/bindings/interface/SBDeclaration.i

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ namespace lldb {
5353
bool
5454
operator != (const lldb::SBDeclaration &rhs) const;
5555

56+
STRING_EXTENSION(SBDeclaration)
57+
5658
#ifdef SWIGPYTHON
5759
%pythoncode %{
5860
file = property(GetFileSpec, None, doc='''A read only property that returns an lldb object that represents the file (lldb.SBFileSpec) for this line entry.''')

lldb/scripts/interface/SBError.i renamed to lldb/bindings/interface/SBError.i

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,8 @@ public:
105105
bool
106106
GetDescription (lldb::SBStream &description);
107107

108+
STRING_EXTENSION(SBError)
109+
108110
#ifdef SWIGPYTHON
109111
%pythoncode %{
110112
value = property(GetError, None, doc='''A read only property that returns the same result as GetError().''')
File renamed without changes.
File renamed without changes.

lldb/scripts/interface/SBFileSpec.i renamed to lldb/bindings/interface/SBFileSpec.i

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,8 @@ public:
8080
void
8181
AppendPathComponent (const char *file_or_directory);
8282

83+
STRING_EXTENSION(SBFileSpec)
84+
8385
#ifdef SWIGPYTHON
8486
%pythoncode %{
8587
def __get_fullpath__(self):

lldb/scripts/interface/SBFrame.i renamed to lldb/bindings/interface/SBFrame.i

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,8 @@ public:
285285
bool
286286
GetDescription (lldb::SBStream &description);
287287

288+
STRING_EXTENSION(SBFrame)
289+
288290
#ifdef SWIGPYTHON
289291
%pythoncode %{
290292
def get_all_variables(self):

lldb/scripts/interface/SBFunction.i renamed to lldb/bindings/interface/SBFunction.i

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,8 @@ public:
111111
bool
112112
operator != (const lldb::SBFunction &rhs) const;
113113

114+
STRING_EXTENSION(SBFunction)
115+
114116
#ifdef SWIGPYTHON
115117
%pythoncode %{
116118
def get_instructions_from_current_target (self):

lldb/scripts/interface/SBInstruction.i renamed to lldb/bindings/interface/SBInstruction.i

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,8 @@ public:
7474
bool
7575
TestEmulation (lldb::SBStream &output_stream, const char *test_file);
7676

77+
STRING_EXTENSION(SBInstruction)
78+
7779
#ifdef SWIGPYTHON
7880
%pythoncode %{
7981
def __mnemonic_property__ (self):

lldb/scripts/interface/SBInstructionList.i renamed to lldb/bindings/interface/SBInstructionList.i

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,8 @@ public:
6666
bool
6767
DumpEmulationForAllInstructions (const char *triple);
6868

69+
STRING_EXTENSION(SBInstructionList)
70+
6971
#ifdef SWIGPYTHON
7072
%pythoncode %{
7173
def __iter__(self):

lldb/scripts/interface/SBLineEntry.i renamed to lldb/bindings/interface/SBLineEntry.i

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,8 @@ public:
8484
bool
8585
operator != (const lldb::SBLineEntry &rhs) const;
8686

87+
STRING_EXTENSION(SBLineEntry)
88+
8789
#ifdef SWIGPYTHON
8890
%pythoncode %{
8991
file = property(GetFileSpec, None, doc='''A read only property that returns an lldb object that represents the file (lldb.SBFileSpec) for this line entry.''')

lldb/scripts/interface/SBMemoryRegionInfo.i renamed to lldb/bindings/interface/SBMemoryRegionInfo.i

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ public:
5555
bool
5656
GetDescription (lldb::SBStream &description);
5757

58+
STRING_EXTENSION(SBMemoryRegionInfo)
5859
};
5960

6061
} // namespace lldb

lldb/scripts/interface/SBModule.i renamed to lldb/bindings/interface/SBModule.i

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -344,6 +344,8 @@ public:
344344
lldb::SBAddress
345345
GetObjectFileEntryPointAddress() const;
346346

347+
STRING_EXTENSION(SBModule)
348+
347349
#ifdef SWIGPYTHON
348350
%pythoncode %{
349351
def __len__(self):

lldb/scripts/interface/SBModuleSpec.i renamed to lldb/bindings/interface/SBModuleSpec.i

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ public:
9191
bool
9292
GetDescription (lldb::SBStream &description);
9393

94+
STRING_EXTENSION(SBModuleSpec)
9495
};
9596

9697

@@ -127,6 +128,7 @@ public:
127128
bool
128129
GetDescription (lldb::SBStream &description);
129130

131+
STRING_EXTENSION(SBModuleSpecList)
130132
};
131133

132134
} // namespace lldb

lldb/scripts/interface/SBProcess.i renamed to lldb/bindings/interface/SBProcess.i

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -417,6 +417,8 @@ public:
417417
lldb::SBProcessInfo
418418
GetProcessInfo();
419419

420+
STRING_EXTENSION(SBProcess)
421+
420422
#ifdef SWIGPYTHON
421423
%pythoncode %{
422424
def __get_is_alive__(self):
File renamed without changes.

lldb/scripts/interface/SBSection.i renamed to lldb/bindings/interface/SBSection.i

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,8 @@ public:
114114
bool
115115
operator != (const lldb::SBSection &rhs);
116116

117+
STRING_EXTENSION(SBSection)
118+
117119
#ifdef SWIGPYTHON
118120
%pythoncode %{
119121
def __iter__(self):

lldb/scripts/interface/SBSymbol.i renamed to lldb/bindings/interface/SBSymbol.i

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ public:
7272
bool
7373
operator != (const lldb::SBSymbol &rhs) const;
7474

75+
STRING_EXTENSION(SBSymbol)
76+
7577
#ifdef SWIGPYTHON
7678
%pythoncode %{
7779
def get_instructions_from_current_target (self):

lldb/scripts/interface/SBSymbolContext.i renamed to lldb/bindings/interface/SBSymbolContext.i

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ public:
8181
bool
8282
GetDescription (lldb::SBStream &description);
8383

84+
STRING_EXTENSION(SBSymbolContext)
8485

8586
#ifdef SWIGPYTHON
8687
%pythoncode %{

lldb/scripts/interface/SBSymbolContextList.i renamed to lldb/bindings/interface/SBSymbolContextList.i

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@ public:
6060
void
6161
Clear();
6262

63+
STRING_EXTENSION(SBSymbolContextList)
64+
6365
#ifdef SWIGPYTHON
6466
%pythoncode %{
6567
def __iter__(self):

lldb/scripts/interface/SBTarget.i renamed to lldb/bindings/interface/SBTarget.i

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88

99
namespace lldb {
1010

11-
1211
%feature("docstring",
1312
"Represents the target program running under the debugger.
1413
@@ -968,6 +967,8 @@ public:
968967
lldb::SBValue
969968
EvaluateExpression (const char *expr, const lldb::SBExpressionOptions &options);
970969

970+
STRING_EXTENSION_LEVEL(SBTarget, lldb::eDescriptionLevelBrief)
971+
971972
#ifdef SWIGPYTHON
972973
%pythoncode %{
973974
class modules_access(object):

lldb/scripts/interface/SBThread.i renamed to lldb/bindings/interface/SBThread.i

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -402,6 +402,8 @@ public:
402402
bool
403403
SafeToCallFunctions ();
404404

405+
STRING_EXTENSION(SBThread)
406+
405407
#ifdef SWIGPYTHON
406408
%pythoncode %{
407409
def __iter__(self):
File renamed without changes.

lldb/scripts/interface/SBType.i renamed to lldb/bindings/interface/SBType.i

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ public:
4343
uint32_t
4444
GetBitfieldSizeInBits();
4545

46+
STRING_EXTENSION_LEVEL(SBTypeMember, lldb::eDescriptionLevelBrief)
47+
4648
#ifdef SWIGPYTHON
4749
%pythoncode %{
4850
name = property(GetName, None, doc='''A read only property that returns the name for this member as a string.''')
@@ -100,6 +102,7 @@ public:
100102
GetDescription (lldb::SBStream &description,
101103
lldb::DescriptionLevel description_level);
102104

105+
STRING_EXTENSION_LEVEL(SBTypeMemberFunction, lldb::eDescriptionLevelBrief)
103106
protected:
104107
lldb::TypeMemberFunctionImplSP m_opaque_sp;
105108
};
@@ -314,6 +317,8 @@ public:
314317

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

320+
STRING_EXTENSION_LEVEL(SBType, lldb::eDescriptionLevelBrief)
321+
317322
#ifdef SWIGPYTHON
318323
%pythoncode %{
319324
def template_arg_array(self):

lldb/scripts/interface/SBTypeCategory.i renamed to lldb/bindings/interface/SBTypeCategory.i

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,8 @@ namespace lldb {
124124
bool
125125
DeleteTypeSynthetic (lldb::SBTypeNameSpecifier);
126126

127+
STRING_EXTENSION_LEVEL(SBTypeCategory, lldb::eDescriptionLevelBrief)
128+
127129
#ifdef SWIGPYTHON
128130
%pythoncode %{
129131

lldb/scripts/interface/SBTypeEnumMember.i renamed to lldb/bindings/interface/SBTypeEnumMember.i

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ public:
4343
GetDescription (lldb::SBStream &description,
4444
lldb::DescriptionLevel description_level);
4545

46+
STRING_EXTENSION_LEVEL(SBTypeEnumMember, lldb::eDescriptionLevelBrief)
4647
#ifdef SWIGPYTHON
4748
%pythoncode %{
4849
name = property(GetName, None, doc='''A read only property that returns the name for this enum member as a string.''')

lldb/scripts/interface/SBTypeFilter.i renamed to lldb/bindings/interface/SBTypeFilter.i

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@ namespace lldb {
6161
bool
6262
operator != (lldb::SBTypeFilter &rhs);
6363

64+
STRING_EXTENSION_LEVEL(SBTypeFilter, lldb::eDescriptionLevelBrief)
65+
6466
#ifdef SWIGPYTHON
6567
%pythoncode %{
6668
options = property(GetOptions, SetOptions)

lldb/scripts/interface/SBTypeFormat.i renamed to lldb/bindings/interface/SBTypeFormat.i

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@ namespace lldb {
6161
bool
6262
operator != (lldb::SBTypeFormat &rhs);
6363

64+
STRING_EXTENSION_LEVEL(SBTypeFormat, lldb::eDescriptionLevelBrief)
65+
6466
#ifdef SWIGPYTHON
6567
%pythoncode %{
6668
format = property(GetFormat, SetFormat)

lldb/scripts/interface/SBTypeNameSpecifier.i renamed to lldb/bindings/interface/SBTypeNameSpecifier.i

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ namespace lldb {
5353
bool
5454
operator != (lldb::SBTypeNameSpecifier &rhs);
5555

56+
STRING_EXTENSION_LEVEL(SBTypeNameSpecifier, lldb::eDescriptionLevelBrief)
57+
5658
#ifdef SWIGPYTHON
5759
%pythoncode %{
5860
name = property(GetName)

0 commit comments

Comments
 (0)