feat: добавил сокращенные команды в пул и возможность получения текущей строки исходного кода

This commit is contained in:
ElectronixTM
2025-03-31 22:03:12 +03:00
parent c556b67fbc
commit 942f3c73fd

View File

@ -65,11 +65,17 @@ class Debugger:
def __init_callbacks__(self): def __init_callbacks__(self):
self._callbacks_table = { self._callbacks_table = {
"step": self._step, "step": self._step,
"s": self._step,
"continue": self._continue, "continue": self._continue,
"c": self._continue,
"breakpoint": self._breakpoint, "breakpoint": self._breakpoint,
"b": self._breakpoint,
"print": self._print, "print": self._print,
"p": self._print,
"run": self._run, "run": self._run,
"inspect": self._inspect "r": self._run,
"inspect": self._inspect,
"i": self._inspect
} }
def do_command(self, command: list[str]) -> str: def do_command(self, command: list[str]) -> str:
@ -87,6 +93,9 @@ class Debugger:
return f"Virtual machine exception: {e.message}" return f"Virtual machine exception: {e.message}"
return "" return ""
def get_current_source_line_number(self) -> int:
return self._dbg_dict["instructions"][self._vm.pc.value]['srcline']
def _continue(self, args: list[str]) -> str: def _continue(self, args: list[str]) -> str:
try: try:
self._vm.continue_() self._vm.continue_()