diff --git a/python/helpers/pydev/_pydev_bundle/pydev_monkey.py b/python/helpers/pydev/_pydev_bundle/pydev_monkey.py
index 48668c33e52b..dadfd87f7b91 100644
--- a/python/helpers/pydev/_pydev_bundle/pydev_monkey.py
+++ b/python/helpers/pydev/_pydev_bundle/pydev_monkey.py
@@ -55,6 +55,11 @@ def _on_forked_process():
pydevd.threadingCurrentThread().__pydevd_main_thread = True
pydevd.settrace_forked()
+def _notify_process_created(dbg):
+ if dbg is not None:
+ cmd = dbg.cmd_factory.make_process_created_message()
+ dbg.writer.add_command(cmd)
+
def _on_set_trace_for_new_thread(global_debugger):
if global_debugger is not None:
global_debugger.SetTrace(global_debugger.trace_dispatch)
@@ -458,6 +463,10 @@ def create_fork(original_name):
if not child_process:
if is_new_python_process:
_on_forked_process()
+ else:
+ if is_new_python_process:
+ from _pydevd_bundle.pydevd_comm import get_global_debugger
+ _notify_process_created(get_global_debugger())
return child_process
return new_fork
diff --git a/python/helpers/pydev/_pydevd_bundle/pydevd_comm.py b/python/helpers/pydev/_pydevd_bundle/pydevd_comm.py
index 8276001789ac..92bfab0dec3d 100644
--- a/python/helpers/pydev/_pydevd_bundle/pydevd_comm.py
+++ b/python/helpers/pydev/_pydevd_bundle/pydevd_comm.py
@@ -143,6 +143,8 @@ CMD_SHOW_RETURN_VALUES = 146
CMD_INPUT_REQUESTED = 147
CMD_GET_DESCRIPTION = 148
+CMD_PROCESS_CREATED = 149
+
CMD_VERSION = 501
CMD_RETURN = 502
CMD_ERROR = 901
@@ -199,6 +201,8 @@ ID_TO_MEANING = {
'147': 'CMD_INPUT_REQUESTED',
'148': 'CMD_GET_DESCRIPTION',
+ '149': 'CMD_PROCESS_CREATED',
+
'501': 'CMD_VERSION',
'502': 'CMD_RETURN',
'901': 'CMD_ERROR',
@@ -559,6 +563,9 @@ class NetCommandFactory:
cmdText = "" + self._thread_to_xml(thread) + ""
return NetCommand(CMD_THREAD_CREATE, 0, cmdText)
+ def make_process_created_message(self):
+ cmdText = ''
+ return NetCommand(CMD_PROCESS_CREATED, 0, cmdText)
def make_custom_frame_created_message(self, frameId, frameDescription):
frameDescription = pydevd_xml.make_valid_xml_value(frameDescription)
diff --git a/python/pydevSrc/com/jetbrains/python/debugger/pydev/AbstractCommand.java b/python/pydevSrc/com/jetbrains/python/debugger/pydev/AbstractCommand.java
index 9090238a6a45..c67c4dcb0525 100644
--- a/python/pydevSrc/com/jetbrains/python/debugger/pydev/AbstractCommand.java
+++ b/python/pydevSrc/com/jetbrains/python/debugger/pydev/AbstractCommand.java
@@ -54,6 +54,7 @@ public abstract class AbstractCommand {
public static final int SHOW_RETURN_VALUES = 146;
public static final int INPUT_REQUESTED = 147;
+ public static final int PROCESS_CREATED = 149;
public static final int ERROR = 901;
diff --git a/python/pydevSrc/com/jetbrains/python/debugger/pydev/ProcessCreatedCommand.java b/python/pydevSrc/com/jetbrains/python/debugger/pydev/ProcessCreatedCommand.java
new file mode 100644
index 000000000000..8bc9a8a7cec4
--- /dev/null
+++ b/python/pydevSrc/com/jetbrains/python/debugger/pydev/ProcessCreatedCommand.java
@@ -0,0 +1,20 @@
+package com.jetbrains.python.debugger.pydev;
+
+import org.jetbrains.annotations.NotNull;
+
+/**
+ * @author Alexander Koshevoy
+ */
+public class ProcessCreatedCommand extends AbstractCommand {
+ public ProcessCreatedCommand(@NotNull RemoteDebugger debugger, int commandCode) {
+ super(debugger, commandCode);
+ }
+
+ @Override
+ protected void buildPayload(Payload payload) {
+ }
+
+ public static boolean isProcessCreatedCommand(int command) {
+ return command == AbstractCommand.PROCESS_CREATED;
+ }
+}
diff --git a/python/pydevSrc/com/jetbrains/python/debugger/pydev/RemoteDebugger.java b/python/pydevSrc/com/jetbrains/python/debugger/pydev/RemoteDebugger.java
index 3f51b5109b62..7164340e4e6a 100644
--- a/python/pydevSrc/com/jetbrains/python/debugger/pydev/RemoteDebugger.java
+++ b/python/pydevSrc/com/jetbrains/python/debugger/pydev/RemoteDebugger.java
@@ -452,6 +452,9 @@ public class RemoteDebugger implements ProcessDebugger {
else if (AbstractCommand.isInputRequested(frame.getCommand())) {
myDebugProcess.consoleInputRequested(ProtocolParser.parseInputCommand(frame.getPayload()));
}
+ else if (ProcessCreatedCommand.isProcessCreatedCommand(frame.getCommand())) {
+ onProcessCreatedEvent();
+ }
else {
placeResponse(frame.getSequence(), frame);
}
@@ -636,6 +639,9 @@ public class RemoteDebugger implements ProcessDebugger {
}
}
+ protected void onProcessCreatedEvent() throws PyDebuggerException {
+ }
+
protected void fireCloseEvent() {
for (RemoteDebuggerCloseListener listener : myCloseListeners) {
listener.closed();