From 6388bc36373b7e4e4dbac9101b34007e839a74bd Mon Sep 17 00:00:00 2001 From: Paul Chaignon Date: Thu, 12 Oct 2023 17:16:46 +0200 Subject: prog: more informative errors on parsing failures This simply prints more information when failing to parse unions and structs in syzkaller programs. This is particularly useful when a syscall has multiple structs or unions (ex. for bpf$PROG_LOAD). Signed-off-by: Paul Chaignon --- prog/encoding.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'prog/encoding.go') diff --git a/prog/encoding.go b/prog/encoding.go index 5a2c564e7..2216955d8 100644 --- a/prog/encoding.go +++ b/prog/encoding.go @@ -660,7 +660,7 @@ func (p *parser) parseArgStruct(typ Type, dir Dir) (Arg, error) { p.Parse('{') t1, ok := typ.(*StructType) if !ok { - p.eatExcessive(false, "wrong struct arg") + p.eatExcessive(false, "wrong struct arg for %q", typ.Name()) p.Parse('}') return typ.DefaultArg(dir), nil } @@ -728,7 +728,7 @@ func (p *parser) parseArgArray(typ Type, dir Dir) (Arg, error) { func (p *parser) parseArgUnion(typ Type, dir Dir) (Arg, error) { t1, ok := typ.(*UnionType) if !ok { - p.eatExcessive(true, "wrong union arg") + p.eatExcessive(true, "wrong union arg for %q", typ.Name()) return typ.DefaultArg(dir), nil } p.Parse('@') -- cgit mrf-deployment