proc: Continue should always work after CallFunction
Continue did not resume execution after a call to CallFunction if the point where the process was stopped, before the call CallFunction, was a breakpoint. Fixes #1374
This commit is contained in:
parent
d7ea38b89a
commit
f72c48c034
12
_fixtures/issue1374.go
Normal file
12
_fixtures/issue1374.go
Normal file
@ -0,0 +1,12 @@
|
||||
package main
|
||||
|
||||
import "fmt"
|
||||
|
||||
func main() {
|
||||
i := getNum()
|
||||
fmt.Println(i)
|
||||
}
|
||||
|
||||
func getNum() int {
|
||||
return 0
|
||||
}
|
@ -281,7 +281,7 @@ func stepInstructionOut(dbp Process, curthread Thread, fnname1, fnname2 string)
|
||||
if g := dbp.SelectedGoroutine(); g != nil {
|
||||
g.CurrentLoc = *loc
|
||||
}
|
||||
return nil
|
||||
return curthread.SetCurrentBreakpoint()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -4084,3 +4084,20 @@ func TestReadDeferArgs(t *testing.T) {
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
func TestIssue1374(t *testing.T) {
|
||||
// Continue did not work when stopped at a breakpoint immediately after calling CallFunction.
|
||||
protest.MustSupportFunctionCalls(t, testBackend)
|
||||
withTestProcess("issue1374", t, func(p proc.Process, fixture protest.Fixture) {
|
||||
setFileBreakpoint(p, t, fixture, 7)
|
||||
assertNoError(proc.Continue(p), t, "First Continue")
|
||||
assertLineNumber(p, t, 7, "Did not continue to correct location (first continue),")
|
||||
assertNoError(proc.CallFunction(p, "getNum()", &normalLoadConfig, true), t, "Call")
|
||||
err := proc.Continue(p)
|
||||
if _, isexited := err.(proc.ErrProcessExited); !isexited {
|
||||
regs, _ := p.CurrentThread().Registers(false)
|
||||
f, l, _ := p.BinInfo().PCToLine(regs.PC())
|
||||
t.Fatalf("expected process exited error got %v at %s:%d", err, f, l)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user