aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/simpletrace.py10
-rwxr-xr-xscripts/tracetool.py31
-rw-r--r--scripts/tracetool/backend/dtrace.py7
-rw-r--r--scripts/tracetool/backend/simple.py1
-rw-r--r--scripts/tracetool/backend/ust.py7
-rw-r--r--scripts/tracetool/format/c.py7
-rw-r--r--scripts/tracetool/format/tcg_h.py6
-rw-r--r--scripts/tracetool/format/tcg_helper_c.py6
-rw-r--r--scripts/tracetool/format/ust_events_c.py2
-rw-r--r--scripts/tracetool/format/ust_events_h.py7
10 files changed, 56 insertions, 28 deletions
diff --git a/scripts/simpletrace.py b/scripts/simpletrace.py
index 4ca903dc0c..4c990047b6 100755
--- a/scripts/simpletrace.py
+++ b/scripts/simpletrace.py
@@ -73,10 +73,14 @@ def read_record(edict, idtoname, fobj):
def read_trace_header(fobj):
"""Read and verify trace file header"""
header = read_header(fobj, log_header_fmt)
- if header is None or \
- header[0] != header_event_id or \
- header[1] != header_magic:
+ if header is None:
raise ValueError('Not a valid trace file!')
+ if header[0] != header_event_id:
+ raise ValueError('Not a valid trace file, header id %d != %d' %
+ (header[0], header_event_id))
+ if header[1] != header_magic:
+ raise ValueError('Not a valid trace file, header magic %d != %d' %
+ (header[1], header_magic))
log_version = header[2]
if log_version not in [0, 2, 3, 4]:
diff --git a/scripts/tracetool.py b/scripts/tracetool.py
index c9e47371d3..c55a21518b 100755
--- a/scripts/tracetool.py
+++ b/scripts/tracetool.py
@@ -49,6 +49,7 @@ Options:
--binary <path> Full path to QEMU binary.
--target-type <type> QEMU emulator target type ('system' or 'user').
--target-name <name> QEMU emulator target name.
+ --group <name> Name of the event group
--probe-prefix <prefix> Prefix for dtrace probe names
(default: qemu-<target-type>-<target-name>).\
""" % {
@@ -62,22 +63,12 @@ Options:
else:
sys.exit(1)
-def make_group_name(filename):
- dirname = os.path.realpath(os.path.dirname(filename))
- basedir = os.path.join(os.path.dirname(__file__), os.pardir)
- basedir = os.path.realpath(os.path.abspath(basedir))
- dirname = dirname[len(basedir) + 1:]
-
- if dirname == "":
- return "common"
- return "_" + re.sub(r"[^A-Za-z0-9]", "_", dirname)
-
def main(args):
global _SCRIPT
_SCRIPT = args[0]
long_opts = ["backends=", "format=", "help", "list-backends",
- "check-backends"]
+ "check-backends", "group="]
long_opts += ["binary=", "target-type=", "target-name=", "probe-prefix="]
try:
@@ -88,6 +79,7 @@ def main(args):
check_backends = False
arg_backends = []
arg_format = ""
+ arg_group = None
binary = None
target_type = None
target_name = None
@@ -98,6 +90,8 @@ def main(args):
elif opt == "--backends":
arg_backends = arg.split(",")
+ elif opt == "--group":
+ arg_group = arg
elif opt == "--format":
arg_format = arg
@@ -129,6 +123,9 @@ def main(args):
sys.exit(1)
sys.exit(0)
+ if arg_group is None:
+ error_opt("group name is required")
+
if arg_format == "stap":
if binary is None:
error_opt("--binary is required for SystemTAP tapset generator")
@@ -140,15 +137,15 @@ def main(args):
if probe_prefix is None:
probe_prefix = ".".join(["qemu", target_type, target_name])
- if len(args) != 1:
+ if len(args) < 1:
error_opt("missing trace-events filepath")
- with open(args[0], "r") as fh:
- events = tracetool.read_events(fh)
-
- group = make_group_name(args[0])
+ events = []
+ for arg in args:
+ with open(arg, "r") as fh:
+ events.extend(tracetool.read_events(fh))
try:
- tracetool.generate(events, group, arg_format, arg_backends,
+ tracetool.generate(events, arg_group, arg_format, arg_backends,
binary=binary, probe_prefix=probe_prefix)
except tracetool.TracetoolError as e:
error_opt(str(e))
diff --git a/scripts/tracetool/backend/dtrace.py b/scripts/tracetool/backend/dtrace.py
index 79505c6b1a..c469cbd1a3 100644
--- a/scripts/tracetool/backend/dtrace.py
+++ b/scripts/tracetool/backend/dtrace.py
@@ -36,7 +36,12 @@ def binary():
def generate_h_begin(events, group):
- out('#include "trace/generated-tracers-dtrace.h"',
+ if group == "root":
+ header = "trace-dtrace-root.h"
+ else:
+ header = "trace-dtrace.h"
+
+ out('#include "%s"' % header,
'')
diff --git a/scripts/tracetool/backend/simple.py b/scripts/tracetool/backend/simple.py
index 85f61028e2..4acc06e81c 100644
--- a/scripts/tracetool/backend/simple.py
+++ b/scripts/tracetool/backend/simple.py
@@ -44,7 +44,6 @@ def generate_h(event, group):
def generate_c_begin(events, group):
out('#include "qemu/osdep.h"',
- '#include "trace.h"',
'#include "trace/control.h"',
'#include "trace/simple.h"',
'')
diff --git a/scripts/tracetool/backend/ust.py b/scripts/tracetool/backend/ust.py
index 4594db6128..52ce892478 100644
--- a/scripts/tracetool/backend/ust.py
+++ b/scripts/tracetool/backend/ust.py
@@ -20,8 +20,13 @@ PUBLIC = True
def generate_h_begin(events, group):
+ if group == "root":
+ header = "trace-ust-root.h"
+ else:
+ header = "trace-ust.h"
+
out('#include <lttng/tracepoint.h>',
- '#include "trace/generated-ust-provider.h"',
+ '#include "%s"' % header,
'')
diff --git a/scripts/tracetool/format/c.py b/scripts/tracetool/format/c.py
index 47115ed8af..833c05a022 100644
--- a/scripts/tracetool/format/c.py
+++ b/scripts/tracetool/format/c.py
@@ -20,10 +20,15 @@ def generate(events, backend, group):
active_events = [e for e in events
if "disable" not in e.properties]
+ if group == "root":
+ header = "trace-root.h"
+ else:
+ header = "trace.h"
+
out('/* This file is autogenerated by tracetool, do not edit. */',
'',
'#include "qemu/osdep.h"',
- '#include "trace.h"',
+ '#include "%s"' % header,
'')
for e in events:
diff --git a/scripts/tracetool/format/tcg_h.py b/scripts/tracetool/format/tcg_h.py
index 5f213f6cba..7ddc4a52ce 100644
--- a/scripts/tracetool/format/tcg_h.py
+++ b/scripts/tracetool/format/tcg_h.py
@@ -28,13 +28,17 @@ def vcpu_transform_args(args):
def generate(events, backend, group):
+ if group == "root":
+ header = "trace-root.h"
+ else:
+ header = "trace.h"
+
out('/* This file is autogenerated by tracetool, do not edit. */',
'/* You must include this file after the inclusion of helper.h */',
'',
'#ifndef TRACE_%s_GENERATED_TCG_TRACERS_H' % group.upper(),
'#define TRACE_%s_GENERATED_TCG_TRACERS_H' % group.upper(),
'',
- '#include "trace.h"',
'#include "exec/helper-proto.h"',
'',
)
diff --git a/scripts/tracetool/format/tcg_helper_c.py b/scripts/tracetool/format/tcg_helper_c.py
index cc26e03008..7dccd8c5ec 100644
--- a/scripts/tracetool/format/tcg_helper_c.py
+++ b/scripts/tracetool/format/tcg_helper_c.py
@@ -41,6 +41,11 @@ def vcpu_transform_args(args, mode):
def generate(events, backend, group):
+ if group == "root":
+ header = "trace-root.h"
+ else:
+ header = "trace.h"
+
events = [e for e in events
if "disable" not in e.properties]
@@ -49,7 +54,6 @@ def generate(events, backend, group):
'#include "qemu/osdep.h"',
'#include "qemu-common.h"',
'#include "cpu.h"',
- '#include "trace.h"',
'#include "exec/helper-proto.h"',
'',
)
diff --git a/scripts/tracetool/format/ust_events_c.py b/scripts/tracetool/format/ust_events_c.py
index cd87d8ab8f..264784cdf2 100644
--- a/scripts/tracetool/format/ust_events_c.py
+++ b/scripts/tracetool/format/ust_events_c.py
@@ -32,4 +32,4 @@ def generate(events, backend, group):
' */',
'#pragma GCC diagnostic ignored "-Wredundant-decls"',
'',
- '#include "generated-ust-provider.h"')
+ '#include "trace-ust-all.h"')
diff --git a/scripts/tracetool/format/ust_events_h.py b/scripts/tracetool/format/ust_events_h.py
index d853155d21..514294c2cc 100644
--- a/scripts/tracetool/format/ust_events_h.py
+++ b/scripts/tracetool/format/ust_events_h.py
@@ -20,13 +20,18 @@ def generate(events, backend, group):
events = [e for e in events
if "disabled" not in e.properties]
+ if group == "all":
+ include = "trace-ust-all.h"
+ else:
+ include = "trace-ust.h"
+
out('/* This file is autogenerated by tracetool, do not edit. */',
'',
'#undef TRACEPOINT_PROVIDER',
'#define TRACEPOINT_PROVIDER qemu',
'',
'#undef TRACEPOINT_INCLUDE_FILE',
- '#define TRACEPOINT_INCLUDE_FILE ./generated-ust-provider.h',
+ '#define TRACEPOINT_INCLUDE_FILE ./%s' % include,
'',
'#if !defined (TRACE_%s_GENERATED_UST_H) || \\' % group.upper(),
' defined(TRACEPOINT_HEADER_MULTI_READ)',