delve/pkg/proc/dwarf_export_test.go
Alessandro Arzilli 6a70d531bb
proc/*: implement proc.(*compositeMemory).WriteMemory (#2271)
Delve represents registerized variables (fully or partially) using
compositeMemory, implementing proc.(*compositeMemory).WriteMemory is
necessary to make SetVariable and function calls work when Go will
switch to using the register calling convention in 1.17.

This commit also makes some refactoring by moving the code that
converts between register numbers and register names out of pkg/proc
into a different package.
2021-03-04 10:28:28 -08:00

22 lines
551 B
Go

package proc
import "github.com/go-delve/delve/pkg/dwarf/op"
// PackageVars returns bi.packageVars (for tests)
func (bi *BinaryInfo) PackageVars() []packageVar {
return bi.packageVars
}
func NewCompositeMemory(p *Target, pieces []op.Piece) (*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
return newCompositeMemory(p.Memory(), arch, dwarfregs, pieces)
}