Print this page
12259 CTF shouldn't assume enum size
@@ -8,11 +8,11 @@
* source. A copy of the CDDL is also available via the Internet at
* http://www.illumos.org/license/CDDL.
*/
/*
- * Copyright 2019, Joyent, Inc.
+ * Copyright 2020 Joyent, Inc.
*/
/*
* To perform a merge of two CTF containers, we first diff the two containers
* types. For every type that's in the src container, but not in the dst
@@ -338,19 +338,22 @@
int flags;
const ctf_type_t *tp;
const char *name;
ctf_id_t enumid;
ctf_merge_enum_t cme;
+ size_t size;
tp = LCTF_INDEX_TO_TYPEPTR(cmp->cm_src, id);
- name = ctf_strraw(cmp->cm_src, tp->ctt_name);
if (CTF_INFO_ISROOT(tp->ctt_info) != 0)
flags = CTF_ADD_ROOT;
else
flags = CTF_ADD_NONROOT;
- enumid = ctf_add_enum(cmp->cm_out, flags, name);
+ name = ctf_strraw(cmp->cm_src, tp->ctt_name);
+ size = ctf_get_ctt_size(cmp->cm_src, tp, NULL, NULL);
+
+ enumid = ctf_add_enum(cmp->cm_out, flags, name, size);
if (enumid == CTF_ERR)
return (enumid);
cme.cme_fp = cmp->cm_out;
cme.cme_id = enumid;