diff options
author | Yannik Enss <Yannik.Enss@rohde-schwarz.com> | 2019-05-29 14:19:14 +0200 |
---|---|---|
committer | Gerald Combs <gerald@wireshark.org> | 2019-06-05 16:35:00 +0000 |
commit | 54db60f4e5d3827fad600bad1cace34249047700 (patch) | |
tree | d04942680b77a5abb856d204e04d28dac133e3c5 /tools | |
parent | 54cccedfbec1a8e8a699317923002a0e7d44cfda (diff) |
idl2wrs: add debug command line parameter
convert the "DEBUG" constant to a command line parameter
Change-Id: I7f873d85fa053cb9298bd03444125d0160ef4640
Reviewed-on: https://code.wireshark.org/review/33456
Reviewed-by: Gerald Combs <gerald@wireshark.org>
Diffstat (limited to 'tools')
-rwxr-xr-x | tools/wireshark_be.py | 13 | ||||
-rwxr-xr-x | tools/wireshark_gen.py | 11 |
2 files changed, 10 insertions, 14 deletions
diff --git a/tools/wireshark_be.py b/tools/wireshark_be.py index 49d97c3a94..cae15d3aa9 100755 --- a/tools/wireshark_be.py +++ b/tools/wireshark_be.py @@ -57,9 +57,8 @@ from wireshark_gen import wireshark_gen_C class WiresharkVisitor: - DEBUG = 0 # debug flag - - def __init__(self, st): + def __init__(self, st, debug=False): + self.DEBUG = debug self.st = st self.oplist = [] # list of operation nodes self.enlist = [] # list of enum nodes @@ -258,8 +257,10 @@ class WiresharkVisitor: def run(tree, args): + DEBUG = "debug" in args + st = output.Stream(sys.stdout, 4) # set indent for stream - ev = WiresharkVisitor(st) # create visitor object + ev = WiresharkVisitor(st, DEBUG) # create visitor object ev.visitAST(tree) # go find some operations @@ -273,7 +274,7 @@ def run(tree, args): nl = string.split(fname,".")[0] # split name of main IDL file using "." as separator # and grab first field (eg: CosNaming) - if ev.DEBUG: + if DEBUG: for i in ev.oplist: print "XXX - Operation node ", i, " repoId() = ", i.repoId() for i in ev.atlist: @@ -290,7 +291,7 @@ def run(tree, args): # and generate some C code - eg = wireshark_gen_C(ev.st, string.upper(nl), string.lower(nl), string.capitalize(nl) + " Dissector Using GIOP API") + eg = wireshark_gen_C(ev.st, string.upper(nl), string.lower(nl), string.capitalize(nl) + " Dissector Using GIOP API", debug=DEBUG) eg.genCode(ev.oplist, ev.atlist, ev.enlist, ev.stlist, ev.unlist) # pass them onto the C generator # diff --git a/tools/wireshark_gen.py b/tools/wireshark_gen.py index d2d837a2d5..324238bafd 100755 --- a/tools/wireshark_gen.py +++ b/tools/wireshark_gen.py @@ -115,13 +115,6 @@ import tempfile class wireshark_gen_C: - - # - # Turn DEBUG stuff on/off - # - - DEBUG = 0 - # # Some string constants for our templates # @@ -147,7 +140,9 @@ class wireshark_gen_C: # Constructor # - def __init__(self, st, protocol_name, dissector_name ,description): + def __init__(self, st, protocol_name, dissector_name ,description, debug=False): + self.DEBUG = debug + self.st = output.Stream(tempfile.TemporaryFile(),4) # for first pass only self.st_save = st # where 2nd pass should go |