def get_effective_breakpoints(self, command): result = editors.get_current_breakpoints() if command == "run_to_cursor": bp = self.get_run_to_cursor_breakpoint() if bp is not None: filename, lineno = bp result.setdefault(filename, set()) result[filename].add(lineno) return result
def send_command(self, cmd: CommandToBackend) -> None: if self._proxy is None: return if self._publishing_events: # allow all event handlers to complete before sending the commands # issued by first event handlers self._postpone_command(cmd) return # First sanity check if ( isinstance(cmd, ToplevelCommand) and not self.is_waiting_toplevel_command() and cmd.name not in ["Reset", "Run", "Debug"] or isinstance(cmd, DebuggerCommand) and not self.is_waiting_debugger_command() ): get_workbench().bell() logging.warning( "RUNNER: Command %s was attempted at state %s" % (cmd, self.get_state()) ) return # Attach extra info if "debug" in cmd.name.lower(): cmd["breakpoints"] = get_current_breakpoints() if "id" not in cmd: cmd["id"] = generate_command_id() cmd["local_cwd"] = get_workbench().get_local_cwd() # Offer the command logging.debug("RUNNER Sending: %s, %s", cmd.name, cmd) response = self._proxy.send_command(cmd) if response == "discard": return None elif response == "postpone": self._postpone_command(cmd) return else: assert response is None get_workbench().event_generate("CommandAccepted", command=cmd) if isinstance(cmd, (ToplevelCommand, DebuggerCommand)): self._set_state("running") if cmd.name[0].isupper(): # This may be only logical restart, which does not look like restart to the runner get_workbench().event_generate("BackendRestart", full=False)