vm: add stepInto,stepOver,stepOut
Original C# vm debugger behavior
This commit is contained in:
parent
aab2f9a837
commit
591d5eafbe
2 changed files with 124 additions and 0 deletions
|
@ -128,6 +128,30 @@ Example:
|
|||
> step 10`,
|
||||
Func: handleStep,
|
||||
},
|
||||
{
|
||||
Name: "stepinto",
|
||||
Help: "Stepinto instruction to take in the debugger",
|
||||
LongHelp: `Usage: stepInto
|
||||
example:
|
||||
> stepinto`,
|
||||
Func: handleStepInto,
|
||||
},
|
||||
{
|
||||
Name: "stepout",
|
||||
Help: "Stepout instruction to take in the debugger",
|
||||
LongHelp: `Usage: stepOut
|
||||
example:
|
||||
> stepout`,
|
||||
Func: handleStepOut,
|
||||
},
|
||||
{
|
||||
Name: "stepover",
|
||||
Help: "Stepover instruction to take in the debugger",
|
||||
LongHelp: `Usage: stepOver
|
||||
example:
|
||||
> stepover`,
|
||||
Func: handleStepOver,
|
||||
},
|
||||
{
|
||||
Name: "ops",
|
||||
Help: "Dump opcodes of the current loaded program",
|
||||
|
@ -297,6 +321,34 @@ func handleStep(c *ishell.Context) {
|
|||
changePrompt(c, v)
|
||||
}
|
||||
|
||||
func handleStepInto(c *ishell.Context) {
|
||||
handleStepType(c, "into")
|
||||
}
|
||||
|
||||
func handleStepOut(c *ishell.Context) {
|
||||
handleStepType(c, "out")
|
||||
}
|
||||
|
||||
func handleStepOver(c *ishell.Context) {
|
||||
handleStepType(c, "over")
|
||||
}
|
||||
|
||||
func handleStepType(c *ishell.Context, stepType string) {
|
||||
if !checkVMIsReady(c) {
|
||||
return
|
||||
}
|
||||
v := getVMFromContext(c)
|
||||
switch stepType {
|
||||
case "into":
|
||||
v.StepInto()
|
||||
case "out":
|
||||
v.StepOut()
|
||||
case "over":
|
||||
v.StepOver()
|
||||
}
|
||||
changePrompt(c, v)
|
||||
}
|
||||
|
||||
func handleOps(c *ishell.Context) {
|
||||
if !checkVMIsReady(c) {
|
||||
return
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue