From e00767d98c8747f7f226ab035e4551f184823a71 Mon Sep 17 00:00:00 2001 From: Jean-Francois Dockes Date: Tue, 29 Dec 2020 15:04:49 +0100 Subject: [PATCH] rclexecm test/debug: add option -f to dump fields --- src/filters/rclexecm.py | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/src/filters/rclexecm.py b/src/filters/rclexecm.py index d2a2e897..da4127b7 100644 --- a/src/filters/rclexecm.py +++ b/src/filters/rclexecm.py @@ -312,15 +312,18 @@ def main(proto, extract): actAsSingle = False debugDumpData = False + debugDumpFields = False ipath = b"" args = sys.argv[1:] - opts, args = getopt.getopt(args, "hdsi:w:") + opts, args = getopt.getopt(args, "dfhis:w:") for opt, arg in opts: - if opt in ['-h']: + if opt in ['-d']: + debugDumpData = True + elif opt in ['-f']: + debugDumpFields = True + elif opt in ['-h']: usage() - elif opt in ['-s']: - actAsSingle = True elif opt in ['-i']: ipath = makebytes(arg) elif opt in ['-w']: @@ -330,8 +333,8 @@ def main(proto, extract): sys.exit(0) else: sys.exit(1) - elif opt in ['-d']: - debugDumpData = True + elif opt in ['-s']: + actAsSingle = True else: print("unknown option %s\n"%opt, file=sys.stderr) usage() @@ -397,6 +400,10 @@ def main(proto, extract): bdata = makebytes(data) debprint(ioout, "== Entry %d dlen %d ipath %s (mimetype [%s]):" % \ (ecnt, len(data), ipath, proto.mimetype.decode('cp1252'))) + if debugDumpFields: + for k,v in proto.fields.items(): + debprint(ioout, " %s -> %s" % (k,v)) + proto.fields = {} if debugDumpData: proto.breakwrite(ioout, bdata) ioout.write(b'\n')