aboutsummaryrefslogtreecommitdiffstats
path: root/pkg/ipc
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/ipc')
-rw-r--r--pkg/ipc/ipc.go19
1 files changed, 19 insertions, 0 deletions
diff --git a/pkg/ipc/ipc.go b/pkg/ipc/ipc.go
index 826d3068d..d87cb8b0e 100644
--- a/pkg/ipc/ipc.go
+++ b/pkg/ipc/ipc.go
@@ -6,6 +6,7 @@ package ipc
import (
"fmt"
"io"
+ "maps"
"os"
"os/exec"
"path/filepath"
@@ -98,6 +99,14 @@ type CallInfo struct {
Errno int // call errno (0 if the call was successful)
}
+func (ci *CallInfo) Clone() CallInfo {
+ ret := *ci
+ ret.Signal = slices.Clone(ret.Signal)
+ ret.Cover = slices.Clone(ret.Cover)
+ ret.Comps = maps.Clone(ret.Comps)
+ return ret
+}
+
type ProgInfo struct {
Calls []CallInfo
Extra CallInfo // stores Signal and Cover collected from background threads
@@ -105,6 +114,16 @@ type ProgInfo struct {
Freshness int // number of programs executed in the same process before this one
}
+func (pi *ProgInfo) Clone() *ProgInfo {
+ ret := *pi
+ ret.Extra = ret.Extra.Clone()
+ ret.Calls = slices.Clone(ret.Calls)
+ for i, call := range ret.Calls {
+ ret.Calls[i] = call.Clone()
+ }
+ return &ret
+}
+
func EmptyProgInfo(calls int) *ProgInfo {
info := &ProgInfo{Calls: make([]CallInfo, calls)}
for i := range info.Calls {