Support bounded machine instruction step counts in MCP

This commit is contained in:
Александр Петров
2026-09-17 23:22:37 +03:00
parent e8189b137a
commit 259c782190
13 changed files with 62 additions and 10 deletions
+4 -2
View File
@@ -201,8 +201,10 @@ class McpSession:
def pause_execution(self):
return self.call('pause', {'owner': self.owner})
def step_instruction(self):
return self.call('step', {'owner': self.owner})
def step_instruction(self, count: int = 1):
if not isinstance(count, int) or isinstance(count, bool) or count < 1 or count > 64:
raise SessionError('Число машинных шагов должно быть 1..64')
return self.call('step', {'count': count, 'owner': self.owner})
def step_source(self, kind: str = 'into'):
if kind not in ('into', 'over', 'out'):
+4 -1
View File
@@ -406,8 +406,11 @@ class SessionController:
if method == 'step':
if self.running:
raise SessionError('CPU уже выполняется; сначала Pause')
count = arguments.get('count', 1)
if type(count) is not int or count < 1 or count > 64:
raise SessionError('Число машинных шагов должно быть 1..64')
self._control(arguments)
self.session.bridge.request('step')
self.session.bridge.request('step', count=count)
self.running = True
self._emit('continued', {'reason': 'step'})
location = self.session.where(self.session.bridge.wait_stopped())