aboutsummaryrefslogtreecommitdiffstats
path: root/prog
diff options
context:
space:
mode:
authorPaul Chaignon <paul.chaignon@gmail.com>2023-10-12 17:16:46 +0200
committerAleksandr Nogikh <nogikh@google.com>2023-10-12 16:40:32 +0000
commit6388bc36373b7e4e4dbac9101b34007e839a74bd (patch)
treec39f9b46ceac7f13937376d10f29cafbdcf13372 /prog
parentfc170927228ea774aeb61449ce88220bd3ce0156 (diff)
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 <paul.chaignon@gmail.com>
Diffstat (limited to 'prog')
-rw-r--r--prog/encoding.go4
1 files changed, 2 insertions, 2 deletions
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('@')