hw/arm/virt-acpi-build: Add SPCR table
[qemu/ar7.git] / scripts / tracetool / format / d.py
blobc77d5b7ab0b0c987f9ce77532874cba7255cd277
1 #!/usr/bin/env python
2 # -*- coding: utf-8 -*-
4 """
5 trace/generated-tracers.dtrace (DTrace only).
6 """
8 __author__ = "Lluís Vilanova <vilanova@ac.upc.edu>"
9 __copyright__ = "Copyright 2012-2014, Lluís Vilanova <vilanova@ac.upc.edu>"
10 __license__ = "GPL version 2 or (at your option) any later version"
12 __maintainer__ = "Stefan Hajnoczi"
13 __email__ = "stefanha@linux.vnet.ibm.com"
16 from tracetool import out
19 # Reserved keywords from
20 # https://wikis.oracle.com/display/DTrace/Types,+Operators+and+Expressions
21 RESERVED_WORDS = (
22 'auto', 'goto', 'sizeof', 'break', 'if', 'static', 'case', 'import',
23 'string', 'char', 'inline', 'stringof', 'const', 'int', 'struct',
24 'continue', 'long', 'switch', 'counter', 'offsetof', 'this',
25 'default', 'probe', 'translator', 'do', 'provider', 'typedef',
26 'double', 'register', 'union', 'else', 'restrict', 'unsigned',
27 'enum', 'return', 'void', 'extern', 'self', 'volatile', 'float',
28 'short', 'while', 'for', 'signed', 'xlate',
32 def generate(events, backend):
33 events = [e for e in events
34 if "disable" not in e.properties]
36 out('/* This file is autogenerated by tracetool, do not edit. */'
37 '',
38 'provider qemu {')
40 for e in events:
41 args = []
42 for type_, name in e.args:
43 if name in RESERVED_WORDS:
44 name += '_'
45 args.append(type_ + ' ' + name)
47 # Define prototype for probe arguments
48 out('',
49 'probe %(name)s(%(args)s);',
50 name=e.name,
51 args=','.join(args))
53 out('',
54 '};')