version 1.13, 2017/10/27 09:22:20 |
version 1.14, 2017/10/27 09:35:22 |
|
|
__dead void usage(void); |
__dead void usage(void); |
|
|
int ctf_dump(const char *, size_t, uint8_t); |
int ctf_dump(const char *, size_t, uint8_t); |
uint32_t ctf_dump_type(struct ctf_header *, const char *, off_t, |
void ctf_dump_type(struct ctf_header *, const char *, off_t, |
uint32_t, uint32_t); |
uint32_t, uint32_t *, uint32_t); |
const char *ctf_kind2name(uint16_t); |
const char *ctf_kind2name(uint16_t); |
const char *ctf_enc2name(uint16_t); |
const char *ctf_enc2name(uint16_t); |
const char *ctf_fpenc2name(uint16_t); |
const char *ctf_fpenc2name(uint16_t); |
|
|
|
|
if (flags & DUMP_TYPE) { |
if (flags & DUMP_TYPE) { |
uint32_t idx = 1, offset = cth->cth_typeoff; |
uint32_t idx = 1, offset = cth->cth_typeoff; |
|
uint32_t stroff = cth->cth_stroff; |
|
|
while (offset < cth->cth_stroff) { |
while (offset < stroff) { |
offset += ctf_dump_type(cth, data, dlen, offset, idx++); |
ctf_dump_type(cth, data, dlen, stroff, &offset, idx++); |
} |
} |
printf("\n"); |
printf("\n"); |
} |
} |
|
|
return 0; |
return 0; |
} |
} |
|
|
uint32_t |
void |
ctf_dump_type(struct ctf_header *cth, const char *data, off_t dlen, |
ctf_dump_type(struct ctf_header *cth, const char *data, off_t dlen, |
uint32_t offset, uint32_t idx) |
uint32_t stroff, uint32_t *offset, uint32_t idx) |
{ |
{ |
const char *p = data + offset; |
const char *p = data + *offset; |
const struct ctf_type *ctt = (struct ctf_type *)p; |
const struct ctf_type *ctt = (struct ctf_type *)p; |
const struct ctf_array *cta; |
const struct ctf_array *cta; |
uint16_t *argp, i, kind, vlen, root; |
uint16_t *argp, i, kind, vlen, root; |
|
|
for (i = 0; i < vlen; i++) { |
for (i = 0; i < vlen; i++) { |
struct ctf_member *ctm; |
struct ctf_member *ctm; |
|
|
|
if (toff > (stroff - sizeof(*ctm))) |
|
break; |
|
|
ctm = (struct ctf_member *)(p + toff); |
ctm = (struct ctf_member *)(p + toff); |
toff += sizeof(struct ctf_member); |
toff += sizeof(struct ctf_member); |
|
|
|
|
for (i = 0; i < vlen; i++) { |
for (i = 0; i < vlen; i++) { |
struct ctf_lmember *ctlm; |
struct ctf_lmember *ctlm; |
|
|
|
if (toff > (stroff - sizeof(*ctlm))) |
|
break; |
|
|
ctlm = (struct ctf_lmember *)(p + toff); |
ctlm = (struct ctf_lmember *)(p + toff); |
toff += sizeof(struct ctf_lmember); |
toff += sizeof(struct ctf_lmember); |
|
|
|
|
for (i = 0; i < vlen; i++) { |
for (i = 0; i < vlen; i++) { |
struct ctf_enum *cte; |
struct ctf_enum *cte; |
|
|
|
if (toff > (stroff - sizeof(*cte))) |
|
break; |
|
|
cte = (struct ctf_enum *)(p + toff); |
cte = (struct ctf_enum *)(p + toff); |
toff += sizeof(struct ctf_enum); |
toff += sizeof(struct ctf_enum); |
|
|
|
|
printf(" refers to %u", ctt->ctt_type); |
printf(" refers to %u", ctt->ctt_type); |
break; |
break; |
default: |
default: |
errx(1, "incorrect type %u at offset %u", kind, offset); |
errx(1, "incorrect type %u at offset %u", kind, *offset); |
} |
} |
|
|
printf("\n"); |
printf("\n"); |
|
|
return toff; |
*offset += toff; |
} |
} |
|
|
const char * |
const char * |