delve/_fixtures/nopbreakpoint/main.go
Alessandro Arzilli f1a5e654ff proc: fix breakpoint confusion on resume (#1738)
Fixes a case of breakpoint confusion on resume caused by having two
breakpoints one byte apart. This bug can cause the target program to
resume execution a single byte inside an instruction and crash either
with SIGILL or a SIGSEGV, or misbehave (depending on how the truncated
instruction is decoded).

native.(*Thread).StepInstruction should call FindBreakpoint using
adjustPC==false because at that point the PC of the thread should
already have been adjusted (and it has been).
2019-10-28 14:55:32 -07:00

19 lines
147 B
Go

package main
import (
"fmt"
)
var g int = 0
func compromised()
func skipped() {
g++
}
func main() {
compromised()
fmt.Printf("%d\n", g)
}