diff --git a/pkg/compiler/codegen.go b/pkg/compiler/codegen.go index 88655b188..252f31e22 100644 --- a/pkg/compiler/codegen.go +++ b/pkg/compiler/codegen.go @@ -593,7 +593,6 @@ func (c *codegen) Visit(node ast.Node) ast.Visitor { case *ast.AssignStmt: multiRet := len(n.Rhs) != len(n.Lhs) - c.saveSequencePoint(n) // Assign operations are grouped https://github.com/golang/go/blob/master/src/go/types/stmt.go#L160 isAssignOp := token.ADD_ASSIGN <= n.Tok && n.Tok <= token.AND_NOT_ASSIGN if isAssignOp { @@ -708,8 +707,8 @@ func (c *codegen) Visit(node ast.Node) ast.Visitor { c.processDefers() - c.saveSequencePoint(n) if len(c.pkgInfoInline) == 0 { + c.saveSequencePoint(n) emit.Opcodes(c.prog.BinWriter, opcode.RET) } return nil diff --git a/pkg/compiler/inline.go b/pkg/compiler/inline.go index 74e33c190..3f0881c00 100644 --- a/pkg/compiler/inline.go +++ b/pkg/compiler/inline.go @@ -21,6 +21,11 @@ import ( // // } func (c *codegen) inlineCall(f *funcScope, n *ast.CallExpr) { + // Save sequence point for the debugger. Not having NOP can result in + // one instruction being used by multiple sequence points. + c.saveSequencePoint(n) + emit.Opcodes(c.prog.BinWriter, opcode.NOP) + labelSz := len(c.labelList) offSz := len(c.inlineLabelOffsets) c.inlineLabelOffsets = append(c.inlineLabelOffsets, labelSz)