[Lldb-commits] [lldb] f6eb89c - [lldb][Windows] Fixed Host::Kill() (#99721)

2024-07-21 Thread via lldb-commits

Author: Dmitry Vasilyev
Date: 2024-07-21T15:59:41+04:00
New Revision: f6eb89cdd02d73a3c9a0da858c3100986282aceb

URL: 
https://github.com/llvm/llvm-project/commit/f6eb89cdd02d73a3c9a0da858c3100986282aceb
DIFF: 
https://github.com/llvm/llvm-project/commit/f6eb89cdd02d73a3c9a0da858c3100986282aceb.diff

LOG: [lldb][Windows] Fixed Host::Kill() (#99721)

HostProcessWindows::Terminate() correctly uses m_process which type is
process_t (HANDLE) to call ::TerminateProcess(). But Host::Kill() uses a
cast from pid, which is wrong.

This patch fixes #51793

Added: 


Modified: 
lldb/source/Host/windows/Host.cpp
lldb/test/API/functionalities/gdb_remote_client/TestPlatformKill.py

Removed: 




diff  --git a/lldb/source/Host/windows/Host.cpp 
b/lldb/source/Host/windows/Host.cpp
index 6908f0003eaf7..642092f61d924 100644
--- a/lldb/source/Host/windows/Host.cpp
+++ b/lldb/source/Host/windows/Host.cpp
@@ -103,7 +103,9 @@ lldb::thread_t Host::GetCurrentThread() {
 }
 
 void Host::Kill(lldb::pid_t pid, int signo) {
-  TerminateProcess((HANDLE)pid, 1);
+  AutoHandle handle(::OpenProcess(PROCESS_TERMINATE, FALSE, pid), nullptr);
+  if (handle.IsValid())
+::TerminateProcess(handle.get(), 1);
 }
 
 const char *Host::GetSignalAsCString(int signo) { return NULL; }

diff  --git 
a/lldb/test/API/functionalities/gdb_remote_client/TestPlatformKill.py 
b/lldb/test/API/functionalities/gdb_remote_client/TestPlatformKill.py
index 46cda4d66b488..430f1871d3b30 100644
--- a/lldb/test/API/functionalities/gdb_remote_client/TestPlatformKill.py
+++ b/lldb/test/API/functionalities/gdb_remote_client/TestPlatformKill.py
@@ -8,7 +8,6 @@
 
 class TestPlatformKill(GDBRemoteTestBase):
 @skipIfRemote
-@expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr52451")
 def test_kill_
diff erent_platform(self):
 """Test connecting to a remote linux platform"""
 



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb][Windows] Fixed Host::Kill() (PR #99721)

2024-07-21 Thread Dmitry Vasilyev via lldb-commits

https://github.com/slydiman closed 
https://github.com/llvm/llvm-project/pull/99721
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb/Plugins] Introduce Scripted Platform Plugin (PR #99814)

2024-07-21 Thread Med Ismail Bennani via lldb-commits

https://github.com/medismailben created 
https://github.com/llvm/llvm-project/pull/99814

This patch introduces Scripted Platform, a new platform plugin that can be 
customized with a python script.

For now this can list processes described in the python script file but 
eventually, it will be used to spawn scripted processes and act as an interface 
between them.

This patch is also a less intrusive implementation of 2d53527.

It introduces a new PlatformMetadata held by every platform that contains 
various objects that might be used by a platform instance.

In its current form, the PlatformMetadata holds a reference to the Debugger and 
a ScriptedMetadata pointer. These are necessary in other to instanciate the 
scripted object that the ScriptedPlatform interacts with.

In order to make it less introsive with the rest of lldb's platform creation 
code, platform metadata are set after the platform creation, and requires to 
platform to reload them (using `Platform::ReloadMetadata`).

This approach has the tradeoff that the ScriptedPlaform instance is technically 
invalid and useless right after its creation. However, the user should never be 
in that situation, since we reload the platform metadata everytime with create 
or select the platform.

This work was previously reviewed in:
- https://reviews.llvm.org/D139252
- https://reviews.llvm.org/D142266

>From 510fb37ba420a83d14233e4c835847e03879f674 Mon Sep 17 00:00:00 2001
From: Med Ismail Bennani 
Date: Sun, 21 Jul 2024 01:28:36 -0700
Subject: [PATCH] [lldb/Plugins] Introduce Scripted Platform Plugin

This patch introduces Scripted Platform, a new platform plugin that can
be customized with a python script.

For now this can list processes described in the python script file but
eventually, it will be used to spawn scripted processes and act as an
interface between them.

This patch is also a less intrusive implementation of 2d53527.

It introduces a new PlatformMetadata held by every platform that
contains various objects that might be used by a platform instance.

In its current form, the PlatformMetadata holds a reference to the
Debugger and a ScriptedMetadata pointer. These are necessary in other to
instanciate the scripted object that the ScriptedPlatform interacts with.

In order to make it less introsive with the rest of lldb's platform
creation code, platform metadata are set after the platform creation,
and requires to platform to reload them (using `Platform::ReloadMetadata`).

This approach has the tradeoff that the ScriptedPlaform instance is
technically invalid and useless right after its creation. However, the user
should never be in that situation, since we reload the platform metadata
everytime with create or select the platform.

This work was previously reviewed in:
- https://reviews.llvm.org/D139252
- https://reviews.llvm.org/D142266

Signed-off-by: Med Ismail Bennani 
---
 .../bindings/interface/SBPlatformDocstrings.i |  12 +
 lldb/bindings/python/python-swigsafecast.swig |  10 +
 lldb/bindings/python/python-wrapper.swig  |  36 +++
 .../python/templates/scripted_platform.py |  13 +-
 lldb/include/lldb/API/SBDebugger.h|   2 +
 lldb/include/lldb/API/SBPlatform.h|   4 +-
 lldb/include/lldb/API/SBProcess.h |   2 +
 lldb/include/lldb/API/SBStructuredData.h  |   1 +
 lldb/include/lldb/API/SBTarget.h  |   2 +
 .../Interfaces/ScriptedPlatformInterface.h|   7 +-
 .../lldb/Interpreter/OptionGroupPlatform.h|  10 +-
 .../lldb/Interpreter/ScriptInterpreter.h  |  19 +-
 lldb/include/lldb/Target/Platform.h   |  22 ++
 lldb/include/lldb/Utility/ScriptedMetadata.h  |   4 +-
 lldb/source/API/SBPlatform.cpp|  31 ++
 .../source/Commands/CommandObjectPlatform.cpp |  17 +-
 lldb/source/Commands/CommandObjectPlatform.h  |   1 +
 lldb/source/Interpreter/ScriptInterpreter.cpp |  15 +
 lldb/source/Plugins/Platform/CMakeLists.txt   |   1 +
 .../Plugins/Platform/scripted/CMakeLists.txt  |   8 +
 .../Platform/scripted/ScriptedPlatform.cpp| 288 ++
 .../Platform/scripted/ScriptedPlatform.h  |  84 +
 .../Process/scripted/ScriptedProcess.h|   2 +-
 .../Process/scripted/ScriptedThread.cpp   |   5 -
 .../Plugins/Process/scripted/ScriptedThread.h |   6 +-
 .../ScriptedPlatformPythonInterface.cpp   |  27 +-
 .../ScriptedPlatformPythonInterface.h |   5 +-
 .../Interfaces/ScriptedPythonInterface.cpp|  45 +++
 .../Interfaces/ScriptedPythonInterface.h  |  23 ++
 .../Python/SWIGPythonBridge.h |   3 +
 .../Python/ScriptInterpreterPython.cpp|   5 +
 .../Python/ScriptInterpreterPythonImpl.h  |   2 +
 lldb/source/Target/Platform.cpp   |  10 +-
 .../scripted_platform/my_scripted_platform.py |   3 +
 .../Python/PythonTestSuite.cpp|  15 +
 35 files changed, 706 insertions(+), 34 deletions(-)
 create mode 100644 lldb/source/Plugins/Platform/scripted/CMakeLists.txt
 create 

[Lldb-commits] [lldb] [lldb/Plugins] Introduce Scripted Platform Plugin (PR #99814)

2024-07-21 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: Med Ismail Bennani (medismailben)


Changes

This patch introduces Scripted Platform, a new platform plugin that can be 
customized with a python script.

For now this can list processes described in the python script file but 
eventually, it will be used to spawn scripted processes and act as an interface 
between them.

This patch is also a less intrusive implementation of 2d53527.

It introduces a new PlatformMetadata held by every platform that contains 
various objects that might be used by a platform instance.

In its current form, the PlatformMetadata holds a reference to the Debugger and 
a ScriptedMetadata pointer. These are necessary in other to instanciate the 
scripted object that the ScriptedPlatform interacts with.

In order to make it less introsive with the rest of lldb's platform creation 
code, platform metadata are set after the platform creation, and requires to 
platform to reload them (using `Platform::ReloadMetadata`).

This approach has the tradeoff that the ScriptedPlaform instance is technically 
invalid and useless right after its creation. However, the user should never be 
in that situation, since we reload the platform metadata everytime with create 
or select the platform.

This work was previously reviewed in:
- https://reviews.llvm.org/D139252
- https://reviews.llvm.org/D142266

---

Patch is 46.91 KiB, truncated to 20.00 KiB below, full version: 
https://github.com/llvm/llvm-project/pull/99814.diff


35 Files Affected:

- (modified) lldb/bindings/interface/SBPlatformDocstrings.i (+12) 
- (modified) lldb/bindings/python/python-swigsafecast.swig (+10) 
- (modified) lldb/bindings/python/python-wrapper.swig (+36) 
- (modified) lldb/examples/python/templates/scripted_platform.py (+8-5) 
- (modified) lldb/include/lldb/API/SBDebugger.h (+2) 
- (modified) lldb/include/lldb/API/SBPlatform.h (+3-1) 
- (modified) lldb/include/lldb/API/SBProcess.h (+2) 
- (modified) lldb/include/lldb/API/SBStructuredData.h (+1) 
- (modified) lldb/include/lldb/API/SBTarget.h (+2) 
- (modified) 
lldb/include/lldb/Interpreter/Interfaces/ScriptedPlatformInterface.h (+5-2) 
- (modified) lldb/include/lldb/Interpreter/OptionGroupPlatform.h (+8-2) 
- (modified) lldb/include/lldb/Interpreter/ScriptInterpreter.h (+15-4) 
- (modified) lldb/include/lldb/Target/Platform.h (+22) 
- (modified) lldb/include/lldb/Utility/ScriptedMetadata.h (+2-2) 
- (modified) lldb/source/API/SBPlatform.cpp (+31) 
- (modified) lldb/source/Commands/CommandObjectPlatform.cpp (+15-2) 
- (modified) lldb/source/Commands/CommandObjectPlatform.h (+1) 
- (modified) lldb/source/Interpreter/ScriptInterpreter.cpp (+15) 
- (modified) lldb/source/Plugins/Platform/CMakeLists.txt (+1) 
- (added) lldb/source/Plugins/Platform/scripted/CMakeLists.txt (+8) 
- (added) lldb/source/Plugins/Platform/scripted/ScriptedPlatform.cpp (+288) 
- (added) lldb/source/Plugins/Platform/scripted/ScriptedPlatform.h (+84) 
- (modified) lldb/source/Plugins/Process/scripted/ScriptedProcess.h (+1-1) 
- (modified) lldb/source/Plugins/Process/scripted/ScriptedThread.cpp (-5) 
- (modified) lldb/source/Plugins/Process/scripted/ScriptedThread.h (+5-1) 
- (modified) 
lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedPlatformPythonInterface.cpp
 (+20-7) 
- (modified) 
lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedPlatformPythonInterface.h
 (+4-1) 
- (modified) 
lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedPythonInterface.cpp
 (+45) 
- (modified) 
lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedPythonInterface.h
 (+23) 
- (modified) lldb/source/Plugins/ScriptInterpreter/Python/SWIGPythonBridge.h 
(+3) 
- (modified) 
lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp (+5) 
- (modified) 
lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPythonImpl.h (+2) 
- (modified) lldb/source/Target/Platform.cpp (+9-1) 
- (modified) 
lldb/test/API/functionalities/scripted_platform/my_scripted_platform.py (+3) 
- (modified) lldb/unittests/ScriptInterpreter/Python/PythonTestSuite.cpp (+15) 


``diff
diff --git a/lldb/bindings/interface/SBPlatformDocstrings.i 
b/lldb/bindings/interface/SBPlatformDocstrings.i
index ef09d5bce13fd..b8cdf21e90f82 100644
--- a/lldb/bindings/interface/SBPlatformDocstrings.i
+++ b/lldb/bindings/interface/SBPlatformDocstrings.i
@@ -29,3 +29,15 @@ and executable type. If the architecture or executable type 
do not match,
 a suitable platform will be found automatically."
 
 ) lldb::SBPlatform;
+
+%feature("docstring", "
+Create a platform instance using a specific platform plugin name, debugger,
+script name and user-provided dictionary.
+
+:param platform_name: name of the platform plugin to use to create the platform
+:param debugger: debugger instance owning the platform
+:param script_name: name of the script class and module to use to create the 
platform
+:param dict: user-provided dictionary that can be use

[Lldb-commits] [lldb] [lldb/Plugins] Introduce Scripted Platform Plugin (PR #99814)

2024-07-21 Thread via lldb-commits

github-actions[bot] wrote:




:warning: Python code formatter, darker found issues in your code. :warning:



You can test this locally with the following command:


``bash
darker --check --diff -r 
867faeec054abb4c035673189c1169fef45f54c8...510fb37ba420a83d14233e4c835847e03879f674
 lldb/examples/python/templates/scripted_platform.py 
lldb/test/API/functionalities/scripted_platform/my_scripted_platform.py
``





View the diff from darker here.


``diff
--- examples/python/templates/scripted_platform.py  2024-07-21 
16:56:25.00 +
+++ examples/python/templates/scripted_platform.py  2024-07-21 
17:00:28.637286 +
@@ -59,18 +59,18 @@
 """
 pass
 
 @abstractmethod
 def attach_to_process(self, attach_info, target, debugger, error):
-""" Attach to a process.
- 
+"""Attach to a process.
+
 Args:
 attach_info (lldb.SBAttachInfo): The information related to attach 
to a process.
 target (lldb.SBTarget): The optional target that we are trying to 
attach to.
 debugger (lldb.SBDebugger): The debugger instance.
 error (lldb.SBError): A status object notifying if the attach 
succeeded.
- 
+
 Returns:
 lldb.SBProcess: The process that the platform attached to, or None.
 """
 pass
 
--- test/API/functionalities/scripted_platform/my_scripted_platform.py  
2024-07-21 16:56:25.00 +
+++ test/API/functionalities/scripted_platform/my_scripted_platform.py  
2024-07-21 17:00:28.664912 +
@@ -17,11 +17,11 @@
 proc["gid"] = 20
 self.processes[420] = proc
 
 def list_processes(self):
 return self.processes
-
+
 def attach_to_process(self, attach_info, target, debugger, error):
 return None
 
 def get_process_info(self, pid):
 return self.processes[pid]

``




https://github.com/llvm/llvm-project/pull/99814
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb/Plugins] Introduce Scripted Platform Plugin (PR #99814)

2024-07-21 Thread Med Ismail Bennani via lldb-commits

https://github.com/medismailben updated 
https://github.com/llvm/llvm-project/pull/99814

>From 8008a0a3de1666580e6cf328b8f34e6f3db00856 Mon Sep 17 00:00:00 2001
From: Med Ismail Bennani 
Date: Sun, 21 Jul 2024 11:16:30 -0700
Subject: [PATCH] [lldb/Plugins] Introduce Scripted Platform Plugin

This patch introduces Scripted Platform, a new platform plugin that can
be customized with a python script.

For now this can list processes described in the python script file but
eventually, it will be used to spawn scripted processes and act as an
interface between them.

This patch is also a less intrusive implementation of 2d53527.

It introduces a new PlatformMetadata held by every platform that
contains various objects that might be used by a platform instance.

In its current form, the PlatformMetadata holds a reference to the
Debugger and a ScriptedMetadata pointer. These are necessary in other to
instanciate the scripted object that the ScriptedPlatform interacts with.

In order to make it less introsive with the rest of lldb's platform
creation code, platform metadata are set after the platform creation,
and requires to platform to reload them (using `Platform::ReloadMetadata`).

This approach has the tradeoff that the ScriptedPlaform instance is
technically invalid and useless right after its creation. However, the user
should never be in that situation, since we reload the platform metadata
everytime with create or select the platform.

This work was previously reviewed in:
- https://reviews.llvm.org/D139252
- https://reviews.llvm.org/D142266

Signed-off-by: Med Ismail Bennani 
---
 .../bindings/interface/SBPlatformDocstrings.i |  12 +
 lldb/bindings/python/python-swigsafecast.swig |  10 +
 lldb/bindings/python/python-wrapper.swig  |  36 +++
 .../python/templates/scripted_platform.py |   7 +-
 lldb/include/lldb/API/SBDebugger.h|   2 +
 lldb/include/lldb/API/SBPlatform.h|   4 +-
 lldb/include/lldb/API/SBProcess.h |   2 +
 lldb/include/lldb/API/SBStructuredData.h  |   1 +
 lldb/include/lldb/API/SBTarget.h  |   2 +
 .../Interfaces/ScriptedPlatformInterface.h|   7 +-
 .../lldb/Interpreter/OptionGroupPlatform.h|  10 +-
 .../lldb/Interpreter/ScriptInterpreter.h  |  19 +-
 lldb/include/lldb/Target/Platform.h   |  22 ++
 lldb/include/lldb/Utility/ScriptedMetadata.h  |   4 +-
 lldb/source/API/SBPlatform.cpp|  31 ++
 lldb/source/API/SBStructuredData.cpp  |   6 +-
 .../source/Commands/CommandObjectPlatform.cpp |  17 +-
 lldb/source/Commands/CommandObjectPlatform.h  |   1 +
 lldb/source/Interpreter/ScriptInterpreter.cpp |  15 +
 lldb/source/Plugins/Platform/CMakeLists.txt   |   1 +
 .../Plugins/Platform/scripted/CMakeLists.txt  |   8 +
 .../Platform/scripted/ScriptedPlatform.cpp| 288 ++
 .../Platform/scripted/ScriptedPlatform.h  |  84 +
 .../Process/scripted/ScriptedProcess.h|   2 +-
 .../Process/scripted/ScriptedThread.cpp   |   5 -
 .../Plugins/Process/scripted/ScriptedThread.h |   6 +-
 .../ScriptedPlatformPythonInterface.cpp   |  27 +-
 .../ScriptedPlatformPythonInterface.h |   5 +-
 .../Interfaces/ScriptedPythonInterface.cpp|  45 +++
 .../Interfaces/ScriptedPythonInterface.h  |  23 ++
 .../Python/SWIGPythonBridge.h |   3 +
 .../Python/ScriptInterpreterPython.cpp|   5 +
 .../Python/ScriptInterpreterPythonImpl.h  |   2 +
 lldb/source/Target/Platform.cpp   |  10 +-
 .../scripted_platform/TestScriptedPlatform.py | 108 +++
 .../scripted_platform/my_scripted_platform.py |  22 +-
 .../Python/PythonTestSuite.cpp|  15 +
 37 files changed, 827 insertions(+), 40 deletions(-)
 create mode 100644 lldb/source/Plugins/Platform/scripted/CMakeLists.txt
 create mode 100644 lldb/source/Plugins/Platform/scripted/ScriptedPlatform.cpp
 create mode 100644 lldb/source/Plugins/Platform/scripted/ScriptedPlatform.h
 create mode 100644 
lldb/test/API/functionalities/scripted_platform/TestScriptedPlatform.py

diff --git a/lldb/bindings/interface/SBPlatformDocstrings.i 
b/lldb/bindings/interface/SBPlatformDocstrings.i
index ef09d5bce13fd..b8cdf21e90f82 100644
--- a/lldb/bindings/interface/SBPlatformDocstrings.i
+++ b/lldb/bindings/interface/SBPlatformDocstrings.i
@@ -29,3 +29,15 @@ and executable type. If the architecture or executable type 
do not match,
 a suitable platform will be found automatically."
 
 ) lldb::SBPlatform;
+
+%feature("docstring", "
+Create a platform instance using a specific platform plugin name, debugger,
+script name and user-provided dictionary.
+
+:param platform_name: name of the platform plugin to use to create the platform
+:param debugger: debugger instance owning the platform
+:param script_name: name of the script class and module to use to create the 
platform
+:param dict: user-provided dictionary that can be used when instanciating a 
platform
+") lldb::SBPlatform (const char *, const

[Lldb-commits] [lldb] [lldb/Plugins] Introduce Scripted Platform Plugin (PR #99814)

2024-07-21 Thread Med Ismail Bennani via lldb-commits

https://github.com/medismailben updated 
https://github.com/llvm/llvm-project/pull/99814

>From f236a764734facb1aa7c48f855f70d56f225a054 Mon Sep 17 00:00:00 2001
From: Med Ismail Bennani 
Date: Sun, 21 Jul 2024 16:44:41 -0700
Subject: [PATCH] [lldb/Plugins] Introduce Scripted Platform Plugin

This patch introduces Scripted Platform, a new platform plugin that can
be customized with a python script.

For now this can list processes described in the python script file but
eventually, it will be used to spawn scripted processes and act as an
interface between them.

This patch is also a less intrusive implementation of 2d53527.

It introduces a new PlatformMetadata held by every platform that
contains various objects that might be used by a platform instance.

In its current form, the PlatformMetadata holds a reference to the
Debugger and a ScriptedMetadata pointer. These are necessary in other to
instanciate the scripted object that the ScriptedPlatform interacts with.

In order to make it less introsive with the rest of lldb's platform
creation code, platform metadata are set after the platform creation,
and requires to platform to reload them (using `Platform::ReloadMetadata`).

This approach has the tradeoff that the ScriptedPlaform instance is
technically invalid and useless right after its creation. However, the user
should never be in that situation, since we reload the platform metadata
everytime with create or select the platform.

This work was previously reviewed in:
- https://reviews.llvm.org/D139252
- https://reviews.llvm.org/D142266

Signed-off-by: Med Ismail Bennani 
---
 .../bindings/interface/SBPlatformDocstrings.i |  12 +
 lldb/bindings/python/python-swigsafecast.swig |  10 +
 lldb/bindings/python/python-wrapper.swig  |  36 +++
 .../python/templates/scripted_platform.py |   7 +-
 lldb/include/lldb/API/SBDebugger.h|   2 +
 lldb/include/lldb/API/SBPlatform.h|   4 +-
 lldb/include/lldb/API/SBProcess.h |   2 +
 lldb/include/lldb/API/SBStructuredData.h  |   1 +
 lldb/include/lldb/API/SBTarget.h  |   2 +
 .../Interfaces/ScriptedPlatformInterface.h|   7 +-
 .../lldb/Interpreter/OptionGroupPlatform.h|  10 +-
 .../lldb/Interpreter/ScriptInterpreter.h  |  19 +-
 lldb/include/lldb/Target/Platform.h   |  22 ++
 lldb/include/lldb/Utility/ScriptedMetadata.h  |   4 +-
 lldb/source/API/SBPlatform.cpp|  31 ++
 lldb/source/API/SBStructuredData.cpp  |   6 +-
 .../source/Commands/CommandObjectPlatform.cpp |  17 +-
 lldb/source/Commands/CommandObjectPlatform.h  |   1 +
 lldb/source/Interpreter/ScriptInterpreter.cpp |  15 +
 lldb/source/Plugins/Platform/CMakeLists.txt   |   1 +
 .../Plugins/Platform/scripted/CMakeLists.txt  |   8 +
 .../Platform/scripted/ScriptedPlatform.cpp| 288 ++
 .../Platform/scripted/ScriptedPlatform.h  |  84 +
 .../Process/scripted/ScriptedProcess.h|   2 +-
 .../Process/scripted/ScriptedThread.cpp   |   5 -
 .../Plugins/Process/scripted/ScriptedThread.h |   6 +-
 .../ScriptedPlatformPythonInterface.cpp   |  42 +--
 .../ScriptedPlatformPythonInterface.h |   5 +-
 .../Interfaces/ScriptedPythonInterface.cpp|  45 +++
 .../Interfaces/ScriptedPythonInterface.h  |  23 ++
 .../Python/SWIGPythonBridge.h |   3 +
 .../Python/ScriptInterpreterPython.cpp|   5 +
 .../Python/ScriptInterpreterPythonImpl.h  |   2 +
 lldb/source/Target/Platform.cpp   |  10 +-
 .../scripted_platform/TestScriptedPlatform.py | 108 +++
 .../scripted_platform/my_scripted_platform.py |  23 +-
 .../Python/PythonTestSuite.cpp|  15 +
 37 files changed, 833 insertions(+), 50 deletions(-)
 create mode 100644 lldb/source/Plugins/Platform/scripted/CMakeLists.txt
 create mode 100644 lldb/source/Plugins/Platform/scripted/ScriptedPlatform.cpp
 create mode 100644 lldb/source/Plugins/Platform/scripted/ScriptedPlatform.h
 create mode 100644 
lldb/test/API/functionalities/scripted_platform/TestScriptedPlatform.py

diff --git a/lldb/bindings/interface/SBPlatformDocstrings.i 
b/lldb/bindings/interface/SBPlatformDocstrings.i
index ef09d5bce13fd..b8cdf21e90f82 100644
--- a/lldb/bindings/interface/SBPlatformDocstrings.i
+++ b/lldb/bindings/interface/SBPlatformDocstrings.i
@@ -29,3 +29,15 @@ and executable type. If the architecture or executable type 
do not match,
 a suitable platform will be found automatically."
 
 ) lldb::SBPlatform;
+
+%feature("docstring", "
+Create a platform instance using a specific platform plugin name, debugger,
+script name and user-provided dictionary.
+
+:param platform_name: name of the platform plugin to use to create the platform
+:param debugger: debugger instance owning the platform
+:param script_name: name of the script class and module to use to create the 
platform
+:param dict: user-provided dictionary that can be used when instanciating a 
platform
+") lldb::SBPlatform (const char *, cons