You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
riscemu/riscemu/debug.py

24 lines
578 B
Python

import typing
if typing.TYPE_CHECKING:
from . import *
def launch_debug_session(cpu: 'CPU', mmu: 'MMU', reg: 'Registers', prompt=""):
if not cpu.conf.debug_instruction:
return
import code
import readline
import rlcompleter
# setup some aliases
registers = reg
memory = mmu
mem = mmu
vars = globals()
vars.update(locals())
readline.set_completer(rlcompleter.Completer(vars).complete)
readline.parse_and_bind("tab: complete")
code.InteractiveConsole(vars).interact(banner=prompt, exitmsg="Resuming simulation")