[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [RFC PATCH 13/21] tracetool: generate plugin snippets
From: |
Richard Henderson |
Subject: |
Re: [Qemu-devel] [RFC PATCH 13/21] tracetool: generate plugin snippets |
Date: |
Mon, 15 Oct 2018 10:02:41 -0700 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 |
On 10/5/18 8:49 AM, Alex Bennée wrote:
> +def generate_h_begin(events, group):
> + for event in events:
> + # prototype for plugin event
> + out('bool _plugin_%(api)s(%(args)s);',
> + api=event.api(),
> + args=event.args)
> + # prototype for plugin fn
> + out("typedef bool (* _plugin_%(api)s_fn)(%(args)s);",
> + api=event.api(),
> + args=event.args)
Do you really want the _fn typedef to be a pointer?
Not doing that would allow declarations like
_plugin_apis_fn _plugin_apis;
> +def generate_h(event, group):
> + out(' if (!_plugin_%(api)s(%(args)s)) {',
> + ' return;',
> + ' };',
Extra ;
> + # Forst the pre-amble, bail early if the event is not enabled and
First.
> + # if it is but no plugin is enabled let the reset of the events proceed.
> +
> + out('',
> + ' if (!%(cond)s) {',
> + ' return false;',
> + ' }',
> + '',
> + ' uintptr_t fp = trace_event_get_plugin(&_%(event)s_EVENT);',
Declaration in the middle of a block.
Which, honestly, we should just allow via -std=gnu99 or gnu01.
But until then...
> + out('',
> + ' _plugin_%(api)s_fn plug_fn = (_plugin_%(api)s_fn) fp;',
Likewise.
r~
- Re: [Qemu-devel] [RFC PATCH 01/21] util/log: allow -dfilter to stack, (continued)
- [Qemu-devel] [RFC PATCH 05/21] trace: keep a count of trace-point hits, Alex Bennée, 2018/10/05
- [Qemu-devel] [RFC PATCH 18/21] linux-user: allow dumping of plugin status at end of run, Alex Bennée, 2018/10/05
- [Qemu-devel] [RFC PATCH 10/21] qom/cpu: add a cpu_exit trace event, Alex Bennée, 2018/10/05
- [Qemu-devel] [RFC PATCH 12/21] configure: expose a plugin to the trace-backends, Alex Bennée, 2018/10/05
- [Qemu-devel] [RFC PATCH 13/21] tracetool: generate plugin snippets, Alex Bennée, 2018/10/05
- Re: [Qemu-devel] [RFC PATCH 13/21] tracetool: generate plugin snippets,
Richard Henderson <=
- [Qemu-devel] [RFC PATCH 09/21] trace: suppress log output of trace points, Alex Bennée, 2018/10/05
- [Qemu-devel] [RFC PATCH 02/21] util/log: add qemu_dfilter_append_range(), Alex Bennée, 2018/10/05
- [Qemu-devel] [RFC PATCH 16/21] trace: add infrastructure for building plugins, Alex Bennée, 2018/10/05
- [Qemu-devel] [RFC PATCH 11/21] trace: expose a plugin fn pointer in TraceEvent, Alex Bennée, 2018/10/05
- [Qemu-devel] [RFC PATCH 14/21] trace: add support for plugin infrastructure, Alex Bennée, 2018/10/05