summaryrefslogtreecommitdiff
path: root/usr.bin/ctfdump
diff options
context:
space:
mode:
authorClaudio Jeker <claudio@cvs.openbsd.org>2024-02-22 13:21:04 +0000
committerClaudio Jeker <claudio@cvs.openbsd.org>2024-02-22 13:21:04 +0000
commit32d9373dbb03f16cff036e06f466595e5d4f3670 (patch)
tree6b437c742c085db3f79ca6725ce0fb5d9a015532 /usr.bin/ctfdump
parent396bd04c7d33a00022b718a1b444abce8906e826 (diff)
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@
Diffstat (limited to 'usr.bin/ctfdump')
-rw-r--r--usr.bin/ctfdump/ctfdump.c13
1 files 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 <mpi@openbsd.org>
@@ -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;