12 import logging |
12 import logging |
13 |
13 |
14 from PyQt5.QtCore import ( |
14 from PyQt5.QtCore import ( |
15 QObject, QProcess, QProcessEnvironment, QTimer |
15 QObject, QProcess, QProcessEnvironment, QTimer |
16 ) |
16 ) |
17 from PyQt5.QtWidgets import QInputDialog |
|
18 |
17 |
19 from E5Gui.E5Application import e5App |
18 from E5Gui.E5Application import e5App |
20 from E5Gui import E5MessageBox |
19 from E5Gui import E5MessageBox |
21 |
20 |
22 from . import DebugClientCapabilities |
21 from . import DebugClientCapabilities |
665 """ |
664 """ |
666 if self.__master: |
665 if self.__master: |
667 self.__sendJsonCommand("RequestEnvironment", {"environment": env}, |
666 self.__sendJsonCommand("RequestEnvironment", {"environment": env}, |
668 self.__master) |
667 self.__master) |
669 |
668 |
|
669 # TODO: remove autoFork and forkChild |
670 def remoteLoad(self, fn, argv, wd, traceInterpreter=False, |
670 def remoteLoad(self, fn, argv, wd, traceInterpreter=False, |
671 autoContinue=True, autoFork=False, forkChild=False, |
671 autoContinue=True, autoFork=False, forkChild=False, |
672 enableMultiprocess=False): |
672 enableMultiprocess=False): |
673 """ |
673 """ |
674 Public method to load a new program to debug. |
674 Public method to load a new program to debug. |
706 "autofork": autoFork, |
706 "autofork": autoFork, |
707 "forkChild": forkChild, |
707 "forkChild": forkChild, |
708 "multiprocess": enableMultiprocess, |
708 "multiprocess": enableMultiprocess, |
709 }, self.__master) |
709 }, self.__master) |
710 |
710 |
|
711 # TODO: remove autoFork and forkChild |
711 def remoteRun(self, fn, argv, wd, autoFork=False, forkChild=False): |
712 def remoteRun(self, fn, argv, wd, autoFork=False, forkChild=False): |
712 """ |
713 """ |
713 Public method to load a new program to run. |
714 Public method to load a new program to run. |
714 |
715 |
715 @param fn the filename to run |
716 @param fn the filename to run |
1287 def remoteUTStop(self): |
1288 def remoteUTStop(self): |
1288 """ |
1289 """ |
1289 Public method to stop a unittest run. |
1290 Public method to stop a unittest run. |
1290 """ |
1291 """ |
1291 self.__sendJsonCommand("RequestUTStop", {}) |
1292 self.__sendJsonCommand("RequestUTStop", {}) |
1292 |
|
1293 def __askForkTo(self, debuggerId): |
|
1294 """ |
|
1295 Private method to ask the user which branch of a fork to follow. |
|
1296 |
|
1297 @param debuggerId ID of the debugger backend |
|
1298 @type str |
|
1299 """ |
|
1300 selections = [self.tr("Parent Process"), |
|
1301 self.tr("Child process")] |
|
1302 res, ok = QInputDialog.getItem( |
|
1303 None, |
|
1304 self.tr("Client forking"), |
|
1305 self.tr("Select the fork branch to follow (Debugger: {0}).") |
|
1306 .format(debuggerId), |
|
1307 selections, |
|
1308 0, False) |
|
1309 if not ok or res == selections[0]: |
|
1310 self.__sendJsonCommand("ResponseForkTo", { |
|
1311 "target": "parent", |
|
1312 }, debuggerId) |
|
1313 else: |
|
1314 self.__sendJsonCommand("ResponseForkTo", { |
|
1315 "target": "child", |
|
1316 }, debuggerId) |
|
1317 |
1293 |
1318 def __parseClientLine(self, sock): |
1294 def __parseClientLine(self, sock): |
1319 """ |
1295 """ |
1320 Private method to handle data from the client. |
1296 Private method to handle data from the client. |
1321 |
1297 |
1559 params["testname"], params["traceback"], params["id"]) |
1535 params["testname"], params["traceback"], params["id"]) |
1560 |
1536 |
1561 elif method == "ResponseUTTestSucceededUnexpected": |
1537 elif method == "ResponseUTTestSucceededUnexpected": |
1562 self.debugServer.clientUtTestSucceededUnexpected( |
1538 self.debugServer.clientUtTestSucceededUnexpected( |
1563 params["testname"], params["id"]) |
1539 params["testname"], params["id"]) |
1564 |
|
1565 elif method == "RequestForkTo": |
|
1566 self.__askForkTo(params["debuggerId"]) |
|
1567 |
1540 |
1568 def __sendJsonCommand(self, command, params, debuggerId="", sock=None): |
1541 def __sendJsonCommand(self, command, params, debuggerId="", sock=None): |
1569 """ |
1542 """ |
1570 Private method to send a single command to the client. |
1543 Private method to send a single command to the client. |
1571 |
1544 |