def get_effective_breakpoints(self, command): result = code.get_current_breakpoints() if command == "run_to_cursor": bp = self.get_run_to_cursor_breakpoint() if bp != 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() # Offer the command logging.debug("RUNNER Sending: %s, %s", cmd.name, cmd) response = self._proxy.send_command(cmd) if response == "discard": return 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(): get_workbench().event_generate("BackendRestart", full=False)
def check_issue_command(self, command, **kwargs): cmd = DebuggerCommand(command, **kwargs) self._last_debugger_command = cmd if get_runner().is_waiting_debugger_command(): logging.debug("_check_issue_debugger_command: %s", cmd) # tell VM the state we are seeing cmd.setdefault( frame_id=self._last_progress_message.stack[-1].id, breakpoints=code.get_current_breakpoints(), cursor_position=self.get_run_to_cursor_breakpoint(), ) cmd.setdefault( state=self._last_progress_message.stack[-1].event, focus=self._last_progress_message.stack[-1].focus, ) get_runner().send_command(cmd) else: logging.debug("Bad state for sending debugger command " + str(command))
def check_issue_command(self, command, **kwargs): cmd = DebuggerCommand(command, **kwargs) self._last_debugger_command = cmd if get_runner().is_waiting_debugger_command(): logging.debug("_check_issue_debugger_command: %s", cmd) # tell VM the state we are seeing cmd.setdefault( frame_id=self._last_progress_message.stack[-1].id, breakpoints=code.get_current_breakpoints(), cursor_position=self.get_run_to_cursor_breakpoint(), state=self._last_progress_message.stack[-1].event, focus=self._last_progress_message.stack[-1].focus, allow_stepping_into_libraries=get_workbench().get_option( "debugger.allow_stepping_into_libraries" ), ) get_runner().send_command(cmd) if command == "resume": self.clear_last_frame() else: logging.debug("Bad state for sending debugger command " + str(command))