aboutsummaryrefslogtreecommitdiffstats
path: root/tools/syz-trace2syz/parser
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2018-12-07 11:21:47 +0100
committerDmitry Vyukov <dvyukov@google.com>2018-12-07 11:30:13 +0100
commit805688986684c68b2807662d2b43890bfd9bd351 (patch)
tree9c07af082a29f6700fe1994806f888ce7aa07319 /tools/syz-trace2syz/parser
parent840b5cc05832dbf0a7a02379097d9e72e25fc00e (diff)
tools/syz-trace2syz/proggen: add ParseFile function
Current code structuring has 2 problems: 1. parsing anything with proggen requires complex multistep dance including - parsing data with parser - walking the resulting tree manually and calling proggen on each - then for each context - calling FillOutMemory (unclear why it's not part of parsing) - calling prog.Finalize - checking is the program is not too large All of this duplicated across trace2syz and tests. And any new tests or fuzzers we will write will need to duplicate all of this logic too. 2. As the result of this structuring, lots of proggen guts and implementation details are exposed. While none of the callers are actually intersted in Context details, they are not interested in Context itself whatsoever. What every caller wants is "here is data to parse, give me programs". Add such function.
Diffstat (limited to 'tools/syz-trace2syz/parser')
-rw-r--r--tools/syz-trace2syz/parser/parser.go10
1 files changed, 0 insertions, 10 deletions
diff --git a/tools/syz-trace2syz/parser/parser.go b/tools/syz-trace2syz/parser/parser.go
index 6076b9a18..08be7f254 100644
--- a/tools/syz-trace2syz/parser/parser.go
+++ b/tools/syz-trace2syz/parser/parser.go
@@ -6,7 +6,6 @@ package parser
import (
"bufio"
"bytes"
- "io/ioutil"
"strings"
"github.com/google/syzkaller/pkg/log"
@@ -48,12 +47,3 @@ func ParseLoop(data []byte) *TraceTree {
}
return tree
}
-
-// Parse parses a trace of system calls and returns an intermediate representation
-func Parse(filename string) *TraceTree {
- data, err := ioutil.ReadFile(filename)
- if err != nil {
- log.Fatalf("error reading file: %s", err.Error())
- }
- return ParseLoop(data)
-}