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
)),
22 struct lttng_ust_probe_ctx
*probe_ctx
__attribute__((unused
)),
27 size
+= lttng_ust_ring_buffer_align(offset
, lttng_ust_rb_alignof(void *));
28 size
+= sizeof(void *);
33 void ip_record(void *priv
__attribute__((unused
)),
34 struct lttng_ust_probe_ctx
*probe_ctx
,
35 struct lttng_ust_ring_buffer_ctx
*ctx
,
36 struct lttng_ust_channel_buffer
*chan
)
41 chan
->ops
->event_write(ctx
, &ip
, sizeof(ip
), lttng_ust_rb_alignof(ip
));
45 void ip_get_value(void *priv
__attribute__((unused
)),
46 struct lttng_ust_probe_ctx
*probe_ctx
,
47 struct lttng_ust_ctx_value
*value
)
49 value
->u
.u64
= (unsigned long) probe_ctx
->ip
;
52 static const struct lttng_ust_ctx_field
*ctx_field
= lttng_ust_static_ctx_field(
53 lttng_ust_static_event_field("ip",
54 lttng_ust_static_type_integer(sizeof(void *) * CHAR_BIT
,
55 lttng_ust_rb_alignof(void *) * CHAR_BIT
,
56 lttng_ust_is_signed_type(void *),
57 LTTNG_UST_BYTE_ORDER
, 10),
64 int lttng_add_ip_to_ctx(struct lttng_ust_ctx
**ctx
)
68 if (lttng_find_context(*ctx
, ctx_field
->event_field
->name
)) {
70 goto error_find_context
;
72 ret
= lttng_ust_context_append(ctx
, ctx_field
);