1#!/usr/bin/env python
2# -*- coding: utf-8 -*-
3
4"""
5Generate .h for LTTng ust event description.
6"""
7
8__author__     = "Mohamad Gebai <mohamad.gebai@polymtl.ca>"
9__copyright__  = "Copyright 2012, Mohamad Gebai <mohamad.gebai@polymtl.ca>"
10__license__    = "GPL version 2 or (at your option) any later version"
11
12__maintainer__ = "Stefan Hajnoczi"
13__email__      = "stefanha@redhat.com"
14
15
16from tracetool import out
17
18
19def begin(events):
20    out('/* This file is autogenerated by tracetool, do not edit. */',
21        '',
22        '#undef TRACEPOINT_PROVIDER',
23        '#define TRACEPOINT_PROVIDER qemu',
24        '',
25        '#undef TRACEPOINT_INCLUDE_FILE',
26        '#define TRACEPOINT_INCLUDE_FILE ./generated-ust-provider.h',
27        '',
28        '#if !defined (TRACE__GENERATED_UST_H) || defined(TRACEPOINT_HEADER_MULTI_READ)',
29        '#define TRACE__GENERATED_UST_H',
30        '',
31        '#include "qemu-common.h"',
32        '#include <lttng/tracepoint.h>',
33        '',
34        '/*',
35        ' * LTTng ust 2.0 does not allow you to use TP_ARGS(void) for tracepoints',
36        ' * requiring no arguments. We define these macros introduced in more recent'
37        ' * versions of LTTng ust as a workaround',
38        ' */',
39        '#ifndef _TP_EXPROTO1',
40        '#define _TP_EXPROTO1(a)               void',
41        '#endif',
42        '#ifndef _TP_EXDATA_PROTO1',
43        '#define _TP_EXDATA_PROTO1(a)          void *__tp_data',
44        '#endif',
45        '#ifndef _TP_EXDATA_VAR1',
46        '#define _TP_EXDATA_VAR1(a)            __tp_data',
47        '#endif',
48        '#ifndef _TP_EXVAR1',
49        '#define _TP_EXVAR1(a)',
50        '#endif',
51        '')
52
53def end(events):
54    out('#endif /* TRACE__GENERATED_UST_H */',
55        '',
56        '/* This part must be outside ifdef protection */',
57        '#include <lttng/tracepoint-event.h>')
58