mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-08 15:09:39 +07:00
some minor fixes in py remote debug
This commit is contained in:
@@ -609,10 +609,12 @@ class PyDB:
|
||||
elif cmd_id == CMD_ADD_EXCEPTION_BREAK:
|
||||
global exception_set
|
||||
exception, notify_always, notify_on_terminate = text.split('\t', 2)
|
||||
exc_type = get_class(exception)
|
||||
|
||||
is_notify_always = int(notify_always) == 1
|
||||
is_notify_on_terminate = int(notify_on_terminate) == 1
|
||||
|
||||
exc_type = get_class(exception)
|
||||
|
||||
if exc_type is not None:
|
||||
exception_set.add(ExceptionBreakpoint(exc_type, is_notify_always, is_notify_on_terminate))
|
||||
|
||||
|
||||
@@ -115,7 +115,10 @@ def get_class( kls ):
|
||||
module = "builtins"
|
||||
else:
|
||||
module = "__builtin__"
|
||||
m = __import__( module )
|
||||
for comp in parts[-1:]:
|
||||
m = getattr(m, comp)
|
||||
return m
|
||||
try:
|
||||
m = __import__( module )
|
||||
for comp in parts[-1:]:
|
||||
m = getattr(m, comp)
|
||||
return m
|
||||
except ImportError:
|
||||
return None
|
||||
@@ -5,6 +5,7 @@
|
||||
*/
|
||||
package com.jetbrains.python.debugger.pydev;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import com.intellij.execution.ui.ConsoleViewContentType;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
@@ -42,6 +43,8 @@ public class RemoteDebugger {
|
||||
private final Map<Integer, ProtocolFrame> myResponseQueue = new HashMap<Integer, ProtocolFrame>();
|
||||
private final TempVarsHolder myTempVars = new TempVarsHolder();
|
||||
|
||||
private final List<RemoteDebuggerCloseListener> myCloseListeners = Lists.newArrayList();
|
||||
|
||||
public RemoteDebugger(final IPyDebugProcess debugProcess, final ServerSocket serverSocket, final int timeout) {
|
||||
myDebugProcess = debugProcess;
|
||||
myServerSocket = serverSocket;
|
||||
@@ -267,8 +270,8 @@ public class RemoteDebugger {
|
||||
os.flush();
|
||||
}
|
||||
catch (SocketException se) {
|
||||
LOG.error(se);
|
||||
disconnect();
|
||||
fireCloseEvent();
|
||||
}
|
||||
catch (IOException e) {
|
||||
LOG.error(e);
|
||||
@@ -303,6 +306,7 @@ public class RemoteDebugger {
|
||||
}
|
||||
}
|
||||
disconnect();
|
||||
fireCloseEvent();
|
||||
}
|
||||
|
||||
|
||||
@@ -322,7 +326,7 @@ public class RemoteDebugger {
|
||||
}
|
||||
}
|
||||
catch (SocketException ignore) {
|
||||
// disconnected
|
||||
fireCloseEvent();
|
||||
}
|
||||
catch (Exception e) {
|
||||
LOG.error(e);
|
||||
@@ -458,4 +462,18 @@ public class RemoteDebugger {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void addCloseListener(RemoteDebuggerCloseListener listener) {
|
||||
myCloseListeners.add(listener);
|
||||
}
|
||||
|
||||
public void remoteCloseListener(RemoteDebuggerCloseListener listener) {
|
||||
myCloseListeners.remove(listener);
|
||||
}
|
||||
|
||||
private void fireCloseEvent() {
|
||||
for (RemoteDebuggerCloseListener listener: myCloseListeners) {
|
||||
listener.closed();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
package com.jetbrains.python.debugger.pydev;
|
||||
|
||||
/**
|
||||
* @author traff
|
||||
*/
|
||||
public interface RemoteDebuggerCloseListener {
|
||||
void closed();
|
||||
}
|
||||
@@ -9,6 +9,7 @@
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="module" module-name="xdebugger-api" />
|
||||
<orderEntry type="library" name="XmlRPC" level="project" />
|
||||
<orderEntry type="library" name="Guava" level="project" />
|
||||
</component>
|
||||
</module>
|
||||
|
||||
|
||||
@@ -66,7 +66,7 @@ public class PyDebugProcess extends XDebugProcess implements IPyDebugProcess, Pr
|
||||
}
|
||||
|
||||
|
||||
public PyDebugProcess(@NotNull XDebugSession session,
|
||||
public PyDebugProcess(final @NotNull XDebugSession session,
|
||||
@NotNull final ServerSocket serverSocket,
|
||||
@NotNull final ExecutionConsole executionConsole,
|
||||
@Nullable final ProcessHandler processHandler, @NotNull PyPositionConverter positionConverter) {
|
||||
@@ -81,6 +81,12 @@ public class PyDebugProcess extends XDebugProcess implements IPyDebugProcess, Pr
|
||||
myProcessHandler.addProcessListener(this);
|
||||
}
|
||||
myPositionConverter = positionConverter;
|
||||
myDebugger.addCloseListener(new RemoteDebuggerCloseListener() {
|
||||
@Override
|
||||
public void closed() {
|
||||
session.stop();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user