Skip to content
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
13 changes: 13 additions & 0 deletions lldb/bindings/interface/SBDebuggerExtensions.i
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,17 @@ STRING_EXTENSION_OUTSIDE(SBDebugger)
lldb::FileSP GetErrorFileHandle() {
return self->GetErrorFile().GetFile();
}

#ifdef SWIGPYTHON
%pythoncode %{
class staticproperty:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

neat

def __init__(self, func):
self.func = func
def __get__(self, instance, owner):
return self.func()
@staticproperty
def version():
return SBDebugger.GetVersionString()
%}
#endif
}
8 changes: 8 additions & 0 deletions lldb/test/API/python_api/debugger/TestDebuggerAPI.py
Original file line number Diff line number Diff line change
Expand Up @@ -286,3 +286,11 @@ def remove_bar(dbg_id):
('remove bar ret', False), # remove_bar should fail, because it's already invoked and removed
('foo called', original_dbg_id), # foo should be called
])

def test_version(self):
instance_str = self.dbg.GetVersionString()
class_str = lldb.SBDebugger.GetVersionString()
property_str = lldb.SBDebugger.version

self.assertEqual(instance_str, class_str)
self.assertEqual(class_str, property_str)
Loading