Skip to contentSkip to conversation

Rewrite tracetool using python modules

RFC PATCH Superseded Lluís Vilanova 2 participants 11 messages Mar 22, 2012 – Mar 26, 2012 Kbuild

v1 of 8 Superseded Latest is v8 →

lore
Share & tools
lore
#0 lore raw

cover Rewrite tracetool using python modules

A full rewrite of the tracetool script using per-format and per-backend modules, so that it's easier to read and extend it in the future.

---
NOTE: This series applies in current master, ignoring the "Rewrite tracetool
using python" series.

Lluís Vilanova (8):
tracetool: Rewrite infrastructure as python modules
tracetool: Add module for the 'c' format
tracetool: Add module for the 'h' format
tracetool: Add support for the 'stderr' backend
tracetool: Add support for the 'simple' backend
tracetool: Add support for the 'ust' backend
tracetool: Add support for the 'dtrace' backend
tracetool: Add MAINTAINERS info

 MAINTAINERS                           |    2 
 Makefile.objs                         |    6 
 Makefile.target                       |   13 -
 configure                             |    4 
 scripts/tracetool                     |  648 ---------------------------------
 scripts/tracetool.py                  |  141 +++++++
 scripts/tracetool/__init__.py         |  210 +++++++++++
 scripts/tracetool/backend/__init__.py |  112 ++++++
 scripts/tracetool/backend/dtrace.py   |  104 +++++
 scripts/tracetool/backend/simple.py   |   60 +++
 scripts/tracetool/backend/stderr.py   |   61 +++
 scripts/tracetool/backend/ust.py      |  102 +++++
 scripts/tracetool/format/__init__.py  |   89 +++++
 scripts/tracetool/format/c.py         |   20 +
 scripts/tracetool/format/d.py         |   20 +
 scripts/tracetool/format/h.py         |   45 ++
 scripts/tracetool/format/stap.py      |   20 +
 17 files changed, 998 insertions(+), 659 deletions(-)
 delete mode 100755 scripts/tracetool
 create mode 100755 scripts/tracetool.py
 create mode 100644 scripts/tracetool/__init__.py
 create mode 100644 scripts/tracetool/backend/__init__.py
 create mode 100644 scripts/tracetool/backend/dtrace.py
 create mode 100644 scripts/tracetool/backend/simple.py
 create mode 100644 scripts/tracetool/backend/stderr.py
 create mode 100644 scripts/tracetool/backend/ust.py
 create mode 100644 scripts/tracetool/format/__init__.py
 create mode 100644 scripts/tracetool/format/c.py
 create mode 100644 scripts/tracetool/format/d.py
 create mode 100644 scripts/tracetool/format/h.py
 create mode 100644 scripts/tracetool/format/stap.py
#1 lore raw

RFC PATCH 1/8 tracetool: Rewrite infrastructure as python modules

---
 Makefile.objs                         |    6 
 Makefile.target                       |   13 -
 configure                             |    4 
 scripts/tracetool                     |  648 ---------------------------------
 scripts/tracetool.py                  |  110 ++++++
 scripts/tracetool/__init__.py         |  202 ++++++++++
 scripts/tracetool/backend/__init__.py |  112 ++++++
 scripts/tracetool/format/__init__.py  |   89 +++++
 8 files changed, 525 insertions(+), 659 deletions(-)
 delete mode 100755 scripts/tracetool
 create mode 100755 scripts/tracetool.py
 create mode 100644 scripts/tracetool/__init__.py
 create mode 100644 scripts/tracetool/backend/__init__.py
 create mode 100644 scripts/tracetool/format/__init__.py
Makefile.objs +3 -3
index 226b01d..8e56f48 100644
@@ -373,12 +373,12 @@ else
 trace.h: trace.h-timestamp
 endif
 trace.h-timestamp: $(SRC_PATH)/trace-events $(BUILD_DIR)/config-host.mak
-	$(call quiet-command,sh $(SRC_PATH)/scripts/tracetool --$(TRACE_BACKEND) -h < $< > $@,"  GEN   trace.h")
+	$(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/tracetool.py --format=h --backend=$(TRACE_BACKEND) < $< > $@,"  GEN   trace.h")
 	@cmp -s $@ trace.h || cp $@ trace.h
 
 trace.c: trace.c-timestamp
 trace.c-timestamp: $(SRC_PATH)/trace-events $(BUILD_DIR)/config-host.mak
-	$(call quiet-command,sh $(SRC_PATH)/scripts/tracetool --$(TRACE_BACKEND) -c < $< > $@,"  GEN   trace.c")
+	$(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/tracetool.py --format=c --backend=$(TRACE_BACKEND) < $< > $@,"  GEN   trace.c")
 	@cmp -s $@ trace.c || cp $@ trace.c
 
 trace.o: trace.c $(GENERATED_HEADERS)
@@ -391,7 +391,7 @@ trace-dtrace.h: trace-dtrace.dtrace
 # rule file. So we use '.dtrace' instead
 trace-dtrace.dtrace: trace-dtrace.dtrace-timestamp
 trace-dtrace.dtrace-timestamp: $(SRC_PATH)/trace-events $(BUILD_DIR)/config-host.mak
-	$(call quiet-command,sh $(SRC_PATH)/scripts/tracetool --$(TRACE_BACKEND) -d < $< > $@,"  GEN   trace-dtrace.dtrace")
+	$(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/tracetool.py --format=d --backend=$(TRACE_BACKEND) < $< > $@,"  GEN   trace-dtrace.dtrace")
 	@cmp -s $@ trace-dtrace.dtrace || cp $@ trace-dtrace.dtrace
 
 trace-dtrace.o: trace-dtrace.dtrace $(GENERATED_HEADERS)
Makefile.target +7 -6
index 63cf769..fe28e8b 100644
@@ -59,12 +59,13 @@ TARGET_TYPE=system
 endif
 
 $(QEMU_PROG).stp:
-	$(call quiet-command,sh $(SRC_PATH)/scripts/tracetool \
-		--$(TRACE_BACKEND) \
-		--binary $(bindir)/$(QEMU_PROG) \
-		--target-arch $(TARGET_ARCH) \
-		--target-type $(TARGET_TYPE) \
-		--stap < $(SRC_PATH)/trace-events > $(QEMU_PROG).stp,"  GEN   $(QEMU_PROG).stp")
+	$(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/tracetool.py \
+		--format=stap \
+		--backend=$(TRACE_BACKEND) \
+		--binary=$(bindir)/$(QEMU_PROG) \
+		--target-arch=$(TARGET_ARCH) \
+		--target-type=$(TARGET_TYPE) \
+		< $(SRC_PATH)/trace-events > $(QEMU_PROG).stp,"  GEN   $(QEMU_PROG).stp")
 else
 stap:
 endif
configure +2 -2
index 8b4e3c1..c2d6117 100755
@@ -1097,7 +1097,7 @@ echo "  --disable-docs           disable documentation build"
 echo "  --disable-vhost-net      disable vhost-net acceleration support"
 echo "  --enable-vhost-net       enable vhost-net acceleration support"
 echo "  --enable-trace-backend=B Set trace backend"
-echo "                           Available backends:" $("$source_path"/scripts/tracetool --list-backends)
+echo "                           Available backends:" $($python "$source_path"/scripts/tracetool.py --list-backends)
 echo "  --with-trace-file=NAME   Full PATH,NAME of file to store traces"
 echo "                           Default:trace-<pid>"
 echo "  --disable-spice          disable spice"
@@ -2654,7 +2654,7 @@ fi
 ##########################################
 # check if trace backend exists
 
-sh "$source_path/scripts/tracetool" "--$trace_backend" --check-backend > /dev/null 2> /dev/null
+$python "$source_path/scripts/tracetool.py" "--backend=$trace_backend" --check-backend  > /dev/null 2> /dev/null
 if test "$?" -ne 0 ; then
   echo
   echo "Error: invalid trace backend"
scripts/tracetool deleted +0 -648

648 lines not on this page · raw message

scripts/tracetool.py new file +110 -0

110 lines not on this page · raw message

scripts/tracetool/__init__.py new file +202 -0

202 lines not on this page · raw message

scripts/tracetool/backend/__init__.py new file +112 -0

112 lines not on this page · raw message

scripts/tracetool/format/__init__.py new file +89 -0

89 lines not on this page · raw message

#2 lore raw

RFC PATCH 2/8 tracetool: Add module for the 'c' format

In reply to Lluís Vilanova
---
 scripts/tracetool/format/c.py |   20 ++++++++++++++++++++
 1 files changed, 20 insertions(+), 0 deletions(-)
 create mode 100644 scripts/tracetool/format/c.py
scripts/tracetool/format/c.py new file +20 -0
new file mode 100644
index 0000000..35555ae
@@ -0,0 +1,20 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+"""
+Generate .c file.
+"""
+
+__author__     = "Lluís Vilanova <[email protected]>"
+__copyright__  = "Copyright 2012, Lluís Vilanova <[email protected]>"
+__license__    = "GPL version 2 or (at your option) any later version"
+
+__maintainer__ = "Stefan Hajnoczi"
+__email__      = "[email protected]"
+
+
+from tracetool import out
+
+
+def begin(events):
+    out('/* This file is autogenerated by tracetool, do not edit. */')
#3 lore raw

RFC PATCH 3/8 tracetool: Add module for the 'h' format

In reply to Lluís Vilanova
---
 scripts/tracetool/format/h.py |   45 +++++++++++++++++++++++++++++++++++++++++
 1 files changed, 45 insertions(+), 0 deletions(-)
 create mode 100644 scripts/tracetool/format/h.py
scripts/tracetool/format/h.py new file +45 -0
new file mode 100644
index 0000000..41a3e2b
@@ -0,0 +1,45 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+"""
+Generate .h file.
+"""
+
+__author__     = "Lluís Vilanova <[email protected]>"
+__copyright__  = "Copyright 2012, Lluís Vilanova <[email protected]>"
+__license__    = "GPL version 2 or (at your option) any later version"
+
+__maintainer__ = "Stefan Hajnoczi"
+__email__      = "[email protected]"
+
+
+from tracetool import out
+
+
+def begin(events):
+    out('/* This file is autogenerated by tracetool, do not edit. */',
+        '',
+        '#ifndef TRACE_H',
+        '#define TRACE_H',
+        '',
+        '#include "qemu-common.h"')
+
+def end(events):
+    for e in events:
+        if "disable" in e.properties:
+            enabled = 0
+        else:
+            enabled = 1
+        out('#define TRACE_%s_ENABLED %d' % (e.name.upper(), enabled))
+    out('',
+        '#endif /* TRACE_H */')
+
+def nop(events):
+    for e in events:
+        out('',
+            'static inline void trace_%(name)s(%(args)s)' % {
+                'name': e.name,
+                'args': e.args
+                },
+            '{',
+            '}')
#4 lore raw

RFC PATCH 4/8 tracetool: Add support for the 'stderr' backend

In reply to Lluís Vilanova
---
 scripts/tracetool/backend/stderr.py |   61 +++++++++++++++++++++++++++++++++++
 1 files changed, 61 insertions(+), 0 deletions(-)
 create mode 100644 scripts/tracetool/backend/stderr.py
scripts/tracetool/backend/stderr.py new file +61 -0
new file mode 100644
index 0000000..5f9abcd
@@ -0,0 +1,61 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+"""
+Stderr built-in backend.
+"""
+
+__author__     = "Lluís Vilanova <[email protected]>"
+__copyright__  = "Copyright 2012, Lluís Vilanova <[email protected]>"
+__license__    = "GPL version 2 or (at your option) any later version"
+
+__maintainer__ = "Stefan Hajnoczi"
+__email__      = "[email protected]"
+
+
+from tracetool import out
+
+
+PUBLIC = True
+
+
+def c(events):
+    out('#include "trace.h"',
+        '',
+        'TraceEvent trace_list[] = {')
+
+    for e in events:
+        out('{.tp_name = "%(name)s", .state=0},' %
+            {
+                'name': e.name,
+                })
+
+    out('};')
+
+def h(events):
+    out('#include <stdio.h>',
+        '#include "trace/stderr.h"',
+        '',
+        'extern TraceEvent trace_list[];')
+
+    for num, e in enumerate(events):
+        argnames = ", ".join(e.args.names())
+        if len(e.args) > 0:
+            argnames = ", " + argnames
+
+        out('''
+static inline void trace_%(name)s(%(args)s)
+{
+    if (trace_list[%(event_num)s].state != 0) {
+        fprintf(stderr, "%(name)s " %(fmt)s "\\n" %(argnames)s);
+    }
+}''' % {
+                'name': e.name,
+                'args': e.args,
+                'event_num': num,
+                'fmt': e.fmt,
+                'argnames': argnames,
+                })
+
+    out('',
+        '#define NR_TRACE_EVENTS %d' % len(events))
#5 lore raw

RFC PATCH 5/8 tracetool: Add support for the 'simple' backend

In reply to Lluís Vilanova
---
 scripts/tracetool/backend/simple.py |   60 +++++++++++++++++++++++++++++++++++
 1 files changed, 60 insertions(+), 0 deletions(-)
 create mode 100644 scripts/tracetool/backend/simple.py
scripts/tracetool/backend/simple.py new file +60 -0
new file mode 100644
index 0000000..fea0a37
@@ -0,0 +1,60 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+"""
+Simple built-in backend.
+"""
+
+__author__     = "Lluís Vilanova <[email protected]>"
+__copyright__  = "Copyright 2012, Lluís Vilanova <[email protected]>"
+__license__    = "GPL version 2 or (at your option) any later version"
+
+__maintainer__ = "Stefan Hajnoczi"
+__email__      = "[email protected]"
+
+
+from tracetool import out
+
+
+PUBLIC = True
+
+
+def c(events):
+    out('#include "trace.h"',
+        '',
+        'TraceEvent trace_list[] = {')
+
+    for e in events:
+        out('{.tp_name = "%(name)s", .state=0},' % {
+                'name': e.name,
+                })
+
+    out('};')
+
+def h(events):
+    out('#include "trace/simple.h"',
+        '')
+
+    for num, e in enumerate(events):
+        if len(e.args):
+            argstr = e.args.names()
+            arg_prefix = ', (uint64_t)(uintptr_t)'
+            cast_args = arg_prefix + arg_prefix.join(argstr)
+            simple_args = (str(num) + cast_args)
+        else:
+            simple_args = str(num)
+
+        out('''\
+static inline void trace_%(name)s(%(args)s)
+{
+    trace%(argc)d(%(trace_args)s);
+}
+''' % {
+                'name': e.name,
+                'args': e.args,
+                'argc': len(e.args),
+                'trace_args': simple_args,
+                })
+
+    out('#define NR_TRACE_EVENTS %d' % len(events))
+    out('extern TraceEvent trace_list[NR_TRACE_EVENTS];')
#6 lore raw

RFC PATCH 6/8 tracetool: Add support for the 'ust' backend

In reply to Lluís Vilanova
---
 scripts/tracetool/backend/ust.py |  102 ++++++++++++++++++++++++++++++++++++++
 1 files changed, 102 insertions(+), 0 deletions(-)
 create mode 100644 scripts/tracetool/backend/ust.py
scripts/tracetool/backend/ust.py new file +102 -0
new file mode 100644
index 0000000..6871373
@@ -0,0 +1,102 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+"""
+LTTng User Space Tracing backend.
+"""
+
+__author__     = "Lluís Vilanova <[email protected]>"
+__copyright__  = "Copyright 2012, Lluís Vilanova <[email protected]>"
+__license__    = "GPL version 2 or (at your option) any later version"
+
+__maintainer__ = "Stefan Hajnoczi"
+__email__      = "[email protected]"
+
+
+from tracetool import out
+
+
+PUBLIC = True
+
+
+def c(events):
+    out('#include <ust/marker.h>',
+        '#undef mutex_lock',
+        '#undef mutex_unlock',
+        '#undef inline',
+        '#undef wmb',
+        '#include "trace.h"')
+
+    for e in events:
+        argnames = ", ".join(e.args.names())
+        if len(e.args) > 0:
+            argnames = ', ' + argnames
+
+            out('''
+DEFINE_TRACE(ust_%(name)s);
+
+static void ust_%(name)s_probe(%(args)s)
+{
+    trace_mark(ust, %(name)s, %(fmt)s%(argnames)s);
+}''' %
+                {
+                    'name': e.name,
+                    'args': e.args,
+                    'fmt': e.fmt,
+                    'argnames': argnames,
+                    })
+
+        else:
+            out('''
+DEFINE_TRACE(ust_%(name)s);
+
+static void ust_%(name)s_probe(%(args)s)
+{
+    trace_mark(ust, %(name)s, UST_MARKER_NOARGS);
+}''' %
+                {
+                    'name': e.name,
+                    'args': e.args,
+                    })
+
+    # register probes
+    out('',
+        'static void __attribute__((constructor)) trace_init(void)',
+        '{')
+
+    for e in events:
+        out('    register_trace_ust_%(name)s(ust_%(name)s_probe);' %
+            {
+                'name': e.name,
+                })
+
+    out('}')
+
+
+def h(events):
+    out('#include <ust/tracepoint.h>',
+        '#undef mutex_lock',
+        '#undef mutex_unlock',
+        '#undef inline',
+        '#undef wmb')
+
+    for e in events:
+        if len(e.args) > 0:
+            out('''
+DECLARE_TRACE(ust_%(name)s, TP_PROTO(%(args)s), TP_ARGS(%(argnames)s));
+#define trace_%(name)s trace_ust_%(name)s''' %
+                {
+                    'name': e.name,
+                    'args': e.args,
+                    'argnames': ", ".join(e.args.names())
+                    })
+
+        else:
+            out('''
+_DECLARE_TRACEPOINT_NOARGS(ust_%(name)s);
+#define trace_%(name)s trace_ust_%(name)s''' %
+                {
+                    'name': e.name,
+                    })
+
+    out()
#7 lore raw

RFC PATCH 7/8 tracetool: Add support for the 'dtrace' backend

In reply to Lluís Vilanova
---
 scripts/tracetool.py                |   31 ++++++++++
 scripts/tracetool/__init__.py       |    8 +++
 scripts/tracetool/backend/dtrace.py |  104 +++++++++++++++++++++++++++++++++++
 scripts/tracetool/format/d.py       |   20 +++++++
 scripts/tracetool/format/stap.py    |   20 +++++++
 5 files changed, 183 insertions(+), 0 deletions(-)
 create mode 100644 scripts/tracetool/backend/dtrace.py
 create mode 100644 scripts/tracetool/format/d.py
 create mode 100644 scripts/tracetool/format/stap.py
scripts/tracetool.py +31 -0
index 22623ae..2dd9da0 100755
@@ -44,6 +44,11 @@ Options:
     --help                   This help message.
     --list-backends          Print list of available backends.
     --check-backend          Check if the given backend is valid.
+    --binary <path>          Full path to QEMU binary.
+    --target-type <type>     QEMU emulator target type ('system' or 'user').
+    --target-arch <arch>     QEMU emulator target arch.
+    --probe-prefix <prefix>  Prefix for dtrace probe names
+                             (default: qemu-<target-type>-<target-arch>).\
 """ % {
             "script" : _SCRIPT,
             "backends" : backend_descr,
@@ -71,6 +76,10 @@ def main(args):
     check_backend = False
     arg_backend = ""
     arg_format = ""
+    binary = None
+    target_type = None
+    target_arch = None
+    probe_prefix = None
     for opt, arg in opts:
         if opt == "--help":
             error_opt()
@@ -87,6 +96,15 @@ def main(args):
         elif opt == "--check-backend":
             check_backend = True
 
+        elif opt == "--binary":
+            binary = arg
+        elif opt == '--target-type':
+            target_type = arg
+        elif opt == '--target-arch':
+            target_arch = arg
+        elif opt == '--probe-prefix':
+            probe_prefix = arg
+
         else:
             error_opt("unhandled option: %s" % opt)
 
@@ -101,6 +119,19 @@ def main(args):
 
     kwargs = {}
 
+    if format == "stap":
+        if binary is None:
+            error_opt("--binary is required for SystemTAP tapset generator")
+        if probe_prefix is None and target_type is None:
+            error_opt("--target-type is required for SystemTAP tapset generator")
+        if probe_prefix is None and target_arch is None:
+            error_opt("--target-arch is required for SystemTAP tapset generator")
+
+        if probe_prefix is None:
+            probe_prefix = ".".join([ "qemu", target_type, target_arch ])
+    kwargs["binary"] = binary
+    kwargs["probe_prefix"] = probe_prefix
+
     try:
         tracetool.generate(sys.stdin, arg_format, arg_backend, **kwargs)
     except tracetool.TracetoolError as e:
scripts/tracetool/__init__.py +8 -0
index 345b666..5c87583 100644
@@ -164,6 +164,9 @@ def try_import(mod_name, attr_name = None, attr_default = None):
 
 def generate(fevents, format, backend, **options):
     """Generate the output for the given (format, backend) pair."""
+    binary = options.pop("binary", None)
+    probe_prefix = options.pop("probe_prefix", None)
+
     if len(options) > 0:
         raise ValueError("unknown options: " + ", ".join(options))
 
@@ -185,6 +188,11 @@ def generate(fevents, format, backend, **options):
         raise TracetoolError("backend '%s' not compatible with format '%s'" %
                              (backend, format))
 
+    if backend == "dtrace":
+        import tracetool.backend.dtrace
+        tracetool.backend.dtrace.BINARY = binary
+        tracetool.backend.dtrace.PROBEPREFIX = probe_prefix
+
     events = _read_events(fevents)
 
     if backend == "nop":
scripts/tracetool/backend/dtrace.py new file +104 -0

104 lines not on this page · raw message

scripts/tracetool/format/d.py new file +20 -0
new file mode 100644
index 0000000..a2d5947
@@ -0,0 +1,20 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+"""
+Generate .d file (DTrace only).
+"""
+
+__author__     = "Lluís Vilanova <[email protected]>"
+__copyright__  = "Copyright 2012, Lluís Vilanova <[email protected]>"
+__license__    = "GPL version 2 or (at your option) any later version"
+
+__maintainer__ = "Stefan Hajnoczi"
+__email__      = "[email protected]"
+
+
+from tracetool import out
+
+
+def begin(events):
+    out('/* This file is autogenerated by tracetool, do not edit. */')
scripts/tracetool/format/stap.py new file +20 -0
new file mode 100644
index 0000000..50a4c69
@@ -0,0 +1,20 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+"""
+Generate .stp file (DTrace with SystemTAP only).
+"""
+
+__author__     = "Lluís Vilanova <[email protected]>"
+__copyright__  = "Copyright 2012, Lluís Vilanova <[email protected]>"
+__license__    = "GPL version 2 or (at your option) any later version"
+
+__maintainer__ = "Stefan Hajnoczi"
+__email__      = "[email protected]"
+
+
+from tracetool import out
+
+
+def begin(events):
+    out('/* This file is autogenerated by tracetool, do not edit. */')
#8 lore raw

RFC PATCH 8/8 tracetool: Add MAINTAINERS info

In reply to Lluís Vilanova
---
 MAINTAINERS |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
MAINTAINERS +2 -0
index f83d07c2..0e66dd8 100644
@@ -548,6 +548,8 @@ Tracing
 M: Stefan Hajnoczi <[email protected]>
 S: Maintained
 F: trace/
+F: scripts/tracetool.py
+F: scripts/tracetool/
 F: docs/tracing.txt
 T: git://github.com/stefanha/qemu.git tracing
 
#9 lore raw
In reply to Lluís Vilanova
Quoted 37 lines · Lluís Vilanova

A full rewrite of the tracetool script using per-format and per-backend modules, so that it's easier to read and extend it in the future.

---
NOTE: This series applies in current master, ignoring the "Rewrite tracetool using python" series.

Lluís Vilanova (8):
     tracetool: Rewrite infrastructure as python modules
     tracetool: Add module for the 'c' format
     tracetool: Add module for the 'h' format
     tracetool: Add support for the 'stderr' backend
     tracetool: Add support for the 'simple' backend
     tracetool: Add support for the 'ust' backend
     tracetool: Add support for the 'dtrace' backend
     tracetool: Add MAINTAINERS info

 MAINTAINERS                           |    2
 Makefile.objs                         |    6
 Makefile.target                       |   13 -
 configure                             |    4
 scripts/tracetool                     |  648 --------------------------------- scripts/tracetool.py                  |  141 +++++++ scripts/tracetool/__init__.py         |  210 +++++++++++ scripts/tracetool/backend/__init__.py |  112 ++++++

 scripts/tracetool/backend/dtrace.py   |  104 +++++
 scripts/tracetool/backend/simple.py   |   60 +++
 scripts/tracetool/backend/stderr.py   |   61 +++
 scripts/tracetool/backend/ust.py      |  102 +++++
 scripts/tracetool/format/__init__.py  |   89 +++++
 scripts/tracetool/format/c.py         |   20 +
 scripts/tracetool/format/d.py         |   20 +
 scripts/tracetool/format/h.py         |   45 ++
 scripts/tracetool/format/stap.py      |   20 +
 17 files changed, 998 insertions(+), 659 deletions(-)
Quoted 13 lines

 delete mode 100755 scripts/tracetool
 create mode 100755 scripts/tracetool.py
 create mode 100644 scripts/tracetool/__init__.py create mode 100644 scripts/tracetool/backend/__init__.py create mode 100644 scripts/tracetool/backend/dtrace.py create mode 100644 scripts/tracetool/backend/simple.py create mode 100644 scripts/tracetool/backend/stderr.py create mode 100644 scripts/tracetool/backend/ust.py create mode 100644 scripts/tracetool/format/__init__.py create mode 100644 scripts/tracetool/format/c.py create mode 100644 scripts/tracetool/format/d.py create mode 100644 scripts/tracetool/format/h.py create mode 100644 scripts/tracetool/format/stap.py

I tried to build this after make distclean with the nop backend:

GEN trace.h
Traceback (most recent call last):
File "/home/stefanha/qemu/scripts/tracetool.py", line 141, in <module>
main(sys.argv)
File "/home/stefanha/qemu/scripts/tracetool.py", line 136, in main
tracetool.generate(sys.stdin, arg_format, arg_backend, **kwargs)
File "/home/stefanha/qemu/scripts/tracetool/__init__.py", line 177,
in generate
if not tracetool.format.exists(mformat):
UnboundLocalError: local variable 'tracetool' referenced before assignment

Do you also get this error?

Stefan

#10 lore raw
Quoted 13 lines · Stefan Hajnoczi

I tried to build this after make distclean with the nop backend:

GEN trace.h
Traceback (most recent call last):
File "/home/stefanha/qemu/scripts/tracetool.py", line 141, in <module>
main(sys.argv)
File "/home/stefanha/qemu/scripts/tracetool.py", line 136, in main
tracetool.generate(sys.stdin, arg_format, arg_backend, **kwargs)
File "/home/stefanha/qemu/scripts/tracetool/__init__.py", line 177,
in generate
if not tracetool.format.exists(mformat):
UnboundLocalError: local variable 'tracetool' referenced before assignment

Quoted 1 line

Do you also get this error?

Strange, I didn't get it on my first tests, but now I do on a clean checkout.

I'll resend the series (a simple "import tracetool" in the "generate" body seems to work).

Lluis

Signature · 4 lines
 "And it's much the same thing with knowledge, for whenever you learn
 something new, the whole world becomes that much richer."
 -- The Princess of Pure Reason, as told by Norton Juster in The Phantom
 Tollbooth