2 * SPDX-License-Identifier: LGPL-2.1-only
4 * Copyright (C) 2009-2012 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 * LTTng UST Instruction Pointer Context.
12 #include <sys/types.h>
14 #include <lttng/ust-events.h>
15 #include <lttng/ust-tracer.h>
16 #include <lttng/ust-ringbuffer-context.h>
18 #include "context-internal.h"
21 size_t ip_get_size(void *priv
__attribute__((unused
)),
26 size
+= lttng_ust_ring_buffer_align(offset
, lttng_ust_rb_alignof(void *));
27 size
+= sizeof(void *);
32 void ip_record(void *priv
__attribute__((unused
)),
33 struct lttng_ust_ring_buffer_ctx
*ctx
,
34 struct lttng_ust_channel_buffer
*chan
)
39 chan
->ops
->event_write(ctx
, &ip
, sizeof(ip
), lttng_ust_rb_alignof(ip
));
42 static const struct lttng_ust_ctx_field
*ctx_field
= lttng_ust_static_ctx_field(
43 lttng_ust_static_event_field("ip",
44 lttng_ust_static_type_integer(sizeof(void *) * CHAR_BIT
,
45 lttng_ust_rb_alignof(void *) * CHAR_BIT
,
46 lttng_ust_is_signed_type(void *),
47 LTTNG_UST_BYTE_ORDER
, 10),
53 int lttng_add_ip_to_ctx(struct lttng_ust_ctx
**ctx
)
57 if (lttng_find_context(*ctx
, ctx_field
->event_field
->name
)) {
59 goto error_find_context
;
61 ret
= lttng_ust_context_append(ctx
, ctx_field
);