2 * Copyright 2016 Jérémie Galarneau <jeremie.galarneau@efficios.com>
4 * SPDX-License-Identifier: LGPL-2.1-only
11 struct bytecode_symbol_iterator
{
12 /* No ownership of bytecode is taken. */
17 struct bytecode_symbol_iterator
*bytecode_symbol_iterator_create(
18 struct lttng_bytecode
*bytecode
)
20 struct bytecode_symbol_iterator
*it
= NULL
;
26 it
= (bytecode_symbol_iterator
*) zmalloc(sizeof(*it
));
31 it
->bytecode
= bytecode
->data
;
32 it
->offset
= bytecode
->reloc_table_offset
;
33 it
->len
= bytecode
->len
;
38 int bytecode_symbol_iterator_next(struct bytecode_symbol_iterator
*it
)
43 if (!it
|| it
->offset
>= it
->len
) {
48 len
= strlen(it
->bytecode
+ it
->offset
+ sizeof(uint16_t)) + 1;
49 it
->offset
+= len
+ sizeof(uint16_t);
50 ret
= it
->offset
>= it
->len
? -1 : 0;
55 int bytecode_symbol_iterator_get_type(struct bytecode_symbol_iterator
*it
)
64 ret
= *((uint16_t *) (it
->bytecode
+ it
->offset
));
69 const char *bytecode_symbol_iterator_get_name(
70 struct bytecode_symbol_iterator
*it
)
72 const char *ret
= NULL
;
78 ret
= it
->bytecode
+ it
->offset
+ sizeof(uint16_t);
83 void bytecode_symbol_iterator_destroy(struct bytecode_symbol_iterator
*it
)
This page took 0.033886 seconds and 4 git commands to generate.