From cb5785324d42967ce0c5e6518f907d1807aa15a0 Mon Sep 17 00:00:00 2001 From: Derek Parker Date: Sun, 9 Nov 2014 18:20:49 -0600 Subject: [PATCH] Acknowledge runtime.breakpoint --- proctl/proctl_linux_amd64.go | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/proctl/proctl_linux_amd64.go b/proctl/proctl_linux_amd64.go index 6d556477..bace27f2 100644 --- a/proctl/proctl_linux_amd64.go +++ b/proctl/proctl_linux_amd64.go @@ -407,7 +407,21 @@ func trapWait(dbp *DebuggedProcess, p int, options int) (int, *syscall.WaitStatu if err != nil { return -1, nil, fmt.Errorf("could not get current pc %s", err) } - // Check to see if we have hit a breakpoint. + // Check to see if we hit a runtime.breakpoint + fn := dbp.GoSymTable.PCToFunc(pc) + if fn != nil && fn.Name == "runtime.breakpoint" { + // step twice to get back to user code + for i := 0; i < 2; i++ { + err = thread.Step() + if err != nil { + return -1, nil, err + } + } + handleBreakPoint(dbp, thread, pid) + return pid, &status, nil + } + + // Check to see if we have hit a user set breakpoint. if bp, ok := dbp.BreakPoints[pc-1]; ok { if !bp.temp { handleBreakPoint(dbp, thread, pid)