github.com/cnboonhan/delve@v0.0.0-20230908061759-363f2388c2fb/pkg/proc/dwarf_export_test.go (about)

     1  package proc
     2  
     3  import (
     4  	"github.com/go-delve/delve/pkg/dwarf/op"
     5  	"golang.org/x/arch/x86/x86asm"
     6  )
     7  
     8  // PackageVars returns bi.packageVars (for tests)
     9  func (bi *BinaryInfo) PackageVars() []packageVar {
    10  	return bi.packageVars
    11  }
    12  
    13  func NewCompositeMemory(p *Target, pieces []op.Piece, base uint64) (*compositeMemory, error) {
    14  	regs, err := p.CurrentThread().Registers()
    15  	if err != nil {
    16  		return nil, err
    17  	}
    18  
    19  	arch := p.BinInfo().Arch
    20  	dwarfregs := arch.RegistersToDwarfRegisters(0, regs)
    21  	dwarfregs.ChangeFunc = p.CurrentThread().SetReg
    22  
    23  	mem, err := newCompositeMemory(p.Memory(), arch, *dwarfregs, pieces, 0)
    24  	if mem != nil {
    25  		mem.base = base
    26  	}
    27  	return mem, err
    28  }
    29  
    30  func IsJNZ(inst archInst) bool {
    31  	return inst.(*x86Inst).Op == x86asm.JNE
    32  }