Closed
Description
I'd like to use miri to step through code like in a debugger. At first I thought it would make sense to restructure miri so the interpreter ends up looping over an iterator that does the actual processing. But now I wonder if it would make sense to insert "hooks" into random places inside the interpreter, which a caller to the interpreter could attach to. So basically the interpreter runs in a thread and whenever it encounters a hook-place, it checks for a hook and if one is there, starts interacting with it.
The hook has a few options available:
- obtain information about a stack frame
- obtain the stack frame list
- read the memory behind a pointer
- execute an arbitrary MIR statement.
- stop the interpreter
- allow the interpreter to continue
- add/remove hooks
- step to the next hook-place
Possible hook-places:
- reaching a file:line (requires checking spans in the interpreter)
- changes a memory location gotten during another hook-processing
- interpretation errors (unknown intrinsic, overflow, UB)
What do you think?