Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
小 白蛋
Intellij Community
Commits
8f47cf26
Commit
8f47cf26
authored
6 years ago
by
Alexander Koshevoy
Browse files
Options
Download
Email Patches
Plain Diff
PY-24191 Use dictionary for handling CMD_PROCESS_CREATED_MSG_RECEIVED messages in predictable way
parent
1f83f996
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
python/helpers/pydev/_pydevd_bundle/pydevd_process_net_command.py
+3
-2
...elpers/pydev/_pydevd_bundle/pydevd_process_net_command.py
python/helpers/pydev/pydevd.py
+14
-16
python/helpers/pydev/pydevd.py
python/pydevSrc/com/jetbrains/python/debugger/pydev/ClientModeMultiProcessDebugger.java
+2
-2
...python/debugger/pydev/ClientModeMultiProcessDebugger.java
python/pydevSrc/com/jetbrains/python/debugger/pydev/ProcessCreatedMsgReceivedCommand.kt
+9
-2
...python/debugger/pydev/ProcessCreatedMsgReceivedCommand.kt
python/pydevSrc/com/jetbrains/python/debugger/pydev/RemoteDebugger.java
+2
-2
...c/com/jetbrains/python/debugger/pydev/RemoteDebugger.java
with
30 additions
and
24 deletions
+30
-24
python/helpers/pydev/_pydevd_bundle/pydevd_process_net_command.py
+
3
-
2
View file @
8f47cf26
...
...
@@ -710,10 +710,11 @@ def process_net_command(py_db, cmd_id, seq, text):
pydevd_dont_trace
.
trace_filter
(
mode
)
elif
cmd_id
==
CMD_PROCESS_CREATED_MSG_RECEIVED
:
event
=
py_db
.
process_created_msg_received_event
original_seq
=
int
(
text
)
event
=
py_db
.
process_created_msg_received_events
.
pop
(
original_seq
,
None
)
if
event
:
py_db
.
process_created_msg_received_event
=
None
event
.
set
()
else
:
...
...
This diff is collapsed.
Click to expand it.
python/helpers/pydev/pydevd.py
+
14
-
16
View file @
8f47cf26
...
...
@@ -281,7 +281,8 @@ class PyDB:
# this flag disables frame evaluation even if it's available
self
.
do_not_use_frame_eval
=
False
self
.
process_created_msg_received_event
=
None
# sequence id of `CMD_PROCESS_CREATED` command -> threading.Event
self
.
process_created_msg_received_events
=
dict
()
# the role PyDB plays in the communication with IDE
self
.
communication_role
=
None
...
...
@@ -759,27 +760,24 @@ class PyDB:
self
.
writer
.
add_command
(
cmd
)
def
send_process_will_be_substituted
(
self
):
"""
Sends a message that a new process is going to be created.
When `PyDB` works in server mode this method also
waits for the
"""
When `PyDB` works in server mode this method sends a message that a
new process is going to be created. After that it
waits for the
response from the IDE to be sure that the IDE received this message.
Waiting for the response is required because the current process might
become substituted before it actually sends the message and the IDE
will not try to connect to `PyDB` in this case.
Waiting of the response in server mode is required because the current
process might become substituted before it actually sends the message
and the IDE will not try to connect to `PyDB` in this case.
Waiting of the response in client mode is not required because the
When `PyDB` works in client mode this method does nothing because the
substituted process will try to connect to the IDE itself.
"""
event
=
None
if
self
.
communication_role
==
CommunicationRole
.
SERVER
:
cmd
=
self
.
cmd_factory
.
make_process_created_message
()
# register event before putting command to the message queue
event
=
threading
.
Event
()
self
.
process_created_msg_received_event
=
event
cmd
=
self
.
cmd_factory
.
make_process_created_message
()
self
.
writer
.
add_command
(
cmd
)
if
self
.
communication_role
==
CommunicationRole
.
SERVER
:
self
.
process_created_msg_received_events
[
cmd
.
seq
]
=
event
# put command to the message queue
self
.
writer
.
add_command
(
cmd
)
# wait for the reply
event
.
wait
()
def
set_next_statement
(
self
,
frame
,
event
,
func_name
,
next_line
):
...
...
This diff is collapsed.
Click to expand it.
python/pydevSrc/com/jetbrains/python/debugger/pydev/ClientModeMultiProcessDebugger.java
+
2
-
2
View file @
8f47cf26
...
...
@@ -82,9 +82,9 @@ public class ClientModeMultiProcessDebugger implements ProcessDebugger {
private
RemoteDebugger
tryToConnectRemoteDebugger
()
throws
Exception
{
RemoteDebugger
debugger
=
new
RemoteDebugger
(
myDebugProcess
,
myHost
,
myPort
)
{
@Override
protected
void
onProcessCreatedEvent
()
{
protected
void
onProcessCreatedEvent
(
int
commandSequence
)
{
try
{
ProcessCreatedMsgReceivedCommand
command
=
new
ProcessCreatedMsgReceivedCommand
(
this
);
ProcessCreatedMsgReceivedCommand
command
=
new
ProcessCreatedMsgReceivedCommand
(
this
,
commandSequence
);
command
.
execute
();
}
catch
(
PyDebuggerException
e
)
{
...
...
This diff is collapsed.
Click to expand it.
python/pydevSrc/com/jetbrains/python/debugger/pydev/ProcessCreatedMsgReceivedCommand.kt
+
9
-
2
View file @
8f47cf26
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package
com.jetbrains.python.debugger.pydev
class
ProcessCreatedMsgReceivedCommand
(
debugger
:
RemoteDebugger
)
:
AbstractCommand
<
Void
>(
debugger
,
PROCESS_CREATED_MSG_RECEIVED
)
{
override
fun
buildPayload
(
payload
:
Payload
)
=
Unit
/**
* @param commandSequence the original [ProcessCreatedCommand] sequence number
*/
class
ProcessCreatedMsgReceivedCommand
(
debugger
:
RemoteDebugger
,
private
val
commandSequence
:
Int
)
:
AbstractCommand
<
Void
>(
debugger
,
PROCESS_CREATED_MSG_RECEIVED
)
{
override
fun
buildPayload
(
payload
:
Payload
)
{
payload
.
add
(
commandSequence
)
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
python/pydevSrc/com/jetbrains/python/debugger/pydev/RemoteDebugger.java
+
2
-
2
View file @
8f47cf26
...
...
@@ -546,7 +546,7 @@ public class RemoteDebugger implements ProcessDebugger {
myDebugProcess
.
consoleInputRequested
(
ProtocolParser
.
parseInputCommand
(
frame
.
getPayload
()));
}
else
if
(
ProcessCreatedCommand
.
isProcessCreatedCommand
(
frame
.
getCommand
()))
{
onProcessCreatedEvent
();
onProcessCreatedEvent
(
frame
.
getSequence
()
);
}
else
if
(
AbstractCommand
.
isShowWarningCommand
(
frame
.
getCommand
()))
{
myDebugProcess
.
showCythonWarning
();
...
...
@@ -736,7 +736,7 @@ public class RemoteDebugger implements ProcessDebugger {
}
}
protected
void
onProcessCreatedEvent
()
{
protected
void
onProcessCreatedEvent
(
int
commandSequence
)
{
}
protected
void
fireCloseEvent
()
{
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Projects
Groups
Snippets
Help