pkg/proc: Move proc exec funcs to Target methods
This commit is contained in:
parent
8bb93e9ae1
commit
ccd438c65f
@ -186,7 +186,7 @@ func EvalExpressionWithCalls(t *Target, g *G, expr string, retLoadCfg LoadConfig
|
||||
|
||||
contReq, ok := <-continueRequest
|
||||
if contReq.cont {
|
||||
return Continue(t)
|
||||
return t.Continue()
|
||||
}
|
||||
|
||||
return finishEvalExpressionWithCalls(t, g, contReq, ok)
|
||||
|
@ -71,23 +71,23 @@ func TestRestartAfterExit(t *testing.T) {
|
||||
protest.AllowRecording(t)
|
||||
withTestRecording("testnextprog", t, func(p *proc.Target, fixture protest.Fixture) {
|
||||
setFunctionBreakpoint(p, t, "main.main")
|
||||
assertNoError(proc.Continue(p), t, "Continue")
|
||||
assertNoError(p.Continue(), t, "Continue")
|
||||
loc, err := p.CurrentThread().Location()
|
||||
assertNoError(err, t, "CurrentThread().Location()")
|
||||
err = proc.Continue(p)
|
||||
err = p.Continue()
|
||||
if _, isexited := err.(proc.ErrProcessExited); err == nil || !isexited {
|
||||
t.Fatalf("program did not exit: %v", err)
|
||||
}
|
||||
|
||||
assertNoError(p.Restart(""), t, "Restart")
|
||||
|
||||
assertNoError(proc.Continue(p), t, "Continue (after restart)")
|
||||
assertNoError(p.Continue(), t, "Continue (after restart)")
|
||||
loc2, err := p.CurrentThread().Location()
|
||||
assertNoError(err, t, "CurrentThread().Location() (after restart)")
|
||||
if loc2.Line != loc.Line {
|
||||
t.Fatalf("stopped at %d (expected %d)", loc2.Line, loc.Line)
|
||||
}
|
||||
err = proc.Continue(p)
|
||||
err = p.Continue()
|
||||
if _, isexited := err.(proc.ErrProcessExited); err == nil || !isexited {
|
||||
t.Fatalf("program did not exit (after exit): %v", err)
|
||||
}
|
||||
@ -98,19 +98,19 @@ func TestRestartDuringStop(t *testing.T) {
|
||||
protest.AllowRecording(t)
|
||||
withTestRecording("testnextprog", t, func(p *proc.Target, fixture protest.Fixture) {
|
||||
setFunctionBreakpoint(p, t, "main.main")
|
||||
assertNoError(proc.Continue(p), t, "Continue")
|
||||
assertNoError(p.Continue(), t, "Continue")
|
||||
loc, err := p.CurrentThread().Location()
|
||||
assertNoError(err, t, "CurrentThread().Location()")
|
||||
|
||||
assertNoError(p.Restart(""), t, "Restart")
|
||||
|
||||
assertNoError(proc.Continue(p), t, "Continue (after restart)")
|
||||
assertNoError(p.Continue(), t, "Continue (after restart)")
|
||||
loc2, err := p.CurrentThread().Location()
|
||||
assertNoError(err, t, "CurrentThread().Location() (after restart)")
|
||||
if loc2.Line != loc.Line {
|
||||
t.Fatalf("stopped at %d (expected %d)", loc2.Line, loc.Line)
|
||||
}
|
||||
err = proc.Continue(p)
|
||||
err = p.Continue()
|
||||
if _, isexited := err.(proc.ErrProcessExited); err == nil || !isexited {
|
||||
t.Fatalf("program did not exit (after exit): %v", err)
|
||||
}
|
||||
@ -139,7 +139,7 @@ func TestReverseBreakpointCounts(t *testing.T) {
|
||||
protest.AllowRecording(t)
|
||||
withTestRecording("bpcountstest", t, func(p *proc.Target, fixture protest.Fixture) {
|
||||
endbp := setFileBreakpoint(p, t, fixture, 28)
|
||||
assertNoError(proc.Continue(p), t, "Continue()")
|
||||
assertNoError(p.Continue(), t, "Continue()")
|
||||
loc, _ := p.CurrentThread().Location()
|
||||
if loc.PC != endbp.Addr {
|
||||
t.Fatalf("did not reach end of main.main function: %s:%d (%#x)", loc.File, loc.Line, loc.PC)
|
||||
@ -152,7 +152,7 @@ func TestReverseBreakpointCounts(t *testing.T) {
|
||||
|
||||
countLoop:
|
||||
for {
|
||||
assertNoError(proc.Continue(p), t, "Continue()")
|
||||
assertNoError(p.Continue(), t, "Continue()")
|
||||
loc, _ := p.CurrentThread().Location()
|
||||
switch loc.PC {
|
||||
case startbp.Addr:
|
||||
@ -195,7 +195,7 @@ func TestCheckpoints(t *testing.T) {
|
||||
withTestRecording("continuetestprog", t, func(p *proc.Target, fixture protest.Fixture) {
|
||||
// Continues until start of main.main, record output of 'when'
|
||||
bp := setFunctionBreakpoint(p, t, "main.main")
|
||||
assertNoError(proc.Continue(p), t, "Continue")
|
||||
assertNoError(p.Continue(), t, "Continue")
|
||||
when0, loc0 := getPosition(p, t)
|
||||
t.Logf("when0: %q (%#x) %x", when0, loc0.PC, p.CurrentThread().ThreadID())
|
||||
|
||||
@ -212,8 +212,8 @@ func TestCheckpoints(t *testing.T) {
|
||||
}
|
||||
|
||||
// Move forward with next, check that the output of 'when' changes
|
||||
assertNoError(proc.Next(p), t, "First Next")
|
||||
assertNoError(proc.Next(p), t, "Second Next")
|
||||
assertNoError(p.Next(), t, "First Next")
|
||||
assertNoError(p.Next(), t, "Second Next")
|
||||
when1, loc1 := getPosition(p, t)
|
||||
t.Logf("when1: %q (%#x) %x", when1, loc1.PC, p.CurrentThread().ThreadID())
|
||||
if loc0.PC == loc1.PC {
|
||||
@ -238,8 +238,8 @@ func TestCheckpoints(t *testing.T) {
|
||||
}
|
||||
|
||||
// Move forward with next again, check that the output of 'when' matches
|
||||
assertNoError(proc.Next(p), t, "First Next")
|
||||
assertNoError(proc.Next(p), t, "Second Next")
|
||||
assertNoError(p.Next(), t, "First Next")
|
||||
assertNoError(p.Next(), t, "Second Next")
|
||||
when3, loc3 := getPosition(p, t)
|
||||
t.Logf("when3: %q (%#x)", when3, loc3.PC)
|
||||
if loc3.PC != loc1.PC {
|
||||
@ -256,8 +256,8 @@ func TestCheckpoints(t *testing.T) {
|
||||
p.Restart(fmt.Sprintf("c%d", cpid))
|
||||
g, _ = proc.FindGoroutine(p, 1)
|
||||
p.SwitchGoroutine(g)
|
||||
assertNoError(proc.Next(p), t, "First Next")
|
||||
assertNoError(proc.Next(p), t, "Second Next")
|
||||
assertNoError(p.Next(), t, "First Next")
|
||||
assertNoError(p.Next(), t, "Second Next")
|
||||
when4, loc4 := getPosition(p, t)
|
||||
t.Logf("when4: %q (%#x)", when4, loc4.PC)
|
||||
if loc4.PC != loc1.PC {
|
||||
@ -282,10 +282,10 @@ func TestIssue1376(t *testing.T) {
|
||||
protest.AllowRecording(t)
|
||||
withTestRecording("continuetestprog", t, func(p *proc.Target, fixture protest.Fixture) {
|
||||
bp := setFunctionBreakpoint(p, t, "main.main")
|
||||
assertNoError(proc.Continue(p), t, "Continue (forward)")
|
||||
assertNoError(p.Continue(), t, "Continue (forward)")
|
||||
_, err := p.ClearBreakpoint(bp.Addr)
|
||||
assertNoError(err, t, "ClearBreakpoint")
|
||||
assertNoError(p.ChangeDirection(proc.Backward), t, "Switching to backward direction")
|
||||
assertNoError(proc.Continue(p), t, "Continue (backward)")
|
||||
assertNoError(p.Continue(), t, "Continue (backward)")
|
||||
})
|
||||
}
|
||||
|
@ -24,7 +24,7 @@ func (err *ErrNoSourceForPC) Error() string {
|
||||
}
|
||||
|
||||
// Next continues execution until the next source line.
|
||||
func Next(dbp *Target) (err error) {
|
||||
func (dbp *Target) Next() (err error) {
|
||||
if _, err := dbp.Valid(); err != nil {
|
||||
return err
|
||||
}
|
||||
@ -37,13 +37,13 @@ func Next(dbp *Target) (err error) {
|
||||
return
|
||||
}
|
||||
|
||||
return Continue(dbp)
|
||||
return dbp.Continue()
|
||||
}
|
||||
|
||||
// Continue continues execution of the debugged
|
||||
// process. It will continue until it hits a breakpoint
|
||||
// or is otherwise stopped.
|
||||
func Continue(dbp *Target) error {
|
||||
func (dbp *Target) Continue() error {
|
||||
if _, err := dbp.Valid(); err != nil {
|
||||
return err
|
||||
}
|
||||
@ -151,7 +151,7 @@ func Continue(dbp *Target) error {
|
||||
if err := dbp.ClearInternalBreakpoints(); err != nil {
|
||||
return err
|
||||
}
|
||||
return StepInstruction(dbp)
|
||||
return dbp.StepInstruction()
|
||||
}
|
||||
default:
|
||||
curthread.Common().returnValues = curbp.Breakpoint.returnInfo.Collect(curthread)
|
||||
@ -257,7 +257,7 @@ func stepInstructionOut(dbp *Target, curthread Thread, fnname1, fnname2 string)
|
||||
|
||||
// Step will continue until another source line is reached.
|
||||
// Will step into functions.
|
||||
func Step(dbp *Target) (err error) {
|
||||
func (dbp *Target) Step() (err error) {
|
||||
if _, err := dbp.Valid(); err != nil {
|
||||
return err
|
||||
}
|
||||
@ -276,10 +276,10 @@ func Step(dbp *Target) (err error) {
|
||||
|
||||
if bp := dbp.CurrentThread().Breakpoint().Breakpoint; bp != nil && bp.Kind == StepBreakpoint && dbp.GetDirection() == Backward {
|
||||
dbp.ClearInternalBreakpoints()
|
||||
return StepInstruction(dbp)
|
||||
return dbp.StepInstruction()
|
||||
}
|
||||
|
||||
return Continue(dbp)
|
||||
return dbp.Continue()
|
||||
}
|
||||
|
||||
// sameGoroutineCondition returns an expression that evaluates to true when
|
||||
@ -325,7 +325,7 @@ func andFrameoffCondition(cond ast.Expr, frameoff int64) ast.Expr {
|
||||
|
||||
// StepOut will continue until the current goroutine exits the
|
||||
// function currently being executed or a deferred function is executed
|
||||
func StepOut(dbp *Target) error {
|
||||
func (dbp *Target) StepOut() error {
|
||||
backward := dbp.GetDirection() == Backward
|
||||
if _, err := dbp.Valid(); err != nil {
|
||||
return err
|
||||
@ -355,7 +355,7 @@ func StepOut(dbp *Target) error {
|
||||
}
|
||||
|
||||
success = true
|
||||
return Continue(dbp)
|
||||
return dbp.Continue()
|
||||
}
|
||||
|
||||
sameGCond := sameGoroutineCondition(selg)
|
||||
@ -367,7 +367,7 @@ func StepOut(dbp *Target) error {
|
||||
}
|
||||
|
||||
success = true
|
||||
return Continue(dbp)
|
||||
return dbp.Continue()
|
||||
}
|
||||
|
||||
var deferpc uint64
|
||||
@ -397,14 +397,14 @@ func StepOut(dbp *Target) error {
|
||||
}
|
||||
|
||||
success = true
|
||||
return Continue(dbp)
|
||||
return dbp.Continue()
|
||||
}
|
||||
|
||||
// StepInstruction will continue the current thread for exactly
|
||||
// one instruction. This method affects only the thread
|
||||
// associated with the selected goroutine. All other
|
||||
// threads will remain stopped.
|
||||
func StepInstruction(dbp *Target) (err error) {
|
||||
func (dbp *Target) StepInstruction() (err error) {
|
||||
thread := dbp.CurrentThread()
|
||||
g := dbp.SelectedGoroutine()
|
||||
if g != nil {
|
||||
@ -414,7 +414,7 @@ func StepInstruction(dbp *Target) (err error) {
|
||||
sameGoroutineCondition(dbp.SelectedGoroutine())); err != nil {
|
||||
return err
|
||||
}
|
||||
return Continue(dbp)
|
||||
return dbp.Continue()
|
||||
}
|
||||
thread = g.Thread
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -32,7 +32,7 @@ func TestIssue419(t *testing.T) {
|
||||
withTestProcess("issue419", t, func(p *proc.Target, fixture protest.Fixture) {
|
||||
defer close(errChan)
|
||||
setFunctionBreakpoint(p, t, "main.main")
|
||||
assertNoError(proc.Continue(p), t, "Continue()")
|
||||
assertNoError(p.Continue(), t, "Continue()")
|
||||
resumeChan := make(chan struct{}, 1)
|
||||
go func() {
|
||||
time.Sleep(500 * time.Millisecond)
|
||||
@ -48,7 +48,7 @@ func TestIssue419(t *testing.T) {
|
||||
errChan <- errIssue419{pid: p.Pid(), err: err}
|
||||
}()
|
||||
p.ResumeNotify(resumeChan)
|
||||
errChan <- proc.Continue(p)
|
||||
errChan <- p.Continue()
|
||||
})
|
||||
|
||||
for i := 0; i < 2; i++ {
|
||||
|
@ -24,7 +24,7 @@ func TestScopeWithEscapedVariable(t *testing.T) {
|
||||
}
|
||||
|
||||
withTestProcess("scopeescapevareval", t, func(p *proc.Target, fixture protest.Fixture) {
|
||||
assertNoError(proc.Continue(p), t, "Continue")
|
||||
assertNoError(p.Continue(), t, "Continue")
|
||||
|
||||
// On the breakpoint there are two 'a' variables in scope, the one that
|
||||
// isn't shadowed is a variable that escapes to the heap and figures in
|
||||
@ -80,7 +80,7 @@ func TestScope(t *testing.T) {
|
||||
t.Logf("%d breakpoints set", len(scopeChecks))
|
||||
|
||||
for {
|
||||
if err := proc.Continue(p); err != nil {
|
||||
if err := p.Continue(); err != nil {
|
||||
if _, exited := err.(proc.ErrProcessExited); exited {
|
||||
break
|
||||
}
|
||||
|
@ -12,7 +12,7 @@ func TestGoroutineCreationLocation(t *testing.T) {
|
||||
protest.AllowRecording(t)
|
||||
withTestProcess("goroutinestackprog", t, func(p *proc.Target, fixture protest.Fixture) {
|
||||
bp := setFunctionBreakpoint(p, t, "main.agoroutine")
|
||||
assertNoError(proc.Continue(p), t, "Continue()")
|
||||
assertNoError(p.Continue(), t, "Continue()")
|
||||
|
||||
gs, _, err := proc.GoroutinesInfo(p, 0, 0)
|
||||
assertNoError(err, t, "GoroutinesInfo")
|
||||
@ -39,6 +39,6 @@ func TestGoroutineCreationLocation(t *testing.T) {
|
||||
}
|
||||
|
||||
p.ClearBreakpoint(bp.Addr)
|
||||
proc.Continue(p)
|
||||
p.Continue()
|
||||
})
|
||||
}
|
||||
|
@ -805,10 +805,10 @@ func (d *Debugger) Command(command *api.DebuggerCommand) (*api.DebuggerState, er
|
||||
if err := d.target.ChangeDirection(proc.Forward); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
err = proc.Continue(d.target)
|
||||
err = d.target.Continue()
|
||||
case api.DirectionCongruentContinue:
|
||||
d.log.Debug("continuing (direction congruent)")
|
||||
err = proc.Continue(d.target)
|
||||
err = d.target.Continue()
|
||||
case api.Call:
|
||||
d.log.Debugf("function call %s", command.Expr)
|
||||
if err := d.target.ChangeDirection(proc.Forward); err != nil {
|
||||
@ -830,55 +830,55 @@ func (d *Debugger) Command(command *api.DebuggerCommand) (*api.DebuggerState, er
|
||||
if err := d.target.ChangeDirection(proc.Backward); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
err = proc.Continue(d.target)
|
||||
err = d.target.Continue()
|
||||
case api.Next:
|
||||
d.log.Debug("nexting")
|
||||
if err := d.target.ChangeDirection(proc.Forward); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
err = proc.Next(d.target)
|
||||
err = d.target.Next()
|
||||
case api.ReverseNext:
|
||||
d.log.Debug("reverse nexting")
|
||||
if err := d.target.ChangeDirection(proc.Backward); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
err = proc.Next(d.target)
|
||||
err = d.target.Next()
|
||||
case api.Step:
|
||||
d.log.Debug("stepping")
|
||||
if err := d.target.ChangeDirection(proc.Forward); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
err = proc.Step(d.target)
|
||||
err = d.target.Step()
|
||||
case api.ReverseStep:
|
||||
d.log.Debug("reverse stepping")
|
||||
if err := d.target.ChangeDirection(proc.Backward); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
err = proc.Step(d.target)
|
||||
err = d.target.Step()
|
||||
case api.StepInstruction:
|
||||
d.log.Debug("single stepping")
|
||||
if err := d.target.ChangeDirection(proc.Forward); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
err = proc.StepInstruction(d.target)
|
||||
err = d.target.StepInstruction()
|
||||
case api.ReverseStepInstruction:
|
||||
d.log.Debug("reverse single stepping")
|
||||
if err := d.target.ChangeDirection(proc.Backward); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
err = proc.StepInstruction(d.target)
|
||||
err = d.target.StepInstruction()
|
||||
case api.StepOut:
|
||||
d.log.Debug("step out")
|
||||
if err := d.target.ChangeDirection(proc.Forward); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
err = proc.StepOut(d.target)
|
||||
err = d.target.StepOut()
|
||||
case api.ReverseStepOut:
|
||||
d.log.Debug("reverse step out")
|
||||
if err := d.target.ChangeDirection(proc.Backward); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
err = proc.StepOut(d.target)
|
||||
err = d.target.StepOut()
|
||||
case api.SwitchThread:
|
||||
d.log.Debugf("switching to thread %d", command.ThreadID)
|
||||
err = d.target.SwitchThread(command.ThreadID)
|
||||
|
@ -200,7 +200,7 @@ func TestVariableEvaluation(t *testing.T) {
|
||||
|
||||
protest.AllowRecording(t)
|
||||
withTestProcess("testvariables", t, func(p *proc.Target, fixture protest.Fixture) {
|
||||
err := proc.Continue(p)
|
||||
err := p.Continue()
|
||||
assertNoError(err, t, "Continue() returned an error")
|
||||
|
||||
for _, tc := range testcases {
|
||||
@ -258,7 +258,7 @@ func TestSetVariable(t *testing.T) {
|
||||
}
|
||||
|
||||
withTestProcess("testvariables2", t, func(p *proc.Target, fixture protest.Fixture) {
|
||||
assertNoError(proc.Continue(p), t, "Continue()")
|
||||
assertNoError(p.Continue(), t, "Continue()")
|
||||
|
||||
for _, tc := range testcases {
|
||||
if tc.name == "iface1" && tc.expr == "parr" {
|
||||
@ -327,7 +327,7 @@ func TestVariableEvaluationShort(t *testing.T) {
|
||||
|
||||
protest.AllowRecording(t)
|
||||
withTestProcess("testvariables", t, func(p *proc.Target, fixture protest.Fixture) {
|
||||
err := proc.Continue(p)
|
||||
err := p.Continue()
|
||||
assertNoError(err, t, "Continue() returned an error")
|
||||
|
||||
for _, tc := range testcases {
|
||||
@ -383,7 +383,7 @@ func TestMultilineVariableEvaluation(t *testing.T) {
|
||||
|
||||
protest.AllowRecording(t)
|
||||
withTestProcess("testvariables", t, func(p *proc.Target, fixture protest.Fixture) {
|
||||
err := proc.Continue(p)
|
||||
err := p.Continue()
|
||||
assertNoError(err, t, "Continue() returned an error")
|
||||
|
||||
for _, tc := range testcases {
|
||||
@ -457,7 +457,7 @@ func TestLocalVariables(t *testing.T) {
|
||||
|
||||
protest.AllowRecording(t)
|
||||
withTestProcess("testvariables", t, func(p *proc.Target, fixture protest.Fixture) {
|
||||
err := proc.Continue(p)
|
||||
err := p.Continue()
|
||||
assertNoError(err, t, "Continue() returned an error")
|
||||
|
||||
for _, tc := range testcases {
|
||||
@ -503,7 +503,7 @@ func TestEmbeddedStruct(t *testing.T) {
|
||||
{"b.s", true, "\"hello\"", "\"hello\"", "string", nil},
|
||||
{"b2", true, "main.B {A: main.A {val: 42}, C: *main.C nil, a: main.A {val: 47}, ptr: *main.A nil}", "main.B {A: (*main.A)(0x…", "main.B", nil},
|
||||
}
|
||||
assertNoError(proc.Continue(p), t, "Continue()")
|
||||
assertNoError(p.Continue(), t, "Continue()")
|
||||
|
||||
ver, _ := goversion.Parse(runtime.Version())
|
||||
if ver.Major >= 0 && !ver.AfterOrEqual(goversion.GoVersion{Major: 1, Minor: 9, Rev: -1}) {
|
||||
@ -535,7 +535,7 @@ func TestEmbeddedStruct(t *testing.T) {
|
||||
|
||||
func TestComplexSetting(t *testing.T) {
|
||||
withTestProcess("testvariables", t, func(p *proc.Target, fixture protest.Fixture) {
|
||||
err := proc.Continue(p)
|
||||
err := p.Continue()
|
||||
assertNoError(err, t, "Continue() returned an error")
|
||||
|
||||
h := func(setExpr, value string) {
|
||||
@ -833,7 +833,7 @@ func TestEvalExpression(t *testing.T) {
|
||||
|
||||
protest.AllowRecording(t)
|
||||
withTestProcess("testvariables2", t, func(p *proc.Target, fixture protest.Fixture) {
|
||||
assertNoError(proc.Continue(p), t, "Continue() returned an error")
|
||||
assertNoError(p.Continue(), t, "Continue() returned an error")
|
||||
for _, tc := range testcases {
|
||||
variable, err := evalVariable(p, tc.name, pnormalLoadConfig)
|
||||
if err != nil && err.Error() == "evaluating methods not supported on this version of Go" {
|
||||
@ -862,7 +862,7 @@ func TestEvalExpression(t *testing.T) {
|
||||
func TestEvalAddrAndCast(t *testing.T) {
|
||||
protest.AllowRecording(t)
|
||||
withTestProcess("testvariables2", t, func(p *proc.Target, fixture protest.Fixture) {
|
||||
assertNoError(proc.Continue(p), t, "Continue() returned an error")
|
||||
assertNoError(p.Continue(), t, "Continue() returned an error")
|
||||
c1addr, err := evalVariable(p, "&c1", pnormalLoadConfig)
|
||||
assertNoError(err, t, "EvalExpression(&c1)")
|
||||
c1addrstr := api.ConvertVar(c1addr).SinglelineString()
|
||||
@ -889,7 +889,7 @@ func TestEvalAddrAndCast(t *testing.T) {
|
||||
func TestMapEvaluation(t *testing.T) {
|
||||
protest.AllowRecording(t)
|
||||
withTestProcess("testvariables2", t, func(p *proc.Target, fixture protest.Fixture) {
|
||||
assertNoError(proc.Continue(p), t, "Continue() returned an error")
|
||||
assertNoError(p.Continue(), t, "Continue() returned an error")
|
||||
m1v, err := evalVariable(p, "m1", pnormalLoadConfig)
|
||||
assertNoError(err, t, "EvalVariable()")
|
||||
m1 := api.ConvertVar(m1v)
|
||||
@ -931,7 +931,7 @@ func TestMapEvaluation(t *testing.T) {
|
||||
func TestUnsafePointer(t *testing.T) {
|
||||
protest.AllowRecording(t)
|
||||
withTestProcess("testvariables2", t, func(p *proc.Target, fixture protest.Fixture) {
|
||||
assertNoError(proc.Continue(p), t, "Continue() returned an error")
|
||||
assertNoError(p.Continue(), t, "Continue() returned an error")
|
||||
up1v, err := evalVariable(p, "up1", pnormalLoadConfig)
|
||||
assertNoError(err, t, "EvalVariable(up1)")
|
||||
up1 := api.ConvertVar(up1v)
|
||||
@ -969,7 +969,7 @@ func TestIssue426(t *testing.T) {
|
||||
// differs from the serialization used by the linker to produce DWARF type information
|
||||
protest.AllowRecording(t)
|
||||
withTestProcess("testvariables2", t, func(p *proc.Target, fixture protest.Fixture) {
|
||||
assertNoError(proc.Continue(p), t, "Continue() returned an error")
|
||||
assertNoError(p.Continue(), t, "Continue() returned an error")
|
||||
for _, testcase := range testcases {
|
||||
v, err := evalVariable(p, testcase.name, pnormalLoadConfig)
|
||||
assertNoError(err, t, fmt.Sprintf("EvalVariable(%s)", testcase.name))
|
||||
@ -1060,7 +1060,7 @@ func TestPackageRenames(t *testing.T) {
|
||||
|
||||
protest.AllowRecording(t)
|
||||
withTestProcess("pkgrenames", t, func(p *proc.Target, fixture protest.Fixture) {
|
||||
assertNoError(proc.Continue(p), t, "Continue() returned an error")
|
||||
assertNoError(p.Continue(), t, "Continue() returned an error")
|
||||
testPackageRenamesHelper(t, p, testcases)
|
||||
|
||||
if goversion.VersionAfterOrEqual(runtime.Version(), 1, 9) {
|
||||
@ -1100,7 +1100,7 @@ func TestConstants(t *testing.T) {
|
||||
t.Skip("constants added in go 1.10")
|
||||
}
|
||||
withTestProcess("consts", t, func(p *proc.Target, fixture protest.Fixture) {
|
||||
assertNoError(proc.Continue(p), t, "Continue")
|
||||
assertNoError(p.Continue(), t, "Continue")
|
||||
for _, testcase := range testcases {
|
||||
variable, err := evalVariable(p, testcase.name, pnormalLoadConfig)
|
||||
assertNoError(err, t, fmt.Sprintf("EvalVariable(%s)", testcase.name))
|
||||
@ -1130,7 +1130,7 @@ func setFunctionBreakpoint(p *proc.Target, t testing.TB, fname string) *proc.Bre
|
||||
func TestIssue1075(t *testing.T) {
|
||||
withTestProcess("clientdo", t, func(p *proc.Target, fixture protest.Fixture) {
|
||||
setFunctionBreakpoint(p, t, "net/http.(*Client).Do")
|
||||
assertNoError(proc.Continue(p), t, "Continue()")
|
||||
assertNoError(p.Continue(), t, "Continue()")
|
||||
for i := 0; i < 10; i++ {
|
||||
scope, err := proc.GoroutineScope(p.CurrentThread())
|
||||
assertNoError(err, t, fmt.Sprintf("GoroutineScope (%d)", i))
|
||||
@ -1271,7 +1271,7 @@ func TestCallFunction(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Skip("function calls not supported on this version of go")
|
||||
}
|
||||
assertNoError(proc.Continue(p), t, "Continue()")
|
||||
assertNoError(p.Continue(), t, "Continue()")
|
||||
for _, tc := range testcases {
|
||||
testCallFunction(t, p, tc)
|
||||
}
|
||||
@ -1381,7 +1381,7 @@ func testCallFunction(t *testing.T, p *proc.Target, tc testCaseCallFunction) {
|
||||
func TestIssue1531(t *testing.T) {
|
||||
// Go 1.12 introduced a change to the map representation where empty cells can be marked with 1 instead of just 0.
|
||||
withTestProcess("issue1531", t, func(p *proc.Target, fixture protest.Fixture) {
|
||||
assertNoError(proc.Continue(p), t, "Continue()")
|
||||
assertNoError(p.Continue(), t, "Continue()")
|
||||
|
||||
hasKeys := func(mv *proc.Variable, keys ...string) {
|
||||
n := 0
|
||||
@ -1463,7 +1463,7 @@ func TestPluginVariables(t *testing.T) {
|
||||
|
||||
withTestProcessArgs("plugintest2", t, ".", []string{pluginFixtures[0].Path, pluginFixtures[1].Path}, protest.AllNonOptimized, func(p *proc.Target, fixture protest.Fixture) {
|
||||
setFileBreakpoint(p, t, fixture, 41)
|
||||
assertNoError(proc.Continue(p), t, "Continue 1")
|
||||
assertNoError(p.Continue(), t, "Continue 1")
|
||||
|
||||
bp := setFunctionBreakpoint(p, t, "github.com/go-delve/delve/_fixtures/plugin2.TypesTest")
|
||||
t.Logf("bp.Addr = %#x", bp.Addr)
|
||||
@ -1473,7 +1473,7 @@ func TestPluginVariables(t *testing.T) {
|
||||
t.Logf("%#x %s\n", image.StaticBase, image.Path)
|
||||
}
|
||||
|
||||
assertNoError(proc.Continue(p), t, "Continue 2")
|
||||
assertNoError(p.Continue(), t, "Continue 2")
|
||||
|
||||
// test that PackageVariables returns variables from the executable and plugins
|
||||
scope, err := evalScope(p)
|
||||
@ -1503,15 +1503,15 @@ func TestPluginVariables(t *testing.T) {
|
||||
|
||||
// test that the concrete type -> interface{} conversion works across plugins (mostly tests proc.dwarfToRuntimeType)
|
||||
assertNoError(setVariable(p, "plugin2.A", "main.ExeGlobal"), t, "setVariable(plugin2.A = main.ExeGlobal)")
|
||||
assertNoError(proc.Continue(p), t, "Continue 3")
|
||||
assertNoError(p.Continue(), t, "Continue 3")
|
||||
assertCurrentLocationFunction(p, t, "github.com/go-delve/delve/_fixtures/plugin2.aIsNotNil")
|
||||
vstr, err := evalVariable(p, "str", pnormalLoadConfig)
|
||||
assertNoError(err, t, "Eval(str)")
|
||||
assertVariable(t, vstr, varTest{"str", true, `"success"`, ``, `string`, nil})
|
||||
|
||||
assertNoError(proc.StepOut(p), t, "StepOut")
|
||||
assertNoError(proc.StepOut(p), t, "StepOut")
|
||||
assertNoError(proc.Next(p), t, "Next")
|
||||
assertNoError(p.StepOut(), t, "StepOut")
|
||||
assertNoError(p.StepOut(), t, "StepOut")
|
||||
assertNoError(p.Next(), t, "Next")
|
||||
|
||||
// read interface variable, inside executable code, with a concrete type defined in a plugin
|
||||
vb, err := evalVariable(p, "b", pnormalLoadConfig)
|
||||
|
Loading…
Reference in New Issue
Block a user