From 4e6a2d216bd809e4bc117bab09c9e2eb894fe296 Mon Sep 17 00:00:00 2001 From: claudio Date: Thu, 22 Feb 2024 13:21:03 +0000 Subject: [PATCH] Print the size of more objects (basic types and enums) based on their ctt_size info. This helps to ensure that the reported sizes match. OK mpi@ --- usr.bin/ctfdump/ctfdump.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/usr.bin/ctfdump/ctfdump.c b/usr.bin/ctfdump/ctfdump.c index d23e7371704..58a79071af0 100644 --- a/usr.bin/ctfdump/ctfdump.c +++ b/usr.bin/ctfdump/ctfdump.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ctfdump.c,v 1.27 2022/08/14 15:01:18 millert Exp $ */ +/* $OpenBSD: ctfdump.c,v 1.28 2024/02/22 13:21:03 claudio Exp $ */ /* * Copyright (c) 2016 Martin Pieuchot @@ -490,16 +490,16 @@ ctf_dump_type(struct ctf_header *cth, const char *data, size_t dlen, case CTF_K_INTEGER: eob = *((uint32_t *)(p + toff)); toff += sizeof(uint32_t); - printf(" encoding=%s offset=%u bits=%u", + printf(" encoding=%s offset=%u bits=%u (%llu bytes)", ctf_enc2name(CTF_INT_ENCODING(eob)), CTF_INT_OFFSET(eob), - CTF_INT_BITS(eob)); + CTF_INT_BITS(eob), size); break; case CTF_K_FLOAT: eob = *((uint32_t *)(p + toff)); toff += sizeof(uint32_t); - printf(" encoding=%s offset=%u bits=%u", + printf(" encoding=%s offset=%u bits=%u (%llu bytes)", ctf_fpenc2name(CTF_FP_ENCODING(eob)), CTF_FP_OFFSET(eob), - CTF_FP_BITS(eob)); + CTF_FP_BITS(eob), size); break; case CTF_K_ARRAY: cta = (struct ctf_array *)(p + toff); @@ -563,7 +563,8 @@ ctf_dump_type(struct ctf_header *cth, const char *data, size_t dlen, } break; case CTF_K_ENUM: - printf("\n"); + printf(" (%llu bytes)\n", size); + for (i = 0; i < vlen; i++) { struct ctf_enum *cte; -- 2.20.1