+2020-07-22 Nick Alcock <nick.alcock@oracle.com>
+
+ * ctf-create.c (ctf_add_slice): Support slices of any kind that
+ resolves to an integral type.
+ * ctf-types.c (ctf_type_encoding): Resolve the type before
+ fishing its encoding out.
+
2020-07-22 Nick Alcock <nick.alcock@oracle.com>
* ctf-create.c (ctf_create): Mark dirty.
const ctf_encoding_t *ep)
{
ctf_dtdef_t *dtd;
+ ctf_id_t resolved_ref = ref;
ctf_id_t type;
int kind;
const ctf_type_t *tp;
if (ref != 0 && ((tp = ctf_lookup_by_id (&tmp, ref)) == NULL))
return CTF_ERR; /* errno is set for us. */
- kind = ctf_type_kind_unsliced (tmp, ref);
+ /* Make sure we ultimately point to an integral type. We also allow slices to
+ point to the unimplemented type, for now, because the compiler can emit
+ such slices, though they're not very much use. */
+
+ resolved_ref = ctf_type_resolve_unsliced (tmp, ref);
+ kind = ctf_type_kind_unsliced (tmp, resolved_ref);
+
if ((kind != CTF_K_INTEGER) && (kind != CTF_K_FLOAT) &&
(kind != CTF_K_ENUM)
&& (ref != 0))
{
const ctf_slice_t *slice;
ctf_encoding_t underlying_en;
+ ctf_id_t underlying;
+
slice = &dtd->dtd_u.dtu_slice;
+ underlying = ctf_type_resolve (fp, slice->cts_type);
+ data = ctf_type_encoding (fp, underlying, &underlying_en);
- data = ctf_type_encoding (fp, slice->cts_type, &underlying_en);
ep->cte_format = underlying_en.cte_format;
ep->cte_offset = slice->cts_offset;
ep->cte_bits = slice->cts_bits;
{
const ctf_slice_t *slice;
ctf_encoding_t underlying_en;
+ ctf_id_t underlying;
slice = (ctf_slice_t *) ((uintptr_t) tp + increment);
- data = ctf_type_encoding (fp, slice->cts_type, &underlying_en);
+ underlying = ctf_type_resolve (fp, slice->cts_type);
+ data = ctf_type_encoding (fp, underlying, &underlying_en);
ep->cte_format = underlying_en.cte_format;
ep->cte_offset = slice->cts_offset;