usb: ccid: check ccid apdu length
[qemu/ar7.git] / scripts / tracetool / backend / log.py
blob4f4a4d38b19796c1eabc6e64badc707ac965831c
1 #!/usr/bin/env python
2 # -*- coding: utf-8 -*-
4 """
5 Stderr built-in backend.
6 """
8 __author__ = "Lluís Vilanova <vilanova@ac.upc.edu>"
9 __copyright__ = "Copyright 2012-2016, 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 PUBLIC = True
22 def generate_h_begin(events, group):
23 out('#include "qemu/log.h"',
24 '')
27 def generate_h(event, group):
28 argnames = ", ".join(event.args.names())
29 if len(event.args) > 0:
30 argnames = ", " + argnames
32 if "vcpu" in event.properties:
33 # already checked on the generic format code
34 cond = "true"
35 else:
36 cond = "trace_event_get_state(%s)" % ("TRACE_" + event.name.upper())
38 out(' if (%(cond)s) {',
39 ' struct timeval _now;',
40 ' gettimeofday(&_now, NULL);',
41 ' qemu_log_mask(LOG_TRACE, "%%d@%%zd.%%06zd:%(name)s " %(fmt)s "\\n",',
42 ' getpid(),',
43 ' (size_t)_now.tv_sec, (size_t)_now.tv_usec',
44 ' %(argnames)s);',
45 ' }',
46 cond=cond,
47 name=event.name,
48 fmt=event.fmt.rstrip("\n"),
49 argnames=argnames)