Skip to content

Commit

Permalink
pkg/cover/backend: fix arch usage
Browse files Browse the repository at this point in the history
There is no need to init arch every loop iteration.
  • Loading branch information
tarasmadan committed Feb 28, 2025
1 parent 6a8fcbc commit cb370b8
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions pkg/cover/backend/dwarf.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ type Arch struct {
callTarget func(arch *Arch, insn []byte, pc uint64) uint64
}

var arches = map[string]Arch{
var arches = map[string]*Arch{
targets.AMD64: {
scanSize: 1,
callLen: 5,
Expand Down Expand Up @@ -535,9 +535,9 @@ func readCoverPoints(target *targets.Target, info *symbolInfo, data []byte) ([2]
}

i := 0
arch := arches[target.Arch]
for {
arch := arches[target.Arch]
callTarget, pc := nextCallTarget(&arch, info.textAddr, data, &i)
callTarget, pc := nextCallTarget(arch, info.textAddr, data, &i)
if callTarget == 0 {
break
}
Expand Down

0 comments on commit cb370b8

Please sign in to comment.