aboutsummaryrefslogtreecommitdiffstats
path: root/prog
diff options
context:
space:
mode:
Diffstat (limited to 'prog')
-rw-r--r--prog/rand.go4
-rw-r--r--prog/target.go11
2 files changed, 13 insertions, 2 deletions
diff --git a/prog/rand.go b/prog/rand.go
index d54ef0dfe..834003914 100644
--- a/prog/rand.go
+++ b/prog/rand.go
@@ -670,9 +670,9 @@ func (target *Target) PseudoSyscalls() []*Syscall {
}
// GenSampleProg generates a single sample program for the call.
-func (target *Target) GenSampleProg(meta *Syscall, rs rand.Source) *Prog {
+func (target *Target) GenSampleProg(meta *Syscall, rs rand.Source, ct *ChoiceTable) *Prog {
r := newRand(target, rs)
- s := newState(target, target.DefaultChoiceTable(), nil)
+ s := newState(target, ct, nil)
p := &Prog{
Target: target,
}
diff --git a/prog/target.go b/prog/target.go
index 300a86a32..b5d198f27 100644
--- a/prog/target.go
+++ b/prog/target.go
@@ -370,6 +370,17 @@ func (target *Target) DefaultChoiceTable() *ChoiceTable {
return target.defaultChoiceTable
}
+func (target *Target) NoAutoChoiceTable() *ChoiceTable {
+ calls := map[*Syscall]bool{}
+ for _, c := range target.Syscalls {
+ if c.Attrs.Automatic {
+ continue
+ }
+ calls[c] = true
+ }
+ return target.BuildChoiceTable(nil, calls)
+}
+
func (target *Target) RequiredGlobs() []string {
globs := make(map[string]bool)
ForeachType(target.Syscalls, func(typ Type, ctx *TypeCtx) {