aboutsummaryrefslogtreecommitdiffstats
path: root/epan/wspython
diff options
context:
space:
mode:
authorAnders Broman <anders.broman@ericsson.com>2011-10-28 06:22:24 +0000
committerAnders Broman <anders.broman@ericsson.com>2011-10-28 06:22:24 +0000
commit5057f53e8b4a5df509729c0c4e87eb533945303c (patch)
tree4847228b9534f84e292208ca6e55963fb37a82a2 /epan/wspython
parent2b2ed072624335bd465e3c4ef4200231e16f60a8 (diff)
From Eliot:
Add runtime tracers (disabled by default) for debug. Add runtime tracers (disabled by default) for debug. This may be useful for ongoing development. https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=6448 svn path=/trunk/; revision=39649
Diffstat (limited to 'epan/wspython')
-rwxr-xr-xepan/wspython/register-dissector.py21
-rwxr-xr-xepan/wspython/wspy_dissector.py20
2 files changed, 41 insertions, 0 deletions
diff --git a/epan/wspython/register-dissector.py b/epan/wspython/register-dissector.py
index a9ca3ac416..a536a4ab95 100755
--- a/epan/wspython/register-dissector.py
+++ b/epan/wspython/register-dissector.py
@@ -86,3 +86,24 @@ def register_dissectors(wspython_dir, plugins_pers_dir=None):
print 'register dissector %s exception %s' % (dissector, e)
print 'registered protocols', registered_protocols
return registered_protocols
+
+if False:
+ import linecache
+
+ # Start tracing when import has finished
+ def tracer(frame, event, arg):
+ if event == "line":
+ lineno = frame.f_lineno
+ filename = frame.f_globals["__file__"]
+ if (filename.endswith(".pyc") or
+ filename.endswith(".pyo")):
+ filename = filename[:-1]
+ name = frame.f_globals["__name__"]
+ line = linecache.getline(filename, lineno)
+ print "%s:%s: %s" % (name, lineno, line.rstrip())
+ if event == "exception":
+ print "exception", arg
+ return tracer
+
+ sys.settrace(tracer)
+
diff --git a/epan/wspython/wspy_dissector.py b/epan/wspython/wspy_dissector.py
index d915fbcd1d..cc1d96f317 100755
--- a/epan/wspython/wspy_dissector.py
+++ b/epan/wspython/wspy_dissector.py
@@ -437,3 +437,23 @@ class TVB(object):
#how to get this working ??? check how application uses this!
#def new_subset(self, offset=0):
# return self.__wsl.tvb_get_new_subset(self.tvb, offset)
+
+if False:
+ import linecache
+ import sys
+ # Start tracing when import has finished
+ def tracer(frame, event, arg):
+ if event == "line":
+ lineno = frame.f_lineno
+ filename = frame.f_globals["__file__"]
+ if (filename.endswith(".pyc") or
+ filename.endswith(".pyo")):
+ filename = filename[:-1]
+ name = frame.f_globals["__name__"]
+ line = linecache.getline(filename, lineno)
+ print "%s:%s: %s" % (name, lineno, line.rstrip())
+ if event == "exception":
+ print "exception", arg
+ return tracer
+
+ sys.settrace(tracer)