40 lines
659 B
Python
40 lines
659 B
Python
# api/debugger.py
|
|
|
|
from fastapi import APIRouter
|
|
|
|
router = APIRouter()
|
|
|
|
ENGINE = None
|
|
|
|
|
|
def set_engine(engine):
|
|
global ENGINE
|
|
ENGINE = engine
|
|
|
|
|
|
# -----------------------------
|
|
# RESUME
|
|
# -----------------------------
|
|
@router.post("/debugger/resume")
|
|
def resume():
|
|
ENGINE.resume()
|
|
return {"state": "running"}
|
|
|
|
|
|
# -----------------------------
|
|
# PAUSE
|
|
# -----------------------------
|
|
@router.post("/debugger/pause")
|
|
def pause():
|
|
ENGINE.pause()
|
|
return {"state": "paused"}
|
|
|
|
|
|
# -----------------------------
|
|
# STEP
|
|
# -----------------------------
|
|
@router.post("/debugger/step")
|
|
def step():
|
|
ENGINE.step()
|
|
return {"state": "stepped"}
|