2 * Copyright 2016 Jérémie Galarneau <jeremie.galarneau@efficios.com>
4 * SPDX-License-Identifier: LGPL-2.1-only
12 struct bytecode_symbol_iterator
{
13 /* No ownership of bytecode is taken. */
18 struct bytecode_symbol_iterator
*bytecode_symbol_iterator_create(struct lttng_bytecode
*bytecode
)
20 struct bytecode_symbol_iterator
*it
= nullptr;
26 it
= zmalloc
<bytecode_symbol_iterator
>();
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(struct bytecode_symbol_iterator
*it
)
71 const char *ret
= nullptr;
77 ret
= it
->bytecode
+ it
->offset
+ sizeof(uint16_t);
82 void bytecode_symbol_iterator_destroy(struct bytecode_symbol_iterator
*it
)
This page took 0.032754 seconds and 4 git commands to generate.