Skip to content

Commit bac4691

Browse files
authored
Merge pull request #7571 from apple/jdevlieghere/cherrypick/sbplatformattach
Jdevlieghere/cherrypick/sbplatformattach
2 parents 2ab914d + 872660f commit bac4691

File tree

22 files changed

+911
-190
lines changed

22 files changed

+911
-190
lines changed

lldb/bindings/headers.swig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
#include "lldb/API/SBPlatform.h"
4747
#include "lldb/API/SBProcess.h"
4848
#include "lldb/API/SBProcessInfo.h"
49+
#include "lldb/API/SBProcessInfoList.h"
4950
#include "lldb/API/SBQueue.h"
5051
#include "lldb/API/SBQueueItem.h"
5152
#include "lldb/API/SBReproducer.h"
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
%extend lldb::SBProcessInfoList {
2+
#ifdef SWIGPYTHON
3+
%pythoncode%{
4+
def __len__(self):
5+
'''Return the number of process info in a lldb.SBProcessInfoListExtensions object.'''
6+
return self.GetSize()
7+
8+
def __iter__(self):
9+
'''Iterate over all the process info in a lldb.SBProcessInfoListExtensions object.'''
10+
return lldb_iter(self, 'GetSize', 'GetProcessInfoAtIndex')
11+
%}
12+
#endif
13+
}

lldb/bindings/interfaces.swig

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@
121121
%include "lldb/API/SBPlatform.h"
122122
%include "lldb/API/SBProcess.h"
123123
%include "lldb/API/SBProcessInfo.h"
124+
%include "lldb/API/SBProcessInfoList.h"
124125
%include "lldb/API/SBQueue.h"
125126
%include "lldb/API/SBQueueItem.h"
126127
%include "lldb/API/SBReproducer.h"
@@ -177,6 +178,7 @@
177178
%include "./interface/SBModuleExtensions.i"
178179
%include "./interface/SBModuleSpecExtensions.i"
179180
%include "./interface/SBProcessExtensions.i"
181+
%include "./interface/SBProcessInfoListExtensions.i"
180182
%include "./interface/SBScriptObjectExtensions.i"
181183
%include "./interface/SBSectionExtensions.i"
182184
%include "./interface/SBStreamExtensions.i"

lldb/bindings/python/static-binding/LLDBWrapPython.cpp

Lines changed: 523 additions & 189 deletions
Large diffs are not rendered by default.

lldb/bindings/python/static-binding/lldb.py

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8325,6 +8325,14 @@ def Launch(self, launch_info):
83258325
r"""Launch(SBPlatform self, SBLaunchInfo launch_info) -> SBError"""
83268326
return _lldb.SBPlatform_Launch(self, launch_info)
83278327

8328+
def Attach(self, attach_info, debugger, target, error):
8329+
r"""Attach(SBPlatform self, SBAttachInfo attach_info, SBDebugger debugger, SBTarget target, SBError error) -> SBProcess"""
8330+
return _lldb.SBPlatform_Attach(self, attach_info, debugger, target, error)
8331+
8332+
def GetAllProcesses(self, error):
8333+
r"""GetAllProcesses(SBPlatform self, SBError error) -> SBProcessInfoList"""
8334+
return _lldb.SBPlatform_GetAllProcesses(self, error)
8335+
83288336
def Kill(self, pid):
83298337
r"""Kill(SBPlatform self, lldb::pid_t const pid) -> SBError"""
83308338
return _lldb.SBPlatform_Kill(self, pid)
@@ -9085,6 +9093,43 @@ def GetTriple(self):
90859093

90869094
# Register SBProcessInfo in _lldb:
90879095
_lldb.SBProcessInfo_swigregister(SBProcessInfo)
9096+
class SBProcessInfoList(object):
9097+
r"""Proxy of C++ lldb::SBProcessInfoList class."""
9098+
9099+
thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
9100+
__repr__ = _swig_repr
9101+
__swig_destroy__ = _lldb.delete_SBProcessInfoList
9102+
9103+
def __init__(self, *args):
9104+
r"""
9105+
__init__(SBProcessInfoList self) -> SBProcessInfoList
9106+
__init__(SBProcessInfoList self, SBProcessInfoList rhs) -> SBProcessInfoList
9107+
"""
9108+
_lldb.SBProcessInfoList_swiginit(self, _lldb.new_SBProcessInfoList(*args))
9109+
9110+
def GetSize(self):
9111+
r"""GetSize(SBProcessInfoList self) -> uint32_t"""
9112+
return _lldb.SBProcessInfoList_GetSize(self)
9113+
9114+
def GetProcessInfoAtIndex(self, idx, info):
9115+
r"""GetProcessInfoAtIndex(SBProcessInfoList self, uint32_t idx, SBProcessInfo info) -> bool"""
9116+
return _lldb.SBProcessInfoList_GetProcessInfoAtIndex(self, idx, info)
9117+
9118+
def Clear(self):
9119+
r"""Clear(SBProcessInfoList self)"""
9120+
return _lldb.SBProcessInfoList_Clear(self)
9121+
9122+
def __len__(self):
9123+
'''Return the number of process info in a lldb.SBProcessInfoListExtensions object.'''
9124+
return self.GetSize()
9125+
9126+
def __iter__(self):
9127+
'''Iterate over all the process info in a lldb.SBProcessInfoListExtensions object.'''
9128+
return lldb_iter(self, 'GetSize', 'GetProcessInfoAtIndex')
9129+
9130+
9131+
# Register SBProcessInfoList in _lldb:
9132+
_lldb.SBProcessInfoList_swigregister(SBProcessInfoList)
90889133
class SBQueue(object):
90899134
r"""Represents a libdispatch queue in the process."""
90909135

lldb/include/lldb/API/LLDB.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
#include "lldb/API/SBPlatform.h"
5050
#include "lldb/API/SBProcess.h"
5151
#include "lldb/API/SBProcessInfo.h"
52+
#include "lldb/API/SBProcessInfoList.h"
5253
#include "lldb/API/SBQueue.h"
5354
#include "lldb/API/SBQueueItem.h"
5455
#include "lldb/API/SBReproducer.h"

lldb/include/lldb/API/SBAttachInfo.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,7 @@ class LLDB_API SBAttachInfo {
197197

198198
protected:
199199
friend class SBTarget;
200+
friend class SBPlatform;
200201

201202
friend class lldb_private::ScriptInterpreter;
202203

lldb/include/lldb/API/SBDebugger.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -483,6 +483,7 @@ class LLDB_API SBDebugger {
483483
friend class SBProcess;
484484
friend class SBSourceManager;
485485
friend class SBStructuredData;
486+
friend class SBPlatform;
486487
friend class SBTarget;
487488
friend class SBTrace;
488489

lldb/include/lldb/API/SBDefines.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ class LLDB_API SBModuleSpec;
8585
class LLDB_API SBModuleSpecList;
8686
class LLDB_API SBProcess;
8787
class LLDB_API SBProcessInfo;
88+
class LLDB_API SBProcessInfoList;
8889
class LLDB_API SBQueue;
8990
class LLDB_API SBQueueItem;
9091
class LLDB_API SBScriptObject;

lldb/include/lldb/API/SBPlatform.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,18 @@
1010
#define LLDB_API_SBPLATFORM_H
1111

1212
#include "lldb/API/SBDefines.h"
13+
#include "lldb/API/SBProcess.h"
14+
#include "lldb/API/SBProcessInfoList.h"
1315

1416
#include <functional>
1517

1618
struct PlatformConnectOptions;
1719
struct PlatformShellCommand;
20+
class ProcessInstanceInfoMatch;
1821

1922
namespace lldb {
2023

24+
class SBAttachInfo;
2125
class SBLaunchInfo;
2226

2327
class LLDB_API SBPlatformConnectOptions {
@@ -149,6 +153,11 @@ class LLDB_API SBPlatform {
149153

150154
SBError Launch(SBLaunchInfo &launch_info);
151155

156+
SBProcess Attach(SBAttachInfo &attach_info, const SBDebugger &debugger,
157+
SBTarget &target, SBError &error);
158+
159+
SBProcessInfoList GetAllProcesses(SBError &error);
160+
152161
SBError Kill(const lldb::pid_t pid);
153162

154163
SBError

0 commit comments

Comments
 (0)