4 * LTTng filter bytecode utilities.
6 * Copyright 2016 - Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 * This library is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU Lesser General Public License, version 2.1 only,
10 * as published by the Free Software Foundation.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public License
18 * along with this library; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
25 struct bytecode_symbol_iterator
{
26 /* No ownership of bytecode is taken. */
32 struct bytecode_symbol_iterator
*bytecode_symbol_iterator_create(
33 struct lttng_filter_bytecode
*bytecode
)
35 struct bytecode_symbol_iterator
*it
= NULL
;
41 it
= zmalloc(sizeof(*it
));
46 it
->bytecode
= bytecode
->data
;
47 it
->offset
= bytecode
->reloc_table_offset
;
48 it
->len
= bytecode
->len
;
54 int bytecode_symbol_iterator_next(struct bytecode_symbol_iterator
*it
)
59 if (!it
|| it
->offset
>= it
->len
) {
64 len
= strlen(it
->bytecode
+ it
->offset
+ sizeof(uint16_t)) + 1;
65 it
->offset
+= len
+ sizeof(uint16_t);
66 ret
= it
->offset
>= it
->len
? -1 : 0;
72 int bytecode_symbol_iterator_get_type(struct bytecode_symbol_iterator
*it
)
81 ret
= *((uint16_t *) (it
->bytecode
+ it
->offset
));
87 const char *bytecode_symbol_iterator_get_name(
88 struct bytecode_symbol_iterator
*it
)
90 const char *ret
= NULL
;
96 ret
= it
->bytecode
+ it
->offset
+ sizeof(uint16_t);
102 void bytecode_symbol_iterator_destroy(struct bytecode_symbol_iterator
*it
)
This page took 0.04224 seconds and 4 git commands to generate.