ctf_encoder: Allow encoding a bit_size in enumeration types
As we have to support enum bitfields, so remember the bit_size. Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
parent
a3cd3c4a09
commit
ce97ac9a26
|
@ -155,7 +155,8 @@ static int enumeration_type__encode(struct tag *self, uint16_t core_id,
|
|||
struct type *etype = tag__type(self);
|
||||
int64_t position;
|
||||
int ctf_id = ctf__add_enumeration_type(ctf, etype->namespace.name,
|
||||
etype->nr_members, &position);
|
||||
etype->size, etype->nr_members,
|
||||
&position);
|
||||
|
||||
if (ctf_id < 0 || tag__check_id_drift(self, core_id, ctf_id))
|
||||
return -1;
|
||||
|
|
4
libctf.c
4
libctf.c
|
@ -324,14 +324,14 @@ int ctf__add_function_type(struct ctf *self, uint16_t type, uint16_t nr_parms,
|
|||
return ++self->type_index;
|
||||
}
|
||||
|
||||
int ctf__add_enumeration_type(struct ctf *self, uint32_t name,
|
||||
int ctf__add_enumeration_type(struct ctf *self, uint32_t name, uint16_t size,
|
||||
uint16_t nr_entries, int64_t *position)
|
||||
{
|
||||
struct ctf_short_type e;
|
||||
|
||||
e.ctf_name = name;
|
||||
e.ctf_info = CTF_INFO_ENCODE(CTF_TYPE_KIND_ENUM, nr_entries, 0);
|
||||
e.ctf_size = 0;
|
||||
e.ctf_size = size;
|
||||
|
||||
gobuffer__add(&self->types, &e, sizeof(e));
|
||||
*position = gobuffer__allocate(&self->types,
|
||||
|
|
2
libctf.h
2
libctf.h
|
@ -31,7 +31,7 @@ int ctf__add_array(struct ctf *self, uint16_t type, uint16_t index_type,
|
|||
void ctf__add_parameter(struct ctf *self, uint16_t type, int64_t *position);
|
||||
int ctf__add_function_type(struct ctf *self, uint16_t type,
|
||||
uint16_t nr_parms, bool varargs, int64_t *position);
|
||||
int ctf__add_enumeration_type(struct ctf *self, uint32_t name,
|
||||
int ctf__add_enumeration_type(struct ctf *self, uint32_t name, uint16_t size,
|
||||
uint16_t nr_entries, int64_t *position);
|
||||
void ctf__add_enumerator(struct ctf *self, uint32_t name, uint32_t value,
|
||||
int64_t *position);
|
||||
|
|
Loading…
Reference in New Issue