mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Merge branch 'master' of git.labs.intellij.net:idea/ultimate
This commit is contained in:
@@ -204,7 +204,6 @@ class PyDB:
|
||||
def FinishDebuggingSession(self):
|
||||
self._finishDebuggingSession = True
|
||||
|
||||
|
||||
def acquire(self):
|
||||
if PyDBUseLocks:
|
||||
self.lock.acquire()
|
||||
@@ -279,6 +278,16 @@ class PyDB:
|
||||
queue = self.getInternalQueue(thread_id)
|
||||
queue.put(int_cmd)
|
||||
|
||||
def checkOutputRedirect(self):
|
||||
global bufferStdOutToServer
|
||||
global bufferStdErrToServer
|
||||
|
||||
if bufferStdOutToServer:
|
||||
self.checkOutput(sys.stdoutBuf, 1) #@UndefinedVariable
|
||||
|
||||
if bufferStdErrToServer:
|
||||
self.checkOutput(sys.stderrBuf, 2) #@UndefinedVariable
|
||||
|
||||
def checkOutput(self, out, outCtx):
|
||||
'''Checks the output to see if we have to send some buffered output to the debug server
|
||||
|
||||
@@ -288,6 +297,7 @@ class PyDB:
|
||||
|
||||
try:
|
||||
v = out.getvalue()
|
||||
|
||||
if v:
|
||||
self.cmdFactory.makeIoMessage(v, outCtx, self)
|
||||
except:
|
||||
@@ -300,11 +310,8 @@ class PyDB:
|
||||
|
||||
self.acquire()
|
||||
try:
|
||||
if bufferStdOutToServer:
|
||||
self.checkOutput(sys.stdoutBuf, 1) #@UndefinedVariable
|
||||
|
||||
if bufferStdErrToServer:
|
||||
self.checkOutput(sys.stderrBuf, 2) #@UndefinedVariable
|
||||
|
||||
self.checkOutputRedirect()
|
||||
|
||||
currThreadId = GetThreadId(threadingCurrentThread())
|
||||
threads = threadingEnumerate()
|
||||
@@ -630,8 +637,11 @@ class PyDB:
|
||||
exception = text
|
||||
exc_type = get_class(exception)
|
||||
if exc_type is not None:
|
||||
exception_set.remove(exc_type)
|
||||
always_exception_set.remove(exc_type)
|
||||
try:
|
||||
exception_set.remove(exc_type)
|
||||
always_exception_set.remove(exc_type)
|
||||
except:
|
||||
pass
|
||||
update_exception_hook()
|
||||
|
||||
elif cmd_id == CMD_LOAD_SOURCE:
|
||||
@@ -1000,6 +1010,9 @@ def SetTraceForParents(frame, dispatch_func):
|
||||
frame = frame.f_back
|
||||
del frame
|
||||
|
||||
def exit_hook():
|
||||
GetGlobalDebugger().checkOutputRedirect()
|
||||
|
||||
def settrace(host='localhost', stdoutToServer=False, stderrToServer=False, port=5678, suspend=True, trace_only_current_thread=True):
|
||||
'''Sets the tracing function with the pydev debug function and initializes needed facilities.
|
||||
|
||||
@@ -1075,6 +1088,8 @@ def settrace(host='localhost', stdoutToServer=False, stderrToServer=False, port=
|
||||
thread.start_new = pydev_start_new_thread
|
||||
except:
|
||||
pass
|
||||
|
||||
#sys.exitfunc = exit_hook
|
||||
|
||||
PyDBCommandThread(debugger).start()
|
||||
|
||||
|
||||
@@ -211,6 +211,7 @@ class PyDBDaemonThread(threading.Thread):
|
||||
def doKill(self):
|
||||
#that was not working very well because jython gave some socket errors
|
||||
self.killReceived = True
|
||||
|
||||
|
||||
#=======================================================================================================================
|
||||
# ReaderThread
|
||||
@@ -232,8 +233,7 @@ class ReaderThread(PyDBDaemonThread):
|
||||
except:
|
||||
#just ignore that
|
||||
pass
|
||||
|
||||
|
||||
|
||||
def OnRun(self):
|
||||
pydevd_tracing.SetTrace(None) # no debugging on this thread
|
||||
buffer = ""
|
||||
@@ -259,7 +259,13 @@ class ReaderThread(PyDBDaemonThread):
|
||||
command, buffer = buffer.split('\n', 1)
|
||||
PydevdLog(1, "received command ", command)
|
||||
args = command.split('\t', 2)
|
||||
GlobalDebuggerHolder.globalDbg.processNetCommand(int(args[0]), int(args[1]), args[2])
|
||||
try:
|
||||
GlobalDebuggerHolder.globalDbg.processNetCommand(int(args[0]), int(args[1]), args[2])
|
||||
except:
|
||||
traceback.print_exc()
|
||||
sys.stderr.write("Can't process net command %" % command)
|
||||
sys.stderr.flush()
|
||||
|
||||
except:
|
||||
traceback.print_exc()
|
||||
GlobalDebuggerHolder.globalDbg.FinishDebuggingSession()
|
||||
|
||||
@@ -43,6 +43,7 @@ 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) {
|
||||
@@ -59,6 +60,7 @@ public class RemoteDebugger {
|
||||
return myConnected;
|
||||
}
|
||||
|
||||
|
||||
public void waitForConnect() throws Exception {
|
||||
try {
|
||||
//noinspection SocketOpenedButNotSafelyClosed
|
||||
|
||||
@@ -523,15 +523,18 @@ run.configuration.remote.debug.name=Python Remote Debug
|
||||
run.configuration.type.description=Starts server for remote debug
|
||||
|
||||
remote.debug.info=Info
|
||||
remote.debug.server.hint=Run this remote debug configuration to start debug server.
|
||||
remote.debug.server.hint2=Add pycharm-debug.egg from PyCharm distribution to python path of your script.
|
||||
remote.debug.server.hint3=Use the following command in your script to connect to debug server:
|
||||
remote.debug.server.hint=Launch this debug configuration to start the debug server.
|
||||
remote.debug.server.hint1.5=Update your script:
|
||||
remote.debug.server.hint2=1. Add pycharm-debug.egg from the PyCharm installation to the Python path.
|
||||
remote.debug.server.hint2.5=2. Add the following import statement:
|
||||
remote.debug.server.hint3=3. Add the following command to connect to the debug server:
|
||||
remote.debug.settings=Settings
|
||||
remote.debug.remote.host=Remote host
|
||||
remote.debug.port=Port
|
||||
remote.debug.remote.root.folder=Remote root folder
|
||||
remote.debug.local.root.folder=Local root folder
|
||||
remote.debug.use.path.mapping=Use path mapping
|
||||
remote.debug.remote.root.folder=Remote paths prefix
|
||||
remote.debug.local.root.folder=Local paths prefix
|
||||
remote.debug.server.hint4=If you want to enable stdout and stderr redirection to PyCharm console, use following command in your script:
|
||||
remote.debug.local.host=Local host name:
|
||||
remote.debug.redirect.output=Redirect output to console
|
||||
remote.debug.suspend.on.conect=Suspend after connect
|
||||
remote.debug.suspend.on.connect=Suspend after connect
|
||||
|
||||
@@ -16,6 +16,7 @@ import com.intellij.openapi.ui.Messages;
|
||||
import com.intellij.openapi.util.Key;
|
||||
import com.intellij.xdebugger.XDebugProcess;
|
||||
import com.intellij.xdebugger.XDebugSession;
|
||||
import com.intellij.xdebugger.XDebuggerBundle;
|
||||
import com.intellij.xdebugger.XSourcePosition;
|
||||
import com.intellij.xdebugger.breakpoints.XBreakpoint;
|
||||
import com.intellij.xdebugger.breakpoints.XBreakpointHandler;
|
||||
@@ -425,4 +426,16 @@ public class PyDebugProcess extends XDebugProcess implements IPyDebugProcess, Pr
|
||||
public PyStackFrame createStackFrame(PyStackFrameInfo frameInfo) {
|
||||
return new PyStackFrame(this, frameInfo);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCurrentStateMessage() {
|
||||
if (getSession().isStopped()) {
|
||||
return XDebuggerBundle.message("debugger.state.message.disconnected");
|
||||
} else
|
||||
if (myDebugger.isConnected()) {
|
||||
return XDebuggerBundle.message("debugger.state.message.connected");
|
||||
} else {
|
||||
return "Waiting for connection...";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user