*/
#define _LGPL_SOURCE
+#include <limits.h>
#include <stddef.h>
#include <stdint.h>
-#include <lttng/align.h>
+#include <lttng/ust-utils.h>
#include "context-internal.h"
#include "lttng-bytecode.h"
switch (stack_top->load.object_type) {
case OBJECT_TYPE_ARRAY:
{
- struct lttng_ust_type_integer *integer_type;
- struct lttng_ust_event_field *field;
+ const struct lttng_ust_type_integer *integer_type;
+ const struct lttng_ust_event_field *field;
uint32_t elem_len, num_elems;
int signedness;
}
case OBJECT_TYPE_SEQUENCE:
{
- struct lttng_ust_type_integer *integer_type;
- struct lttng_ust_event_field *field;
+ const struct lttng_ust_type_integer *integer_type;
+ const struct lttng_ust_event_field *field;
uint32_t elem_len;
int signedness;
const char *name;
offset = ((struct get_symbol *) insn->data)->offset;
- name = bytecode->p.priv->bc->bc.data + bytecode->p.priv->bc->bc.reloc_offset + offset;
+ name = bytecode->p.bc->bc.data + bytecode->p.bc->bc.reloc_offset + offset;
return lttng_get_context_index(ctx, name);
}
-static int specialize_load_object(struct lttng_ust_event_field *field,
+static int specialize_load_object(const struct lttng_ust_event_field *field,
struct vstack_load *load, bool is_context)
{
load->type = LOAD_OBJECT;
break;
case lttng_ust_type_enum:
{
- struct lttng_ust_type_integer *itype;
+ const struct lttng_ust_type_integer *itype;
itype = lttng_ust_get_type_integer(lttng_ust_get_type_enum(field->type)->container_type);
if (itype->signedness)
struct vstack_load *load)
{
int idx, ret;
- struct lttng_ust_ctx_field *ctx_field;
- struct lttng_ust_event_field *field;
+ const struct lttng_ust_ctx_field *ctx_field;
+ const struct lttng_ust_event_field *field;
struct bytecode_get_index_data gid;
ssize_t data_offset;
if (idx < 0) {
return -ENOENT;
}
- ctx_field = ctx->fields[idx];
+ ctx_field = &ctx->fields[idx];
field = ctx_field->event_field;
ret = specialize_load_object(field, load, true);
if (ret)
const char *orig_name;
char *name = NULL;
int idx, ret;
- struct lttng_ust_ctx_field *ctx_field;
- struct lttng_ust_event_field *field;
+ const struct lttng_ust_ctx_field *ctx_field;
+ const struct lttng_ust_event_field *field;
struct bytecode_get_index_data gid;
ssize_t data_offset;
offset = ((struct get_symbol *) insn->data)->offset;
- orig_name = runtime->p.priv->bc->bc.data + runtime->p.priv->bc->bc.reloc_offset + offset;
+ orig_name = runtime->p.bc->bc.data + runtime->p.bc->bc.reloc_offset + offset;
name = zmalloc(strlen(orig_name) + strlen("$app.") + 1);
if (!name) {
ret = -ENOMEM;
if (idx < 0)
return -ENOENT;
}
- ctx_field = (*pctx)->fields[idx];
+ ctx_field = &(*pctx)->fields[idx];
field = ctx_field->event_field;
ret = specialize_load_object(field, load, true);
if (ret)
return ret;
}
-static int specialize_payload_lookup(struct lttng_ust_event_desc *event_desc,
+static int specialize_payload_lookup(const struct lttng_ust_event_desc *event_desc,
struct bytecode_runtime *runtime,
struct load_op *insn,
struct vstack_load *load)
unsigned int i, nr_fields;
bool found = false;
uint32_t field_offset = 0;
- struct lttng_ust_event_field *field;
+ const struct lttng_ust_event_field *field;
int ret;
struct bytecode_get_index_data gid;
ssize_t data_offset;
nr_fields = event_desc->nr_fields;
offset = ((struct get_symbol *) insn->data)->offset;
- name = runtime->p.priv->bc->bc.data + runtime->p.priv->bc->bc.reloc_offset + offset;
+ name = runtime->p.bc->bc.data + runtime->p.bc->bc.reloc_offset + offset;
for (i = 0; i < nr_fields; i++) {
field = event_desc->fields[i];
if (field->nofilter) {
return ret;
}
-int lttng_bytecode_specialize(struct lttng_ust_event_desc *event_desc,
+int lttng_bytecode_specialize(const struct lttng_ust_event_desc *event_desc,
struct bytecode_runtime *bytecode)
{
void *pc, *next_pc, *start_pc;
int ret = -EINVAL;
struct vstack _stack;
struct vstack *stack = &_stack;
- struct lttng_ust_ctx **pctx = bytecode->p.priv->pctx;
+ struct lttng_ust_ctx **pctx = bytecode->p.pctx;
vstack_init(stack);