File: dwarf_export_test.go

package info (click to toggle)
delve 1.24.0-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 14,092 kB
  • sloc: ansic: 111,943; sh: 169; asm: 141; makefile: 43; python: 23
file content (43 lines) | stat: -rw-r--r-- 1,041 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
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, 0)
	if mem != nil {
		mem.base = base
	}
	return mem, err
}

func IsJNZ(inst archInst) bool {
	return inst.(*x86Inst).Op == x86asm.JNE
}

// HasDebugPinner returns true if the target has runtime.debugPinner.
func (bi *BinaryInfo) HasDebugPinner() bool {
	return bi.hasDebugPinner()
}

// DebugPinCount returns the number of addresses pinned during the last
// function call injection.
func DebugPinCount() int {
	return debugPinCount
}