2 * Copyright (C) 2017 Jérémie Galarneau <jeremie.galarneau@efficios.com>
4 * SPDX-License-Identifier: LGPL-2.1-only
8 #include <lttng/trigger/trigger-internal.h>
9 #include <lttng/condition/condition-internal.h>
10 #include <lttng/condition/event-rule-internal.h>
11 #include <lttng/condition/event-rule.h>
12 #include <lttng/condition/buffer-usage.h>
13 #include <lttng/event-rule/event-rule-internal.h>
14 #include <lttng/event-expr-internal.h>
15 #include <lttng/action/action-internal.h>
16 #include <common/credentials.h>
17 #include <common/payload.h>
18 #include <common/payload-view.h>
19 #include <lttng/domain.h>
20 #include <common/error.h>
21 #include <common/dynamic-array.h>
22 #include <common/optional.h>
26 static void destroy_lttng_condition_event_rule_capture_bytecode_element(void *ptr
)
28 struct lttng_condition_event_rule_capture_bytecode_element
*element
=
30 lttng_event_expr_destroy(element
->expression
);
31 free(element
->bytecode
);
35 bool lttng_trigger_validate(const struct lttng_trigger
*trigger
)
44 if (!trigger
->creds
.uid
.is_set
) {
49 valid
= lttng_condition_validate(trigger
->condition
) &&
50 lttng_action_validate(trigger
->action
);
55 struct lttng_trigger
*lttng_trigger_create(
56 struct lttng_condition
*condition
,
57 struct lttng_action
*action
)
59 struct lttng_trigger
*trigger
= NULL
;
61 if (!condition
|| !action
) {
65 trigger
= zmalloc(sizeof(struct lttng_trigger
));
70 urcu_ref_init(&trigger
->ref
);
72 trigger
->firing_policy
.type
= LTTNG_TRIGGER_FIRE_EVERY_N
;
73 trigger
->firing_policy
.threshold
= 1;
74 lttng_trigger_set_error_count(trigger
, 0);
76 lttng_condition_get(condition
);
77 trigger
->condition
= condition
;
79 lttng_action_get(action
);
80 trigger
->action
= action
;
82 lttng_dynamic_pointer_array_init(&trigger
->capture_bytecode_set
,
83 destroy_lttng_condition_event_rule_capture_bytecode_element
);
90 * Note: the lack of reference counting 'get' on the condition object is normal.
91 * This API was exposed as such in 2.11. The client is not expected to call
92 * lttng_condition_destroy on the returned object.
94 struct lttng_condition
*lttng_trigger_get_condition(
95 struct lttng_trigger
*trigger
)
97 return trigger
? trigger
->condition
: NULL
;
100 const struct lttng_condition
*lttng_trigger_get_const_condition(
101 const struct lttng_trigger
*trigger
)
103 return trigger
? trigger
->condition
: NULL
;
108 * Note: the lack of reference counting 'get' on the action object is normal.
109 * This API was exposed as such in 2.11. The client is not expected to call
110 * lttng_action_destroy on the returned object.
112 struct lttng_action
*lttng_trigger_get_action(
113 struct lttng_trigger
*trigger
)
115 return trigger
? trigger
->action
: NULL
;
118 const struct lttng_action
*lttng_trigger_get_const_action(
119 const struct lttng_trigger
*trigger
)
121 return trigger
? trigger
->action
: NULL
;
124 static void trigger_destroy_ref(struct urcu_ref
*ref
)
126 struct lttng_trigger
*trigger
=
127 container_of(ref
, struct lttng_trigger
, ref
);
128 struct lttng_action
*action
= lttng_trigger_get_action(trigger
);
129 struct lttng_condition
*condition
=
130 lttng_trigger_get_condition(trigger
);
132 lttng_dynamic_pointer_array_reset(&trigger
->capture_bytecode_set
);
137 /* Release ownership. */
138 lttng_action_put(action
);
139 lttng_condition_put(condition
);
145 void lttng_trigger_destroy(struct lttng_trigger
*trigger
)
147 lttng_trigger_put(trigger
);
150 static bool is_firing_policy_valid(enum lttng_trigger_firing_policy_type policy
)
155 case LTTNG_TRIGGER_FIRE_EVERY_N
:
156 case LTTNG_TRIGGER_FIRE_ONCE_AFTER_N
:
168 ssize_t
lttng_trigger_create_from_payload(
169 struct lttng_payload_view
*src_view
,
170 struct lttng_trigger
**trigger
)
172 ssize_t ret
, offset
= 0, condition_size
, action_size
, name_size
= 0;
173 enum lttng_trigger_status status
;
174 struct lttng_condition
*condition
= NULL
;
175 struct lttng_action
*action
= NULL
;
176 const struct lttng_trigger_comm
*trigger_comm
;
177 const char *name
= NULL
;
178 uint64_t firing_threshold
;
180 enum lttng_trigger_firing_policy_type firing_policy
;
181 struct lttng_credentials creds
= {
182 .uid
= LTTNG_OPTIONAL_INIT_UNSET
,
183 .gid
= LTTNG_OPTIONAL_INIT_UNSET
,
186 if (!src_view
|| !trigger
) {
191 /* lttng_trigger_comm header */
192 trigger_comm
= (typeof(trigger_comm
)) src_view
->buffer
.data
;
194 /* Get the trigger creds */
195 LTTNG_OPTIONAL_SET(&creds
.uid
, trigger_comm
->uid
);
197 offset
+= sizeof(*trigger_comm
);
199 firing_policy
= trigger_comm
->policy_type
;
200 if (!is_firing_policy_valid(firing_policy
)) {
205 firing_threshold
= trigger_comm
->policy_threshold
;
206 error_count
= trigger_comm
->error_count
;
207 if (trigger_comm
->name_length
!= 0) {
209 struct lttng_payload_view name_view
=
210 lttng_payload_view_from_view(
211 src_view
, offset
, trigger_comm
->name_length
);
213 name
= name_view
.buffer
.data
;
214 if (!lttng_buffer_view_contains_string(&name_view
.buffer
, name
, trigger_comm
->name_length
)){
218 offset
+= trigger_comm
->name_length
;
219 name_size
= trigger_comm
->name_length
;
223 /* struct lttng_condition */
224 struct lttng_payload_view condition_view
=
225 lttng_payload_view_from_view(
226 src_view
, offset
, -1);
228 condition_size
= lttng_condition_create_from_payload(&condition_view
,
232 if (condition_size
< 0) {
233 ret
= condition_size
;
237 offset
+= condition_size
;
239 /* struct lttng_action */
240 struct lttng_payload_view action_view
=
241 lttng_payload_view_from_view(
242 src_view
, offset
, -1);
244 action_size
= lttng_action_create_from_payload(&action_view
, &action
);
247 if (action_size
< 0) {
251 offset
+= action_size
;
253 /* Unexpected size of inner-elements; the buffer is corrupted. */
254 if ((ssize_t
) trigger_comm
->length
!= condition_size
+ action_size
+ name_size
) {
259 *trigger
= lttng_trigger_create(condition
, action
);
265 lttng_trigger_set_credentials(*trigger
, &creds
);
268 * The trigger object owns references to the action and condition
271 lttng_condition_put(condition
);
274 lttng_action_put(action
);
278 status
= lttng_trigger_set_name(*trigger
, name
);
279 if (status
!= LTTNG_TRIGGER_STATUS_OK
) {
285 status
= lttng_trigger_set_firing_policy(*trigger
, firing_policy
, firing_threshold
);
286 if (status
!= LTTNG_TRIGGER_STATUS_OK
) {
291 lttng_trigger_set_error_count(*trigger
, error_count
);
296 lttng_condition_destroy(condition
);
297 lttng_action_destroy(action
);
303 * Both elements are stored contiguously, see their "*_comm" structure
304 * for the detailed format.
307 int lttng_trigger_serialize(const struct lttng_trigger
*trigger
,
308 struct lttng_payload
*payload
)
311 size_t header_offset
, size_before_payload
, size_name
;
312 struct lttng_trigger_comm trigger_comm
= {};
313 struct lttng_trigger_comm
*header
;
314 const struct lttng_credentials
*creds
= NULL
;
316 creds
= lttng_trigger_get_credentials(trigger
);
319 trigger_comm
.uid
= LTTNG_OPTIONAL_GET(creds
->uid
);
321 if (trigger
->name
!= NULL
) {
322 size_name
= strlen(trigger
->name
) + 1;
327 trigger_comm
.name_length
= size_name
;
328 trigger_comm
.policy_type
= (uint8_t) trigger
->firing_policy
.type
;
329 trigger_comm
.policy_threshold
= (uint64_t) trigger
->firing_policy
.threshold
;
330 trigger_comm
.error_count
= (int64_t) lttng_trigger_get_error_count(trigger
);
332 header_offset
= payload
->buffer
.size
;
333 ret
= lttng_dynamic_buffer_append(&payload
->buffer
, &trigger_comm
,
334 sizeof(trigger_comm
));
339 size_before_payload
= payload
->buffer
.size
;
342 ret
= lttng_dynamic_buffer_append(
343 &payload
->buffer
, trigger
->name
, size_name
);
348 ret
= lttng_condition_serialize(trigger
->condition
, payload
);
353 ret
= lttng_action_serialize(trigger
->action
, payload
);
358 /* Update payload size. */
359 header
= (typeof(header
)) (payload
->buffer
.data
+ header_offset
);
360 header
->length
= payload
->buffer
.size
- size_before_payload
;
365 enum lttng_trigger_status
lttng_trigger_set_name(struct lttng_trigger
*trigger
, const char* name
)
367 char *name_copy
= NULL
;
368 enum lttng_trigger_status status
= LTTNG_TRIGGER_STATUS_OK
;
370 if (!trigger
|| !name
||
372 status
= LTTNG_TRIGGER_STATUS_INVALID
;
376 name_copy
= strdup(name
);
378 status
= LTTNG_TRIGGER_STATUS_ERROR
;
384 trigger
->name
= name_copy
;
390 enum lttng_trigger_status
lttng_trigger_get_name(
391 const struct lttng_trigger
*trigger
, const char **name
)
393 enum lttng_trigger_status status
= LTTNG_TRIGGER_STATUS_OK
;
395 if (!trigger
|| !name
) {
396 status
= LTTNG_TRIGGER_STATUS_INVALID
;
400 if (!trigger
->name
) {
401 status
= LTTNG_TRIGGER_STATUS_UNSET
;
404 *name
= trigger
->name
;
410 int lttng_trigger_assign_name(struct lttng_trigger
*dst
,
411 const struct lttng_trigger
*src
)
414 enum lttng_trigger_status status
;
416 status
= lttng_trigger_set_name(dst
, src
->name
);
417 if (status
!= LTTNG_TRIGGER_STATUS_OK
) {
419 ERR("Failed to set name for trigger");
427 void lttng_trigger_set_tracer_token(struct lttng_trigger
*trigger
, uint64_t token
)
430 LTTNG_OPTIONAL_SET(&trigger
->tracer_token
, token
);
434 uint64_t lttng_trigger_get_tracer_token(const struct lttng_trigger
*trigger
)
438 return LTTNG_OPTIONAL_GET(trigger
->tracer_token
);
442 void lttng_trigger_set_error_counter_index(struct lttng_trigger
*trigger
,
443 uint64_t error_counter_index
)
446 LTTNG_OPTIONAL_SET(&trigger
->error_counter_index
, error_counter_index
);
450 uint64_t lttng_trigger_get_error_counter_index(
451 const struct lttng_trigger
*trigger
)
455 return LTTNG_OPTIONAL_GET(trigger
->error_counter_index
);
459 int lttng_trigger_generate_name(struct lttng_trigger
*trigger
, uint64_t offset
)
462 char *generated_name
= NULL
;
464 ret
= asprintf(&generated_name
, "T%" PRIu64
"", offset
);
466 ERR("Failed to generate trigger name");
472 trigger
->name
= generated_name
;
478 void lttng_trigger_get(struct lttng_trigger
*trigger
)
480 urcu_ref_get(&trigger
->ref
);
484 void lttng_trigger_put(struct lttng_trigger
*trigger
)
490 urcu_ref_put(&trigger
->ref
, trigger_destroy_ref
);
493 static void delete_trigger_array_element(void *ptr
)
495 struct lttng_trigger
*trigger
= ptr
;
496 lttng_trigger_put(trigger
);
500 bool lttng_trigger_is_equal(
501 const struct lttng_trigger
*a
, const struct lttng_trigger
*b
)
503 if (a
->firing_policy
.type
!= b
->firing_policy
.type
) {
507 if (a
->firing_policy
.threshold
!= b
->firing_policy
.threshold
) {
512 * Name is not taken into account since it is cosmetic only.
514 if (!lttng_condition_is_equal(a
->condition
, b
->condition
)) {
518 if (!lttng_action_is_equal(a
->action
, b
->action
)) {
522 if (!lttng_credentials_is_equal(lttng_trigger_get_credentials(a
),
523 lttng_trigger_get_credentials(b
))) {
531 struct lttng_triggers
*lttng_triggers_create(void)
533 struct lttng_triggers
*triggers
= NULL
;
535 triggers
= zmalloc(sizeof(*triggers
));
540 lttng_dynamic_pointer_array_init(&triggers
->array
, delete_trigger_array_element
);
547 struct lttng_trigger
*lttng_triggers_get_pointer_of_index(
548 const struct lttng_triggers
*triggers
, unsigned int index
)
550 struct lttng_trigger
*trigger
= NULL
;
552 if (index
>= lttng_dynamic_pointer_array_get_count(&triggers
->array
)) {
556 trigger
= (struct lttng_trigger
*)
557 lttng_dynamic_pointer_array_get_pointer(
558 &triggers
->array
, index
);
564 int lttng_triggers_add(
565 struct lttng_triggers
*triggers
, struct lttng_trigger
*trigger
)
572 lttng_trigger_get(trigger
);
574 ret
= lttng_dynamic_pointer_array_add_pointer(&triggers
->array
, trigger
);
576 lttng_trigger_put(trigger
);
582 const struct lttng_trigger
*lttng_triggers_get_at_index(
583 const struct lttng_triggers
*triggers
, unsigned int index
)
586 return lttng_triggers_get_pointer_of_index(triggers
, index
);
589 enum lttng_trigger_status
lttng_triggers_get_count(const struct lttng_triggers
*triggers
, unsigned int *count
)
591 enum lttng_trigger_status status
= LTTNG_TRIGGER_STATUS_OK
;
593 if (!triggers
|| !count
) {
594 status
= LTTNG_TRIGGER_STATUS_INVALID
;
598 *count
= lttng_dynamic_pointer_array_get_count(&triggers
->array
);
603 void lttng_triggers_destroy(struct lttng_triggers
*triggers
)
609 lttng_dynamic_pointer_array_reset(&triggers
->array
);
613 int lttng_triggers_serialize(const struct lttng_triggers
*triggers
,
614 struct lttng_payload
*payload
)
618 size_t header_offset
, size_before_payload
;
619 struct lttng_triggers_comm triggers_comm
= {};
620 struct lttng_triggers_comm
*header
;
621 enum lttng_trigger_status status
;
623 header_offset
= payload
->buffer
.size
;
625 status
= lttng_triggers_get_count(triggers
, &count
);
626 if (status
!= LTTNG_TRIGGER_STATUS_OK
) {
627 ret
= LTTNG_ERR_INVALID
;
631 triggers_comm
.count
= count
;
633 ret
= lttng_dynamic_buffer_append(&payload
->buffer
, &triggers_comm
,
634 sizeof(triggers_comm
));
639 size_before_payload
= payload
->buffer
.size
;
641 for (int i
= 0; i
< count
; i
++) {
642 const struct lttng_trigger
*trigger
=
643 lttng_triggers_get_at_index(triggers
, i
);
646 ret
= lttng_trigger_serialize(trigger
, payload
);
652 /* Update payload size. */
653 header
= (struct lttng_triggers_comm
*) ((char *) payload
->buffer
.data
+ header_offset
);
654 header
->length
= payload
->buffer
.size
- size_before_payload
;
660 ssize_t
lttng_triggers_create_from_payload(
661 struct lttng_payload_view
*src_view
,
662 struct lttng_triggers
**triggers
)
664 ssize_t ret
, offset
= 0, trigger_size
, triggers_size
= 0;
665 const struct lttng_triggers_comm
*triggers_comm
;
666 struct lttng_triggers
*local_triggers
= NULL
;
668 if (!src_view
|| !triggers
) {
673 /* lttng_trigger_comms header */
674 triggers_comm
= (const struct lttng_triggers_comm
*) src_view
->buffer
.data
;
675 offset
+= sizeof(*triggers_comm
);
677 local_triggers
= lttng_triggers_create();
678 if (!local_triggers
) {
683 for (int i
= 0; i
< triggers_comm
->count
; i
++) {
684 struct lttng_trigger
*trigger
= NULL
;
685 struct lttng_payload_view trigger_view
=
686 lttng_payload_view_from_view(src_view
, offset
, -1);
687 trigger_size
= lttng_trigger_create_from_payload(&trigger_view
,
689 if (trigger_size
< 0) {
694 /* Pass ownership of the trigger to the collection */
695 ret
= lttng_triggers_add(local_triggers
, trigger
);
696 lttng_trigger_put(trigger
);
702 offset
+= trigger_size
;
703 triggers_size
+= trigger_size
;
706 /* Unexpected size of inner-elements; the buffer is corrupted. */
707 if ((ssize_t
) triggers_comm
->length
!= triggers_size
) {
712 /* Pass ownership to caller */
713 *triggers
= local_triggers
;
714 local_triggers
= NULL
;
719 lttng_triggers_destroy(local_triggers
);
724 const struct lttng_credentials
*lttng_trigger_get_credentials(
725 const struct lttng_trigger
*trigger
)
727 return &trigger
->creds
;
731 void lttng_trigger_set_credentials(struct lttng_trigger
*trigger
,
732 const struct lttng_credentials
*creds
)
735 trigger
->creds
= *creds
;
738 enum lttng_trigger_status
lttng_trigger_set_user_identity(
739 struct lttng_trigger
*trigger
, uid_t uid
)
741 enum lttng_trigger_status ret
= LTTNG_TRIGGER_STATUS_OK
;
742 struct lttng_credentials creds
= {
743 .uid
= LTTNG_OPTIONAL_INIT_UNSET
,
744 .gid
= LTTNG_OPTIONAL_INIT_UNSET
,
748 ret
= LTTNG_TRIGGER_STATUS_INVALID
;
752 if (geteuid() != 0) {
753 ret
= LTTNG_TRIGGER_STATUS_EPERM
;
757 LTTNG_OPTIONAL_SET(&creds
.uid
, uid
);
759 lttng_trigger_set_credentials(trigger
, &creds
);
765 enum lttng_trigger_status
lttng_trigger_get_user_identity(
766 const struct lttng_trigger
*trigger
, uid_t
*uid
)
768 enum lttng_trigger_status ret
= LTTNG_TRIGGER_STATUS_OK
;
769 const struct lttng_credentials
*creds
= NULL
;
771 if (!trigger
|| !uid
) {
772 ret
= LTTNG_TRIGGER_STATUS_INVALID
;
776 if (!trigger
->creds
.uid
.is_set
) {
777 ret
= LTTNG_TRIGGER_STATUS_UNSET
;
781 creds
= lttng_trigger_get_credentials(trigger
);
782 *uid
= lttng_credentials_get_uid(creds
);
789 uint64_t lttng_trigger_get_error_count(
790 const struct lttng_trigger
*trigger
)
792 return LTTNG_OPTIONAL_GET(trigger
->error_count
);
796 void lttng_trigger_set_error_count(
797 struct lttng_trigger
*trigger
,
798 uint64_t error_count
)
800 LTTNG_OPTIONAL_SET(&trigger
->error_count
, error_count
);
803 enum lttng_trigger_status
lttng_trigger_set_firing_policy(
804 struct lttng_trigger
*trigger
,
805 enum lttng_trigger_firing_policy_type policy_type
,
808 enum lttng_trigger_status ret
= LTTNG_TRIGGER_STATUS_OK
;
812 ret
= LTTNG_TRIGGER_STATUS_INVALID
;
816 trigger
->firing_policy
.type
= policy_type
;
817 trigger
->firing_policy
.threshold
= threshold
;
823 enum lttng_trigger_status
lttng_trigger_get_firing_policy(
824 const struct lttng_trigger
*trigger
,
825 enum lttng_trigger_firing_policy_type
*policy_type
,
828 enum lttng_trigger_status status
= LTTNG_TRIGGER_STATUS_OK
;
830 if (!trigger
|| !policy_type
|| !threshold
) {
831 status
= LTTNG_TRIGGER_STATUS_INVALID
;
835 *policy_type
= trigger
->firing_policy
.type
;
836 *threshold
= trigger
->firing_policy
.threshold
;
843 bool lttng_trigger_should_fire(const struct lttng_trigger
*trigger
)
846 bool ready_to_fire
= false;
848 switch (trigger
->firing_policy
.type
) {
849 case LTTNG_TRIGGER_FIRE_EVERY_N
:
850 if (trigger
->firing_policy
.current_count
< trigger
->firing_policy
.threshold
) {
851 ready_to_fire
= true;
854 case LTTNG_TRIGGER_FIRE_ONCE_AFTER_N
:
855 if (trigger
->firing_policy
.current_count
< trigger
->firing_policy
.threshold
) {
856 ready_to_fire
= true;
863 return ready_to_fire
;
867 void lttng_trigger_fire(struct lttng_trigger
*trigger
)
871 trigger
->firing_policy
.current_count
++;
873 switch (trigger
->firing_policy
.type
) {
874 case LTTNG_TRIGGER_FIRE_EVERY_N
:
875 if (trigger
->firing_policy
.current_count
== trigger
->firing_policy
.threshold
) {
876 trigger
->firing_policy
.current_count
= 0;
879 case LTTNG_TRIGGER_FIRE_ONCE_AFTER_N
:
881 * TODO: deactivate the trigger condition on
882 * remove any work overhead on the
883 * traced application or kernel since the trigger will
893 enum lttng_domain_type
lttng_trigger_get_underlying_domain_type_restriction(
894 const struct lttng_trigger
*trigger
)
896 enum lttng_domain_type type
= LTTNG_DOMAIN_NONE
;
897 const struct lttng_event_rule
*event_rule
;
898 enum lttng_condition_status c_status
;
899 enum lttng_condition_type c_type
;
902 assert(trigger
->condition
);
903 c_type
= lttng_condition_get_type(trigger
->condition
);
904 if (c_type
== LTTNG_CONDITION_TYPE_UNKNOWN
) {
909 case LTTNG_CONDITION_TYPE_SESSION_CONSUMED_SIZE
:
910 case LTTNG_CONDITION_TYPE_SESSION_ROTATION_ONGOING
:
911 case LTTNG_CONDITION_TYPE_SESSION_ROTATION_COMPLETED
:
912 type
= LTTNG_DOMAIN_NONE
;
914 case LTTNG_CONDITION_TYPE_EVENT_RULE_HIT
:
915 c_status
= lttng_condition_event_rule_get_rule(
916 trigger
->condition
, &event_rule
);
917 if (c_status
!= LTTNG_CONDITION_STATUS_OK
) {
918 /* The condition object is invalid */
922 type
= lttng_event_rule_get_domain_type(event_rule
);
924 case LTTNG_CONDITION_TYPE_BUFFER_USAGE_HIGH
:
925 case LTTNG_CONDITION_TYPE_BUFFER_USAGE_LOW
:
926 c_status
= lttng_condition_buffer_usage_get_domain_type(
927 trigger
->condition
, &type
);
928 if (c_status
!= LTTNG_CONDITION_STATUS_OK
) {
929 /* The condition object is invalid */
934 type
= LTTNG_DOMAIN_NONE
;
942 struct lttng_trigger
*lttng_trigger_copy(const struct lttng_trigger
*trigger
)
945 struct lttng_payload copy_buffer
;
946 struct lttng_trigger
*copy
= NULL
;
948 lttng_payload_init(©_buffer
);
950 ret
= lttng_trigger_serialize(trigger
, ©_buffer
);
956 struct lttng_payload_view view
=
957 lttng_payload_view_from_payload(
958 ©_buffer
, 0, -1);
959 ret
= lttng_trigger_create_from_payload(
968 lttng_payload_reset(©_buffer
);
973 unsigned int lttng_trigger_get_capture_bytecode_count(
974 const struct lttng_trigger
*trigger
)
976 unsigned int count
= 0;
981 count
= lttng_dynamic_pointer_array_get_count(
982 &trigger
->capture_bytecode_set
);
989 const struct lttng_bytecode
*
990 lttng_trigger_get_capture_bytecode_at_index(
991 const struct lttng_trigger
*trigger
, unsigned int index
)
993 struct lttng_condition_event_rule_capture_bytecode_element
*element
= NULL
;
994 struct lttng_bytecode
*bytecode
= NULL
;
996 element
= lttng_dynamic_pointer_array_get_pointer(
997 &trigger
->capture_bytecode_set
, index
);
999 if (element
== NULL
) {
1002 bytecode
= element
->bytecode
;