proc: fix RFLAGS corruption after call injection on amd64 (#3002)

debugCallV2 for amd64 has a bug where it corrupts the flags registers
every time it is called, this commit works around that problem by
restoring flags one extra time to its original value after stepping out
of debugCallV2.

Fixes #2985
This commit is contained in:
Alessandro Arzilli
2022-05-05 17:41:40 +02:00
committed by GitHub
parent 51090f003b
commit b53fcbe43a
6 changed files with 98 additions and 1 deletions

View File

@ -1,6 +1,9 @@
package proc
import "github.com/go-delve/delve/pkg/dwarf/op"
import (
"github.com/go-delve/delve/pkg/dwarf/op"
"golang.org/x/arch/x86/x86asm"
)
// PackageVars returns bi.packageVars (for tests)
func (bi *BinaryInfo) PackageVars() []packageVar {
@ -23,3 +26,7 @@ func NewCompositeMemory(p *Target, pieces []op.Piece, base uint64) (*compositeMe
}
return mem, err
}
func IsJNZ(inst archInst) bool {
return inst.(*x86Inst).Op == x86asm.JNE
}