delve/pkg/proc/dwarf_export_test.go
Alessandro Arzilli b53fcbe43a
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
2022-05-05 08:41:40 -07:00

33 lines
739 B
Go

package proc
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 {
return bi.packageVars
}
func NewCompositeMemory(p *Target, pieces []op.Piece, base uint64) (*compositeMemory, error) {
regs, err := p.CurrentThread().Registers()
if err != nil {
return nil, err
}
arch := p.BinInfo().Arch
dwarfregs := arch.RegistersToDwarfRegisters(0, regs)
dwarfregs.ChangeFunc = p.CurrentThread().SetReg
mem, err := newCompositeMemory(p.Memory(), arch, *dwarfregs, pieces)
if mem != nil {
mem.base = base
}
return mem, err
}
func IsJNZ(inst archInst) bool {
return inst.(*x86Inst).Op == x86asm.JNE
}