src/eric7/Debugger/DebugServer.py

branch
eric7
changeset 10417
c6011e501282
parent 10373
093dcebe5ecb
child 10423
299802979277
equal deleted inserted replaced
10416:5d807e997391 10417:c6011e501282
971 def remoteEnvironment(self, env): 971 def remoteEnvironment(self, env):
972 """ 972 """
973 Public method to set the environment for a program to debug, run, ... 973 Public method to set the environment for a program to debug, run, ...
974 974
975 @param env environment settings 975 @param env environment settings
976 @type str 976 @type str or dict
977 """ 977 @exception TypeError taised to indicate an unsupported parameter type
978 envlist = shlex.split(env) 978 """
979 envdict = {} 979 if not isinstance(env, (dict, str)):
980 for el in envlist: 980 raise TypeError("'env' must be of type str or list of str")
981 if "=" in el: 981 elif isinstance(env, str):
982 key, value = el.split("=", 1) 982 envlist = shlex.split(env)
983 envdict[key] = value 983 envdict = {}
984 else: 984 for el in envlist:
985 envdict[el] = "" 985 if "=" in el:
986 key, value = el.split("=", 1)
987 envdict[key] = value
988 else:
989 envdict[el] = ""
990 else:
991 envdict = env
986 self.debuggerInterface.remoteEnvironment(envdict) 992 self.debuggerInterface.remoteEnvironment(envdict)
987 993
988 def remoteLoad( 994 def remoteLoad(
989 self, 995 self,
990 venvName, 996 venvName,
1007 """ 1013 """
1008 Public method to load a new program to debug. 1014 Public method to load a new program to debug.
1009 1015
1010 @param venvName name of the virtual environment to be used 1016 @param venvName name of the virtual environment to be used
1011 @type str 1017 @type str
1012 @param fn the filename to debug 1018 @param fn filename to debug
1013 @type str 1019 @type str
1014 @param argv the command line arguments to pass to the program 1020 @param argv list of command line arguments to pass to the program
1015 @type str 1021 @type list of str
1016 @param wd the working directory for the program 1022 @param wd working directory for the program
1017 @type str 1023 @type str
1018 @param env environment parameter settings 1024 @param env environment parameter settings
1019 @type str 1025 @type str or dict
1020 @param autoClearShell flag indicating, that the interpreter window 1026 @param autoClearShell flag indicating, that the interpreter window
1021 should be cleared 1027 should be cleared
1022 @type bool 1028 @type bool
1023 @param tracePython flag indicating if the Python library should be 1029 @param tracePython flag indicating if the Python library should be
1024 traced as well 1030 traced as well
1118 """ 1124 """
1119 Public method to load a new program to run. 1125 Public method to load a new program to run.
1120 1126
1121 @param venvName name of the virtual environment to be used 1127 @param venvName name of the virtual environment to be used
1122 @type str 1128 @type str
1123 @param fn the filename to debug 1129 @param fn filename to debug
1124 @type str 1130 @type str
1125 @param argv the command line arguments to pass to the program 1131 @param argv list of command line arguments to pass to the program
1126 @type str 1132 @type list str
1127 @param wd the working directory for the program 1133 @param wd working directory for the program
1128 @type str 1134 @type str
1129 @param env environment parameter settings 1135 @param env environment parameter settings
1130 @type str 1136 @type str or dict
1131 @param autoClearShell flag indicating, that the interpreter window 1137 @param autoClearShell flag indicating, that the interpreter window
1132 should be cleared 1138 should be cleared
1133 @type bool 1139 @type bool
1134 @param forProject flag indicating a project related action 1140 @param forProject flag indicating a project related action
1135 @type bool 1141 @type bool
1197 """ 1203 """
1198 Public method to load a new program to collect coverage data. 1204 Public method to load a new program to collect coverage data.
1199 1205
1200 @param venvName name of the virtual environment to be used 1206 @param venvName name of the virtual environment to be used
1201 @type str 1207 @type str
1202 @param fn the filename to debug 1208 @param fn filename to debug
1203 @type str 1209 @type str
1204 @param argv the command line arguments to pass to the program 1210 @param argv list of command line arguments to pass to the program
1205 @type str 1211 @type list of str
1206 @param wd the working directory for the program 1212 @param wd working directory for the program
1207 @type str 1213 @type str
1208 @param env environment parameter settings 1214 @param env environment parameter settings
1209 @type str 1215 @type str or dict
1210 @param autoClearShell flag indicating, that the interpreter window 1216 @param autoClearShell flag indicating, that the interpreter window
1211 should be cleared 1217 should be cleared
1212 @type bool 1218 @type bool
1213 @param erase flag indicating that coverage info should be 1219 @param erase flag indicating that coverage info should be
1214 cleared first 1220 cleared first
1279 """ 1285 """
1280 Public method to load a new program to collect profiling data. 1286 Public method to load a new program to collect profiling data.
1281 1287
1282 @param venvName name of the virtual environment to be used 1288 @param venvName name of the virtual environment to be used
1283 @type str 1289 @type str
1284 @param fn the filename to debug 1290 @param fn filename to debug
1285 @type str 1291 @type str
1286 @param argv the command line arguments to pass to the program 1292 @param argv list of command line arguments to pass to the program
1287 @type str 1293 @type list of str
1288 @param wd the working directory for the program 1294 @param wd working directory for the program
1289 @type str 1295 @type str
1290 @param env environment parameter settings 1296 @param env environment parameter settings
1291 @type str 1297 @type str or dict
1292 @param autoClearShell flag indicating, that the interpreter window 1298 @param autoClearShell flag indicating, that the interpreter window
1293 should be cleared 1299 should be cleared
1294 @type bool 1300 @type bool
1295 @param erase flag indicating that coverage info should be 1301 @param erase flag indicating that coverage info should be
1296 cleared first 1302 cleared first
1348 """ 1354 """
1349 Public method to execute a Python statement. 1355 Public method to execute a Python statement.
1350 1356
1351 @param debuggerId ID of the debugger backend 1357 @param debuggerId ID of the debugger backend
1352 @type str 1358 @type str
1353 @param stmt the Python statement to execute. 1359 @param stmt Python statement to execute.
1354 @type str 1360 @type str
1355 """ 1361 """
1356 self.debuggerInterface.remoteStatement(debuggerId, stmt.rstrip()) 1362 self.debuggerInterface.remoteStatement(debuggerId, stmt.rstrip())
1357 1363
1358 def remoteStep(self, debuggerId): 1364 def remoteStep(self, debuggerId):
1406 Public method to continue the debugged program to the given line 1412 Public method to continue the debugged program to the given line
1407 or until returning from the current frame. 1413 or until returning from the current frame.
1408 1414
1409 @param debuggerId ID of the debugger backend 1415 @param debuggerId ID of the debugger backend
1410 @type str 1416 @type str
1411 @param line the new line, where execution should be continued to 1417 @param line new line, where execution should be continued to
1412 @type int 1418 @type int
1413 """ 1419 """
1414 self.debuggerInterface.remoteContinueUntil(debuggerId, line) 1420 self.debuggerInterface.remoteContinueUntil(debuggerId, line)
1415 1421
1416 def remoteMoveIP(self, debuggerId, line): 1422 def remoteMoveIP(self, debuggerId, line):
1417 """ 1423 """
1418 Public method to move the instruction pointer to a different line. 1424 Public method to move the instruction pointer to a different line.
1419 1425
1420 @param debuggerId ID of the debugger backend 1426 @param debuggerId ID of the debugger backend
1421 @type str 1427 @type str
1422 @param line the new line, where execution should be continued 1428 @param line new line, where execution should be continued
1423 @type int 1429 @type int
1424 """ 1430 """
1425 self.debuggerInterface.remoteMoveIP(debuggerId, line) 1431 self.debuggerInterface.remoteMoveIP(debuggerId, line)
1426 1432
1427 def remoteBreakpoint( 1433 def remoteBreakpoint(
1432 1438
1433 @param debuggerId ID of the debugger backend 1439 @param debuggerId ID of the debugger backend
1434 @type str 1440 @type str
1435 @param fn filename the breakpoint belongs to 1441 @param fn filename the breakpoint belongs to
1436 @type str 1442 @type str
1437 @param line linenumber of the breakpoint 1443 @param line line number of the breakpoint
1438 @type int 1444 @type int
1439 @param setBreakpoint flag indicating setting or resetting a breakpoint 1445 @param setBreakpoint flag indicating setting or resetting a breakpoint
1440 @type bool 1446 @type bool
1441 @param cond condition of the breakpoint 1447 @param cond condition of the breakpoint
1442 @type str 1448 @type str
1453 1459
1454 @param debuggerId ID of the debugger backend 1460 @param debuggerId ID of the debugger backend
1455 @type str 1461 @type str
1456 @param fn filename the breakpoint belongs to 1462 @param fn filename the breakpoint belongs to
1457 @type str 1463 @type str
1458 @param line linenumber of the breakpoint 1464 @param line line number of the breakpoint
1459 @type int 1465 @type int
1460 @param enable flag indicating enabling or disabling a breakpoint 1466 @param enable flag indicating enabling or disabling a breakpoint
1461 @type bool 1467 @type bool
1462 """ 1468 """
1463 self.debuggerInterface.remoteBreakpointEnable(debuggerId, fn, line, enable) 1469 self.debuggerInterface.remoteBreakpointEnable(debuggerId, fn, line, enable)
1468 1474
1469 @param debuggerId ID of the debugger backend 1475 @param debuggerId ID of the debugger backend
1470 @type str 1476 @type str
1471 @param fn filename the breakpoint belongs to 1477 @param fn filename the breakpoint belongs to
1472 @type str 1478 @type str
1473 @param line linenumber of the breakpoint 1479 @param line line number of the breakpoint
1474 @type int 1480 @type int
1475 @param count number of occurrences to ignore 1481 @param count number of occurrences to ignore
1476 @type int 1482 @type int
1477 """ 1483 """
1478 self.debuggerInterface.remoteBreakpointIgnore(debuggerId, fn, line, count) 1484 self.debuggerInterface.remoteBreakpointIgnore(debuggerId, fn, line, count)
1526 """ 1532 """
1527 Public method to send the raw input to the debugged program. 1533 Public method to send the raw input to the debugged program.
1528 1534
1529 @param debuggerId ID of the debugger backend 1535 @param debuggerId ID of the debugger backend
1530 @type str 1536 @type str
1531 @param inputString the raw input 1537 @param inputString raw input
1532 @type str 1538 @type str
1533 """ 1539 """
1534 self.debuggerInterface.remoteRawInput(debuggerId, inputString) 1540 self.debuggerInterface.remoteRawInput(debuggerId, inputString)
1535 self.clientRawInputSent.emit(debuggerId) 1541 self.clientRawInputSent.emit(debuggerId)
1536 1542
1567 """ 1573 """
1568 Public method to request the variables of the debugged program. 1574 Public method to request the variables of the debugged program.
1569 1575
1570 @param debuggerId ID of the debugger backend 1576 @param debuggerId ID of the debugger backend
1571 @type str 1577 @type str
1572 @param scope the scope of the variables (0 = local, 1 = global) 1578 @param scope scope of the variables (0 = local, 1 = global)
1573 @type int 1579 @type int
1574 @param filterList list of variable types to filter out 1580 @param filterList list of variable types to filter out
1575 @type list of str 1581 @type list of str
1576 @param framenr framenumber of the variables to retrieve 1582 @param framenr framenumber of the variables to retrieve
1577 @type int 1583 @type int
1586 """ 1592 """
1587 Public method to request the variables of the debugged program. 1593 Public method to request the variables of the debugged program.
1588 1594
1589 @param debuggerId ID of the debugger backend 1595 @param debuggerId ID of the debugger backend
1590 @type str 1596 @type str
1591 @param scope the scope of the variables (0 = local, 1 = global) 1597 @param scope scope of the variables (0 = local, 1 = global)
1592 @type int 1598 @type int
1593 @param filterList list of variable types to filter out 1599 @param filterList list of variable types to filter out
1594 @type list of str 1600 @type list of str
1595 @param var list encoded name of variable to retrieve 1601 @param var list encoded name of variable to retrieve
1596 @type list of str 1602 @type list of str
1619 """ 1625 """
1620 Public method to set a variables filter list. 1626 Public method to set a variables filter list.
1621 1627
1622 @param debuggerId ID of the debugger backend 1628 @param debuggerId ID of the debugger backend
1623 @type str 1629 @type str
1624 @param scope the scope of the variables (0 = local, 1 = global) 1630 @param scope scope of the variables (0 = local, 1 = global)
1625 @type int 1631 @type int
1626 @param filterStr regexp string for variable names to filter out 1632 @param filterStr regexp string for variable names to filter out
1627 @type str 1633 @type str
1628 """ 1634 """
1629 self.debuggerInterface.remoteClientSetFilter(debuggerId, scope, filterStr) 1635 self.debuggerInterface.remoteClientSetFilter(debuggerId, scope, filterStr)
1656 Public slot to get the a list of possible commandline completions 1662 Public slot to get the a list of possible commandline completions
1657 from the remote client. 1663 from the remote client.
1658 1664
1659 @param debuggerId ID of the debugger backend 1665 @param debuggerId ID of the debugger backend
1660 @type str 1666 @type str
1661 @param text the text to be completed 1667 @param text text to be completed
1662 @type str 1668 @type str
1663 """ 1669 """
1664 self.debuggerInterface.remoteCompletion(debuggerId, text) 1670 self.debuggerInterface.remoteCompletion(debuggerId, text)
1665 1671
1666 def signalClientOutput(self, line, debuggerId): 1672 def signalClientOutput(self, line, debuggerId):

eric ide

mercurial