
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.
22 lines
551 B
Go
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)
|
|
}
|