X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=libctf%2Fctf-types.c;h=cd910434ea41abcf72bdee6c19b5d8b9f22cd05b;hb=efb763a5ea351f9d865cbe491909f03472ebf2d6;hp=ec221d734948e12faac78af46abd71c68dfb167e;hpb=1a6ab13e712348c59c2757457b9f913a333f3c92;p=deliverable%2Fbinutils-gdb.git diff --git a/libctf/ctf-types.c b/libctf/ctf-types.c index ec221d7349..cd910434ea 100644 --- a/libctf/ctf-types.c +++ b/libctf/ctf-types.c @@ -1,5 +1,5 @@ /* Type handling functions. - Copyright (C) 2019 Free Software Foundation, Inc. + Copyright (C) 2019-2020 Free Software Foundation, Inc. This file is part of libctf. @@ -441,7 +441,7 @@ ctf_type_lname (ctf_file_t *fp, ctf_id_t type, char *buf, size_t len) size_t slen; if (str == NULL) - return CTF_ERR; /* errno is set for us */ + return CTF_ERR; /* errno is set for us. */ slen = strlen (str); snprintf (buf, len, "%s", str); @@ -739,7 +739,27 @@ ctf_type_encoding (ctf_file_t *fp, ctf_id_t type, ctf_encoding_t *ep) if ((dtd = ctf_dynamic_type (ofp, type)) != NULL) { - *ep = dtd->dtd_u.dtu_enc; + switch (LCTF_INFO_KIND (fp, tp->ctt_info)) + { + case CTF_K_INTEGER: + case CTF_K_FLOAT: + *ep = dtd->dtd_u.dtu_enc; + break; + case CTF_K_SLICE: + { + const ctf_slice_t *slice; + ctf_encoding_t underlying_en; + slice = &dtd->dtd_u.dtu_slice; + + 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; + break; + } + default: + return (ctf_set_errno (ofp, ECTF_NOTINTFP)); + } return 0; }