summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormpi <mpi@openbsd.org>2018-01-09 10:19:25 +0000
committermpi <mpi@openbsd.org>2018-01-09 10:19:25 +0000
commitab77b743b55a8ead6d7dee9f088fe7850644f948 (patch)
treef72511dbc74edcaaae79e048a6b088d5815ae8d7
parentUse ip{,6}_send() instead of ip{,6}_output() to prevent a recursion. (diff)
downloadwireguard-openbsd-ab77b743b55a8ead6d7dee9f088fe7850644f948.tar.xz
wireguard-openbsd-ab77b743b55a8ead6d7dee9f088fe7850644f948.zip
Do not truncate 64bit integers when pretty-printing types.
-rw-r--r--sys/ddb/db_ctf.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/sys/ddb/db_ctf.c b/sys/ddb/db_ctf.c
index 5e2b83d157a..5671d5c96d6 100644
--- a/sys/ddb/db_ctf.c
+++ b/sys/ddb/db_ctf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: db_ctf.c,v 1.25 2017/11/01 16:12:30 mpi Exp $ */
+/* $OpenBSD: db_ctf.c,v 1.26 2018/01/09 10:19:25 mpi Exp $ */
/*
* Copyright (c) 2016-2017 Martin Pieuchot
@@ -343,10 +343,16 @@ db_ctf_type_by_index(uint16_t index)
void
db_ctf_pprint(const struct ctf_type *ctt, vaddr_t addr)
{
+ db_addr_t taddr = (db_addr_t)ctt;
const struct ctf_type *ref;
uint16_t kind;
+ uint32_t eob, toff;
kind = CTF_INFO_KIND(ctt->ctt_info);
+ if (ctt->ctt_size <= CTF_MAX_SIZE)
+ toff = sizeof(struct ctf_stype);
+ else
+ toff = sizeof(struct ctf_type);
switch (kind) {
case CTF_K_FLOAT:
@@ -356,7 +362,15 @@ db_ctf_pprint(const struct ctf_type *ctt, vaddr_t addr)
db_printf("%lu", *((unsigned long *)addr));
break;
case CTF_K_INTEGER:
- db_printf("%d", *((int *)addr));
+ eob = db_get_value((taddr + toff), sizeof(eob), 0);
+ switch (CTF_INT_BITS(eob)) {
+ case 64:
+ db_printf("0x%llx", *((long long *)addr));
+ break;
+ default:
+ db_printf("0x%x", *((int *)addr));
+ break;
+ }
break;
case CTF_K_STRUCT:
case CTF_K_UNION: