[lttng-dev] [RFC-PATCH] Adding trap tracepoints definitions

Francis Deslauriers fdeslaur at gmail.com
Wed Mar 20 16:00:13 EDT 2013


Here is reworked version on the trap tracepoints.

If it looks good, i will go on by sending a lttng-modules patch adding the
trap-probe.

Comments are welcome.

Francis


On Wed, Mar 20, 2013 at 3:55 PM, Francis Deslauriers <fdeslaur at gmail.com>wrote:

> This patch adds new trap tracepoint definitions. Both trap entry and trap
> exit
> tracepoints can be added.
>
> Signed-off-by: Francis Deslauriers <fdeslaur at gmail.com>
> ---
>  include/trace/events/trap.h |   45
> +++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 45 insertions(+)
>  create mode 100644 include/trace/events/trap.h
>
> diff --git a/include/trace/events/trap.h b/include/trace/events/trap.h
> new file mode 100644
> index 0000000..e79e8c0
> --- /dev/null
> +++ b/include/trace/events/trap.h
> @@ -0,0 +1,45 @@
> +#undef TRACE_SYSTEM
> +#define TRACE_SYSTEM trap
> +
> +#if !defined(_TRACE_TRAP_H) || defined(TRACE_HEADER_MULTI_READ)
> +#define _TRACE_TRAP_H
> +
> +#include <linux/tracepoint.h>
> +
> +TRACE_EVENT(trap_entry,
> +
> +       TP_PROTO(struct pt_regs *regs, long trap),
> +
> +       TP_ARGS(regs, trap),
> +
> +       TP_STRUCT__entry(
> +               __field(    long,    trap )
> +               __field(  unsigned long,        ip)
> +       ),
> +       TP_fast_assign(
> +               __entry->trap = trap;
> +               __entry->ip = regs ? instruction_pointer(regs) : 0UL;
> +       ),
> +
> +       TP_printk("number=%ld, ip = %lu", __entry->trap, __entry->ip)
> +);
> +
> +TRACE_EVENT(trap_exit,
> +
> +       TP_PROTO(long trap),
> +
> +       TP_ARGS(trap),
> +
> +       TP_STRUCT__entry(
> +               __field(    long,    trap )
> +       ),
> +       TP_fast_assign(
> +               __entry->trap = trap;
> +       ),
> +
> +       TP_printk("number=%ld", __entry->trap)
> +);
> +
> +#endif /* _TRACE_TRAP_H */
> +/* This part must be outside protection */
> +#include <trace/define_trace.h>
> --
> 1.7.10.4
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lttng.org/pipermail/lttng-dev/attachments/20130320/c88156c1/attachment.html>


More information about the lttng-dev mailing list