aboutsummaryrefslogtreecommitdiffstats
path: root/prog/generation.go
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2015-10-14 16:55:09 +0200
committerDmitry Vyukov <dvyukov@google.com>2015-10-14 16:55:09 +0200
commitc9b915608d0ae354e5666093c6e6bb7b11d5ce77 (patch)
treeab40104cd3ab597ea32f8f92d632ee51e35640ee /prog/generation.go
parent38493312da49f7b5b2d6d2c27f0841c3f0a50302 (diff)
initial support for call priorities
Diffstat (limited to 'prog/generation.go')
-rw-r--r--prog/generation.go8
1 files changed, 3 insertions, 5 deletions
diff --git a/prog/generation.go b/prog/generation.go
index 43e527aa0..b08e98d31 100644
--- a/prog/generation.go
+++ b/prog/generation.go
@@ -5,18 +5,16 @@ package prog
import (
"math/rand"
-
- "github.com/google/syzkaller/sys"
)
// Generate generates a random program of length ~ncalls.
// calls is a set of allowed syscalls, if nil all syscalls are used.
-func Generate(rs rand.Source, ncalls int, enabledCalls []*sys.Call) *Prog {
+func Generate(rs rand.Source, ncalls int, ct *ChoiceTable) *Prog {
p := new(Prog)
r := newRand(rs)
- s := newState(enabledCalls)
+ s := newState(ct)
for len(p.Calls) < ncalls {
- calls := r.generateCall(s)
+ calls := r.generateCall(s, p)
for _, c := range calls {
s.analyze(c)
p.Calls = append(p.Calls, c)